mirror of
https://github.com/electron/electron.git
synced 2026-01-09 07:28:12 -05:00
revert Don't use static variable for UseExternalPopupMenus
This commit is contained in:
@@ -3,11 +3,8 @@ From: Samuel Attard <sattard@slack-corp.com>
|
||||
Date: Mon, 8 Mar 2021 16:27:39 -0800
|
||||
Subject: extend ApplyWebPreferences with Electron-specific logic
|
||||
|
||||
On macOS, popup menus are rendered by the main process by default.
|
||||
This causes problems in OSR, since when the popup is rendered separately,
|
||||
it won't be captured in the rendered image.
|
||||
Offscreen can be updated at runtime, as such we need to apply the
|
||||
turn on/off ExternalPopupMenu in the ApplyPreferences method.
|
||||
background_color can be updated at runtime, as such we need to apply the
|
||||
new background color to the WebView in the ApplyPreferences method.
|
||||
There is no current way to attach an observer to these prefs so patching
|
||||
is our only option.
|
||||
|
||||
@@ -15,15 +12,22 @@ Ideally we could add an embedder observer pattern here but that can be
|
||||
done in future work.
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
index 2390395a3df10aca3510a619e91dab674de60e67..40d67cfda7740a5c1c0ed811fa71681a36f09fce 100644
|
||||
index 2390395a3df10aca3510a619e91dab674de60e67..f8fae134e122a223440530bd696db899dce2fe56 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -1864,6 +1864,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
|
||||
@@ -172,6 +172,7 @@
|
||||
#include "third_party/blink/renderer/core/view_transition/view_transition_supplement.h"
|
||||
#include "third_party/blink/renderer/platform/fonts/font_cache.h"
|
||||
#include "third_party/blink/renderer/platform/fonts/generic_font_family_settings.h"
|
||||
+#include "third_party/blink/renderer/platform/graphics/color.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/image.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
|
||||
@@ -1864,6 +1865,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
web_view_impl->SetMaximumLegibleScale(
|
||||
prefs.default_maximum_page_scale_factor);
|
||||
+ web_view_impl->GetChromeClient().SetUseExternalPopupMenusForTesting(
|
||||
+ !prefs.offscreen);
|
||||
+ SetUseExternalPopupMenus(!prefs.offscreen);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
||||
@@ -241,7 +241,7 @@ index aa8b248b94ea7f6c0e04dc66e976dc7923ff3a98..868630ed2adb8f40fb7f002d45b260c0
|
||||
bool RenderVSyncNotificationEnabled() const {
|
||||
return render_v_sync_notification_enabled_;
|
||||
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
index 40d67cfda7740a5c1c0ed811fa71681a36f09fce..0672068891793403b6674533f8fc6fce58b43ac9 100644
|
||||
index f8fae134e122a223440530bd696db899dce2fe56..cec68a428fbf63932066ceb296c3db3eb9e34166 100644
|
||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||
@@ -3579,6 +3579,9 @@ void WebViewImpl::UpdateRendererPreferences(
|
||||
|
||||
Reference in New Issue
Block a user