Commit a52bee94 authored by Lucas Gadani's avatar Lucas Gadani Committed by Commit Bot

Portals: Take fallback content from previous frame.

This prevents the white flash when activating a portal.

Bug: 956575
Change-Id: I02864de8f4a23a219a61c511a5f268d02c834d37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1603094Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658280}
parent 74854870
...@@ -185,8 +185,19 @@ void Portal::Activate(blink::TransferableMessage data, ...@@ -185,8 +185,19 @@ void Portal::Activate(blink::TransferableMessage data,
auto* outer_contents_main_frame_view = static_cast<RenderWidgetHostViewBase*>( auto* outer_contents_main_frame_view = static_cast<RenderWidgetHostViewBase*>(
outer_contents->GetMainFrame()->GetView()); outer_contents->GetMainFrame()->GetView());
if (outer_contents_main_frame_view)
if (outer_contents_main_frame_view) {
// Take fallback contents from previous WebContents so that the activation
// is smooth without flashes.
auto* portal_contents_main_frame_view =
static_cast<RenderWidgetHostViewBase*>(
portal_contents_impl_->GetMainFrame()->GetView());
portal_contents_main_frame_view->TakeFallbackContentFrom(
outer_contents_main_frame_view);
outer_contents_main_frame_view->Destroy(); outer_contents_main_frame_view->Destroy();
}
std::unique_ptr<WebContents> predecessor_web_contents = std::unique_ptr<WebContents> predecessor_web_contents =
delegate->SwapWebContents(outer_contents, std::move(portal_contents), delegate->SwapWebContents(outer_contents, std::move(portal_contents),
true, is_loading); true, is_loading);
......
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