Index: trunk/src/ui/views/controls/label.cc |
=================================================================== |
--- trunk/src/ui/views/controls/label.cc (revision 266071) |
+++ trunk/src/ui/views/controls/label.cc (working copy) |
@@ -378,25 +378,14 @@ |
} |
void Label::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
- if (!enabled_color_set_) { |
- requested_enabled_color_ = theme->GetSystemColor( |
- ui::NativeTheme::kColorId_LabelEnabledColor); |
- } |
- if (!disabled_color_set_) { |
- requested_disabled_color_ = theme->GetSystemColor( |
- ui::NativeTheme::kColorId_LabelDisabledColor); |
- } |
- if (!background_color_set_) { |
- background_color_ = theme->GetSystemColor( |
- ui::NativeTheme::kColorId_LabelBackgroundColor); |
- } |
- RecalculateColors(); |
+ UpdateColorsFromTheme(theme); |
} |
void Label::Init(const base::string16& text, const gfx::FontList& font_list) { |
font_list_ = font_list; |
enabled_color_set_ = disabled_color_set_ = background_color_set_ = false; |
auto_color_readability_ = true; |
+ UpdateColorsFromTheme(ui::NativeTheme::instance()); |
horizontal_alignment_ = gfx::ALIGN_CENTER; |
line_height_ = 0; |
is_multi_line_ = false; |
@@ -545,6 +534,22 @@ |
*flags |= gfx::Canvas::NO_ELLIPSIS; |
} |
+void Label::UpdateColorsFromTheme(const ui::NativeTheme* theme) { |
+ if (!enabled_color_set_) { |
+ requested_enabled_color_ = theme->GetSystemColor( |
+ ui::NativeTheme::kColorId_LabelEnabledColor); |
+ } |
+ if (!disabled_color_set_) { |
+ requested_disabled_color_ = theme->GetSystemColor( |
+ ui::NativeTheme::kColorId_LabelDisabledColor); |
+ } |
+ if (!background_color_set_) { |
+ background_color_ = theme->GetSystemColor( |
+ ui::NativeTheme::kColorId_LabelBackgroundColor); |
+ } |
+ RecalculateColors(); |
+} |
+ |
void Label::ResetCachedSize() { |
text_size_valid_ = false; |
cached_heights_cursor_ = 0; |