OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 void Textfield::AccessibilitySetValue(const base::string16& new_value) { | 1634 void Textfield::AccessibilitySetValue(const base::string16& new_value) { |
1635 if (!read_only()) { | 1635 if (!read_only()) { |
1636 SetText(new_value); | 1636 SetText(new_value); |
1637 ClearSelection(); | 1637 ClearSelection(); |
1638 } | 1638 } |
1639 } | 1639 } |
1640 | 1640 |
1641 void Textfield::UpdateBackgroundColor() { | 1641 void Textfield::UpdateBackgroundColor() { |
1642 const SkColor color = GetBackgroundColor(); | 1642 const SkColor color = GetBackgroundColor(); |
1643 set_background(Background::CreateSolidBackground(color)); | 1643 set_background(Background::CreateSolidBackground(color)); |
1644 GetRenderText()->set_background_is_transparent(SkColorGetA(color) != 0xFF); | 1644 GetRenderText()->set_subpixel_rendering_enabled(SkColorGetA(color) == 0xFF); |
1645 SchedulePaint(); | 1645 SchedulePaint(); |
1646 } | 1646 } |
1647 | 1647 |
1648 void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) { | 1648 void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) { |
1649 if (text_changed) { | 1649 if (text_changed) { |
1650 if (controller_) | 1650 if (controller_) |
1651 controller_->ContentsChanged(this, text()); | 1651 controller_->ContentsChanged(this, text()); |
1652 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); | 1652 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); |
1653 } | 1653 } |
1654 if (cursor_changed) { | 1654 if (cursor_changed) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 RequestFocus(); | 1865 RequestFocus(); |
1866 model_->MoveCursorTo(mouse); | 1866 model_->MoveCursorTo(mouse); |
1867 if (!selection_clipboard_text.empty()) { | 1867 if (!selection_clipboard_text.empty()) { |
1868 model_->InsertText(selection_clipboard_text); | 1868 model_->InsertText(selection_clipboard_text); |
1869 UpdateAfterChange(true, true); | 1869 UpdateAfterChange(true, true); |
1870 } | 1870 } |
1871 OnAfterUserAction(); | 1871 OnAfterUserAction(); |
1872 } | 1872 } |
1873 | 1873 |
1874 } // namespace views | 1874 } // namespace views |
OLD | NEW |