Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm |
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm |
index a875eac5a6ae10e7fb163d974485eb1d9627dd70..984b1765af364b31476c61ea18c7ab28c9f58577 100644 |
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm |
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm |
@@ -8,6 +8,7 @@ |
#import "chrome/browser/ui/chrome_style.h" |
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h" |
#include "skia/ext/skia_utils_mac.h" |
+#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
@implementation ConstrainedWindowCustomWindow |
@@ -33,7 +34,8 @@ |
backing:bufferingType |
defer:NO])) { |
[self setHasShadow:YES]; |
- [self setBackgroundColor:[NSColor clearColor]]; |
+ [self setBackgroundColor:gfx::SkColorToCalibratedNSColor( |
+ chrome_style::GetBackgroundColor())]; |
[self setOpaque:NO]; |
[self setReleasedWhenClosed:NO]; |
} |
@@ -66,12 +68,19 @@ |
@implementation ConstrainedWindowCustomWindowContentView |
- (void)drawRect:(NSRect)rect { |
- NSBezierPath* path = [NSBezierPath |
+ gfx::ScopedNSGraphicsContextSaveGState state; |
+ |
+ // Draw symmetric difference between rect path and oval path as "clear". |
+ NSBezierPath* ovalPath = [NSBezierPath |
bezierPathWithRoundedRect:[self bounds] |
xRadius:chrome_style::kBorderRadius |
yRadius:chrome_style::kBorderRadius]; |
- [gfx::SkColorToCalibratedNSColor( |
- chrome_style::GetBackgroundColor()) set]; |
+ NSBezierPath* path = [NSBezierPath bezierPathWithRect:[self bounds]]; |
+ [path appendBezierPath:ovalPath]; |
+ [path setWindingRule:NSEvenOddWindingRule]; |
+ [[NSGraphicsContext currentContext] setCompositingOperation: |
+ NSCompositeCopy]; |
+ [[NSColor clearColor] set]; |
[path fill]; |
[[self window] invalidateShadow]; |