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

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

Issue 155537: [Mac] Remove guard on FocusLocation() in autocomplete field. (Closed)
Patch Set: Created 11 years, 5 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
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index 6f8f6c8974ad3e8e1caed1ace4c13edbf58b01db..2c541c885d5d73ecaeadd6835c30d61e9e051f51 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -223,9 +223,7 @@ void AutocompleteEditViewMac::Update(
// store existing state before anyone tries to setup the new
// state. Anyhow, it would look something like this.
#if 0
- FocusLocation();
-
- // Must restore directly to evade model_->has_focus() guard.
+ [[field_ window] makeFirstResponder:field_];
[[field_ currentEditor] setSelectedRange:state->selection];
#endif
}
@@ -295,7 +293,9 @@ void AutocompleteEditViewMac::SetSelectedRange(const NSRange range) {
if (model_->has_focus()) {
// TODO(shess): If |model_| thinks we have focus, this should not
// be necessary. Try to convert to DCHECK(IsFirstResponder()).
- FocusLocation();
+ if (![field_ currentEditor]) {
+ [[field_ window] makeFirstResponder:field_];
+ }
// TODO(shess): What if it didn't get first responder, and there is
// no field editor? This will do nothing. Well, at least it won't
@@ -549,13 +549,8 @@ void AutocompleteEditViewMac::AcceptInput(
}
void AutocompleteEditViewMac::FocusLocation() {
- // -makeFirstResponder: will select the entire field_. If we're
- // already firstResponder, it's likely that we want to retain the
- // current selection.
- if (![field_ currentEditor]) {
- [[field_ window] makeFirstResponder:field_];
- DCHECK_EQ([field_ currentEditor], [[field_ window] firstResponder]);
- }
+ [[field_ window] makeFirstResponder:field_];
+ DCHECK_EQ([field_ currentEditor], [[field_ window] firstResponder]);
}
@implementation AutocompleteFieldDelegate
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698