diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-05 21:36:50 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-05 21:36:50 +0000 |
commit | b534997d1ff9b241dd207598c42ea705c110dc11 (patch) | |
tree | f0e3d142d10d7b34a0db316a5e805fa55594fffa /chrome/browser/autocomplete/autocomplete.cc | |
parent | 99deea6d3b0cf9c93351f247c5b62d3c8dea47da (diff) | |
download | chromium_src-b534997d1ff9b241dd207598c42ea705c110dc11.zip chromium_src-b534997d1ff9b241dd207598c42ea705c110dc11.tar.gz chromium_src-b534997d1ff9b241dd207598c42ea705c110dc11.tar.bz2 |
Fix flicker that happened when hitting ctrl while in FORCED_QUERY mode. We were comparing an input that had the "?" stripped off to one which didn't and thus never setting |minimal_changes| = true.
BUG=13295
TEST=Type "?foo" into the omnibox. Then hit the ctrl key. The box should not flicker at all when pressing and releasing ctrl.
Review URL: http://codereview.chromium.org/118325
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete.cc')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index 95e9956..3276b6e 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -659,16 +659,22 @@ void AutocompleteController::Start(const std::wstring& text, bool prevent_inline_autocomplete, bool prefer_keyword, bool synchronous_only) { + const std::wstring old_input_text(input_.text()); + const bool old_synchronous_only = input_.synchronous_only(); + input_ = AutocompleteInput(text, desired_tld, prevent_inline_autocomplete, + prefer_keyword, synchronous_only); + // See if we can avoid rerunning autocomplete when the query hasn't changed // much. When the user presses or releases the ctrl key, the desired_tld // changes, and when the user finishes an IME composition, inline autocomplete // may no longer be prevented. In both these cases the text itself hasn't // changed since the last query, and some providers can do much less work (and // get results back more quickly). Taking advantage of this reduces flicker. - const bool minimal_changes = (input_.text() == text) && - (input_.synchronous_only() == synchronous_only); - input_ = AutocompleteInput(text, desired_tld, prevent_inline_autocomplete, - prefer_keyword, synchronous_only); + // + // NOTE: This comes after constructing |input_| above since that construction + // can change the text string (e.g. by stripping off a leading '?'). + const bool minimal_changes = (input_.text() == old_input_text) && + (input_.synchronous_only() == old_synchronous_only); // If we're starting a brand new query, stop caring about any old query. if (!minimal_changes && !done_) { |