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

Unified Diff: ui/base/cocoa/nsview_additions.mm

Issue 1125363005: Fix darkly-drawn Show All button in Downloads Shelf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change API to accommodate Show All button background drawing. Created 5 years, 7 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 | « ui/base/cocoa/nsview_additions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « ui/base/cocoa/nsview_additions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698