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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 void Textfield::AccessibilitySetValue(const base::string16& new_value) { | 1641 void Textfield::AccessibilitySetValue(const base::string16& new_value) { |
1642 if (!read_only()) { | 1642 if (!read_only()) { |
1643 SetText(new_value); | 1643 SetText(new_value); |
1644 ClearSelection(); | 1644 ClearSelection(); |
1645 } | 1645 } |
1646 } | 1646 } |
1647 | 1647 |
1648 void Textfield::UpdateBackgroundColor() { | 1648 void Textfield::UpdateBackgroundColor() { |
1649 const SkColor color = GetBackgroundColor(); | 1649 const SkColor color = GetBackgroundColor(); |
1650 set_background(Background::CreateSolidBackground(color)); | 1650 set_background(Background::CreateSolidBackground(color)); |
1651 GetRenderText()->set_background_is_transparent(SkColorGetA(color) != 0xFF); | 1651 // Disable subpixel rendering when the background color is transparent. |
| 1652 GetRenderText()->set_subpixel_rendering_enabled(SkColorGetA(color) == 0xFF); |
1652 SchedulePaint(); | 1653 SchedulePaint(); |
1653 } | 1654 } |
1654 | 1655 |
1655 void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) { | 1656 void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) { |
1656 if (text_changed) { | 1657 if (text_changed) { |
1657 if (controller_) | 1658 if (controller_) |
1658 controller_->ContentsChanged(this, text()); | 1659 controller_->ContentsChanged(this, text()); |
1659 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); | 1660 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); |
1660 } | 1661 } |
1661 if (cursor_changed) { | 1662 if (cursor_changed) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 RequestFocus(); | 1873 RequestFocus(); |
1873 model_->MoveCursorTo(mouse); | 1874 model_->MoveCursorTo(mouse); |
1874 if (!selection_clipboard_text.empty()) { | 1875 if (!selection_clipboard_text.empty()) { |
1875 model_->InsertText(selection_clipboard_text); | 1876 model_->InsertText(selection_clipboard_text); |
1876 UpdateAfterChange(true, true); | 1877 UpdateAfterChange(true, true); |
1877 } | 1878 } |
1878 OnAfterUserAction(); | 1879 OnAfterUserAction(); |
1879 } | 1880 } |
1880 | 1881 |
1881 } // namespace views | 1882 } // namespace views |
OLD | NEW |