Fix corrupt background and text color of IPH buttons on Win and Linux
* Transparent background was used in button and was problematic
on Windows and Linux. See screenshot http://shortn/_PJngbEljUE
Fix using an explicit color.
* Use SetEnabledTextColors to set button text color.
This sets color for NORMAL, PRESSED and HOVERED states.
On Windows and Linux, setting only NORMAL but omitting others
will render text in other states in black, which is not desired.
(cherry picked from commit e3787541457f17efae3af8a0b8600e3d222c7396)
Bug: 1121399
Change-Id: Ica95095855a619220a5dd9cf62c67b87acb6be0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2452554
Reviewed-by: Collin Baker <[email protected]>
Commit-Queue: Keren Zhu <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#814269}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2457307
Commit-Queue: Collin Baker <[email protected]>
Cr-Commit-Position: refs/branch-heads/4280@{#95}
Cr-Branched-From: ea420fb963f9658c9969b6513c56b8f47efa1a2a-refs/heads/master@{#812852}
diff --git a/chrome/browser/ui/views/in_product_help/feature_promo_bubble_view.cc b/chrome/browser/ui/views/in_product_help/feature_promo_bubble_view.cc
index e013ed3..ebc058e 100644
--- a/chrome/browser/ui/views/in_product_help/feature_promo_bubble_view.cc
+++ b/chrome/browser/ui/views/in_product_help/feature_promo_bubble_view.cc
@@ -77,13 +77,11 @@
has_border_(has_border) {
// Prominent style gives a button hover highlight.
SetProminent(true);
- // Button color is the same as IPH bubble's color.
- SetBgColorOverride(SK_ColorTRANSPARENT);
// TODO(kerenzhu): IPH bubble uses blue600 as the background color
// for both regular and dark mode. We might want to use a
// dark-mode-appropriate background color so that overriding text color
// is not needed.
- SetTextColor(ButtonState::STATE_NORMAL, kBubbleButtonTextColor);
+ SetEnabledTextColors(kBubbleButtonTextColor);
// TODO(crbug/1112244): Temporary fix for Mac. Bubble shouldn't be in
// inactive style when the bubble loses focus.
SetTextColor(ButtonState::STATE_DISABLED, kBubbleButtonTextColor);
@@ -96,15 +94,19 @@
// Adapted from MdTextButton::UpdateBackgroundColor()
ui::NativeTheme* theme = GetNativeTheme();
- SkColor bg_color =
- HasFocus() ? kBubbleButtonFocusedBackgroundColor : SK_ColorTRANSPARENT;
+ // Default button background color is the same as IPH bubble's color.
+ const SkColor kBubbleBackgroundColor = ThemeProperties::GetDefaultColor(
+ ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_BACKGROUND, false);
+
+ SkColor bg_color = HasFocus() ? kBubbleButtonFocusedBackgroundColor
+ : kBubbleBackgroundColor;
if (GetState() == STATE_PRESSED)
- theme->GetSystemButtonPressedColor(bg_color);
+ bg_color = theme->GetSystemButtonPressedColor(bg_color);
SkColor stroke_color =
has_border_
? theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonBorderColor)
- : SK_ColorTRANSPARENT;
+ : kBubbleBackgroundColor;
SetBackground(CreateBackgroundFromPainter(
Painter::CreateRoundRectWith1PxBorderPainter(bg_color, stroke_color,