Index: ui/views/controls/label.cc |
diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc |
index c5e3fc5e4d6f5994199fc13649b2d1f0b2d20efd..1db98e38acece6a602712d7867780a6365489096 100644 |
--- a/ui/views/controls/label.cc |
+++ b/ui/views/controls/label.cc |
@@ -53,13 +53,19 @@ Label::Label(const base::string16& text) |
: Label(text, style::CONTEXT_LABEL, style::STYLE_PRIMARY) {} |
Label::Label(const base::string16& text, int text_context, int text_style) |
- : context_menu_contents_(this) { |
+ : text_context_(text_context), context_menu_contents_(this) { |
Init(text, style::GetFont(text_context, text_style)); |
SetLineHeight(style::GetLineHeight(text_context, text_style)); |
+ |
+ // If an explicit style is given, ignore color changes due to the NativeTheme. |
+ if (text_style != style::STYLE_PRIMARY) { |
+ SetEnabledColor( |
+ style::GetColor(text_context, text_style, GetNativeTheme())); |
+ } |
} |
Label::Label(const base::string16& text, const CustomFont& font) |
- : context_menu_contents_(this) { |
+ : text_context_(style::CONTEXT_LABEL), context_menu_contents_(this) { |
Init(text, font.font_list); |
} |
@@ -103,7 +109,8 @@ void Label::SetEnabledColor(SkColor color) { |
RecalculateColors(); |
} |
-void Label::SetDisabledColor(SkColor color) { |
+// TODO(tapted): Move this into a subclass used only by LabelButton. |
+void Label::SetDisabledColorForLabelButton(SkColor color) { |
if (disabled_color_set_ && requested_disabled_color_ == color) |
return; |
is_first_paint_text_ = true; |
@@ -998,12 +1005,12 @@ void Label::ApplyTextColors() const { |
void Label::UpdateColorsFromTheme(const ui::NativeTheme* theme) { |
if (!enabled_color_set_) { |
- requested_enabled_color_ = theme->GetSystemColor( |
- ui::NativeTheme::kColorId_LabelEnabledColor); |
+ requested_enabled_color_ = |
+ style::GetColor(text_context_, style::STYLE_PRIMARY, theme); |
} |
if (!disabled_color_set_) { |
- requested_disabled_color_ = theme->GetSystemColor( |
- ui::NativeTheme::kColorId_LabelDisabledColor); |
+ requested_disabled_color_ = |
+ style::GetColor(text_context_, style::STYLE_DISABLED, theme); |
} |
if (!background_color_set_) { |
background_color_ = |