| 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 // because it draws incorrect colors around the glyphs in that case. |
| 1653 // See crbug.com/115198 |
| 1654 GetRenderText()->set_subpixel_rendering_suppressed( |
| 1655 SkColorGetA(color) != 0xFF); |
| 1652 SchedulePaint(); | 1656 SchedulePaint(); |
| 1653 } | 1657 } |
| 1654 | 1658 |
| 1655 void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) { | 1659 void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) { |
| 1656 if (text_changed) { | 1660 if (text_changed) { |
| 1657 if (controller_) | 1661 if (controller_) |
| 1658 controller_->ContentsChanged(this, text()); | 1662 controller_->ContentsChanged(this, text()); |
| 1659 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); | 1663 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); |
| 1660 } | 1664 } |
| 1661 if (cursor_changed) { | 1665 if (cursor_changed) { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1872 RequestFocus(); | 1876 RequestFocus(); |
| 1873 model_->MoveCursorTo(mouse); | 1877 model_->MoveCursorTo(mouse); |
| 1874 if (!selection_clipboard_text.empty()) { | 1878 if (!selection_clipboard_text.empty()) { |
| 1875 model_->InsertText(selection_clipboard_text); | 1879 model_->InsertText(selection_clipboard_text); |
| 1876 UpdateAfterChange(true, true); | 1880 UpdateAfterChange(true, true); |
| 1877 } | 1881 } |
| 1878 OnAfterUserAction(); | 1882 OnAfterUserAction(); |
| 1879 } | 1883 } |
| 1880 | 1884 |
| 1881 } // namespace views | 1885 } // namespace views |
| OLD | NEW |