summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/toolbar_controller.mm
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 23:05:07 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 23:05:07 +0000
commite9ccfe39326c10720e3b284c16e8c0bf96c965b5 (patch)
tree7438f7e470a0400417554b83681217bb04b17467 /chrome/browser/cocoa/toolbar_controller.mm
parent9c1981c591996af8fdbce5dcb0d2d473e7383e5e (diff)
downloadchromium_src-e9ccfe39326c10720e3b284c16e8c0bf96c965b5.zip
chromium_src-e9ccfe39326c10720e3b284c16e8c0bf96c965b5.tar.gz
chromium_src-e9ccfe39326c10720e3b284c16e8c0bf96c965b5.tar.bz2
[Mac] Trim Omnibox hints as field shrinks.
When user text doesn't fit with the full hint: "Type to search" hint goes away "Tab to search" condenses to "Tab" "Search Engine:" is truncated http://crbug.com/20285 TEST=Type a sentence. Resize window to see if type-hint goes away. TEST=Type "google". Resize window to see if tab-hint goes away. TEST=Type "google" then TAB, then sentence. Resize window to see if "Search Google:" is truncated. TEST=In all cases, text should not scroll before truncation (though it might move as part of truncation). Review URL: http://codereview.chromium.org/262034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29202 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/toolbar_controller.mm')
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm13
1 files changed, 8 insertions, 5 deletions
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index cc69542..9f588a5 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -510,11 +510,14 @@ class PrefObserverBridge : public NotificationObserver {
// up with the visible borders on the location stack.
const int kLocationStackEdgeWidth = 2;
- NSRect locationFrame = [locationBar_ frame];
- int minX = NSMinX([starButton_ frame]);
- int maxX = NSMaxX([goButton_ frame]);
- DCHECK(minX < NSMinX(locationFrame));
- DCHECK(maxX > NSMaxX(locationFrame));
+ const NSRect locationFrame = [locationBar_ frame];
+
+ // Expand to include star and go buttons. Including the widths
+ // rather that calculating from their current placement because this
+ // method can be called while the resize is still rearranging the
+ // views involved.
+ const CGFloat minX = NSMinX(locationFrame) - NSWidth([starButton_ frame]);
+ const CGFloat maxX = NSMaxX(locationFrame) + NSWidth([goButton_ frame]);
NSRect r = NSMakeRect(minX, NSMinY(locationFrame), maxX - minX,
NSHeight(locationFrame));