diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-05 00:29:54 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-05 00:29:54 +0000 |
commit | 77e5eb6b11b789c8ea2ac6215bcf73c86d2d1ca3 (patch) | |
tree | 9c122c1834735586013c67e0f2d7c61d4078bfd9 | |
parent | 192bf51c4d660a4fd38182ab6eada141bcdbbd59 (diff) | |
download | chromium_src-77e5eb6b11b789c8ea2ac6215bcf73c86d2d1ca3.zip chromium_src-77e5eb6b11b789c8ea2ac6215bcf73c86d2d1ca3.tar.gz chromium_src-77e5eb6b11b789c8ea2ac6215bcf73c86d2d1ca3.tar.bz2 |
[Mac] Drop shadow for Omnibox popup.
Adding the system drop shadow adds a border, so removed the border we
were drawing. Also pushed all of the one-pixel-here-one-pixel-there
positioning tweaks to -autocompletePopupPosition.
http://crbug.com/20283
TEST=Omnibox popup border should have drop shadow, be two pixels below
Omnibox, and rounded corners should align with rounded corners of star
and go buttons.
Review URL: http://codereview.chromium.org/185013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25560 0039d316-1c4b-4281-b951-d872f2087c98
-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 |