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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 2763063002: [omnibox] Narrow condition for resetting selection (Closed)
Patch Set: Some attempts Created 3 years, 8 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/ui/views/omnibox/omnibox_view_views.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 6fc3b895ef0ba5c89f7e333c373d373a25bd902d..3df6f587db1ff865bc7fb1b7eaeaf9b85767239e 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -772,12 +772,14 @@ void OmniboxViewViews::OnBlur() {
views::Textfield::OnBlur();
model()->OnWillKillFocus();
- // If ZeroSuggest is active, we may have refused to show an update to the
- // underlying permanent URL that happened while the popup was open, so
- // revert to ensure that update is shown now. Otherwise, make sure to call
- // CloseOmniboxPopup() unconditionally, so that if ZeroSuggest is in the midst
- // of running but hasn't yet opened the popup, it will be halted.
- if (!model()->user_input_in_progress() && model()->popup_model()->IsOpen())
+ // If ZeroSuggest is active, and there is evidence that there is a text
+ // update to show, revert to ensure that update is shown now. Otherwise,
+ // at least call CloseOmniboxPopup(), so that if ZeroSuggest is in the
+ // midst of running but hasn't yet opened the popup, it will be halted.
+ // If we fully reverted in this case, we'd lose the cursor/highlight
+ // information saved above.
+ if (!model()->user_input_in_progress() && model()->popup_model()->IsOpen() &&
+ text() != model()->PermanentText())
RevertAll();
else
CloseOmniboxPopup();

Powered by Google App Engine
This is Rietveld 408576698