| Index: chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
|
| diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
|
| index f2a33d8785e7039e5eb41ea93682fc34c33be9fb..1a0d35cdf95c141edc5f4a0c751d705d6d1773fb 100644
|
| --- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
|
| +++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
|
| @@ -190,6 +190,10 @@ NSAttributedString* AutocompletePopupViewMac::MatchText(
|
|
|
| // Tell popup model via popup_view_ about the selected row.
|
| - (void)select:sender;
|
| +
|
| +// Resize the popup when the field's window resizes.
|
| +- (void)windowDidResize:(NSNotification*)notification;
|
| +
|
| @end
|
|
|
| AutocompletePopupViewMac::AutocompletePopupViewMac(
|
| @@ -241,6 +245,13 @@ void AutocompletePopupViewMac::CreatePopupIfNeeded() {
|
| [matrix setTarget:matrix_target_];
|
| [matrix setAction:@selector(select:)];
|
| [popup_ setContentView:matrix];
|
| +
|
| + // We need the popup to follow window resize.
|
| + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
| + [nc addObserver:matrix_target_
|
| + selector:@selector(windowDidResize:)
|
| + name:NSWindowDidResizeNotification
|
| + object:[field_ window]];
|
| }
|
| }
|
|
|
| @@ -254,6 +265,11 @@ void AutocompletePopupViewMac::UpdatePopupAppearance() {
|
| NSMatrix* matrix = [popup_ contentView];
|
| [matrix setTarget:nil];
|
|
|
| + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
| + [nc removeObserver:matrix_target_
|
| + name:NSWindowDidResizeNotification
|
| + object:[field_ window]];
|
| +
|
| popup_.reset(nil);
|
|
|
| return;
|
| @@ -455,4 +471,14 @@ void AutocompletePopupViewMac::AcceptInput() {
|
| popup_view_->AcceptInput();
|
| }
|
|
|
| +- (void)windowDidResize:(NSNotification*)notification {
|
| + DCHECK(popup_view_);
|
| +
|
| + // TODO(shess): UpdatePopupAppearance() is called frequently, so it
|
| + // should be really cheap, but in this case we could probably make
|
| + // things even cheaper by refactoring between the popup-placement
|
| + // code and the matrix-population code.
|
| + popup_view_->UpdatePopupAppearance();
|
| +}
|
| +
|
| @end
|
|
|