summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 16:48:30 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 16:48:30 +0000
commit2823c295fb18cb555252a6037e5e58ecaabf4113 (patch)
treed591aedcf125a9b172632ea33579f4a7189916f7 /chrome/browser/autocomplete
parentbc4c7e6c6621e82a550bf23f798034b6b51ab4c1 (diff)
downloadchromium_src-2823c295fb18cb555252a6037e5e58ecaabf4113.zip
chromium_src-2823c295fb18cb555252a6037e5e58ecaabf4113.tar.gz
chromium_src-2823c295fb18cb555252a6037e5e58ecaabf4113.tar.bz2
[Mac] M6 Omnibox positioning changes.
3px from top and bottom of images to cell edges in popup. With this change baselines worked out without tweaking. Omnibox popup text wasn't quite aligned with field because previous change used leading 'w' (regression). This change measured using leading 'P'. Adjust keyword-hint decoration spacing around the image. Also adjust baseline to match font (regression). Modify ImageDecoration to center the image horizontally, which allows the decoration width to be independent of the image width. PageActionDecoration uses this to pin the effective size at |kPageActionIconMaxSize|. Position page-action and bookmark popups so top border is at same gap from Omnibox (2px) as Omnibox popup. The mocks actually show the bookmark point as an additional px from the star "crotch", but I think this is reasonable for M6. BUG=50575, 50765 TEST=none. Everything still works? Review URL: http://codereview.chromium.org/3015046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54767 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm15
1 files changed, 6 insertions, 9 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index 8e78f37..14a2560 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <cmath>
+
#include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h"
#include "app/resource_bundle.h"
@@ -26,7 +28,7 @@ const int kEditFontAdjust = -1;
// How much to adjust the cell sizing up from the default determined
// by the font.
-const int kCellHeightAdjust = 7.0;
+const int kCellHeightAdjust = 6.0;
// How to round off the popup's corners. Goal is to match star and go
// buttons.
@@ -43,7 +45,7 @@ const CGFloat kPopupAlpha = 240.0 / 255.0;
const CGFloat kImageXOffset = 4.0;
// How far to offset the text column from the left.
-const CGFloat kTextXOffset = 26.0;
+const CGFloat kTextXOffset = 27.0;
// Animation duration when animating the popup window smaller.
const NSTimeInterval kShrinkAnimationDuration = 0.1;
@@ -65,11 +67,6 @@ const CGFloat kFieldVisualInset = 1.0;
// borders.
const CGFloat kWindowBorderWidth = 1.0;
-// |AutocompleteButtonCell| and |AutocompleteTextFieldCell| draw their
-// text somewhat differently. The image needs to be adjusted slightly
-// downward to align with the text the same.
-const CGFloat kImageBaselineAdjust = 1.0;
-
// Background colors for different states of the popup elements.
NSColor* BackgroundColor() {
return [[NSColor controlBackgroundColor] colorWithAlphaComponent:kPopupAlpha];
@@ -519,8 +516,8 @@ void AutocompletePopupViewMac::OpenURLForRow(int row, bool force_background) {
if (image) {
NSRect imageRect = cellFrame;
imageRect.size = [image size];
- imageRect.origin.y += kImageBaselineAdjust +
- floor((NSHeight(cellFrame) - NSHeight(imageRect)) / 2);
+ imageRect.origin.y +=
+ std::floor((NSHeight(cellFrame) - NSHeight(imageRect)) / 2.0);
imageRect.origin.x += kImageXOffset;
[image drawInRect:imageRect
fromRect:NSZeroRect // Entire image