Reapply omnibox result styles on theme change
Bug: 974432
Change-Id: I6173c9d08d82699904b8681f530cdf4d920b16b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1684860
Reviewed-by: Kevin Bailey <krb@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#674188}
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
index 6a1917e..519db4b 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -121,7 +121,7 @@
animation_->Hide();
}
-void OmniboxResultView::Invalidate() {
+void OmniboxResultView::Invalidate(bool force_reapply_styles) {
bool high_contrast =
GetNativeTheme() && GetNativeTheme()->UsesHighContrastColors();
// TODO(tapted): Consider using background()->SetNativeControlColor() and
@@ -191,7 +191,7 @@
// Normally, OmniboxTextView caches its appearance, but in high contrast,
// selected-ness changes the text colors, so the styling of the text part of
// the results needs to be recomputed.
- if (high_contrast) {
+ if (high_contrast || force_reapply_styles) {
suggestion_view_->content()->ReapplyStyling();
suggestion_view_->description()->ReapplyStyling();
}
@@ -404,7 +404,7 @@
}
void OmniboxResultView::OnThemeChanged() {
- Invalidate();
+ Invalidate(true);
SchedulePaint();
}
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.h b/chrome/browser/ui/views/omnibox/omnibox_result_view.h
index 580cb9b..dc2d8131 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_result_view.h
+++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.h
@@ -60,7 +60,7 @@
void ShowKeyword(bool show_keyword);
- void Invalidate();
+ void Invalidate(bool force_reapply_styles = false);
// Invoked when this result view has been selected.
void OnSelected();