summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 18:13:34 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 18:13:34 +0000
commit311addea8095371a9c5e6f49c69a20072513d5b1 (patch)
tree8f383b1c5f5196719c583ab57538adfa96bc4137 /chrome/browser/autocomplete
parent01eec886976e8cbbce04e1d3db041c610af17a7e (diff)
downloadchromium_src-311addea8095371a9c5e6f49c69a20072513d5b1.zip
chromium_src-311addea8095371a9c5e6f49c69a20072513d5b1.tar.gz
chromium_src-311addea8095371a9c5e6f49c69a20072513d5b1.tar.bz2
Mac: Fix so the omnibox popup doesn't show all tiny first time.
Also improve the code which sizes the popup. http://crbug.com/12324 TEST=In previous release, start typing in omnibox. Should see a 6-pixel-tall or so popup which is quickly replaced with the real popup. With this fix, should not see the incorrect version. Review URL: http://codereview.chromium.org/113644 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16758 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm17
1 files changed, 8 insertions, 9 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index 7da9f95..68b48c6 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -277,22 +277,21 @@ void AutocompletePopupViewMac::UpdatePopupAppearance() {
// because the popup doesn't need any of the field-like aspects of
// field_. The edit view could expose helper methods for attaching
// the window to the field.
- NSRect r = [field_ bounds];
- r = [field_ convertRectToBase:r];
+
+ // Locate |field_| on the screen.
+ NSRect r = [field_ convertRect:[field_ bounds] toView:nil];
r.origin = [[field_ window] convertBaseToScreen:r.origin];
+ DCHECK_GT(r.size.width, 0.0);
// Set the cell size to fit a line of text in the cell's font. All
- // cells should use the same font and layout to one line.
- NSRect bigRect = [matrix bounds];
- // TODO(shess): Why 1000.0? Because it's "big enough". Find
- // something better.
- bigRect.size.height = 1000.0;
- NSSize cellSize = [[matrix cellAtRow:0 column:0] cellSizeForBounds:bigRect];
+ // cells should use the same font and each should layout in one
+ // line, so they should all be about the same height.
+ const NSSize cellSize = [[matrix cellAtRow:0 column:0] cellSize];
+ DCHECK_GT(cellSize.height, 0.0);
[matrix setCellSize:NSMakeSize(r.size.width, cellSize.height)];
// Make the matrix big enough to hold all the cells.
[matrix sizeToCells];
- [matrix setFrameSize:NSMakeSize(r.size.width, [matrix frame].size.height)];
// Make the window just as big.
r.size.height = [matrix frame].size.height;