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

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

Issue 392143002: Fix flipped views on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rwhelper_monstrosity
Patch Set: Rebase Created 6 years, 5 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6454008032fe52e94f797a2e9d20eeb5e6612be2..82255825b061d603f6d5bb7ab7924a237d65cb66 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -513,14 +513,25 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget)
cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc]
initWithRenderWidgetHostViewMac:this] autorelease];
+ // Make this view host a solid white layer when there is no content ready to
+ // draw.
background_layer_.reset([[CALayer alloc] init]);
[background_layer_
setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
- [background_layer_ setGeometryFlipped:YES];
- [background_layer_ setContentsGravity:kCAGravityTopLeft];
[cocoa_view_ setLayer:background_layer_];
[cocoa_view_ setWantsLayer:YES];
+ if (!IsDelegatedRendererEnabled()) {
+ // Add a flipped transparent layer as a child, so that we don't need to
+ // fiddle with the position of sub-layers -- they will always be at the
+ // origin.
+ flipped_layer_.reset([[CALayer alloc] init]);
+ [flipped_layer_ setGeometryFlipped:YES];
+ [flipped_layer_
+ setAutoresizingMask:kCALayerWidthSizable|kCALayerHeightSizable];
+ [background_layer_ addSublayer:flipped_layer_];
+ }
+
if (IsDelegatedRendererEnabled()) {
root_layer_.reset(new ui::Layer(ui::LAYER_TEXTURED));
delegated_frame_host_.reset(new DelegatedFrameHost(this));
@@ -653,7 +664,7 @@ void RenderWidgetHostViewMac::EnsureSoftwareLayer() {
// Disable the fade-in animation as the layer is added.
ScopedCAActionDisabler disabler;
- [background_layer_ addSublayer:software_layer_];
+ [flipped_layer_ addSublayer:software_layer_];
}
void RenderWidgetHostViewMac::DestroySoftwareLayer() {
@@ -681,7 +692,7 @@ void RenderWidgetHostViewMac::EnsureCompositedIOSurfaceLayer() {
// Disable the fade-in animation as the layer is added.
ScopedCAActionDisabler disabler;
- [background_layer_ addSublayer:compositing_iosurface_layer_];
+ [flipped_layer_ addSublayer:compositing_iosurface_layer_];
}
void RenderWidgetHostViewMac::DestroyCompositedIOSurfaceLayer(
@@ -1754,7 +1765,7 @@ void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped(
[remote_layer_host_ setContextId:context_id];
[remote_layer_host_
setAutoresizingMask:kCALayerMaxXMargin|kCALayerMaxYMargin];
- [background_layer_ addSublayer:remote_layer_host_];
+ [flipped_layer_ addSublayer:remote_layer_host_];
}
// Ack the frame immediately. Any GPU back pressure will be applied by
@@ -2192,7 +2203,7 @@ void RenderWidgetHostViewMac::PauseForPendingResizeOrRepaintsAndDraw() {
// Synchronized resizing does not yet work with browser compositor.
// http://crbug.com/388005
- if (delegated_frame_host_)
+ if (IsDelegatedRendererEnabled())
return;
// Pausing for one view prevents others from receiving frames.
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698