Chromium Code Reviews| Index: chrome/browser/ui/browser.cc |
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
| index e27fd842fcc187a1bfefb787e1928bebd2449f75..a7ca7e466bc7ca074a281cb837b13e2982ac85df 100644 |
| --- a/chrome/browser/ui/browser.cc |
| +++ b/chrome/browser/ui/browser.cc |
| @@ -1041,6 +1041,18 @@ 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 navigating |
|
nasko
2017/03/08 23:11:32
nit: Is it when navigating or when switching tabs?
chrishtr
2017/03/09 00:04:53
Fixed.
|
| + // from a site whith a dark background to another site with a dark background. |
| + if (old_contents && new_contents) { |
| + RenderWidgetHostView* old_view = old_contents->GetMainFrame()->GetView(); |
| + 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 |