summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 17:26:30 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 17:26:30 +0000
commitfc72076a7fa4c7260312fcb092294ab6e2a39821 (patch)
tree34ca8cca838e7f2aaf317a74034e60033ae8009f /chrome/browser
parente5ef3c8b7bebbce20319c73ccf153f3da596d650 (diff)
downloadchromium_src-fc72076a7fa4c7260312fcb092294ab6e2a39821.zip
chromium_src-fc72076a7fa4c7260312fcb092294ab6e2a39821.tar.gz
chromium_src-fc72076a7fa4c7260312fcb092294ab6e2a39821.tar.bz2
[Mac] Tweaks to Omnibox metrics.
Pull in the popup corners by half a pixel to more closely match the rounding on the buttons. Pull up the gap between the popup and the field by one pixel to match Windows. http://crbug.com/20446 Review URL: http://codereview.chromium.org/178007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm7
-rw-r--r--chrome/browser/cocoa/autocomplete_text_field_cell.mm2
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm4
-rw-r--r--chrome/browser/cocoa/toolbar_controller_unittest.mm5
4 files changed, 13 insertions, 5 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index 9de258f..314bd32 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -25,7 +25,10 @@ const int kCellHeightAdjust = 7.0;
// How to round off the popup's corners. Goal is to match star and go
// buttons.
-const CGFloat kPopupRoundingRadius = 4.0;
+const CGFloat kPopupRoundingRadius = 3.5;
+
+// Gap between the field and the popup.
+const CGFloat kPopupFieldGap = 2.0;
// How much space to leave for the left and right margins.
const CGFloat kLeftRightMargin = 8.0;
@@ -356,7 +359,7 @@ void AutocompletePopupViewMac::UpdatePopupAppearance() {
// Make the window just as big.
r.size.height = [matrix frame].size.height;
- r.origin.y -= r.size.height + 2;
+ r.origin.y -= r.size.height + kPopupFieldGap;
// Update the selection.
PaintUpdatesNow();
diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell.mm b/chrome/browser/cocoa/autocomplete_text_field_cell.mm
index b52d9d8..d4ef0fe 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_cell.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_cell.mm
@@ -161,6 +161,8 @@ const NSInteger kBaselineOffset = 4;
[[NSColor colorWithCalibratedWhite:1.0 alpha:0.25] set];
NSFrameRectWithWidthUsingOperation(cellFrame, 1, NSCompositeSourceOver);
+ // TODO(shess): This inset is also reflected in ToolbarController
+ // -autocompletePopupPosition.
NSRect frame = NSInsetRect(cellFrame, 0, 1);
[[self backgroundColor] setFill];
NSRect innerFrame = NSInsetRect(frame, 1, 1);
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index 718eb30..f3f3659 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -412,7 +412,9 @@ class PrefObserverBridge : public NotificationObserver {
DCHECK(minX < NSMinX(locationFrame));
DCHECK(maxX > NSMaxX(locationFrame));
- NSRect r = NSMakeRect(minX, NSMinY(locationFrame), maxX - minX, 0);
+ // 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);
return gfx::Rect(NSRectToCGRect([[self view] convertRect:r toView:nil]));
}
@end
diff --git a/chrome/browser/cocoa/toolbar_controller_unittest.mm b/chrome/browser/cocoa/toolbar_controller_unittest.mm
index a39481b..64532b0 100644
--- a/chrome/browser/cocoa/toolbar_controller_unittest.mm
+++ b/chrome/browser/cocoa/toolbar_controller_unittest.mm
@@ -272,8 +272,9 @@ TEST_F(ToolbarControllerTest, AutocompletePopupPosition) {
EXPECT_LT(popupFrame.x(), NSMinX(locationFrame));
EXPECT_GT(popupFrame.right(), NSMaxX(locationFrame));
- // Make sure the popup frame is positioned at the bottom of the location bar.
- EXPECT_EQ(popupFrame.bottom(), NSMinY(locationFrame));
+ // Make sure the popup frame is positioned above the bottom of the
+ // location bar.
+ EXPECT_GE(popupFrame.bottom(), NSMinY(locationFrame));
}