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

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

Issue 2345183002: Views: Draw Textfield selected text in gray when top-level Widget loses focus.
Patch Set: Fix up diff & add colors to Windows/Mac. Created 4 years, 3 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 | ui/gfx/render_text.h » ('j') | ui/gfx/render_text.cc » ('J')
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 c9cf7111b946dbc0c44ac718eed6eca6bb15480c..d3fbdb66daf344ed56cce50952ac1b52660d866b 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -308,7 +308,18 @@ void OmniboxViewViews::OnNativeThemeChanged(const ui::NativeTheme* theme) {
}
void OmniboxViewViews::OnPaint(gfx::Canvas* canvas) {
+ bool draw_unfocused_selection_ =
+ !HasFocus() &&
+ GetWidget()->GetFocusManager()->GetStoredFocusView() == this;
+ gfx::Range range = GetSelectedRange();
+ if (draw_unfocused_selection_)
+ GetRenderText()->SelectRange(saved_selection_for_focus_change_);
+
Textfield::OnPaint(canvas);
+
+ if (draw_unfocused_selection_)
+ GetRenderText()->SelectRange(range);
+
if (!insert_char_time_.is_null()) {
UMA_HISTOGRAM_TIMES("Omnibox.CharTypedToRepaintLatency",
base::TimeTicks::Now() - insert_char_time_);
« no previous file with comments | « no previous file | ui/gfx/render_text.h » ('j') | ui/gfx/render_text.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698