Index: content/browser/frame_host/render_frame_host_impl.cc |
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc |
index de78df1b008a679665336147ce250c5ad9bf3a98..e6e821d3b503a1b2dc01d2ab6e1121c144fb5f43 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.cc |
+++ b/content/browser/frame_host/render_frame_host_impl.cc |
@@ -1787,14 +1787,49 @@ void RenderFrameHostImpl::OnAccessibilitySnapshotResponse( |
} |
} |
+// TODO(alexmos): When the allowFullscreen flag is known in the browser |
+// process, use it to double-check that fullscreen can be entered here. |
void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) { |
+ // Entering fullscreen from a cross-process subframe also affects all |
+ // renderers for ancestor frames, which will need to apply fullscreen CSS to |
+ // appropriate ancestor <iframe> elements, fire fullscreenchange events, etc. |
+ // Thus, walk through the ancestor chain of this frame and send a message |
+ // about the pending fullscreen change, providing the routing ID of the |
+ // remote child frame that contains the fullscreened element. The renderer |
Charlie Reis
2016/05/12 22:59:23
nit: renderer process
alexmos
2016/05/13 07:21:03
Done.
|
+ // will use this to find the <iframe> element that will need fullscreen |
+ // styles. This is done at most once per SiteInstance: for example, with a |
+ // A-B-A-B hierarchy, if the bottom frame goes fullscreen, this only needs to |
+ // notify its parent, and Blink-side logic will take care of applying |
+ // necessary changes to the other two ancestors. |
alexmos
2016/05/10 21:36:24
I considered whether this should be per-widget or
Charlie Reis
2016/05/12 22:59:23
Acknowledged.
|
+ if (enter_fullscreen && |
+ SiteIsolationPolicy::AreCrossProcessFramesPossible()) { |
+ std::set<SiteInstance*> notified_instances; |
+ notified_instances.insert(GetSiteInstance()); |
+ for (FrameTreeNode* node = frame_tree_node_; node->parent(); |
+ node = node->parent()) { |
+ RenderFrameHostImpl* parent_rfh = node->parent()->current_frame_host(); |
+ if (ContainsKey(notified_instances, parent_rfh->GetSiteInstance())) |
+ continue; |
+ |
+ int child_routing_id = |
+ node->render_manager()->GetRoutingIdForSiteInstance( |
+ parent_rfh->GetSiteInstance()); |
+ parent_rfh->Send(new FrameMsg_WillEnterFullscreen( |
+ parent_rfh->GetRoutingID(), child_routing_id)); |
Charlie Reis
2016/05/12 22:59:23
Nick was wondering if this should just go to child
alexmos
2016/05/13 07:21:03
This is a great idea! Done.
|
+ notified_instances.insert(parent_rfh->GetSiteInstance()); |
+ } |
+ } |
+ |
+ // TODO(alexmos): See if this can use the last committed origin instead. |
if (enter_fullscreen) |
delegate_->EnterFullscreenMode(last_committed_url().GetOrigin()); |
else |
delegate_->ExitFullscreenMode(/* will_cause_resize */ true); |
// The previous call might change the fullscreen state. We need to make sure |
- // the renderer is aware of that, which is done via the resize message. |
+ // the renderer is aware of that, which is done via the resize message. We |
+ // always send this to the main frame's widget, and if there are any OOPIF |
+ // widgets, this will also trigger them to resize via frameRectsChanged. |
alexmos
2016/05/10 21:36:24
My doc (https://goo.gl/Y5wdqi) has some more info
Charlie Reis
2016/05/12 22:59:23
Acknowledged.
|
render_view_host_->GetWidget()->WasResized(); |
} |