| 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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1817 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1818 if (text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD) { | 1818 if (text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD) { |
| 1819 ui::ScopedClipboardWriter(ui::CLIPBOARD_TYPE_SELECTION) | 1819 ui::ScopedClipboardWriter(ui::CLIPBOARD_TYPE_SELECTION) |
| 1820 .WriteText(GetSelectedText()); | 1820 .WriteText(GetSelectedText()); |
| 1821 if (controller_) | 1821 if (controller_) |
| 1822 controller_->OnAfterCutOrCopy(ui::CLIPBOARD_TYPE_SELECTION); | 1822 controller_->OnAfterCutOrCopy(ui::CLIPBOARD_TYPE_SELECTION); |
| 1823 } | 1823 } |
| 1824 #endif | 1824 #endif |
| 1825 } | 1825 } |
| 1826 | 1826 |
| 1827 void Textfield::AccessibilitySetValue(const base::string16& new_value) { | 1827 void Textfield::AccessibilitySetValue(const base::string16& new_value, |
| 1828 if (!read_only()) { | 1828 bool clear_first) { |
| 1829 if (read_only()) |
| 1830 return; |
| 1831 if (!clear_first) |
| 1832 InsertOrReplaceText(new_value); |
| 1833 else |
| 1829 SetText(new_value); | 1834 SetText(new_value); |
| 1830 ClearSelection(); | 1835 ClearSelection(); |
| 1831 } | |
| 1832 } | 1836 } |
| 1833 | 1837 |
| 1834 void Textfield::UpdateBackgroundColor() { | 1838 void Textfield::UpdateBackgroundColor() { |
| 1835 const SkColor color = GetBackgroundColor(); | 1839 const SkColor color = GetBackgroundColor(); |
| 1836 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1840 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1837 set_background(Background::CreateBackgroundPainter( | 1841 set_background(Background::CreateBackgroundPainter( |
| 1838 true, Painter::CreateSolidRoundRectPainter( | 1842 true, Painter::CreateSolidRoundRectPainter( |
| 1839 color, FocusableBorder::kCornerRadiusDp))); | 1843 color, FocusableBorder::kCornerRadiusDp))); |
| 1840 } else { | 1844 } else { |
| 1841 set_background(Background::CreateSolidBackground(color)); | 1845 set_background(Background::CreateSolidBackground(color)); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 } | 2045 } |
| 2042 | 2046 |
| 2043 void Textfield::OnCursorBlinkTimerFired() { | 2047 void Textfield::OnCursorBlinkTimerFired() { |
| 2044 DCHECK(ShouldBlinkCursor()); | 2048 DCHECK(ShouldBlinkCursor()); |
| 2045 gfx::RenderText* render_text = GetRenderText(); | 2049 gfx::RenderText* render_text = GetRenderText(); |
| 2046 render_text->set_cursor_visible(!render_text->cursor_visible()); | 2050 render_text->set_cursor_visible(!render_text->cursor_visible()); |
| 2047 RepaintCursor(); | 2051 RepaintCursor(); |
| 2048 } | 2052 } |
| 2049 | 2053 |
| 2050 } // namespace views | 2054 } // namespace views |
| OLD | NEW |