Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6915)

Unified Diff: chrome/browser/ui/views/frame/contents_web_view.cc

Issue 1943183002: Transfer theme & page background colors between changes of RWHV. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@noflash
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/contents_web_view.cc
diff --git a/chrome/browser/ui/views/frame/contents_web_view.cc b/chrome/browser/ui/views/frame/contents_web_view.cc
index 151823ad34a7d75b21e0648aed23847077a88832..aaf54023ada95c7cc65475780ce9fa23f5215712 100644
--- a/chrome/browser/ui/views/frame/contents_web_view.cc
+++ b/chrome/browser/ui/views/frame/contents_web_view.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/views/status_bubble_views.h"
+#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/theme_provider.h"
@@ -129,3 +130,15 @@ void ContentsWebView::RenderViewReady() {
OnThemeChanged();
WebView::RenderViewReady();
}
+
+void ContentsWebView::RenderFrameHostChanged(
+ content::RenderFrameHost* old_host, content::RenderFrameHost* new_host) {
+ // Pass the background color of the old host to the new one. This passes
+ // on the page background color of the old host (or the theme color if the
+ // page background color is not set). This avoids flashes of white when
+ // starting up new_host.
+ if (old_host && new_host)
sky 2016/05/04 20:39:09 If this is the right change, can't we do it entire
chrishtr 2016/05/04 21:10:18 I'm not sure what you mean. What do you mean by "i
sky 2016/05/04 21:48:06 Content knows when the renderframehost is changing
chrishtr 2016/05/04 23:07:16 Done (hope I understood your suggestion). Should
+ new_host->GetView()->SetBackgroundColor(
+ old_host->GetView()->background_color());
+ WebView::RenderFrameHostChanged(old_host, new_host);
+}
« no previous file with comments | « chrome/browser/ui/views/frame/contents_web_view.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698