1diff --git third_party/blink/public/web/web_view.h third_party/blink/public/web/web_view.h 2index 14d4a00293ab0..fc574edaaa2ad 100644 3--- third_party/blink/public/web/web_view.h 4+++ third_party/blink/public/web/web_view.h 5@@ -340,6 +340,7 @@ class WebView { 6 7 // Sets whether select popup menus should be rendered by the browser. 8 BLINK_EXPORT static void SetUseExternalPopupMenus(bool); 9+ virtual void SetUseExternalPopupMenusThisInstance(bool) = 0; 10 11 // Cancels and hides the current popup (datetime, select...) if any. 12 virtual void CancelPagePopup() = 0; 13diff --git third_party/blink/renderer/core/exported/web_view_impl.cc third_party/blink/renderer/core/exported/web_view_impl.cc 14index 87e3d73b791eb..7cc3388b38c3f 100644 15--- third_party/blink/renderer/core/exported/web_view_impl.cc 16+++ third_party/blink/renderer/core/exported/web_view_impl.cc 17@@ -247,8 +247,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { 18 g_should_use_external_popup_menus = use_external_popup_menus; 19 } 20 21-bool WebViewImpl::UseExternalPopupMenus() { 22- return g_should_use_external_popup_menus; 23+void WebViewImpl::SetUseExternalPopupMenusThisInstance( 24+ bool use_external_popup_menus) { 25+ should_use_external_popup_menus_ = use_external_popup_menus; 26+} 27+ 28+bool WebViewImpl::UseExternalPopupMenus() const { 29+ return should_use_external_popup_menus_; 30 } 31 32 namespace { 33@@ -556,6 +561,7 @@ WebViewImpl::WebViewImpl( 34 chrome_client_(MakeGarbageCollected<ChromeClientImpl>(this)), 35 minimum_zoom_level_(PageZoomFactorToZoomLevel(kMinimumPageZoomFactor)), 36 maximum_zoom_level_(PageZoomFactorToZoomLevel(kMaximumPageZoomFactor)), 37+ should_use_external_popup_menus_(g_should_use_external_popup_menus), 38 does_composite_(does_composite), 39 fullscreen_controller_(std::make_unique<FullscreenController>(this)), 40 page_base_background_color_( 41diff --git third_party/blink/renderer/core/exported/web_view_impl.h third_party/blink/renderer/core/exported/web_view_impl.h 42index 25f9a9fc617d7..8c59629d4cfa1 100644 43--- third_party/blink/renderer/core/exported/web_view_impl.h 44+++ third_party/blink/renderer/core/exported/web_view_impl.h 45@@ -133,7 +133,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, 46 static HashSet<WebViewImpl*>& AllInstances(); 47 // Returns true if popup menus should be rendered by the browser, false if 48 // they should be rendered by WebKit (which is the default). 49- static bool UseExternalPopupMenus(); 50+ void SetUseExternalPopupMenusThisInstance(bool) override; 51+ bool UseExternalPopupMenus() const; 52 53 // Returns whether frames under this WebView are backed by a compositor. 54 bool does_composite() const { return does_composite_; } 55@@ -799,6 +800,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, 56 float fake_page_scale_animation_page_scale_factor_ = 0.f; 57 bool fake_page_scale_animation_use_anchor_ = false; 58 59+ bool should_use_external_popup_menus_; 60+ 61 float compositor_device_scale_factor_override_ = 0.f; 62 TransformationMatrix device_emulation_transform_; 63 64diff --git third_party/blink/renderer/core/page/chrome_client_impl.cc third_party/blink/renderer/core/page/chrome_client_impl.cc 65index c442ddf0d214c..56bf5066688d3 100644 66--- third_party/blink/renderer/core/page/chrome_client_impl.cc 67+++ third_party/blink/renderer/core/page/chrome_client_impl.cc 68@@ -889,7 +889,7 @@ bool ChromeClientImpl::HasOpenedPopup() const { 69 PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame, 70 HTMLSelectElement& select) { 71 NotifyPopupOpeningObservers(); 72- if (WebViewImpl::UseExternalPopupMenus()) 73+ if (web_view_->UseExternalPopupMenus()) 74 return MakeGarbageCollected<ExternalPopupMenu>(frame, select); 75 76 DCHECK(RuntimeEnabledFeatures::PagePopupEnabled()); 77