| Index: trunk/src/ui/views/controls/textfield/textfield.cc
|
| ===================================================================
|
| --- trunk/src/ui/views/controls/textfield/textfield.cc (revision 266071)
|
| +++ trunk/src/ui/views/controls/textfield/textfield.cc (working copy)
|
| @@ -846,6 +846,12 @@
|
| SchedulePaint();
|
| }
|
|
|
| +void Textfield::ViewHierarchyChanged(
|
| + const ViewHierarchyChangedDetails& details) {
|
| + if (details.is_add && details.child == this)
|
| + UpdateColorsFromTheme(GetNativeTheme());
|
| +}
|
| +
|
| void Textfield::OnPaint(gfx::Canvas* canvas) {
|
| OnPaintBackground(canvas);
|
| PaintTextAndCursor(canvas);
|
| @@ -890,15 +896,7 @@
|
| }
|
|
|
| void Textfield::OnNativeThemeChanged(const ui::NativeTheme* theme) {
|
| - gfx::RenderText* render_text = GetRenderText();
|
| - render_text->SetColor(GetTextColor());
|
| - UpdateBackgroundColor();
|
| - render_text->set_cursor_color(GetTextColor());
|
| - render_text->set_selection_color(theme->GetSystemColor(
|
| - ui::NativeTheme::kColorId_TextfieldSelectionColor));
|
| - render_text->set_selection_background_focused_color(theme->GetSystemColor(
|
| - ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused));
|
| -
|
| + UpdateColorsFromTheme(theme);
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -1464,6 +1462,17 @@
|
| SchedulePaint();
|
| }
|
|
|
| +void Textfield::UpdateColorsFromTheme(const ui::NativeTheme* theme) {
|
| + gfx::RenderText* render_text = GetRenderText();
|
| + render_text->SetColor(GetTextColor());
|
| + UpdateBackgroundColor();
|
| + render_text->set_cursor_color(GetTextColor());
|
| + render_text->set_selection_color(theme->GetSystemColor(
|
| + ui::NativeTheme::kColorId_TextfieldSelectionColor));
|
| + render_text->set_selection_background_focused_color(theme->GetSystemColor(
|
| + ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused));
|
| +}
|
| +
|
| void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) {
|
| if (text_changed) {
|
| if (controller_)
|
|
|