electron/patches/chromium/webview_fullscreen.patch
trop[bot] ca22facaaf
chore: bump chromium to 138.0.7190.0 (37-x-y) (#47349)
* chore: bump chromium in DEPS to 138.0.7180.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 6546797: Add a metric for the overall success of the "safe storage" item retrieval.

Refs 6546797

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* 6548078: extensions: Fix TODO in ScriptInjectionTracker for desktop Android

Refs 6548078

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* 6544950: Revert "FSA: Only normalize the hardcoded rules once during initialization"

Refs 6544950

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* chore: bump chromium in DEPS to 138.0.7181.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* fix: correctly clamp HSL shift values between 0 and 1

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* chore: bump DEPS to 138.0.7183.0

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6553142: Remove SelectFileDialogLinuxKde | 6553142

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: update patches

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: bump chromium in DEPS to 138.0.7184.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 138.0.7186.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: bump chromium in DEPS to 138.0.7190.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6547778: Remove some superfluous //ui/gfx includes from //chrome headers | 6547778

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | 6556022

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* fix: remove pdf_extension_util::AddAdditionalData 4099130

This was removed 2 years ago in Chrome.

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* fix: provide BrowserContext to pdf_extension_util::AddAdditionalData 6558173

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* fixup! 6556022: Reland FSA: Only normalize the hardcoded rules once during initialization | 6556022

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* fix: pass in navigation throttle registry 6536175

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* fixup! 6556022: Reland "FSA: Only normalize the hardcoded rules once during initialization" | 6556022

This partially reverts commit 20d709dd15ba0ff332e24ee314149d642dc5d47c.

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* 6545984: corner-shape: render dashed & dotted borders Refs 6545984

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>

* Update corner smoothing expected images

Co-authored-by: clavin <clavin@electronjs.org>

* Apply "future" revert commit to fix windows build

> Reason for revert: Multiple eng reporting that this is causing build failures due to too-long pathnames, with no immediate feasible workaround

This issue also affects our CI builds.

Problematic CL in current roll: 6494836: [webgl] Add stub WebGL[2]RenderingContextWebGPU | 6494836
"Future" revert CL: 6565622: Revert "[webgl] Add stub WebGL[2]RenderingContextWebGPU" | 6565622

This patch should automatically disappear when we roll the revert.

Co-authored-by: clavin <clavin@electronjs.org>

* 6533919: win: don't add WS_CAPTION style to popup windows 6533919

This mirrors the change made earlier to the code ours is based on: 6374074: [headless] Provide headless aware window metrics on Windows | 6374074

Co-authored-by: clavin <clavin@electronjs.org>

* chore: update patches

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2025-06-03 17:06:30 -04:00

102 lines
5.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Thu, 4 Oct 2018 14:57:02 -0700
Subject: fix: also propagate fullscreen state for outer frame
When entering fullscreen with Element.requestFullscreen in child frames,
the parent frame should also enter fullscreen mode too. Chromium handles
this for iframes, but not for webviews as they are essentially main
frames instead of child frames.
This patch makes webviews propagate the fullscreen state to embedder.It also handles a
DCHECK preventing guest webcontents from becoming the focused webContents.
Note that we also need to manually update embedder's
`api::WebContents::IsFullscreenForTabOrPending` value.
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index be73611db5328c76982ecca3caf5eccc30aac45e..0c4d801b3705fb609a40b8c58d2ee7f9b690461f 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -8824,6 +8824,17 @@ void RenderFrameHostImpl::EnterFullscreen(
}
}
+ // Entering fullscreen from webview should also notify its outer frame.
+ if (frame_tree_node()->render_manager()->IsMainFrameForInnerDelegate()) {
+ RenderFrameProxyHost* outer_proxy =
+ frame_tree_node()->render_manager()->GetProxyToOuterDelegate();
+ DCHECK(outer_proxy);
+ if (outer_proxy->is_render_frame_proxy_live()) {
+ outer_proxy->GetAssociatedRemoteFrame()->WillEnterFullscreen(
+ options.Clone());
+ }
+ }
+
// Focus the window if another frame may have delegated the capability.
if (had_fullscreen_token && !GetView()->HasFocus())
GetView()->Focus();
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 0cf259360950a7063c4f9d6dc71b004706330f37..97df851aa73d1bf8d8c8001646b63cbb43cd9a92 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4384,21 +4384,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent(
const input::NativeWebKeyboardEvent& event) {
OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"),
"WebContentsImpl::PreHandleKeyboardEvent");
- auto* outermost_contents = GetOutermostWebContents();
- // TODO(wjmaclean): Generalize this to forward all key events to the outermost
- // delegate's handler.
- if (outermost_contents != this && IsFullscreen() &&
- event.windows_key_code == ui::VKEY_ESCAPE) {
- // When an inner WebContents has focus and is fullscreen, redirect <esc>
- // key events to the outermost WebContents so it can be handled by that
- // WebContents' delegate.
- if (outermost_contents->PreHandleKeyboardEvent(event) ==
- KeyboardEventProcessingResult::HANDLED) {
+
+ auto handled = delegate_ ? delegate_->PreHandleKeyboardEvent(this, event)
+ : KeyboardEventProcessingResult::NOT_HANDLED;
+
+ if (IsFullscreen() && event.windows_key_code == ui::VKEY_ESCAPE) {
+ if (handled == KeyboardEventProcessingResult::HANDLED)
return KeyboardEventProcessingResult::HANDLED;
+
+ // When an inner WebContents has focus and is fullscreen, traverse through
+ // containing webcontents to any that may handle the escape key.
+ while (auto* outer_web_contents = GetOuterWebContents()) {
+ auto result = outer_web_contents->PreHandleKeyboardEvent(event);
+ if (result == KeyboardEventProcessingResult::HANDLED) {
+ return KeyboardEventProcessingResult::HANDLED;
+ }
}
}
- return delegate_ ? delegate_->PreHandleKeyboardEvent(this, event)
- : KeyboardEventProcessingResult::NOT_HANDLED;
+
+ return handled;
}
bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) {
@@ -4557,7 +4561,7 @@ void WebContentsImpl::EnterFullscreenMode(
OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode");
DCHECK(CanEnterFullscreenMode(requesting_frame));
DCHECK(requesting_frame->IsActive());
- DCHECK(ContainsOrIsFocusedWebContents());
+ DCHECK(ContainsOrIsFocusedWebContents() || IsGuest());
if (base::FeatureList::IsEnabled(
features::kAutomaticFullscreenContentSetting)) {
// Ensure the window is made active to take input focus. The user may have
diff --git a/third_party/blink/renderer/core/fullscreen/fullscreen.cc b/third_party/blink/renderer/core/fullscreen/fullscreen.cc
index 0a37c1f1eb49023a4a209e9664e0fadadb97e297..76c52a0528a100787b83ccd76f552f98216a5aaa 100644
--- a/third_party/blink/renderer/core/fullscreen/fullscreen.cc
+++ b/third_party/blink/renderer/core/fullscreen/fullscreen.cc
@@ -110,7 +110,7 @@ void FullscreenElementChanged(Document& document,
// is the iframe element for the out-of-process frame that contains the
// fullscreen element. Hence, it must match :-webkit-full-screen-ancestor.
if (new_request_type & FullscreenRequestType::kForCrossProcessDescendant) {
- DCHECK(IsA<HTMLIFrameElement>(new_element));
+ // DCHECK(IsA<HTMLIFrameElement>(new_element));
new_element->SetContainsFullScreenElement(true);
}
new_element->SetContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(