| Index: ui/views/controls/textfield/textfield.cc
|
| diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
|
| index c46ddd24b6d8b7bc5236e7e5fd83758772cb13ed..00492d2dd354709f6b5fb9e9e5b12e429279c59c 100644
|
| --- a/ui/views/controls/textfield/textfield.cc
|
| +++ b/ui/views/controls/textfield/textfield.cc
|
| @@ -849,12 +849,6 @@ void Textfield::OnEnabledChanged() {
|
| 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);
|
| @@ -901,7 +895,15 @@ gfx::Point Textfield::GetKeyboardContextMenuLocation() {
|
| }
|
|
|
| void Textfield::OnNativeThemeChanged(const ui::NativeTheme* theme) {
|
| - UpdateColorsFromTheme(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));
|
| +
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -1467,17 +1469,6 @@ void Textfield::UpdateBackgroundColor() {
|
| 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_)
|
|
|