diff options
| author | ccameron <ccameron@chromium.org> | 2016-03-23 15:39:31 -0700 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-03-23 22:41:25 +0000 |
| commit | 03b68744da59e5806888641a2dc6d5b41a34a5f7 (patch) | |
| tree | d05f453b4037a426e4c60152a02bcbdd756ad045 | |
| parent | cf586a159d5612f4cd77ecbc716f8bd28ab87b7e (diff) | |
| download | chromium_src-03b68744da59e5806888641a2dc6d5b41a34a5f7.zip chromium_src-03b68744da59e5806888641a2dc6d5b41a34a5f7.tar.gz chromium_src-03b68744da59e5806888641a2dc6d5b41a34a5f7.tar.bz2 | |
Mac: Push background color from RWHVMac to CALayer
Make RenderWidgetHostViewMac::SetBackgroundColor set the background
color of the widget.
Push the NTP background color to RWHVMac from TabContentsController.
BUG=470669
Review URL: https://codereview.chromium.org/1817373002
Cr-Commit-Position: refs/heads/master@{#382955}
| -rw-r--r-- | chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm | 11 | ||||
| -rw-r--r-- | content/browser/renderer_host/render_widget_host_view_mac.mm | 8 |
2 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm index 14b7dce..08c4324 100644 --- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm +++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm @@ -246,6 +246,17 @@ class FullscreenObserver : public WebContentsObserver { NSViewHeightSizable]; [contentsContainer setNeedsDisplay:YES]; + + // Push the background color down to the RenderWidgetHostView, so that if + // there is a flash between contents appearing, it will be the theme's color, + // not white. + SkColor skBackgroundColor = SK_ColorWHITE; + const ThemeProvider* theme = [[[self view] window] themeProvider]; + if (theme) + skBackgroundColor = theme->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND); + content::RenderWidgetHostView* rwhv = contents_->GetRenderWidgetHostView(); + if (rwhv) + rwhv->SetBackgroundColor(skBackgroundColor); } - (void)updateFullscreenWidgetFrame { diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 3a99741..0b6ad26 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -1682,6 +1682,9 @@ void RenderWidgetHostViewMac::ShowDefinitionForSelection() { } void RenderWidgetHostViewMac::SetBackgroundColor(SkColor color) { + if (color == background_color_) + return; + RenderWidgetHostViewBase::SetBackgroundColor(color); bool opaque = GetBackgroundOpaque(); @@ -1691,6 +1694,11 @@ void RenderWidgetHostViewMac::SetBackgroundColor(SkColor color) { [cocoa_view_ setOpaque:opaque]; if (browser_compositor_state_ != BrowserCompositorDestroyed) browser_compositor_->compositor()->SetHostHasTransparentBackground(!opaque); + + ScopedCAActionDisabler disabler; + base::ScopedCFTypeRef<CGColorRef> cg_color( + skia::CGColorCreateFromSkColor(color)); + [background_layer_ setBackgroundColor:cg_color]; } BrowserAccessibilityManager* |
