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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2824613002: Mac: Remove white CALayers (Closed)
Patch Set: Fix unit test Created 3 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: content/browser/renderer_host/render_widget_host_view_mac.mm
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 896170ae4e541513134d13aef9818e7d67a5e91f..37903daefeb08dc26ac166cfff2dba100c84da39 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -442,7 +442,6 @@ float FlipYFromRectToScreen(float y, float rect_height) {
is_guest_view_hack_(is_guest_view_hack),
fullscreen_parent_host_view_(nullptr),
needs_flush_input_(false),
- background_color_(SK_ColorWHITE),
weak_factory_(this) {
// |cocoa_view_| owns us and we will be deleted when |cocoa_view_|
// goes away. Since we autorelease it, our caller must put
@@ -450,12 +449,7 @@ float FlipYFromRectToScreen(float y, float rect_height) {
cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc]
initWithRenderWidgetHostViewMac:this] autorelease];
- // Paint this view host with |background_color_| when there is no content
- // ready to draw.
background_layer_.reset([[CALayer alloc] init]);
- // Set the default color to be white. This is the wrong thing to do, but many
- // UI components expect this view to be opaque.
- [background_layer_ setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
[cocoa_view_ setLayer:background_layer_];
[cocoa_view_ setWantsLayer:YES];
@@ -1639,6 +1633,9 @@ new BrowserCompositorMac(this, this, render_widget_host_->is_hidden(),
}
void RenderWidgetHostViewMac::SetBackgroundColor(SkColor color) {
+ if (color == background_color_)
+ return;
+
// The renderer will feed its color back to us with the first CompositorFrame.
// We short-cut here to show a sensible color before that happens.
UpdateBackgroundColorFromRenderer(color);
@@ -1655,7 +1652,7 @@ new BrowserCompositorMac(this, this, render_widget_host_->is_hidden(),
}
void RenderWidgetHostViewMac::UpdateBackgroundColorFromRenderer(SkColor color) {
- if (color == background_color())
+ if (color == background_color_)
return;
background_color_ = color;
@@ -1767,7 +1764,7 @@ - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r {
renderWidgetHostView_.reset(r);
canBeKeyView_ = YES;
- opaque_ = YES;
+ opaque_ = NO;
pinchHasReachedZoomThreshold_ = false;
isStylusEnteringProximity_ = false;

Powered by Google App Engine
This is Rietveld 408576698