diff options
Diffstat (limited to 'chromium/content/child')
-rw-r--r-- | chromium/content/child/BUILD.gn | 1 | ||||
-rw-r--r-- | chromium/content/child/blink_platform_impl.cc | 10 | ||||
-rw-r--r-- | chromium/content/child/blink_platform_impl.h | 2 | ||||
-rw-r--r-- | chromium/content/child/child_process.cc | 26 | ||||
-rw-r--r-- | chromium/content/child/child_thread_impl.cc | 24 | ||||
-rw-r--r-- | chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc | 6 | ||||
-rw-r--r-- | chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc | 76 | ||||
-rw-r--r-- | chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.h | 18 | ||||
-rw-r--r-- | chromium/content/child/runtime_features.cc | 62 | ||||
-rw-r--r-- | chromium/content/child/webthemeengine_impl_android.cc | 2 | ||||
-rw-r--r-- | chromium/content/child/webthemeengine_impl_default.cc | 2 | ||||
-rw-r--r-- | chromium/content/child/webthemeengine_impl_mac.cc | 61 | ||||
-rw-r--r-- | chromium/content/child/webthemeengine_impl_mac.h | 20 |
13 files changed, 236 insertions, 74 deletions
diff --git a/chromium/content/child/BUILD.gn b/chromium/content/child/BUILD.gn index 131caa77dd9..58474970eb7 100644 --- a/chromium/content/child/BUILD.gn +++ b/chromium/content/child/BUILD.gn @@ -147,7 +147,6 @@ target(link_target_type, "child") { deps += [ "//components/services/font/public/cpp", "//components/services/font/public/mojom", - "//services/service_manager/zygote", ] } diff --git a/chromium/content/child/blink_platform_impl.cc b/chromium/content/child/blink_platform_impl.cc index 0ac2471fcae..2c238c5af3e 100644 --- a/chromium/content/child/blink_platform_impl.cc +++ b/chromium/content/child/blink_platform_impl.cc @@ -38,6 +38,7 @@ #include "content/public/common/content_client.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" +#include "content/public/common/url_utils.h" #include "mojo/public/cpp/bindings/shared_remote.h" #include "net/base/net_errors.h" #include "services/network/public/cpp/features.h" @@ -78,8 +79,6 @@ std::unique_ptr<blink::WebThemeEngine> GetWebThemeEngine() { #if defined(OS_ANDROID) return std::make_unique<WebThemeEngineAndroid>(); #elif defined(OS_MACOSX) - if (features::IsFormControlsRefreshEnabled()) - return std::make_unique<WebThemeEngineDefault>(); return std::make_unique<WebThemeEngineMac>(); #else return std::make_unique<WebThemeEngineDefault>(); @@ -87,12 +86,10 @@ std::unique_ptr<blink::WebThemeEngine> GetWebThemeEngine() { } // This must match third_party/WebKit/public/blink_resources.grd. -// In particular, |is_gzipped| corresponds to compress="gzip". struct DataResource { const char* name; int id; ui::ScaleFactor scale_factor; - bool is_gzipped; }; class NestedMessageLoopRunnerImpl @@ -262,6 +259,11 @@ bool BlinkPlatformImpl::IsURLSupportedForAppCache(const blink::WebURL& url) { return IsSchemeSupportedForAppCache(url); } +bool BlinkPlatformImpl::IsURLSavableForSavableResource( + const blink::WebURL& url) { + return IsSavableURL(url); +} + size_t BlinkPlatformImpl::MaxDecodedImageBytes() { const int kMB = 1024 * 1024; const int kMaxNumberOfBytesPerPixel = 4; diff --git a/chromium/content/child/blink_platform_impl.h b/chromium/content/child/blink_platform_impl.h index 464c0bb45e7..a87e4f68418 100644 --- a/chromium/content/child/blink_platform_impl.h +++ b/chromium/content/child/blink_platform_impl.h @@ -37,6 +37,8 @@ class CONTENT_EXPORT BlinkPlatformImpl : public blink::Platform { blink::WebThemeEngine* ThemeEngine() override; bool IsURLSupportedForAppCache(const blink::WebURL& url) override; + bool IsURLSavableForSavableResource(const blink::WebURL& url) override; + size_t MaxDecodedImageBytes() override; bool IsLowEndDevice() override; void RecordAction(const blink::UserMetricsAction&) override; diff --git a/chromium/content/child/child_process.cc b/chromium/content/child/child_process.cc index 04b8f40e3dc..0f4fa57ae42 100644 --- a/chromium/content/child/child_process.cc +++ b/chromium/content/child/child_process.cc @@ -16,6 +16,10 @@ #include "base/threading/thread_local.h" #include "build/build_config.h" #include "content/child/child_thread_impl.h" +#include "content/common/android/cpu_time_metrics.h" +#include "content/common/mojo_core_library_support.h" +#include "mojo/public/cpp/system/dynamic_library_support.h" +#include "services/service_manager/sandbox/sandbox_type.h" #include "services/tracing/public/cpp/trace_startup.h" #include "third_party/blink/public/common/features.h" @@ -37,6 +41,23 @@ ChildProcess::ChildProcess(base::ThreadPriority io_thread_priority, DCHECK(!g_lazy_child_process_tls.Pointer()->Get()); g_lazy_child_process_tls.Pointer()->Set(this); +#if defined(OS_LINUX) + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + if (IsMojoCoreSharedLibraryEnabled()) { + // If we're in a child process on Linux and dynamic Mojo Core is in use, we + // expect early process startup code (see ContentMainRunnerImpl::Run()) to + // have already loaded the library via |mojo::LoadCoreLibrary()|, rendering + // this call safe even from within a strict sandbox. + MojoInitializeFlags flags = MOJO_INITIALIZE_FLAG_NONE; + if (service_manager::IsUnsandboxedSandboxType( + service_manager::SandboxTypeFromCommandLine(command_line))) { + flags |= MOJO_INITIALIZE_FLAG_FORCE_DIRECT_SHARED_MEMORY_ALLOCATION; + } + CHECK_EQ(MOJO_RESULT_OK, mojo::InitializeCoreLibrary(flags)); + } +#endif + // Initialize ThreadPoolInstance if not already done. A ThreadPoolInstance may // already exist when ChildProcess is instantiated in the browser process or // in a test process. @@ -52,8 +73,13 @@ ChildProcess::ChildProcess(base::ThreadPriority io_thread_priority, DCHECK(base::ThreadPoolInstance::Get()); initialized_thread_pool_ = true; } + tracing::InitTracingPostThreadPoolStartAndFeatureList(); +#if defined(OS_ANDROID) + SetupCpuTimeMetrics(); +#endif + // We can't recover from failing to start the IO thread. base::Thread::Options thread_options(base::MessagePumpType::IO, 0); thread_options.priority = io_thread_priority; diff --git a/chromium/content/child/child_thread_impl.cc b/chromium/content/child/child_thread_impl.cc index 9d3b69def68..78e5cd7958d 100644 --- a/chromium/content/child/child_thread_impl.cc +++ b/chromium/content/child/child_thread_impl.cc @@ -5,6 +5,8 @@ #include "content/child/child_thread_impl.h" #include <signal.h> + +#include <memory> #include <string> #include <utility> @@ -47,6 +49,7 @@ #include "content/common/child_process.mojom.h" #include "content/common/field_trial_recorder.mojom.h" #include "content/common/in_process_child_thread_params.h" +#include "content/common/mojo_core_library_support.h" #include "content/public/common/content_client.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" @@ -570,16 +573,19 @@ void ChildThreadImpl::Init(const Options& options) { // IPC mode. mojo::ScopedMessagePipeHandle child_process_pipe; if (!IsInBrowserProcess()) { - scoped_refptr<base::SingleThreadTaskRunner> mojo_ipc_task_runner = - GetIOTaskRunner(); - if (base::FeatureList::IsEnabled(features::kMojoDedicatedThread)) { - mojo_ipc_thread_.StartWithOptions( - base::Thread::Options(base::MessagePumpType::IO, 0)); - mojo_ipc_task_runner = mojo_ipc_thread_.task_runner(); + // If using a shared Mojo Core library, IPC support is already initialized. + if (!IsMojoCoreSharedLibraryEnabled()) { + scoped_refptr<base::SingleThreadTaskRunner> mojo_ipc_task_runner = + GetIOTaskRunner(); + if (base::FeatureList::IsEnabled(features::kMojoDedicatedThread)) { + mojo_ipc_thread_.StartWithOptions( + base::Thread::Options(base::MessagePumpType::IO, 0)); + mojo_ipc_task_runner = mojo_ipc_thread_.task_runner(); + } + mojo_ipc_support_ = std::make_unique<mojo::core::ScopedIPCSupport>( + mojo_ipc_task_runner, + mojo::core::ScopedIPCSupport::ShutdownPolicy::FAST); } - mojo_ipc_support_.reset(new mojo::core::ScopedIPCSupport( - mojo_ipc_task_runner, - mojo::core::ScopedIPCSupport::ShutdownPolicy::FAST)); mojo::IncomingInvitation invitation = InitializeMojoIPCChannel(); child_process_pipe = invitation.ExtractMessagePipe(0); } else { diff --git a/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc b/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc index 7d717652d05..c06ca35000b 100644 --- a/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc +++ b/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc @@ -59,12 +59,8 @@ void InitializeDWriteFontProxy() { if (!g_font_collection) { mojo::PendingRemote<blink::mojom::DWriteFontProxy> dwrite_font_proxy; - if (g_connection_callback_override) { + if (g_connection_callback_override) dwrite_font_proxy = g_connection_callback_override->Run(); - } else if (auto* thread = ChildThread::Get()) { - thread->BindHostReceiver( - dwrite_font_proxy.InitWithNewPipeAndPassReceiver()); - } DWriteFontCollectionProxy::Create(&g_font_collection, factory.Get(), std::move(dwrite_font_proxy)); } diff --git a/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc b/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc index 23330b6374b..b788c4ded4f 100644 --- a/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc +++ b/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc @@ -17,7 +17,6 @@ #include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" -#include "base/task/thread_pool.h" #include "base/trace_event/trace_event.h" #include "content/child/dwrite_font_proxy/dwrite_localized_strings_win.h" #include "content/public/child/child_thread.h" @@ -29,6 +28,33 @@ namespace content { namespace { +// Limits to 20 the number of family names that can be accessed by a renderer. +// This feature will be enabled for a subset of users to assess the impact on +// input delay. It will not ship as-is, because it breaks some pages. Local +// experiments show that accessing >20 fonts is typically done by fingerprinting +// scripts. +// TODO(https://crbug.com/1089390): Remove this feature when the experiment is +// complete. If the experiment shows a significant input delay improvement, +// replace with a more refined mitigation for pages that access many fonts. +const base::Feature kLimitFontFamilyNamesPerRenderer{ + "LimitFontFamilyNamesPerRenderer", base::FEATURE_DISABLED_BY_DEFAULT}; +constexpr size_t kFamilyNamesLimit = 20; + +// Family names that opted-out from the limit enforced by +// |kLimitFontFamilyNamesPerRenderer|. This is required because Blink uses these +// fonts as last resort and crashes if they can't be loaded. +const wchar_t* kLastResortFontNames[] = { + L"Sans", L"Arial", L"MS UI Gothic", L"Microsoft Sans Serif", + L"Segoe UI", L"Calibri", L"Times New Roman", L"Courier New"}; + +bool IsLastResortFontName(const base::string16& font_name) { + for (const wchar_t* last_resort_font_name : kLastResortFontNames) { + if (font_name == last_resort_font_name) + return true; + } + return false; +} + // This enum is used to define the buckets for an enumerated UMA histogram. // Hence, // (a) existing enumerated constants should never be deleted or reordered, and @@ -73,6 +99,13 @@ void LogFontProxyError(FontProxyError error) { FONT_PROXY_ERROR_MAX_VALUE); } +// Binds a DWriteFontProxy pending receiver. Must be invoked from the main +// thread. +void BindHostReceiverOnMainThread( + mojo::PendingReceiver<blink::mojom::DWriteFontProxy> pending_receiver) { + ChildThread::Get()->BindHostReceiver(std::move(pending_receiver)); +} + } // namespace HRESULT DWriteFontCollectionProxy::Create( @@ -95,7 +128,6 @@ HRESULT DWriteFontCollectionProxy::FindFamilyName(const WCHAR* family_name, DCHECK(exists); TRACE_EVENT0("dwrite,fonts", "FontProxy::FindFamilyName"); - uint32_t family_index = 0; base::string16 name(family_name); auto iter = family_names_.find(name); @@ -105,6 +137,14 @@ HRESULT DWriteFontCollectionProxy::FindFamilyName(const WCHAR* family_name, return S_OK; } + if (base::FeatureList::IsEnabled(kLimitFontFamilyNamesPerRenderer) && + family_names_.size() > kFamilyNamesLimit && !IsLastResortFontName(name)) { + *exists = FALSE; + *index = UINT32_MAX; + return S_OK; + } + + uint32_t family_index = 0; if (!GetFontProxy().FindFamily(name, &family_index)) { LogFontProxyError(FIND_FAMILY_SEND_FAILED); return E_FAIL; @@ -269,9 +309,8 @@ HRESULT DWriteFontCollectionProxy::RuntimeClassInitialize( factory_ = factory; if (proxy) - SetProxy(std::move(proxy)); - else - main_task_runner_ = base::ThreadTaskRunnerHandle::Get(); + font_proxy_.GetOrCreateValue().Bind(std::move(proxy)); + main_task_runner_ = base::ThreadTaskRunnerHandle::Get(); HRESULT hr = factory->RegisterFontCollectionLoader(this); DCHECK(SUCCEEDED(hr)); @@ -358,32 +397,19 @@ bool DWriteFontCollectionProxy::CreateFamily(UINT32 family_index) { return true; } -void DWriteFontCollectionProxy::SetProxy( - mojo::PendingRemote<blink::mojom::DWriteFontProxy> proxy) { - font_proxy_ = blink::mojom::ThreadSafeDWriteFontProxyPtr::Create( - std::move(proxy), base::ThreadPool::CreateSequencedTaskRunner( - {base::WithBaseSyncPrimitives()})); -} - blink::mojom::DWriteFontProxy& DWriteFontCollectionProxy::GetFontProxy() { - if (!font_proxy_) { - mojo::PendingRemote<blink::mojom::DWriteFontProxy> dwrite_font_proxy; + mojo::Remote<blink::mojom::DWriteFontProxy>& font_proxy = + font_proxy_.GetOrCreateValue(); + if (!font_proxy) { if (main_task_runner_->RunsTasksInCurrentSequence()) { - ChildThread::Get()->BindHostReceiver( - dwrite_font_proxy.InitWithNewPipeAndPassReceiver()); + BindHostReceiverOnMainThread(font_proxy.BindNewPipeAndPassReceiver()); } else { main_task_runner_->PostTask( - FROM_HERE, - base::BindOnce( - [](mojo::PendingReceiver<blink::mojom::DWriteFontProxy> - receiver) { - ChildThread::Get()->BindHostReceiver(std::move(receiver)); - }, - dwrite_font_proxy.InitWithNewPipeAndPassReceiver())); + FROM_HERE, base::BindOnce(&BindHostReceiverOnMainThread, + font_proxy.BindNewPipeAndPassReceiver())); } - SetProxy(std::move(dwrite_font_proxy)); } - return **font_proxy_; + return *font_proxy; } DWriteFontFamilyProxy::DWriteFontFamilyProxy() = default; diff --git a/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.h b/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.h index 576fa767650..0e14fa0c51b 100644 --- a/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.h +++ b/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_win.h @@ -15,8 +15,10 @@ #include "base/files/memory_mapped_file.h" #include "base/macros.h" #include "base/strings/string16.h" +#include "base/threading/sequence_local_storage_slot.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/remote.h" #include "third_party/blink/public/mojom/dwrite_font_proxy/dwrite_font_proxy.mojom.h" namespace content { @@ -28,6 +30,8 @@ class DWriteFontFamilyProxy; // into a custom font collection. // This is needed because the sandbox interferes with DirectWrite's // communication with the system font service. +// This class can be accessed from any thread, but it is expected that a lock +// internal to DWrite prevents concurrent accesses. class DWriteFontCollectionProxy : public Microsoft::WRL::RuntimeClass< Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, @@ -36,6 +40,12 @@ class DWriteFontCollectionProxy IDWriteFontFileLoader> { public: // Factory method to avoid exporting the class and all it derives from. + // + // |proxy| is an optional DWriteFontProxy to use when the constructed + // DWriteFontCollectionProxy is used on the current sequence. DWriteFontProxy + // remotes will be bound via ChildThread when the constructed + // DWriteFontCollectionProxy is used from a sequence for which no + // DWriteFontProxy has been provided. static CONTENT_EXPORT HRESULT Create(DWriteFontCollectionProxy** proxy_out, IDWriteFactory* dwrite_factory, @@ -92,14 +102,16 @@ class DWriteFontCollectionProxy blink::mojom::DWriteFontProxy& GetFontProxy(); private: - void SetProxy(mojo::PendingRemote<blink::mojom::DWriteFontProxy> proxy); - Microsoft::WRL::ComPtr<IDWriteFactory> factory_; std::vector<Microsoft::WRL::ComPtr<DWriteFontFamilyProxy>> families_; std::map<base::string16, UINT32> family_names_; UINT32 family_count_ = UINT_MAX; scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; - scoped_refptr<blink::mojom::ThreadSafeDWriteFontProxyPtr> font_proxy_; + // Per-sequence mojo::Remote<DWriteFontProxy>. This is preferred to a + // mojo::SharedRemote, which would force a thread hop for each call that + // doesn't originate from the "bound" sequence. + base::SequenceLocalStorageSlot<mojo::Remote<blink::mojom::DWriteFontProxy>> + font_proxy_; DISALLOW_ASSIGN(DWriteFontCollectionProxy); }; diff --git a/chromium/content/child/runtime_features.cc b/chromium/content/child/runtime_features.cc index a8f08ddedfe..94702732887 100644 --- a/chromium/content/child/runtime_features.cc +++ b/chromium/content/child/runtime_features.cc @@ -26,6 +26,7 @@ #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/network_switches.h" #include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/common/switches.h" #include "third_party/blink/public/platform/web_runtime_features.h" #include "ui/accessibility/accessibility_features.h" #include "ui/base/ui_base_features.h" @@ -59,8 +60,11 @@ void SetRuntimeFeatureDefaultsForPlatform( WebRuntimeFeatures::EnableCompositedSelectionUpdate(true); #endif #if defined(OS_WIN) - if (base::win::GetVersion() >= base::win::Version::WIN10) + if (base::win::GetVersion() >= base::win::Version::WIN10) { WebRuntimeFeatures::EnableWebBluetooth(true); + WebRuntimeFeatures::EnableWebBluetoothRemoteCharacteristicNewWriteValue( + true); + } #endif #if defined(SUPPORT_WEBGL2_COMPUTE_CONTEXT) @@ -72,7 +76,7 @@ void SetRuntimeFeatureDefaultsForPlatform( #if defined(OS_MACOSX) const bool enable_canvas_2d_image_chromium = command_line.HasSwitch( - switches::kEnableGpuMemoryBufferCompositorResources) && + blink::switches::kEnableGpuMemoryBufferCompositorResources) && !command_line.HasSwitch(switches::kDisable2dCanvasImageChromium) && !command_line.HasSwitch(switches::kDisableGpu) && base::FeatureList::IsEnabled(features::kCanvas2DImageChromium); @@ -85,7 +89,7 @@ void SetRuntimeFeatureDefaultsForPlatform( #if defined(OS_MACOSX) const bool enable_web_gl_image_chromium = command_line.HasSwitch( - switches::kEnableGpuMemoryBufferCompositorResources) && + blink::switches::kEnableGpuMemoryBufferCompositorResources) && !command_line.HasSwitch(switches::kDisableWebGLImageChromium) && !command_line.HasSwitch(switches::kDisableGpu) && base::FeatureList::IsEnabled(features::kWebGLImageChromium); @@ -209,9 +213,12 @@ void SetRuntimeFeaturesFromChromiumFeatures() { {wf::EnableWebXR, features::kWebXr, kUseFeatureState}, {wf::EnableWebXRARModule, features::kWebXrArModule, kUseFeatureState}, {wf::EnableWebXRHitTest, features::kWebXrHitTest, kUseFeatureState}, - {wf::EnableWebXRIncubations, features::kWebXrIncubations, kEnableOnly}, {wf::EnableWebXRAnchors, features::kWebXrIncubations, kEnableOnly}, + {wf::EnableWebXRCameraAccess, features::kWebXrIncubations, kEnableOnly}, {wf::EnableWebXRLightEstimation, features::kWebXrIncubations, kEnableOnly}, + {wf::EnableWebXRPlaneDetection, features::kWebXrIncubations, kEnableOnly}, + {wf::EnableWebXRReflectionEstimation, features::kWebXrIncubations, + kEnableOnly}, {wf::EnableUserActivationPostMessageTransfer, features::kUserActivationPostMessageTransfer, kUseFeatureState}, {wf::EnableUserActivationSameOriginVisibility, @@ -283,12 +290,15 @@ void SetRuntimeFeaturesFromChromiumFeatures() { {wf::EnableSkipTouchEventFilter, blink::features::kSkipTouchEventFilter, kUseFeatureState}, {wf::EnableSmsReceiver, features::kSmsReceiver, kDisableOnly}, + {wf::EnableClickPointerEvent, features::kClickPointerEvent, kEnableOnly}, {wf::EnableConsolidatedMovementXY, features::kConsolidatedMovementXY, kUseFeatureState}, {wf::EnableCooperativeScheduling, features::kCooperativeScheduling, kUseFeatureState}, {wf::EnableMouseSubframeNoImplicitCapture, features::kMouseSubframeNoImplicitCapture, kUseFeatureState}, + {wf::EnableSubresourceWebBundles, features::kSubresourceWebBundles, + kUseFeatureState}, {wf::EnableCookieDeprecationMessages, features::kCookieDeprecationMessages, kEnableOnly}, {wf::EnableSameSiteByDefaultCookies, @@ -300,12 +310,6 @@ void SetRuntimeFeaturesFromChromiumFeatures() { {wf::EnableScrollUnification, features::kScrollUnification, kUseFeatureState}, {wf::EnableNeverSlowMode, features::kNeverSlowMode, kUseFeatureState}, - {wf::EnableShadowDOMV0, blink::features::kWebComponentsV0Enabled, - kEnableOnly}, - {wf::EnableCustomElementsV0, blink::features::kWebComponentsV0Enabled, - kEnableOnly}, - {wf::EnableHTMLImports, blink::features::kWebComponentsV0Enabled, - kEnableOnly}, {wf::EnableVideoPlaybackQuality, features::kVideoPlaybackQuality, kUseFeatureState}, {wf::EnableBrowserVerifiedUserActivationKeyboard, @@ -320,8 +324,12 @@ void SetRuntimeFeaturesFromChromiumFeatures() { {wf::EnableInstalledApp, features::kInstalledApp, kDisableOnly}, {wf::EnableWebAuthenticationGetAssertionFeaturePolicy, device::kWebAuthGetAssertionFeaturePolicy, kUseFeatureState}, + {wf::EnableTransformInterop, blink::features::kTransformInterop, + kUseFeatureState}, {wf::EnableVideoWakeLockOptimisationHiddenMuted, media::kWakeLockOptimisationHiddenMuted, kUseFeatureState}, + {wf::EnableMediaFeeds, media::kMediaFeeds, kUseFeatureState}, + }; for (const auto& mapping : blinkFeatureToBaseFeatureMapping) { SetRuntimeFeatureFromChromiumFeature( @@ -341,36 +349,45 @@ void SetRuntimeFeaturesFromChromiumFeatures() { blink::features::kAudioWorkletRealtimeThread, kEnableOnly}, {"BlockCredentialedSubresources", features::kBlockCredentialedSubresources, kDisableOnly}, + {"BlockFlowHandlesWebkitLineClamp", + blink::features::kBlockFlowHandlesWebkitLineClamp, kUseFeatureState}, {"BlockHTMLParserOnStyleSheets", blink::features::kBlockHTMLParserOnStyleSheets, kUseFeatureState}, - {"ConversionMeasurement", features::kConversionMeasurement, - kEnableOnly}, + {"CSSColorSchemeUARendering", features::kCSSColorSchemeUARendering, + kUseFeatureState}, {"CSSReducedFontLoadingInvalidations", blink::features::kCSSReducedFontLoadingInvalidations, kUseFeatureState}, - {"CustomElementsV0", blink::features::kWebComponentsV0Enabled, - kEnableOnly}, + {"CSSReducedFontLoadingLayoutInvalidations", + blink::features::kCSSReducedFontLoadingLayoutInvalidations, + kUseFeatureState}, + {"CSSMatchedPropertiesCacheDependencies", + blink::features::kCSSMatchedPropertiesCacheDependencies, + kUseFeatureState}, {"FeaturePolicyForClientHints", features::kFeaturePolicyForClientHints, kUseFeatureState}, {"FlexGaps", blink::features::kFlexGaps, kEnableOnly}, {"FontAccess", blink::features::kFontAccess, kUseFeatureState}, {"FontSrcLocalMatching", features::kFontSrcLocalMatching, kUseFeatureState}, - {"HTMLImports", blink::features::kWebComponentsV0Enabled, - kEnableOnly}, + {"ForceSynchronousHTMLParsing", + blink::features::kForceSynchronousHTMLParsing, kUseFeatureState}, {"IgnoreCrossOriginWindowWhenNamedAccessOnWindow", blink::features::kIgnoreCrossOriginWindowWhenNamedAccessOnWindow, kEnableOnly}, {"LayoutNG", blink::features::kLayoutNG, kUseFeatureState}, - {"LayoutNGFlexBox", blink::features::kFlexNG, kEnableOnly}, + {"LayoutNGFlexBox", blink::features::kFlexNG, kUseFeatureState}, + {"LayoutNGFragmentItem", blink::features::kFragmentItem, + kUseFeatureState}, + {"LayoutNGRuby", blink::features::kLayoutNGRuby, kUseFeatureState}, {"LegacyWindowsDWriteFontFallback", features::kLegacyWindowsDWriteFontFallback, kUseFeatureState}, + {"LinkDisabledNewSpecBehavior", + blink::features::kLinkDisabledNewSpecBehavior, kUseFeatureState}, {"OriginPolicy", features::kOriginPolicy, kUseFeatureState}, {"OriginIsolationHeader", features::kOriginIsolationHeader, kUseFeatureState}, {"RawClipboard", blink::features::kRawClipboard, kEnableOnly}, - {"ShadowDOMV0", blink::features::kWebComponentsV0Enabled, - kEnableOnly}, {"StorageAccessAPI", blink::features::kStorageAccessAPI, kEnableOnly}, {"TrustedDOMTypes", features::kTrustedDOMTypes, kEnableOnly}, {"UserAgentClientHint", features::kUserAgentClientHint, @@ -449,9 +466,6 @@ void SetRuntimeFeaturesFromCommandLine(const base::CommandLine& command_line) { switches::kEnableAccessibilityObjectModel, true}, {wrf::EnableAllowSyncXHRInPageDismissal, switches::kAllowSyncXHRInPageDismissal, true}, - {wrf::EnableShadowDOMV0, switches::kWebComponentsV0Enabled, true}, - {wrf::EnableCustomElementsV0, switches::kWebComponentsV0Enabled, true}, - {wrf::EnableHTMLImports, switches::kWebComponentsV0Enabled, true}, }; for (const auto& mapping : switchToFeatureMapping) { if (command_line.HasSwitch(mapping.switch_name)) @@ -525,9 +539,7 @@ void SetCustomizedRuntimeFeaturesFromCombinedArgs( blink::features::kNativeFileSystemAPI.name, base::FeatureList::OVERRIDE_ENABLE_FEATURE)) { WebRuntimeFeatures::EnableFeatureFromString("NativeFileSystem", true); - WebRuntimeFeatures::EnableFeatureFromString( - "CloneableNativeFileSystemHandles", true); - WebRuntimeFeatures::EnableFeatureFromString("WritableFileStream", true); + WebRuntimeFeatures::EnableFeatureFromString("LegacyNativeFileSystem", true); } if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI) && base::FeatureList::IsEnabled(blink::features::kFileHandlingAPI)) { diff --git a/chromium/content/child/webthemeengine_impl_android.cc b/chromium/content/child/webthemeengine_impl_android.cc index a879ed2cfa4..fe96bd18f74 100644 --- a/chromium/content/child/webthemeengine_impl_android.cc +++ b/chromium/content/child/webthemeengine_impl_android.cc @@ -84,6 +84,8 @@ static void GetNativeThemeExtraParams( native_theme_extra_params->slider.thumb_x = extra_params->slider.thumb_x; native_theme_extra_params->slider.thumb_y = extra_params->slider.thumb_y; native_theme_extra_params->slider.zoom = extra_params->slider.zoom; + native_theme_extra_params->slider.right_to_left = + extra_params->slider.right_to_left; FALLTHROUGH; case WebThemeEngine::kPartSliderThumb: native_theme_extra_params->slider.vertical = diff --git a/chromium/content/child/webthemeengine_impl_default.cc b/chromium/content/child/webthemeengine_impl_default.cc index 0691820cc19..3b81850a18f 100644 --- a/chromium/content/child/webthemeengine_impl_default.cc +++ b/chromium/content/child/webthemeengine_impl_default.cc @@ -107,6 +107,8 @@ static void GetNativeThemeExtraParams( native_theme_extra_params->slider.thumb_x = extra_params->slider.thumb_x; native_theme_extra_params->slider.thumb_y = extra_params->slider.thumb_y; native_theme_extra_params->slider.zoom = extra_params->slider.zoom; + native_theme_extra_params->slider.right_to_left = + extra_params->slider.right_to_left; FALLTHROUGH; // vertical and in_drag properties are used by both slider track and // slider thumb. diff --git a/chromium/content/child/webthemeengine_impl_mac.cc b/chromium/content/child/webthemeengine_impl_mac.cc index dbd8f0bda68..f8aa72dbe3c 100644 --- a/chromium/content/child/webthemeengine_impl_mac.cc +++ b/chromium/content/child/webthemeengine_impl_mac.cc @@ -18,4 +18,65 @@ void WebThemeEngineMac::SetForcedColors( forced_colors_ = forced_colors; } +void WebThemeEngineMac::Paint(cc::PaintCanvas* canvas, + WebThemeEngine::Part part, + WebThemeEngine::State state, + const blink::WebRect& rect, + const WebThemeEngine::ExtraParams* extra_params, + blink::WebColorScheme color_scheme) { + if (IsScrollbarPart(part)) { + PaintMacScrollBarParts(canvas, part, state, rect, extra_params, + color_scheme); + return; + } + + WebThemeEngineDefault::Paint(canvas, part, state, rect, extra_params, + color_scheme); +} + +bool WebThemeEngineMac::IsScrollbarPart(WebThemeEngine::Part part) { + switch (part) { + case WebThemeEngine::kPartScrollbarHorizontalTrack: + case WebThemeEngine::kPartScrollbarVerticalTrack: + case WebThemeEngine::kPartScrollbarHorizontalThumb: + case WebThemeEngine::kPartScrollbarVerticalThumb: + case WebThemeEngine::kPartScrollbarCorner: + return true; + default: + return false; + } +} + +void WebThemeEngineMac::PaintMacScrollBarParts( + cc::PaintCanvas* canvas, + WebThemeEngine::Part part, + WebThemeEngine::State state, + const blink::WebRect& rect, + const WebThemeEngine::ExtraParams* extra_params, + blink::WebColorScheme color_scheme) { + ui::NativeTheme::ExtraParams native_theme_extra_params; + native_theme_extra_params.scrollbar_extra.is_hovering = + extra_params->scrollbar_extra.is_hovering; + native_theme_extra_params.scrollbar_extra.is_overlay = + extra_params->scrollbar_extra.is_overlay; + switch (extra_params->scrollbar_extra.orientation) { + case WebThemeEngine::kVerticalOnRight: + native_theme_extra_params.scrollbar_extra.orientation = + ui::NativeTheme::ScrollbarOrientation::kVerticalOnRight; + break; + case WebThemeEngine::kVerticalOnLeft: + native_theme_extra_params.scrollbar_extra.orientation = + ui::NativeTheme::ScrollbarOrientation::kVerticalOnLeft; + break; + case WebThemeEngine::kHorizontal: + native_theme_extra_params.scrollbar_extra.orientation = + ui::NativeTheme::ScrollbarOrientation::kHorizontal; + break; + } + + ui::NativeTheme::GetInstanceForNativeUi()->Paint( + canvas, NativeThemePart(part), NativeThemeState(state), gfx::Rect(rect), + native_theme_extra_params, NativeColorScheme(color_scheme)); +} + } // namespace content diff --git a/chromium/content/child/webthemeengine_impl_mac.h b/chromium/content/child/webthemeengine_impl_mac.h index 81f1d06b1f7..f2f232388d5 100644 --- a/chromium/content/child/webthemeengine_impl_mac.h +++ b/chromium/content/child/webthemeengine_impl_mac.h @@ -5,17 +5,33 @@ #ifndef CONTENT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_ #define CONTENT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_ -#include "third_party/blink/public/platform/web_theme_engine.h" +#include "content/child/webthemeengine_impl_default.h" namespace content { -class WebThemeEngineMac : public blink::WebThemeEngine { +class WebThemeEngineMac : public WebThemeEngineDefault { public: ~WebThemeEngineMac() override {} blink::ForcedColors GetForcedColors() const override; void SetForcedColors(const blink::ForcedColors forced_colors) override; + void Paint(cc::PaintCanvas* canvas, + blink::WebThemeEngine::Part part, + blink::WebThemeEngine::State state, + const blink::WebRect& rect, + const blink::WebThemeEngine::ExtraParams* extra_params, + blink::WebColorScheme color_scheme) override; + + static bool IsScrollbarPart(WebThemeEngine::Part part); + static void PaintMacScrollBarParts( + cc::PaintCanvas* canvas, + WebThemeEngine::Part part, + WebThemeEngine::State state, + const blink::WebRect& rect, + const WebThemeEngine::ExtraParams* extra_params, + blink::WebColorScheme color_scheme); + private: blink::ForcedColors forced_colors_ = blink::ForcedColors::kNone; }; |