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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 693 |
694 const int command = GetCommandForKeyEvent(event, HasSelection()); | 694 const int command = GetCommandForKeyEvent(event, HasSelection()); |
695 if (!handled && IsCommandIdEnabled(command)) { | 695 if (!handled && IsCommandIdEnabled(command)) { |
696 ExecuteCommand(command); | 696 ExecuteCommand(command); |
697 handled = true; | 697 handled = true; |
698 } | 698 } |
699 return handled; | 699 return handled; |
700 } | 700 } |
701 | 701 |
702 ui::TextInputClient* Textfield::GetTextInputClient() { | 702 ui::TextInputClient* Textfield::GetTextInputClient() { |
703 return read_only_ ? NULL : this; | 703 return this; |
704 } | 704 } |
705 | 705 |
706 void Textfield::OnGestureEvent(ui::GestureEvent* event) { | 706 void Textfield::OnGestureEvent(ui::GestureEvent* event) { |
707 switch (event->type()) { | 707 switch (event->type()) { |
708 case ui::ET_GESTURE_TAP_DOWN: | 708 case ui::ET_GESTURE_TAP_DOWN: |
709 RequestFocus(); | 709 RequestFocus(); |
710 ShowImeIfNeeded(); | 710 ShowImeIfNeeded(); |
711 event->SetHandled(); | 711 event->SetHandled(); |
712 break; | 712 break; |
713 case ui::ET_GESTURE_TAP: | 713 case ui::ET_GESTURE_TAP: |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 const size_t length = selection_clipboard_text.length(); | 1873 const size_t length = selection_clipboard_text.length(); |
1874 range = gfx::Range(range.start() + length, range.end() + length); | 1874 range = gfx::Range(range.start() + length, range.end() + length); |
1875 } | 1875 } |
1876 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1876 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
1877 UpdateAfterChange(true, true); | 1877 UpdateAfterChange(true, true); |
1878 OnAfterUserAction(); | 1878 OnAfterUserAction(); |
1879 } | 1879 } |
1880 } | 1880 } |
1881 | 1881 |
1882 } // namespace views | 1882 } // namespace views |
OLD | NEW |