From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao 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. 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 6dfd547b9e6c4e345af79d4875be95fb6a6d8bb0..66bf5aea4d53e72e9b1f6fb0d7a64290db6c14b7 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -5661,6 +5661,15 @@ void RenderFrameHostImpl::EnterFullscreen( notified_instances.insert(parent_site_instance); } + // 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); + outer_proxy->GetAssociatedRemoteFrame()->WillEnterFullscreen( + options.Clone()); + } + delegate_->EnterFullscreenMode(this, *options); delegate_->FullscreenStateChanged(this, true /* is_fullscreen */, std::move(options));