diff --git third_party/WebKit/Source/core/exported/WebViewImpl.cpp third_party/WebKit/Source/core/exported/WebViewImpl.cpp index 1cc7c6eb7182..67129b9719b5 100644 --- third_party/WebKit/Source/core/exported/WebViewImpl.cpp +++ third_party/WebKit/Source/core/exported/WebViewImpl.cpp @@ -249,8 +249,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { g_should_use_external_popup_menus = use_external_popup_menus; } -bool WebViewImpl::UseExternalPopupMenus() { - return g_should_use_external_popup_menus; +void WebViewImpl::SetUseExternalPopupMenusThisInstance( + bool use_external_popup_menus) { + should_use_external_popup_menus_ = use_external_popup_menus; +} + +bool WebViewImpl::UseExternalPopupMenus() const { + return should_use_external_popup_menus_; } namespace { @@ -346,6 +351,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, enable_fake_page_scale_animation_for_testing_(false), fake_page_scale_animation_page_scale_factor_(0), fake_page_scale_animation_use_anchor_(false), + should_use_external_popup_menus_(g_should_use_external_popup_menus), compositor_device_scale_factor_override_(0), suppress_next_keypress_event_(false), ime_accept_events_(true), diff --git third_party/WebKit/Source/core/exported/WebViewImpl.h third_party/WebKit/Source/core/exported/WebViewImpl.h index 820c1d2a8500..653c868a8444 100644 --- third_party/WebKit/Source/core/exported/WebViewImpl.h +++ third_party/WebKit/Source/core/exported/WebViewImpl.h @@ -108,7 +108,8 @@ class CORE_EXPORT WebViewImpl final static const WebInputEvent* CurrentInputEvent(); // Returns true if popup menus should be rendered by the browser, false if // they should be rendered by WebKit (which is the default). - static bool UseExternalPopupMenus(); + void SetUseExternalPopupMenusThisInstance(bool); + bool UseExternalPopupMenus() const; // WebWidget methods: void Close() override; @@ -613,6 +614,8 @@ class CORE_EXPORT WebViewImpl final float fake_page_scale_animation_page_scale_factor_; bool fake_page_scale_animation_use_anchor_; + bool should_use_external_popup_menus_; + float compositor_device_scale_factor_override_; TransformationMatrix device_emulation_transform_; diff --git third_party/WebKit/Source/core/page/ChromeClientImpl.cpp third_party/WebKit/Source/core/page/ChromeClientImpl.cpp index a68ce2c67710..c85fd4cdfa43 100644 --- third_party/WebKit/Source/core/page/ChromeClientImpl.cpp +++ third_party/WebKit/Source/core/page/ChromeClientImpl.cpp @@ -774,7 +774,7 @@ PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame, return nullptr; NotifyPopupOpeningObservers(); - if (WebViewImpl::UseExternalPopupMenus()) + if (web_view_->UseExternalPopupMenus()) return new ExternalPopupMenu(frame, select, *web_view_); DCHECK(RuntimeEnabledFeatures::PagePopupEnabled()); diff --git third_party/WebKit/public/web/WebView.h third_party/WebKit/public/web/WebView.h index 03bfa9b85e7e..6f970fe0802e 100644 --- third_party/WebKit/public/web/WebView.h +++ third_party/WebKit/public/web/WebView.h @@ -367,6 +367,7 @@ class WebView : protected WebWidget { // Sets whether select popup menus should be rendered by the browser. BLINK_EXPORT static void SetUseExternalPopupMenus(bool); + virtual void SetUseExternalPopupMenusThisInstance(bool) = 0; // Hides any popup (suggestions, selects...) that might be showing. virtual void HidePopups() = 0;