Loading build/e_patches/Multiple-fingerprinting-mitigations.patch +35 −39 Original line number Diff line number Diff line From 0e4d03920ed50b7032e7fcc0dd3be08e418a3b66 Mon Sep 17 00:00:00 2001 From fca335f568f86e26052d0318050637bd26e623b4 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Fri, 30 Mar 2018 10:09:03 +0200 Subject: Multiple fingerprinting mitigations Loading Loading @@ -54,10 +54,10 @@ Signed-off-by: Saalim Quadri <danascape@gmail.com> create mode 100644 third_party/ungoogled/ungoogled_switches.h diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 1dca41c54804f..6b2fb381cbd40 100644 index f5acf46010e85..fa4efe2e957d6 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -2580,6 +2580,7 @@ static_library("browser") { @@ -2567,6 +2567,7 @@ static_library("browser") { "//services/device/public/cpp/bluetooth", "//services/device/public/cpp/geolocation", "//services/device/public/cpp/usb", Loading @@ -66,7 +66,7 @@ index 1dca41c54804f..6b2fb381cbd40 100644 "//services/device/public/mojom:usb", "//services/image_annotation:service", diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 463034bd99d35..9b79899e3aa38 100644 index dea76ad306c78..ba39cbebce08d 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -268,6 +268,8 @@ Loading @@ -79,10 +79,10 @@ index 463034bd99d35..9b79899e3aa38 100644 #include "base/android/pre_freeze_background_memory_trimmer.h" #include "chrome/browser/contextmenu/context_menu_features.h" diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 5a1b57da76eb5..e2297349b4b4f 100644 index 548abd4a6857c..aae4a32f13862 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -301,6 +301,7 @@ source_set("browser") { @@ -298,6 +298,7 @@ source_set("browser") { "//third_party/re2", "//third_party/snappy", "//third_party/sqlite", Loading @@ -91,7 +91,7 @@ index 5a1b57da76eb5..e2297349b4b4f 100644 "//third_party/zlib", "//tools/v8_context_snapshot:buildflags", diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 2a6512aeadc14..d467b192997e1 100644 index 6190ba7b4bf74..49cb73485b933 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -222,6 +222,7 @@ Loading @@ -102,7 +102,7 @@ index 2a6512aeadc14..d467b192997e1 100644 #if BUILDFLAG(IS_ANDROID) #include "base/android/child_process_binding_types.h" #include "content/browser/font_unique_name_lookup/font_unique_name_lookup_service.h" @@ -3558,6 +3559,8 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( @@ -3665,6 +3666,8 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kDisableBestEffortTasks, switches::kDisableBreakpad, switches::kDisableFileSystem, Loading @@ -112,10 +112,10 @@ index 2a6512aeadc14..d467b192997e1 100644 switches::kDisableGpuMemoryBufferVideoFrames, switches::kDisableHistogramCustomizer, diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn index 15fd6044640d3..ebc9ff3aa9888 100644 index 02c5836b0ffad..6bddb14544640 100644 --- a/content/child/BUILD.gn +++ b/content/child/BUILD.gn @@ -110,6 +110,7 @@ target(link_target_type, "child") { @@ -109,6 +109,7 @@ target(link_target_type, "child") { "//third_party/blink/public/common:buildflags", "//third_party/blink/public/strings", "//third_party/ced", Loading @@ -124,10 +124,10 @@ index 15fd6044640d3..ebc9ff3aa9888 100644 "//ui/base", "//ui/events/blink", diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index c0a056e2c2031..2e272bea294d8 100644 index 000546b72b98c..30bc68f70a56f 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc @@ -49,6 +49,8 @@ @@ -50,6 +50,8 @@ #include "ui/native_theme/features/native_theme_features.h" #include "ui/native_theme/native_theme.h" Loading @@ -136,7 +136,7 @@ index c0a056e2c2031..2e272bea294d8 100644 #if BUILDFLAG(IS_ANDROID) #include "base/android/android_info.h" #endif @@ -519,6 +521,10 @@ void SetRuntimeFeaturesFromCommandLine(const base::CommandLine& command_line) { @@ -521,6 +523,10 @@ void SetRuntimeFeaturesFromCommandLine(const base::CommandLine& command_line) { // as a last resort. void SetCustomizedRuntimeFeaturesFromCombinedArgs( const base::CommandLine& command_line) { Loading Loading @@ -179,7 +179,7 @@ index fa4bf2c66839c..c122ef2200108 100644 static void EnableFluentOverlayScrollbars(bool); static void EnableVibration(bool); diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index dc2c6de1fde5e..7e60d56b617e0 100644 index 10d5114316e9c..8375e22ce3c88 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc @@ -41,6 +41,7 @@ Loading @@ -190,7 +190,7 @@ index dc2c6de1fde5e..7e60d56b617e0 100644 #include "base/task/single_thread_task_runner.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" @@ -1087,6 +1088,16 @@ Document::Document(const DocumentInit& initializer, @@ -1089,6 +1090,16 @@ Document::Document(const DocumentInit& initializer, TRACE_EVENT_WITH_FLOW0("blink", "Document::Document", TRACE_ID_LOCAL(this), TRACE_EVENT_FLAG_FLOW_OUT); DCHECK(agent_); Loading @@ -207,7 +207,7 @@ index dc2c6de1fde5e..7e60d56b617e0 100644 if (base::FeatureList::IsEnabled(features::kDelayAsyncScriptExecution) && features::kDelayAsyncScriptExecutionDelayByDefaultParam.Get()) { script_runner_delayer_->Activate(); @@ -2814,6 +2825,14 @@ void Document::UpdateStyleAndLayoutTreeForThisDocument() { @@ -2816,6 +2827,14 @@ void Document::UpdateStyleAndLayoutTreeForThisDocument() { #endif } Loading @@ -223,7 +223,7 @@ index dc2c6de1fde5e..7e60d56b617e0 100644 DCHECK(IsActive()); DCHECK(IsMainThread()); diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index ed9bde0727af4..66bb9700e7336 100644 index 8780a16c1d28b..56b08c3f1a3d2 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h @@ -574,6 +574,10 @@ class CORE_EXPORT Document : public ContainerNode, Loading @@ -237,7 +237,7 @@ index ed9bde0727af4..66bb9700e7336 100644 V8VisibilityState visibilityState() const; String visibilityStateAsString() const; bool IsPageVisible() const; @@ -2795,6 +2799,9 @@ class CORE_EXPORT Document : public ContainerNode, @@ -2810,6 +2814,9 @@ class CORE_EXPORT Document : public ContainerNode, base::ElapsedTimer start_time_; Loading Loading @@ -270,12 +270,12 @@ index cec45ea050457..156af76a6e58c 100644 } diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.cc b/third_party/blink/renderer/core/html/canvas/text_metrics.cc index 392e0f763a5ed..89cc1d88a321d 100644 index 4789cc78b4c47..e748b2b0f24a0 100644 --- a/third_party/blink/renderer/core/html/canvas/text_metrics.cc +++ b/third_party/blink/renderer/core/html/canvas/text_metrics.cc @@ -106,6 +106,24 @@ const ShapeResult* ShapeWord(const TextRun& word_run, const Font& font) { @@ -89,6 +89,24 @@ TextMetrics::TextMetrics(const Font* font, Update(font, direction, baseline, align, text, text_painter); } } // namespace +void TextMetrics::Shuffle(const double factor) { + // x-direction Loading @@ -299,10 +299,10 @@ index 392e0f763a5ed..89cc1d88a321d 100644 const TextDirection& direction, const V8CanvasTextBaseline::Enum baseline, diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.h b/third_party/blink/renderer/core/html/canvas/text_metrics.h index 4705120d20a94..8cbaa8ec2f062 100644 index 95d91ccaf1023..db9e1d2f8b490 100644 --- a/third_party/blink/renderer/core/html/canvas/text_metrics.h +++ b/third_party/blink/renderer/core/html/canvas/text_metrics.h @@ -111,6 +111,8 @@ class CORE_EXPORT TextMetrics final : public ScriptWrappable { @@ -109,6 +109,8 @@ class CORE_EXPORT TextMetrics final : public ScriptWrappable { float x_position_; }; Loading Loading @@ -390,10 +390,10 @@ index 817e8f2d1290d..ef1738b4a02d6 100644 } return -1; diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc index 7831167a986c3..975a2639b35d1 100644 index c85ea15a17907..3acfce25ed7a2 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc @@ -104,6 +104,10 @@ @@ -103,6 +103,10 @@ #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "ui/gfx/geometry/skia_conversions.h" Loading @@ -404,7 +404,7 @@ index 7831167a986c3..975a2639b35d1 100644 // Including "base/time/time.h" triggers a bug in IWYU. // https://github.com/include-what-you-use/include-what-you-use/issues/1122 // IWYU pragma: no_include "base/numerics/clamped_math.h" @@ -555,6 +559,10 @@ ImageData* BaseRenderingContext2D::getImageDataInternal( @@ -554,6 +558,10 @@ ImageData* BaseRenderingContext2D::getImageDataInternal( snapshot->PaintImageForCurrentFrame().GetSkImageInfo().bounds(); DCHECK(!bounds.intersect(SkIRect::MakeXYWH(sx, sy, sw, sh))); } Loading @@ -415,18 +415,14 @@ index 7831167a986c3..975a2639b35d1 100644 } return image_data; @@ -1252,13 +1260,27 @@ TextMetrics* BaseRenderingContext2D::measureText(const String& text) { @@ -1233,9 +1241,23 @@ TextMetrics* BaseRenderingContext2D::measureText(const String& text) { TextDirection direction = ToTextDirection(state.GetDirection(), host, computed_style); - return MakeGarbageCollected<TextMetrics>( + auto* text_metrics = MakeGarbageCollected<TextMetrics>( font, direction, state.GetTextBaseline().AsEnum(), state.GetTextAlign().AsEnum(), text, RuntimeEnabledFeatures::CanvasTextNgEnabled( host->GetTopExecutionContext()) ? &host->GetPlainTextPainter() : nullptr); state.GetTextAlign().AsEnum(), text, host->GetPlainTextPainter()); + // Scale text metrics if enabled + if (RuntimeEnabledFeatures::FingerprintingCanvasMeasureTextNoiseEnabled()) { + OffscreenCanvas* offscreen_canvas = HostAsOffscreenCanvas(); Loading @@ -445,10 +441,10 @@ index 7831167a986c3..975a2639b35d1 100644 String BaseRenderingContext2D::lang() const { diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 589dd18b99174..ddb5bd6ecd4bd 100644 index d7a67479b6140..4e5967f763751 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn @@ -1757,7 +1757,9 @@ component("platform") { @@ -1753,7 +1753,9 @@ component("platform") { "//third_party/blink/renderer:non_test_config", ] Loading @@ -459,7 +455,7 @@ index 589dd18b99174..ddb5bd6ecd4bd 100644 allow_circular_includes_from = [ "//third_party/blink/renderer/platform/blob", @@ -1841,6 +1843,7 @@ component("platform") { @@ -1837,6 +1839,7 @@ component("platform") { "//third_party/blink/public/strings", "//third_party/blink/renderer/platform/wtf", "//third_party/ced", Loading Loading @@ -691,10 +687,10 @@ index 7bd7cb5906d18..efb8211d09376 100644 + } // namespace blink diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h index 2c016b0cd581d..3e84dfeae63ab 100644 index 3569ab7ee695e..41ce0df8031e6 100644 --- a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h +++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h @@ -39,6 +39,8 @@ class PLATFORM_EXPORT StaticBitmapImage : public Image { @@ -38,6 +38,8 @@ class PLATFORM_EXPORT StaticBitmapImage : public Image { StaticBitmapImage(ImageOrientation orientation) : orientation_(orientation) {} Loading @@ -704,10 +700,10 @@ index 2c016b0cd581d..3e84dfeae63ab 100644 // Methods overridden by all sub-classes diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 8a20854d95660..4b2127483fb0d 100644 index d0b01e9080532..a441d7582bd28 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -3424,6 +3424,12 @@ @@ -3467,6 +3467,12 @@ status: {"Mac": "test", "default": "stable"}, base_feature: "none", }, Loading Loading
build/e_patches/Multiple-fingerprinting-mitigations.patch +35 −39 Original line number Diff line number Diff line From 0e4d03920ed50b7032e7fcc0dd3be08e418a3b66 Mon Sep 17 00:00:00 2001 From fca335f568f86e26052d0318050637bd26e623b4 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Fri, 30 Mar 2018 10:09:03 +0200 Subject: Multiple fingerprinting mitigations Loading Loading @@ -54,10 +54,10 @@ Signed-off-by: Saalim Quadri <danascape@gmail.com> create mode 100644 third_party/ungoogled/ungoogled_switches.h diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 1dca41c54804f..6b2fb381cbd40 100644 index f5acf46010e85..fa4efe2e957d6 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -2580,6 +2580,7 @@ static_library("browser") { @@ -2567,6 +2567,7 @@ static_library("browser") { "//services/device/public/cpp/bluetooth", "//services/device/public/cpp/geolocation", "//services/device/public/cpp/usb", Loading @@ -66,7 +66,7 @@ index 1dca41c54804f..6b2fb381cbd40 100644 "//services/device/public/mojom:usb", "//services/image_annotation:service", diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 463034bd99d35..9b79899e3aa38 100644 index dea76ad306c78..ba39cbebce08d 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -268,6 +268,8 @@ Loading @@ -79,10 +79,10 @@ index 463034bd99d35..9b79899e3aa38 100644 #include "base/android/pre_freeze_background_memory_trimmer.h" #include "chrome/browser/contextmenu/context_menu_features.h" diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 5a1b57da76eb5..e2297349b4b4f 100644 index 548abd4a6857c..aae4a32f13862 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -301,6 +301,7 @@ source_set("browser") { @@ -298,6 +298,7 @@ source_set("browser") { "//third_party/re2", "//third_party/snappy", "//third_party/sqlite", Loading @@ -91,7 +91,7 @@ index 5a1b57da76eb5..e2297349b4b4f 100644 "//third_party/zlib", "//tools/v8_context_snapshot:buildflags", diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 2a6512aeadc14..d467b192997e1 100644 index 6190ba7b4bf74..49cb73485b933 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -222,6 +222,7 @@ Loading @@ -102,7 +102,7 @@ index 2a6512aeadc14..d467b192997e1 100644 #if BUILDFLAG(IS_ANDROID) #include "base/android/child_process_binding_types.h" #include "content/browser/font_unique_name_lookup/font_unique_name_lookup_service.h" @@ -3558,6 +3559,8 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( @@ -3665,6 +3666,8 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( switches::kDisableBestEffortTasks, switches::kDisableBreakpad, switches::kDisableFileSystem, Loading @@ -112,10 +112,10 @@ index 2a6512aeadc14..d467b192997e1 100644 switches::kDisableGpuMemoryBufferVideoFrames, switches::kDisableHistogramCustomizer, diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn index 15fd6044640d3..ebc9ff3aa9888 100644 index 02c5836b0ffad..6bddb14544640 100644 --- a/content/child/BUILD.gn +++ b/content/child/BUILD.gn @@ -110,6 +110,7 @@ target(link_target_type, "child") { @@ -109,6 +109,7 @@ target(link_target_type, "child") { "//third_party/blink/public/common:buildflags", "//third_party/blink/public/strings", "//third_party/ced", Loading @@ -124,10 +124,10 @@ index 15fd6044640d3..ebc9ff3aa9888 100644 "//ui/base", "//ui/events/blink", diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index c0a056e2c2031..2e272bea294d8 100644 index 000546b72b98c..30bc68f70a56f 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc @@ -49,6 +49,8 @@ @@ -50,6 +50,8 @@ #include "ui/native_theme/features/native_theme_features.h" #include "ui/native_theme/native_theme.h" Loading @@ -136,7 +136,7 @@ index c0a056e2c2031..2e272bea294d8 100644 #if BUILDFLAG(IS_ANDROID) #include "base/android/android_info.h" #endif @@ -519,6 +521,10 @@ void SetRuntimeFeaturesFromCommandLine(const base::CommandLine& command_line) { @@ -521,6 +523,10 @@ void SetRuntimeFeaturesFromCommandLine(const base::CommandLine& command_line) { // as a last resort. void SetCustomizedRuntimeFeaturesFromCombinedArgs( const base::CommandLine& command_line) { Loading Loading @@ -179,7 +179,7 @@ index fa4bf2c66839c..c122ef2200108 100644 static void EnableFluentOverlayScrollbars(bool); static void EnableVibration(bool); diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index dc2c6de1fde5e..7e60d56b617e0 100644 index 10d5114316e9c..8375e22ce3c88 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc @@ -41,6 +41,7 @@ Loading @@ -190,7 +190,7 @@ index dc2c6de1fde5e..7e60d56b617e0 100644 #include "base/task/single_thread_task_runner.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" @@ -1087,6 +1088,16 @@ Document::Document(const DocumentInit& initializer, @@ -1089,6 +1090,16 @@ Document::Document(const DocumentInit& initializer, TRACE_EVENT_WITH_FLOW0("blink", "Document::Document", TRACE_ID_LOCAL(this), TRACE_EVENT_FLAG_FLOW_OUT); DCHECK(agent_); Loading @@ -207,7 +207,7 @@ index dc2c6de1fde5e..7e60d56b617e0 100644 if (base::FeatureList::IsEnabled(features::kDelayAsyncScriptExecution) && features::kDelayAsyncScriptExecutionDelayByDefaultParam.Get()) { script_runner_delayer_->Activate(); @@ -2814,6 +2825,14 @@ void Document::UpdateStyleAndLayoutTreeForThisDocument() { @@ -2816,6 +2827,14 @@ void Document::UpdateStyleAndLayoutTreeForThisDocument() { #endif } Loading @@ -223,7 +223,7 @@ index dc2c6de1fde5e..7e60d56b617e0 100644 DCHECK(IsActive()); DCHECK(IsMainThread()); diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index ed9bde0727af4..66bb9700e7336 100644 index 8780a16c1d28b..56b08c3f1a3d2 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h @@ -574,6 +574,10 @@ class CORE_EXPORT Document : public ContainerNode, Loading @@ -237,7 +237,7 @@ index ed9bde0727af4..66bb9700e7336 100644 V8VisibilityState visibilityState() const; String visibilityStateAsString() const; bool IsPageVisible() const; @@ -2795,6 +2799,9 @@ class CORE_EXPORT Document : public ContainerNode, @@ -2810,6 +2814,9 @@ class CORE_EXPORT Document : public ContainerNode, base::ElapsedTimer start_time_; Loading Loading @@ -270,12 +270,12 @@ index cec45ea050457..156af76a6e58c 100644 } diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.cc b/third_party/blink/renderer/core/html/canvas/text_metrics.cc index 392e0f763a5ed..89cc1d88a321d 100644 index 4789cc78b4c47..e748b2b0f24a0 100644 --- a/third_party/blink/renderer/core/html/canvas/text_metrics.cc +++ b/third_party/blink/renderer/core/html/canvas/text_metrics.cc @@ -106,6 +106,24 @@ const ShapeResult* ShapeWord(const TextRun& word_run, const Font& font) { @@ -89,6 +89,24 @@ TextMetrics::TextMetrics(const Font* font, Update(font, direction, baseline, align, text, text_painter); } } // namespace +void TextMetrics::Shuffle(const double factor) { + // x-direction Loading @@ -299,10 +299,10 @@ index 392e0f763a5ed..89cc1d88a321d 100644 const TextDirection& direction, const V8CanvasTextBaseline::Enum baseline, diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.h b/third_party/blink/renderer/core/html/canvas/text_metrics.h index 4705120d20a94..8cbaa8ec2f062 100644 index 95d91ccaf1023..db9e1d2f8b490 100644 --- a/third_party/blink/renderer/core/html/canvas/text_metrics.h +++ b/third_party/blink/renderer/core/html/canvas/text_metrics.h @@ -111,6 +111,8 @@ class CORE_EXPORT TextMetrics final : public ScriptWrappable { @@ -109,6 +109,8 @@ class CORE_EXPORT TextMetrics final : public ScriptWrappable { float x_position_; }; Loading Loading @@ -390,10 +390,10 @@ index 817e8f2d1290d..ef1738b4a02d6 100644 } return -1; diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc index 7831167a986c3..975a2639b35d1 100644 index c85ea15a17907..3acfce25ed7a2 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc @@ -104,6 +104,10 @@ @@ -103,6 +103,10 @@ #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "ui/gfx/geometry/skia_conversions.h" Loading @@ -404,7 +404,7 @@ index 7831167a986c3..975a2639b35d1 100644 // Including "base/time/time.h" triggers a bug in IWYU. // https://github.com/include-what-you-use/include-what-you-use/issues/1122 // IWYU pragma: no_include "base/numerics/clamped_math.h" @@ -555,6 +559,10 @@ ImageData* BaseRenderingContext2D::getImageDataInternal( @@ -554,6 +558,10 @@ ImageData* BaseRenderingContext2D::getImageDataInternal( snapshot->PaintImageForCurrentFrame().GetSkImageInfo().bounds(); DCHECK(!bounds.intersect(SkIRect::MakeXYWH(sx, sy, sw, sh))); } Loading @@ -415,18 +415,14 @@ index 7831167a986c3..975a2639b35d1 100644 } return image_data; @@ -1252,13 +1260,27 @@ TextMetrics* BaseRenderingContext2D::measureText(const String& text) { @@ -1233,9 +1241,23 @@ TextMetrics* BaseRenderingContext2D::measureText(const String& text) { TextDirection direction = ToTextDirection(state.GetDirection(), host, computed_style); - return MakeGarbageCollected<TextMetrics>( + auto* text_metrics = MakeGarbageCollected<TextMetrics>( font, direction, state.GetTextBaseline().AsEnum(), state.GetTextAlign().AsEnum(), text, RuntimeEnabledFeatures::CanvasTextNgEnabled( host->GetTopExecutionContext()) ? &host->GetPlainTextPainter() : nullptr); state.GetTextAlign().AsEnum(), text, host->GetPlainTextPainter()); + // Scale text metrics if enabled + if (RuntimeEnabledFeatures::FingerprintingCanvasMeasureTextNoiseEnabled()) { + OffscreenCanvas* offscreen_canvas = HostAsOffscreenCanvas(); Loading @@ -445,10 +441,10 @@ index 7831167a986c3..975a2639b35d1 100644 String BaseRenderingContext2D::lang() const { diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 589dd18b99174..ddb5bd6ecd4bd 100644 index d7a67479b6140..4e5967f763751 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn @@ -1757,7 +1757,9 @@ component("platform") { @@ -1753,7 +1753,9 @@ component("platform") { "//third_party/blink/renderer:non_test_config", ] Loading @@ -459,7 +455,7 @@ index 589dd18b99174..ddb5bd6ecd4bd 100644 allow_circular_includes_from = [ "//third_party/blink/renderer/platform/blob", @@ -1841,6 +1843,7 @@ component("platform") { @@ -1837,6 +1839,7 @@ component("platform") { "//third_party/blink/public/strings", "//third_party/blink/renderer/platform/wtf", "//third_party/ced", Loading Loading @@ -691,10 +687,10 @@ index 7bd7cb5906d18..efb8211d09376 100644 + } // namespace blink diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h index 2c016b0cd581d..3e84dfeae63ab 100644 index 3569ab7ee695e..41ce0df8031e6 100644 --- a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h +++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h @@ -39,6 +39,8 @@ class PLATFORM_EXPORT StaticBitmapImage : public Image { @@ -38,6 +38,8 @@ class PLATFORM_EXPORT StaticBitmapImage : public Image { StaticBitmapImage(ImageOrientation orientation) : orientation_(orientation) {} Loading @@ -704,10 +700,10 @@ index 2c016b0cd581d..3e84dfeae63ab 100644 // Methods overridden by all sub-classes diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 8a20854d95660..4b2127483fb0d 100644 index d0b01e9080532..a441d7582bd28 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -3424,6 +3424,12 @@ @@ -3467,6 +3467,12 @@ status: {"Mac": "test", "default": "stable"}, base_feature: "none", }, Loading