Properly expose display-mode in OOP child frames.
The display-mode is currently passed to the renderer and through to
blink only for the main frame. Secondly, when navigating and re-creating
a main frame RenderWidget, the display-mode is set on the RenderWidget
during construction which accidentally prevents it from getting the
value to blink.
This introduces tests for same-site/same-process child frames as well as
child local root frames which are in a separate renderer process.
Problems fixed:
1. WebContentsImpl would return the wrong value for child local roots
because it tries to return kBrowser always for non-frame widgets. But
it checks this condition by checking if the widget is the main frame
widget only by converting it to a RenderViewHost. Now we only call it
from frame-based widgets and it gives the right value to them all.
2. RenderWidget would throw away the value if it was not attached to the
main frame. We remove that condition and give it to blink regardless.
These two fixes are verified by a new browser test.
3. RenderWidget no longer stores a display-mode on construction but gets
it through the following call to update VisualProperties that comes with
the CreateFrame IPC message. Because it is no longer stored on
RenderWidget at all, we ensure it always gets through to blink and that
blink reads the correct and only value being stored.
4. The display-mode is no longer passed through WebView which causes
different local roots in the same process to clobber each other. Instead
it goes to the WebWidget.
5. When it changes in the local root frame, we also notify all local
child frames' documents about the change recursively. This is verified
by a new unit test in web_view_tests.cc.
[email protected], [email protected]
Bug: 1060336, 1058633
Change-Id: Ic67e24b298ad4e8be107305531dfefc68a45c85b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2100433
Commit-Queue: danakj <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Philip Rogers <[email protected]>
Cr-Commit-Position: refs/heads/master@{#757480}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 9f596277..f59b9b6 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2687,11 +2687,7 @@
return IsFullscreenForCurrentTab();
}
-blink::mojom::DisplayMode WebContentsImpl::GetDisplayMode(
- RenderWidgetHostImpl* render_widget_host) const {
- if (!RenderViewHostImpl::From(render_widget_host))
- return blink::mojom::DisplayMode::kBrowser;
-
+blink::mojom::DisplayMode WebContentsImpl::GetDisplayMode() const {
return delegate_ ? delegate_->GetDisplayMode(this)
: blink::mojom::DisplayMode::kBrowser;
}