Chromium Code Reviews| Index: chrome/browser/ui/browser.cc |
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
| index d2063c2f561ca8edecea3ef93c812f62903d6b41..d9f656944e700b18ef45a1f80866a9184ec24f87 100644 |
| --- a/chrome/browser/ui/browser.cc |
| +++ b/chrome/browser/ui/browser.cc |
| @@ -1040,6 +1040,19 @@ void Browser::ActiveTabChanged(WebContents* old_contents, |
| WebContents* new_contents, |
| int index, |
| int reason) { |
| + // Copies the background color from an old WebContents to a new one that |
| + // replaces it on the screen. This allows the new WebContents to use the |
| + // old one's background color as the starting background color, before having |
| + // loaded any contents. As a result, we avoid flashing white when moving to |
| + // a new tab. (There is also code in RenderFrameHostManager to do something |
| + // similar for intra-tab navigations.) |
| + if (old_contents && new_contents) { |
| + RenderWidgetHostView* old_view = old_contents->GetMainFrame()->GetView(); |
|
Peter Kasting
2017/03/09 00:02:03
NIt: Document the null check, e.g. "While GetMainF
chrishtr
2017/03/09 00:04:53
Done.
|
| + RenderWidgetHostView* new_view = new_contents->GetMainFrame()->GetView(); |
| + if (old_view && new_view) |
| + new_view->SetBackgroundColor(old_view->background_color()); |
| + } |
| + |
| content::RecordAction(UserMetricsAction("ActiveTabChanged")); |
| // Update the bookmark state, since the BrowserWindow may query it during |