summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 03:57:04 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 03:57:04 +0000
commit22f5aaa21ecb93bef8b0171b50137e5bc1c838bd (patch)
tree7f24b41dfecfc230155d4f29a3071024d5292738 /chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
parente3c6f51fcf256b17a1469c00b1f3fd7e6be0f914 (diff)
downloadchromium_src-22f5aaa21ecb93bef8b0171b50137e5bc1c838bd.zip
chromium_src-22f5aaa21ecb93bef8b0171b50137e5bc1c838bd.tar.gz
chromium_src-22f5aaa21ecb93bef8b0171b50137e5bc1c838bd.tar.bz2
[Mac] The autocomplete popup now gets its position from the toolbar controller,
rather than simply growing its width by 2*height. BUG=None TEST=The autocomplete popup should continue to appear in the same location. Review URL: http://codereview.chromium.org/173439 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24586 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_popup_view_mac.mm')
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm18
1 files changed, 4 insertions, 14 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index 9d68b74..9de258f 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -6,6 +6,7 @@
#include "app/gfx/text_elider.h"
#include "base/sys_string_conversions.h"
+#include "base/gfx/rect.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
@@ -236,10 +237,12 @@ NSAttributedString* AutocompletePopupViewMac::MatchText(
AutocompletePopupViewMac::AutocompletePopupViewMac(
AutocompleteEditViewMac* edit_view,
AutocompleteEditModel* edit_model,
+ AutocompletePopupPositioner* positioner,
Profile* profile,
NSTextField* field)
: model_(new AutocompletePopupModel(this, edit_model, profile)),
edit_view_(edit_view),
+ positioner_(positioner),
field_(field),
matrix_target_([[AutocompleteMatrixTarget alloc] initWithPopupView:this]),
popup_(nil) {
@@ -316,20 +319,7 @@ void AutocompletePopupViewMac::UpdatePopupAppearance() {
CreatePopupIfNeeded();
// Layout the popup and size it to land underneath the field.
- // TODO(shess) Consider refactoring to remove this depenency,
- // 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.
-
- // Locate |field_| on the screen, and pad the left and right sides
- // by the height to make it wide enough to include the star and go
- // buttons.
- // TODO(shess): This assumes that those buttons will be square.
- // Better to plumb through so that this code can get the rect from
- // the toolbar controller?
- NSRect r = [field_ convertRect:[field_ bounds] toView:nil];
- r.origin.x -= r.size.height;
- r.size.width += 2 * r.size.height;
+ NSRect r = NSRectFromCGRect(positioner_->GetPopupBounds().ToCGRect());
r.origin = [[field_ window] convertBaseToScreen:r.origin];
DCHECK_GT(r.size.width, 0.0);