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

Unified Diff: components/omnibox/browser/omnibox_popup_model.cc

Issue 2070733002: Update omnibox dropdown selection/hover background drawing for MD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scaled_radius
Patch Set: Use BackgroundWith1PxBorder to do the drawing Created 4 years, 6 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 | « chrome/browser/ui/views/omnibox/omnibox_result_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/omnibox/browser/omnibox_popup_model.cc
diff --git a/components/omnibox/browser/omnibox_popup_model.cc b/components/omnibox/browser/omnibox_popup_model.cc
index 86dc529faaec43ae55b355bdc5c98b0a3b8fa26b..e8f1d92faafde7c6afb934ee3351bf0a564bdd1b 100644
--- a/components/omnibox/browser/omnibox_popup_model.cc
+++ b/components/omnibox/browser/omnibox_popup_model.cc
@@ -111,13 +111,16 @@ void OmniboxPopupModel::SetHoveredLine(size_t line) {
if (line == hovered_line_)
return; // Nothing to do
+ // We need to update |hovered_line_| before calling InvalidateLine(), since it
+ // will check it to determine how to draw.
+ const size_t prev_hovered_line = hovered_line_;
+ hovered_line_ = line;
+
// Make sure the old hovered line is redrawn. No need to redraw the selected
// line since selection overrides hover so the appearance won't change.
- if ((hovered_line_ != kNoMatch) && (hovered_line_ != selected_line_))
- view_->InvalidateLine(hovered_line_);
+ if ((prev_hovered_line != kNoMatch) && (prev_hovered_line != selected_line_))
+ view_->InvalidateLine(prev_hovered_line);
- // Change the hover to the new line.
- hovered_line_ = line;
if (!is_disabling && (hovered_line_ != selected_line_))
view_->InvalidateLine(hovered_line_);
}
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_result_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698