refactor: replace --offscreen flag with ApplyWebPreferences (#28938)
This commit is contained in:
parent
e0fa327daf
commit
9601dc59fc
4 changed files with 6 additions and 22 deletions
|
@ -103,6 +103,6 @@ web_contents.patch
|
||||||
fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch
|
fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch
|
||||||
disable_unload_metrics.patch
|
disable_unload_metrics.patch
|
||||||
fix_add_check_for_sandbox_then_result.patch
|
fix_add_check_for_sandbox_then_result.patch
|
||||||
moves_background_color_setter_of_webview_to_blinks_webprefs_logic.patch
|
extend_apply_webpreferences.patch
|
||||||
fix_expose_decrementcapturercount_in_web_contents_impl.patch
|
fix_expose_decrementcapturercount_in_web_contents_impl.patch
|
||||||
add_setter_for_browsermainloop_result_code.patch
|
add_setter_for_browsermainloop_result_code.patch
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Samuel Attard <sattard@slack-corp.com>
|
From: Samuel Attard <sattard@slack-corp.com>
|
||||||
Date: Mon, 8 Mar 2021 16:27:39 -0800
|
Date: Mon, 8 Mar 2021 16:27:39 -0800
|
||||||
Subject: moves background_color setter of WebView to blinks webprefs logic
|
Subject: extend ApplyWebPreferences with Electron-specific logic
|
||||||
|
|
||||||
background_color can be updated at runtime, as such we need to apply the
|
background_color can be updated at runtime, as such we need to apply the
|
||||||
new background color to the WebView in the ApplyPreferences method.
|
new background color to the WebView in the ApplyPreferences method.
|
||||||
|
@ -12,7 +12,7 @@ Ideally we could add an embedder observer pattern here but that can be
|
||||||
done in future work.
|
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
|
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 affad073f806c509779c041128708fb074fee8ad..b2615fc4ea5e9ae96182fb611a419c7c5630e983 100644
|
index affad073f806c509779c041128708fb074fee8ad..0d3486f136f77375a8977cefeef1e1dea7549045 100644
|
||||||
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
--- a/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||||
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
+++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
|
||||||
@@ -155,6 +155,7 @@
|
@@ -155,6 +155,7 @@
|
||||||
|
@ -23,7 +23,7 @@ index affad073f806c509779c041128708fb074fee8ad..b2615fc4ea5e9ae96182fb611a419c7c
|
||||||
#include "third_party/blink/renderer/platform/graphics/image.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/cull_rect.h"
|
||||||
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
|
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
|
||||||
@@ -1755,6 +1756,14 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
|
@@ -1755,6 +1756,16 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
|
||||||
|
|
||||||
RuntimeEnabledFeatures::SetTranslateServiceEnabled(
|
RuntimeEnabledFeatures::SetTranslateServiceEnabled(
|
||||||
prefs.translate_service_available);
|
prefs.translate_service_available);
|
||||||
|
@ -35,6 +35,8 @@ index affad073f806c509779c041128708fb074fee8ad..b2615fc4ea5e9ae96182fb611a419c7c
|
||||||
+ color = static_cast<SkColor>(blink_color);
|
+ color = static_cast<SkColor>(blink_color);
|
||||||
+ }
|
+ }
|
||||||
+ web_view->SetBaseBackgroundColor(color);
|
+ web_view->SetBaseBackgroundColor(color);
|
||||||
|
+
|
||||||
|
+ SetUseExternalPopupMenus(!prefs.offscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewImpl::ThemeChanged() {
|
void WebViewImpl::ThemeChanged() {
|
|
@ -325,13 +325,6 @@ void WebContentsPreferences::AppendCommandLineSwitches(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --offscreen
|
|
||||||
// TODO(loc): Offscreen is duplicated in WebPreferences because it's needed
|
|
||||||
// earlier than we can get WebPreferences at the moment.
|
|
||||||
if (IsEnabled(options::kOffscreen)) {
|
|
||||||
command_line->AppendSwitch(options::kOffscreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(OS_MAC)
|
#if defined(OS_MAC)
|
||||||
// Enable scroll bounce.
|
// Enable scroll bounce.
|
||||||
if (IsEnabled(options::kScrollBounce))
|
if (IsEnabled(options::kScrollBounce))
|
||||||
|
|
|
@ -148,17 +148,6 @@ void RendererClientBase::BindProcess(v8::Isolate* isolate,
|
||||||
void RendererClientBase::RenderThreadStarted() {
|
void RendererClientBase::RenderThreadStarted() {
|
||||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
|
|
||||||
// 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.
|
|
||||||
// TODO(loc): This will be wrong for in-process child windows, as this
|
|
||||||
// function won't run again for them.
|
|
||||||
if (command_line->HasSwitch(options::kOffscreen)) {
|
|
||||||
blink::WebView::SetUseExternalPopupMenus(false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||||
auto* thread = content::RenderThread::Get();
|
auto* thread = content::RenderThread::Get();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue