| Index: ui/base/cocoa/nsview_additions.mm
|
| diff --git a/ui/base/cocoa/nsview_additions.mm b/ui/base/cocoa/nsview_additions.mm
|
| index 49f18b02b2f2997afc0df55753775130fda7f9be..1bfd3a577a0ef381b70bd28bf817c30344a41a76 100644
|
| --- a/ui/base/cocoa/nsview_additions.mm
|
| +++ b/ui/base/cocoa/nsview_additions.mm
|
| @@ -75,7 +75,8 @@
|
| static NSView* g_ancestorBeingDrawnFrom = nil;
|
| static NSView* g_childBeingDrawnTo = nil;
|
|
|
| -- (void)cr_drawUsingAncestor:(NSView*)ancestorView inRect:(NSRect)dirtyRect {
|
| +- (void)cr_drawUsingAncestor:(NSView*)ancestorView inRect:(NSRect)dirtyRect
|
| + clippedToAncestorBounds:(BOOL)clipToAncestorBounds {
|
| gfx::ScopedNSGraphicsContextSaveGState scopedGSState;
|
| NSRect frame = [self convertRect:[self bounds] toView:ancestorView];
|
| NSAffineTransform* transform = [NSAffineTransform transform];
|
| @@ -91,13 +92,21 @@ static NSView* g_childBeingDrawnTo = nil;
|
| DCHECK(!g_ancestorBeingDrawnFrom && !g_childBeingDrawnTo);
|
| g_ancestorBeingDrawnFrom = ancestorView;
|
| g_childBeingDrawnTo = self;
|
| - [ancestorView drawRect:NSIntersectionRect(
|
| - [ancestorView bounds],
|
| - [self convertRect:dirtyRect toView:ancestorView])];
|
| + NSRect drawRect = [self convertRect:dirtyRect toView:ancestorView];
|
| + if (clipToAncestorBounds) {
|
| + drawRect = NSIntersectionRect([ancestorView bounds], drawRect);
|
| + }
|
| + [ancestorView drawRect:drawRect];
|
| g_childBeingDrawnTo = nil;
|
| g_ancestorBeingDrawnFrom = nil;
|
| }
|
|
|
| +- (void)cr_drawUsingAncestor:(NSView*)ancestorView inRect:(NSRect)dirtyRect {
|
| + [self cr_drawUsingAncestor:ancestorView
|
| + inRect:dirtyRect
|
| + clippedToAncestorBounds:YES];
|
| +}
|
| +
|
| - (NSView*)cr_viewBeingDrawnTo {
|
| if (!g_ancestorBeingDrawnFrom)
|
| return self;
|
|
|