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

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

Issue 164753008: Views Omnibox: Only select all on update with previous selection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only select all on omnibox update with previous selection. Created 6 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 93c5b16148ce5e929ae50d459d2e01f2a34a60bd..2fa39254bbcb682640dcf36b06e0c97bcb994923 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -494,8 +494,8 @@ void OmniboxViewViews::Update() {
// change it right before the permanent URL is changed. Since the new URL
// is still fully selected, the user's typing will replace the edit contents
// as they'd intended.
- const gfx::Range range(GetSelectedRange());
- const bool was_select_all = (range.length() == text().length());
+ const bool was_select_all = !text().empty() && IsSelectAll();
+ const bool was_reversed = GetSelectedRange().is_reversed();
RevertAll();
@@ -508,7 +508,7 @@ void OmniboxViewViews::Update() {
// and address cases like this, but it seems better to just not muck with
// things when the omnibox isn't focused to begin with.
if (was_select_all && model()->has_focus())
- SelectAll(range.is_reversed());
+ SelectAll(was_reversed);
} else if (old_security_level != security_level_) {
EmphasizeURLComponents();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698