Skip to content

Commit

Permalink
Portals: Take fallback content from previous frame.
Browse files Browse the repository at this point in the history
This prevents the white flash when activating a portal.

Bug: 956575
Change-Id: I02864de8f4a23a219a61c511a5f268d02c834d37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1603094
Reviewed-by: Saman Sami <samans@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658280}
  • Loading branch information
lucasgadani authored and Commit Bot committed May 9, 2019
1 parent 7485487 commit a52bee9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion content/browser/portal/portal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,19 @@ void Portal::Activate(blink::TransferableMessage data,

auto* outer_contents_main_frame_view = static_cast<RenderWidgetHostViewBase*>(
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();
}

std::unique_ptr<WebContents> predecessor_web_contents =
delegate->SwapWebContents(outer_contents, std::move(portal_contents),
true, is_loading);
Expand Down

0 comments on commit a52bee9

Please sign in to comment.