Commit cfe54a6a authored by danakj's avatar danakj Committed by Commit Bot

Only call OnSynchronizeVisualProperties in RenderView creation for a local frame

The CreateRenderView IPC comes with a set of VisualProperties for the local
main frame, and they should be set on the RenderWidget similar to how we do
so for the CreateFrame IPC so that blink reads valid things off the
RenderWidget while it exists and is not undead.

However when the RenderWidget is undead, there is no local frame, so stop
calling OnSynchronizeVisualProperties. The VisualProperties will be passed
along in the future with CreateFrame in that case and set when the
RenderWidget is reanimated.

We must not call UpdateWebViewWithDeviceScaleFactor() after calling
OnSynchronizeVisualProperties() as it dirties the compositor state, and
Android WebView expects the compositor state to be clean when it sends an
IPC to set the base background colour. The OnSynchronizeVisualProperties()
does a Resize of the WebView which runs the document lifecycle and cleans
the compositor state. So this also removes the call to that from
RenderViewImpl, and places it with the OnSynchronizeVisualProperties call
in RenderFrameImpl.

The true purpose of UpdateWebViewWithDeviceScaleFactor() is to propagate
the page zoom factor down to a new LocalFrame, and so it only needs to be
called when the main frame is local as well.

R=erikchen@chromium.org

Change-Id: Idd06d7af65ebd01ceec03ec9591445eb7805f413
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1805873
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697327}
parent f4f8f447
...@@ -1479,12 +1479,14 @@ RenderFrameImpl* RenderFrameImpl::CreateMainFrame( ...@@ -1479,12 +1479,14 @@ RenderFrameImpl* RenderFrameImpl::CreateMainFrame(
render_view->GetWidget(), web_frame); render_view->GetWidget(), web_frame);
render_widget->Init(std::move(show_callback), web_frame_widget); render_widget->Init(std::move(show_callback), web_frame_widget);
render_view->AttachWebFrameWidget(web_frame_widget); render_view->AttachWebFrameWidget(web_frame_widget);
// TODO(crbug.com/419087): This was added in 6ccadf770766e89c3 to prevent an
// empty ScreenInfo, but the WebView has already been created and initialized // This call makes sure the page zoom is propagated to the provisional frame
// by RenderViewImpl, so this is surely redundant? // since it has to go through the WebViewImpl, and it may not be be changed
// in OnSynchronizeVisualProperties(), which would pass it along if it did
// change.
render_widget->UpdateWebViewWithDeviceScaleFactor(); render_widget->UpdateWebViewWithDeviceScaleFactor();
render_widget->OnSynchronizeVisualProperties(params->visual_properties);
// The WebFrame created here was already attached to the Page as its // The WebFrame created here was already attached to the Page as its
// main frame, and the WebFrameWidget has been initialized, so we can call // main frame, and the WebFrameWidget has been initialized, so we can call
......
...@@ -534,9 +534,7 @@ void RenderViewImpl::Initialize( ...@@ -534,9 +534,7 @@ void RenderViewImpl::Initialize(
if (params->window_was_created_with_opener) if (params->window_was_created_with_opener)
webview()->SetOpenedByDOM(); webview()->SetOpenedByDOM();
GetWidget()->UpdateWebViewWithDeviceScaleFactor();
OnSetRendererPrefs(*params->renderer_preferences); OnSetRendererPrefs(*params->renderer_preferences);
GetWidget()->OnSynchronizeVisualProperties(params->visual_properties);
GetContentClient()->renderer()->RenderViewCreated(this); GetContentClient()->renderer()->RenderViewCreated(this);
page_zoom_level_ = 0; page_zoom_level_ = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment