| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 } | 682 } |
| 683 | 683 |
| 684 void Textfield::OnGestureEvent(ui::GestureEvent* event) { | 684 void Textfield::OnGestureEvent(ui::GestureEvent* event) { |
| 685 switch (event->type()) { | 685 switch (event->type()) { |
| 686 case ui::ET_GESTURE_TAP_DOWN: | 686 case ui::ET_GESTURE_TAP_DOWN: |
| 687 RequestFocus(); | 687 RequestFocus(); |
| 688 ShowImeIfNeeded(); | 688 ShowImeIfNeeded(); |
| 689 event->SetHandled(); | 689 event->SetHandled(); |
| 690 break; | 690 break; |
| 691 case ui::ET_GESTURE_TAP: | 691 case ui::ET_GESTURE_TAP: |
| 692 if (controller_ && controller_->HandleGestureEvent(this, *event)) { |
| 693 event->SetHandled(); |
| 694 return; |
| 695 } |
| 692 if (event->details().tap_count() == 1) { | 696 if (event->details().tap_count() == 1) { |
| 693 // If tap is on the selection and touch handles are not present, handles | 697 // If tap is on the selection and touch handles are not present, handles |
| 694 // should be shown without changing selection. Otherwise, cursor should | 698 // should be shown without changing selection. Otherwise, cursor should |
| 695 // be moved to the tap location. | 699 // be moved to the tap location. |
| 696 if (touch_selection_controller_ || | 700 if (touch_selection_controller_ || |
| 697 !GetRenderText()->IsPointInSelection(event->location())) { | 701 !GetRenderText()->IsPointInSelection(event->location())) { |
| 698 OnBeforeUserAction(); | 702 OnBeforeUserAction(); |
| 699 MoveCursorTo(event->location(), false); | 703 MoveCursorTo(event->location(), false); |
| 700 OnAfterUserAction(); | 704 OnAfterUserAction(); |
| 701 } | 705 } |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2114 cursor_blink_timer_.Stop(); | 2118 cursor_blink_timer_.Stop(); |
| 2115 } | 2119 } |
| 2116 | 2120 |
| 2117 void Textfield::OnCursorBlinkTimerFired() { | 2121 void Textfield::OnCursorBlinkTimerFired() { |
| 2118 DCHECK(ShouldBlinkCursor()); | 2122 DCHECK(ShouldBlinkCursor()); |
| 2119 UpdateCursorViewPosition(); | 2123 UpdateCursorViewPosition(); |
| 2120 cursor_view_.SetVisible(!cursor_view_.visible()); | 2124 cursor_view_.SetVisible(!cursor_view_.visible()); |
| 2121 } | 2125 } |
| 2122 | 2126 |
| 2123 } // namespace views | 2127 } // namespace views |
| OLD | NEW |