diff options
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup_view_mac.mm | 26 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.mm | 11 |
2 files changed, 15 insertions, 22 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm index 497a5bb..943fc0a 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm @@ -298,9 +298,12 @@ void AutocompletePopupViewMac::CreatePopupIfNeeded() { backing:NSBackingStoreBuffered defer:YES]); [popup_ setMovableByWindowBackground:NO]; - // The window will have rounded borders. + // The window shape is determined by the content view + // (AutocompleteMatrix). [popup_ setAlphaValue:1.0]; [popup_ setOpaque:NO]; + [popup_ setBackgroundColor:[NSColor clearColor]]; + [popup_ setHasShadow:YES]; [popup_ setLevel:NSNormalWindowLevel]; AutocompleteMatrix* matrix = @@ -635,20 +638,15 @@ void AutocompletePopupViewMac::OnMiddleClick() { middleClickAction_ = anAction; } +- (BOOL)isOpaque { + return NO; +} + // This handles drawing the decorations of the rounded popup window, // calling on NSMatrix to draw the actual contents. - (void)drawRect:(NSRect)rect { - // Background clear so we can round the corners. - [[NSColor clearColor] set]; - NSRectFill([self frame]); - - // The toolbar items we're mirroring for shape are inset slightly - // for width. I don't know why, which is why I didn't make this a - // constant, yet. The factor of 0.5 on both dimensions is to put - // the stroke down the middle of the pixels. - const NSRect border(NSInsetRect([self bounds], 1.5, 0.5)); NSBezierPath* path = - [NSBezierPath bezierPathWithRoundedRect:border + [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:kPopupRoundingRadius yRadius:kPopupRoundingRadius]; @@ -657,12 +655,6 @@ void AutocompletePopupViewMac::OnMiddleClick() { [path addClip]; [super drawRect:rect]; [NSGraphicsContext restoreGraphicsState]; - - // Put a border over that. - // TODO(shess): Theme the color? - [[NSColor lightGrayColor] setStroke]; - [path setLineWidth:1.0]; - [path stroke]; } @end diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index f6aab53..99f84e8 100644 --- a/chrome/browser/cocoa/toolbar_controller.mm +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -448,14 +448,15 @@ class PrefObserverBridge : public NotificationObserver { // The popup should span from the left edge of the star button to the right // edge of the go button. The returned height is ignored. NSRect locationFrame = [locationBar_ frame]; - int minX = NSMinX([starButton_ frame]); - int maxX = NSMaxX([goButton_ frame]); + // TODO(shess): The buttons have an extra 2 pixels between the edge + // of the visual button and the edge of the logical button. This + // seems wrong. + int minX = NSMinX([starButton_ frame]) + 2.0; + int maxX = NSMaxX([goButton_ frame]) - 2.0; DCHECK(minX < NSMinX(locationFrame)); DCHECK(maxX > NSMaxX(locationFrame)); - // TODO(shess): The + 1.0 is because the field's visual boundary - // differs from its on-screen boundary. - NSRect r = NSMakeRect(minX, NSMinY(locationFrame) + 1.0, maxX - minX, 0); + NSRect r = NSMakeRect(minX, NSMinY(locationFrame), maxX - minX, 0); return gfx::Rect(NSRectToCGRect([[self view] convertRect:r toView:nil])); } @end |