• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git third_party/blink/common/web_preferences/web_preferences.cc third_party/blink/common/web_preferences/web_preferences.cc
2index 1363ee73abdf..dca6c5b9bf66 100644
3--- third_party/blink/common/web_preferences/web_preferences.cc
4+++ third_party/blink/common/web_preferences/web_preferences.cc
5@@ -153,6 +153,7 @@ WebPreferences::WebPreferences()
6       animation_policy(
7           blink::mojom::ImageAnimationPolicy::kImageAnimationPolicyAllowed),
8       user_gesture_required_for_presentation(true),
9+      base_background_color(0xFFFFFFFF),  // Color::kWhite
10       text_tracks_enabled(false),
11       text_track_margin_percentage(0.0f),
12       immersive_mode_enabled(false),
13diff --git third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
14index 7fa49dd367b2..af16c09d0b85 100644
15--- third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
16+++ third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
17@@ -159,6 +159,7 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
18       data.accelerated_video_decode_enabled();
19   out->user_gesture_required_for_presentation =
20       data.user_gesture_required_for_presentation();
21+  out->base_background_color = data.base_background_color();
22   out->text_tracks_enabled = data.text_tracks_enabled();
23   out->text_track_margin_percentage = data.text_track_margin_percentage();
24   out->immersive_mode_enabled = data.immersive_mode_enabled();
25diff --git third_party/blink/public/common/web_preferences/web_preferences.h third_party/blink/public/common/web_preferences/web_preferences.h
26index c457698eba5d..5e1e6b80cee3 100644
27--- third_party/blink/public/common/web_preferences/web_preferences.h
28+++ third_party/blink/public/common/web_preferences/web_preferences.h
29@@ -177,6 +177,8 @@ struct BLINK_COMMON_EXPORT WebPreferences {
30
31   bool user_gesture_required_for_presentation;
32
33+  uint32_t base_background_color;
34+
35   bool text_tracks_enabled;
36
37   // These fields specify the foreground and background color for WebVTT text
38diff --git third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
39index e35980e72f5d..92f222bb29d0 100644
40--- third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
41+++ third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
42@@ -465,6 +465,11 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
43     return r.user_gesture_required_for_presentation;
44   }
45
46+  static uint32_t base_background_color(
47+      const blink::web_pref::WebPreferences& r) {
48+    return r.base_background_color;
49+  }
50+
51   static bool text_tracks_enabled(const blink::web_pref::WebPreferences& r) {
52     return r.text_tracks_enabled;
53   }
54diff --git third_party/blink/public/mojom/webpreferences/web_preferences.mojom third_party/blink/public/mojom/webpreferences/web_preferences.mojom
55index 3e2aae1d92b1..2c0ed243eede 100644
56--- third_party/blink/public/mojom/webpreferences/web_preferences.mojom
57+++ third_party/blink/public/mojom/webpreferences/web_preferences.mojom
58@@ -227,6 +227,8 @@ struct WebPreferences {
59
60   bool user_gesture_required_for_presentation;
61
62+  uint32 base_background_color;
63+
64   bool text_tracks_enabled;
65
66   // These fields specify the foreground and background color for WebVTT text
67diff --git third_party/blink/public/web/web_view.h third_party/blink/public/web/web_view.h
68index 209067240ccc..55d642f88ad3 100644
69--- third_party/blink/public/web/web_view.h
70+++ third_party/blink/public/web/web_view.h
71@@ -315,6 +315,7 @@ class WebView {
72
73   // Sets whether select popup menus should be rendered by the browser.
74   BLINK_EXPORT static void SetUseExternalPopupMenus(bool);
75+  virtual void SetUseExternalPopupMenusThisInstance(bool) = 0;
76
77   // Cancels and hides the current popup (datetime, select...) if any.
78   virtual void CancelPagePopup() = 0;
79diff --git third_party/blink/renderer/core/exported/web_view_impl.cc third_party/blink/renderer/core/exported/web_view_impl.cc
80index b236663d8f01..dd1681e6b71b 100644
81--- third_party/blink/renderer/core/exported/web_view_impl.cc
82+++ third_party/blink/renderer/core/exported/web_view_impl.cc
83@@ -242,8 +242,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) {
84   g_should_use_external_popup_menus = use_external_popup_menus;
85 }
86
87-bool WebViewImpl::UseExternalPopupMenus() {
88-  return g_should_use_external_popup_menus;
89+void WebViewImpl::SetUseExternalPopupMenusThisInstance(
90+    bool use_external_popup_menus) {
91+  should_use_external_popup_menus_ = use_external_popup_menus;
92+}
93+
94+bool WebViewImpl::UseExternalPopupMenus() const {
95+  return should_use_external_popup_menus_;
96 }
97
98 namespace {
99@@ -550,6 +555,7 @@ WebViewImpl::WebViewImpl(
100       chrome_client_(MakeGarbageCollected<ChromeClientImpl>(this)),
101       minimum_zoom_level_(PageZoomFactorToZoomLevel(kMinimumPageZoomFactor)),
102       maximum_zoom_level_(PageZoomFactorToZoomLevel(kMaximumPageZoomFactor)),
103+      should_use_external_popup_menus_(g_should_use_external_popup_menus),
104       does_composite_(does_composite),
105       fullscreen_controller_(std::make_unique<FullscreenController>(this)),
106       receiver_(this,
107@@ -1768,6 +1774,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
108
109   RuntimeEnabledFeatures::SetTranslateServiceEnabled(
110       prefs.translate_service_available);
111+
112+  web_view->SetBaseBackgroundColor(prefs.base_background_color);
113 }
114
115 void WebViewImpl::ThemeChanged() {
116diff --git third_party/blink/renderer/core/exported/web_view_impl.h third_party/blink/renderer/core/exported/web_view_impl.h
117index ace66b559cdc..130638e2dfab 100644
118--- third_party/blink/renderer/core/exported/web_view_impl.h
119+++ third_party/blink/renderer/core/exported/web_view_impl.h
120@@ -128,7 +128,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
121   static HashSet<WebViewImpl*>& AllInstances();
122   // Returns true if popup menus should be rendered by the browser, false if
123   // they should be rendered by WebKit (which is the default).
124-  static bool UseExternalPopupMenus();
125+  void SetUseExternalPopupMenusThisInstance(bool) override;
126+  bool UseExternalPopupMenus() const;
127
128   // Returns whether frames under this WebView are backed by a compositor.
129   bool does_composite() const { return does_composite_; }
130@@ -749,6 +750,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
131   float fake_page_scale_animation_page_scale_factor_ = 0.f;
132   bool fake_page_scale_animation_use_anchor_ = false;
133
134+  bool should_use_external_popup_menus_;
135+
136   float compositor_device_scale_factor_override_ = 0.f;
137   TransformationMatrix device_emulation_transform_;
138
139diff --git third_party/blink/renderer/core/page/chrome_client_impl.cc third_party/blink/renderer/core/page/chrome_client_impl.cc
140index 4e33591b87e1..f3381f443602 100644
141--- third_party/blink/renderer/core/page/chrome_client_impl.cc
142+++ third_party/blink/renderer/core/page/chrome_client_impl.cc
143@@ -811,7 +811,7 @@ bool ChromeClientImpl::HasOpenedPopup() const {
144 PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame,
145                                            HTMLSelectElement& select) {
146   NotifyPopupOpeningObservers();
147-  if (WebViewImpl::UseExternalPopupMenus())
148+  if (web_view_->UseExternalPopupMenus())
149     return MakeGarbageCollected<ExternalPopupMenu>(frame, select);
150
151   DCHECK(RuntimeEnabledFeatures::PagePopupEnabled());
152