Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1229)

Unified Diff: chrome/browser/autocomplete/autocomplete_popup_view_mac.mm

Issue 173439: [Mac] The autocomplete popup now gets its position from the toolbar controlle... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
===================================================================
--- chrome/browser/autocomplete/autocomplete_popup_view_mac.mm (revision 24441)
+++ chrome/browser/autocomplete/autocomplete_popup_view_mac.mm (working copy)
@@ -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 @@
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 @@
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);
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_popup_view_mac.h ('k') | chrome/browser/cocoa/location_bar_view_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698