| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 cursor_changed |= GetSelectionModel() != selection_model; | 1801 cursor_changed |= GetSelectionModel() != selection_model; |
| 1802 if (cursor_changed) | 1802 if (cursor_changed) |
| 1803 UpdateSelectionClipboard(); | 1803 UpdateSelectionClipboard(); |
| 1804 UpdateAfterChange(text_changed, cursor_changed); | 1804 UpdateAfterChange(text_changed, cursor_changed); |
| 1805 OnAfterUserAction(); | 1805 OnAfterUserAction(); |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 //////////////////////////////////////////////////////////////////////////////// | 1808 //////////////////////////////////////////////////////////////////////////////// |
| 1809 // Textfield, private: | 1809 // Textfield, private: |
| 1810 | 1810 |
| 1811 void Textfield::AccessibilitySetValue(const base::string16& new_value) { | 1811 void Textfield::AccessibilitySetValue(const base::string16& new_value, |
| 1812 if (!read_only()) { | 1812 bool replace) { |
| 1813 if (read_only()) |
| 1814 return; |
| 1815 if (replace) |
| 1816 InsertOrReplaceText(new_value); |
| 1817 else |
| 1813 SetText(new_value); | 1818 SetText(new_value); |
| 1814 ClearSelection(); | 1819 ClearSelection(); |
| 1815 } | |
| 1816 } | 1820 } |
| 1817 | 1821 |
| 1818 void Textfield::UpdateBackgroundColor() { | 1822 void Textfield::UpdateBackgroundColor() { |
| 1819 const SkColor color = GetBackgroundColor(); | 1823 const SkColor color = GetBackgroundColor(); |
| 1820 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1824 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1821 set_background(Background::CreateBackgroundPainter( | 1825 set_background(Background::CreateBackgroundPainter( |
| 1822 true, Painter::CreateSolidRoundRectPainter( | 1826 true, Painter::CreateSolidRoundRectPainter( |
| 1823 color, FocusableBorder::kCornerRadiusDp))); | 1827 color, FocusableBorder::kCornerRadiusDp))); |
| 1824 } else { | 1828 } else { |
| 1825 set_background(Background::CreateSolidBackground(color)); | 1829 set_background(Background::CreateSolidBackground(color)); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 } | 2109 } |
| 2106 | 2110 |
| 2107 void Textfield::OnCursorBlinkTimerFired() { | 2111 void Textfield::OnCursorBlinkTimerFired() { |
| 2108 DCHECK(ShouldBlinkCursor()); | 2112 DCHECK(ShouldBlinkCursor()); |
| 2109 gfx::RenderText* render_text = GetRenderText(); | 2113 gfx::RenderText* render_text = GetRenderText(); |
| 2110 render_text->set_cursor_visible(!render_text->cursor_visible()); | 2114 render_text->set_cursor_visible(!render_text->cursor_visible()); |
| 2111 RepaintCursor(); | 2115 RepaintCursor(); |
| 2112 } | 2116 } |
| 2113 | 2117 |
| 2114 } // namespace views | 2118 } // namespace views |
| OLD | NEW |