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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 if (controller_) | 1561 if (controller_) |
1562 controller_->ContentsChanged(this, text()); | 1562 controller_->ContentsChanged(this, text()); |
1563 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); | 1563 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); |
1564 } | 1564 } |
1565 if (cursor_changed) { | 1565 if (cursor_changed) { |
1566 cursor_visible_ = true; | 1566 cursor_visible_ = true; |
1567 RepaintCursor(); | 1567 RepaintCursor(); |
1568 if (cursor_repaint_timer_.IsRunning()) | 1568 if (cursor_repaint_timer_.IsRunning()) |
1569 cursor_repaint_timer_.Reset(); | 1569 cursor_repaint_timer_.Reset(); |
1570 if (!text_changed) { | 1570 if (!text_changed) { |
1571 // TEXT_CHANGED implies SELECTION_CHANGED, so we only need to fire | 1571 // TEXT_CHANGED implies TEXT_SELECTION_CHANGED, so we only need to fire |
1572 // this if only the selection changed. | 1572 // this if only the selection changed. |
1573 NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION_CHANGED, true); | 1573 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_SELECTION_CHANGED, true); |
1574 } | 1574 } |
1575 } | 1575 } |
1576 if (text_changed || cursor_changed) { | 1576 if (text_changed || cursor_changed) { |
1577 OnCaretBoundsChanged(); | 1577 OnCaretBoundsChanged(); |
1578 SchedulePaint(); | 1578 SchedulePaint(); |
1579 } | 1579 } |
1580 } | 1580 } |
1581 | 1581 |
1582 void Textfield::UpdateCursor() { | 1582 void Textfield::UpdateCursor() { |
1583 const size_t caret_blink_ms = Textfield::GetCaretBlinkMs(); | 1583 const size_t caret_blink_ms = Textfield::GetCaretBlinkMs(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 const size_t length = selection_clipboard_text.length(); | 1778 const size_t length = selection_clipboard_text.length(); |
1779 range = gfx::Range(range.start() + length, range.end() + length); | 1779 range = gfx::Range(range.start() + length, range.end() + length); |
1780 } | 1780 } |
1781 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1781 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
1782 UpdateAfterChange(true, true); | 1782 UpdateAfterChange(true, true); |
1783 OnAfterUserAction(); | 1783 OnAfterUserAction(); |
1784 } | 1784 } |
1785 } | 1785 } |
1786 | 1786 |
1787 } // namespace views | 1787 } // namespace views |
OLD | NEW |