9d0e6d09f0
* chore: bump chromium in DEPS to 119.0.6036.0 * chore: bump chromium in DEPS to 119.0.6037.0 * chore: bump chromium in DEPS to 119.0.6039.0 * chore: bump chromium in DEPS to 119.0.6041.0 * chore: update chromium patches * 4765230: Move //content/browser/renderer_host/event_with_latency_info.h to //content/common/input | https://chromium-review.googlesource.com/c/chromium/src/+/4765230 * 4890325: ScopedRunLoopTimeout: add custom timeout callback handler for testing | https://chromium-review.googlesource.com/c/chromium/src/+/4890325 * chore: update all patches * chore: bump chromium in DEPS to 119.0.6043.0 * 4898682: [api] Add Error.cause to V8 API https://chromium-review.googlesource.com/c/v8/v8/+/4898682 * 4837192: Plumb origin through for drags. https://chromium-review.googlesource.com/c/chromium/src/+/4837192 * Prevent content analysis on web pages that don't accept drag and drop. https://chromium-review.googlesource.com/c/chromium/src/+/4814086 * Make getting displayed notifications work with notification attribution. https://chromium-review.googlesource.com/c/chromium/src/+/4738935 * 4898682: [api] Add Error.cause to V8 API https://chromium-review.googlesource.com/c/v8/v8/+/4898682 * lib,test: do not hardcode Buffer.kMaxLength https://github.com/nodejs/node/pull/49876 * chore: remove Goma warning from mksnapshot_args * 4776412: Remove Windows-specific wstring variants of StringPrintf() etc. https://chromium-review.googlesource.com/c/chromium/src/+/4776412 * [dPWA] Prevent WebAppInstallInfo from being included on Android https://chromium-review.googlesource.com/c/chromium/src/+/4886594 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
102 lines
5.2 KiB
Diff
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 5ea6972f03fd450272de52c84f783be9113608bc..72dc42e2919fcb7bdfb15512b1ff38ea48807c7f 100644
|
|
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
|
@@ -7316,6 +7316,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 c42ace29f426d7ea7d6d5ae9370d12b380181082..737ca972a248538d110d4c91f9eb45a4645bdd0c 100644
|
|
--- a/content/browser/web_contents/web_contents_impl.cc
|
|
+++ b/content/browser/web_contents/web_contents_impl.cc
|
|
@@ -3594,21 +3594,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent(
|
|
const 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) {
|
|
@@ -3740,7 +3744,7 @@ void WebContentsImpl::EnterFullscreenMode(
|
|
OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode");
|
|
DCHECK(CanEnterFullscreenMode(requesting_frame, options));
|
|
DCHECK(requesting_frame->IsActive());
|
|
- DCHECK(ContainsOrIsFocusedWebContents());
|
|
+ DCHECK(ContainsOrIsFocusedWebContents() || IsGuest());
|
|
|
|
// When WebView is the `delegate_` we can end up with VisualProperties changes
|
|
// synchronously. Notify the view ahead so it can handle the transition.
|
|
diff --git a/third_party/blink/renderer/core/fullscreen/fullscreen.cc b/third_party/blink/renderer/core/fullscreen/fullscreen.cc
|
|
index 32b4f5d0c0e75fc94d95298ef127c113330896b0..ae1b2ebef7c9620f465506a38855a585fd79ce48 100644
|
|
--- a/third_party/blink/renderer/core/fullscreen/fullscreen.cc
|
|
+++ b/third_party/blink/renderer/core/fullscreen/fullscreen.cc
|
|
@@ -99,7 +99,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(
|