diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-27 08:13:43 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-27 08:13:43 +0000 |
commit | aa90e58c7e88cbcae7e4a7667e047c320a3fc0aa (patch) | |
tree | b5941c6472ea95896937f83548d06941b48af26d /chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc | |
parent | 1b24f85903fca15bb44122c43c2e0e4548d1e094 (diff) | |
download | chromium_src-aa90e58c7e88cbcae7e4a7667e047c320a3fc0aa.zip chromium_src-aa90e58c7e88cbcae7e4a7667e047c320a3fc0aa.tar.gz chromium_src-aa90e58c7e88cbcae7e4a7667e047c320a3fc0aa.tar.bz2 |
Use AutocompletePopupPositioner for the Linux Omnibox.
Now a few less magic numbers in exchange for a lot more plumbing.
BUG=10966
Review URL: http://codereview.chromium.org/92127
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14592 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc')
-rwxr-xr-x | chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc index b21152b..372f311 100755 --- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc @@ -36,16 +36,10 @@ const GdkColor kURLTextColor = GDK_COLOR_RGB(0x00, 0x88, 0x00); const GdkColor kDescriptionTextColor = GDK_COLOR_RGB(0x80, 0x80, 0x80); const GdkColor kDescriptionSelectedTextColor = GDK_COLOR_RGB(0x78, 0x82, 0xb1); -// TODO(deanm): This is added to extend past just the location box, and to -// be below the the star and go button. Really this means that this should -// probably plumb all the way back to the location bar view. -const int kExtraSpace = 32; // We have a 1 pixel border around the entire results popup. const int kBorderThickness = 1; // The vertical height of each result. const int kHeightPerResult = 24; -// Additional distance below the edit control. -const int kTopMargin = 6; // Width of the icons. const int kIconWidth = 16; // We want to vertically center the image in the result space. @@ -181,9 +175,11 @@ void SetupLayoutForMatch(PangoLayout* layout, AutocompletePopupViewGtk::AutocompletePopupViewGtk( AutocompleteEditViewGtk* edit_view, AutocompleteEditModel* edit_model, - Profile* profile) + Profile* profile, + AutocompletePopupPositioner* popup_positioner) : model_(new AutocompletePopupModel(this, edit_model, profile)), edit_view_(edit_view), + popup_positioner_(popup_positioner), window_(gtk_window_new(GTK_WINDOW_POPUP)), gc_(NULL), layout_(NULL), @@ -267,14 +263,11 @@ AutocompletePopupModel* AutocompletePopupViewGtk::GetModel() { } void AutocompletePopupViewGtk::Show(size_t num_results) { - gint x, y, width; - edit_view_->BottomLeftPosWidth(&x, &y, &width); - x -= kExtraSpace; - width += kExtraSpace * 2; - - gtk_window_move(GTK_WINDOW(window_), x, y + kTopMargin); - gtk_widget_set_size_request(window_, width, - (num_results * kHeightPerResult) + (kBorderThickness * 2)); + gfx::Rect rect = popup_positioner_->GetPopupBounds(); + rect.set_height((num_results * kHeightPerResult) + (kBorderThickness * 2)); + + gtk_window_move(GTK_WINDOW(window_), rect.x(), rect.y()); + gtk_widget_set_size_request(window_, rect.width(), rect.height()); gtk_widget_show(window_); opened_ = true; } |