webview_fullscreen.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Cheng Zhao <[email protected]>
  3. Date: Thu, 4 Oct 2018 14:57:02 -0700
  4. Subject: fix: also propagate fullscreen state for outer frame
  5. When entering fullscreen with Element.requestFullscreen in child frames,
  6. the parent frame should also enter fullscreen mode too. Chromium handles
  7. this for iframes, but not for webviews as they are essentially main
  8. frames instead of child frames.
  9. This patch makes webviews propagate the fullscreen state to embedder.
  10. Note that we also need to manually update embedder's
  11. `api::WebContents::IsFullscreenForTabOrPending` value.
  12. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
  13. index a6ed7b9f89b7fca2c6a6676053d520ba6c7716d7..dd8c421545d75cd8c9864b88701e0f9071259444 100644
  14. --- a/content/browser/renderer_host/render_frame_host_impl.cc
  15. +++ b/content/browser/renderer_host/render_frame_host_impl.cc
  16. @@ -6253,6 +6253,15 @@ void RenderFrameHostImpl::EnterFullscreen(
  17. notified_instances.insert(parent_site_instance);
  18. }
  19. + // Entering fullscreen from webview should also notify its outer frame.
  20. + if (frame_tree_node()->render_manager()->IsMainFrameForInnerDelegate()) {
  21. + RenderFrameProxyHost* outer_proxy =
  22. + frame_tree_node()->render_manager()->GetProxyToOuterDelegate();
  23. + DCHECK(outer_proxy);
  24. + outer_proxy->GetAssociatedRemoteFrame()->WillEnterFullscreen(
  25. + options.Clone());
  26. + }
  27. +
  28. delegate_->EnterFullscreenMode(this, *options);
  29. delegate_->FullscreenStateChanged(this, /*is_fullscreen=*/true,
  30. std::move(options));