summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 20:43:44 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 20:43:44 +0000
commit2815fd215021595d12782cd15bb69d7d03c39618 (patch)
treea5099307a6498b3b3b412b6ce1bdbfc5dab29043 /chrome
parentc11132e8c15c88716ee6b3b73729f13090a67f24 (diff)
downloadchromium_src-2815fd215021595d12782cd15bb69d7d03c39618.zip
chromium_src-2815fd215021595d12782cd15bb69d7d03c39618.tar.gz
chromium_src-2815fd215021595d12782cd15bb69d7d03c39618.tar.bz2
Don't update our text from toolbar if the toolbar's text doesn't
visibly differ from the model's text. In most cases, this doesn't come up, because focus is usually not in the field (so there wouldn't be local changes), but when opening NTP you can type between when the tab opens in the browser and when the renderer finishes loading it. In that case, the model and toolbar both have "" as the url text, so this case is hit. http://crbug.com/13109 TEST=Browse to www.google.com. Command-t for new tab and type http as fast as you can. Before this fix, you sometimes got "tp" or something of the sort. Review URL: http://codereview.chromium.org/119125 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm18
1 files changed, 13 insertions, 5 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index 2ae9165..11c4dc3 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -202,8 +202,8 @@ void AutocompleteEditViewMac::Update(
// that the field isn't always updated correctly. Figure out why
// this is. Maybe this method should be refactored into more
// specific cases.
- const std::wstring text = toolbar_model_->GetText();
- const bool user_visible = model_->UpdatePermanentText(text);
+ const bool user_visible =
+ model_->UpdatePermanentText(toolbar_model_->GetText());
if (tab_for_state_restoring) {
RevertAll();
@@ -237,9 +237,13 @@ void AutocompleteEditViewMac::Update(
// we're getting the selection and popup right.
} else {
- // TODO(shess): Figure out how this case is used, to make sure
- // we're getting the selection and popup right.
- UpdateAndStyleText(text);
+ // TODO(shess): This corresponds to _win and _gtk, except those
+ // guard it with a test for whether the security level changed.
+ // But AFAICT, that can only change if the text changed, and that
+ // code compares the toolbar_model_ security level with the local
+ // security level. Dig in and figure out why this isn't a no-op
+ // that should go away.
+ UpdateAndStyleText(GetText());
}
}
@@ -320,6 +324,10 @@ void AutocompleteEditViewMac::RevertAll() {
ClosePopup();
model_->Revert();
+ // TODO(shess): This should be a no-op, the results from GetText()
+ // could only get there via UpdateAndStyleText() in the first place.
+ // Dig into where this code can be called from and see if this line
+ // can be removed.
UpdateAndStyleText(GetText());
controller_->OnChanged();
}