OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/renderer_host/input/gesture_text_selector.h" | 5 #include "content/browser/renderer_host/input/gesture_text_selector.h" |
6 | 6 |
7 #include "ui/events/event_constants.h" | 7 #include "ui/events/event_constants.h" |
8 #include "ui/events/gesture_detection/gesture_event_data.h" | 8 #include "ui/events/gesture_detection/gesture_event_data.h" |
9 #include "ui/events/gesture_detection/motion_event.h" | 9 #include "ui/events/gesture_detection/motion_event.h" |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 client_->Unselect(); | 42 client_->Unselect(); |
43 // TODO(changwan): check if we can show handles on ET_GESTURE_SCROLL_END | 43 // TODO(changwan): check if we can show handles on ET_GESTURE_SCROLL_END |
44 // instead. Currently it is not possible as ShowSelectionHandles should | 44 // instead. Currently it is not possible as ShowSelectionHandles should |
45 // be called before we change the selection. | 45 // be called before we change the selection. |
46 client_->ShowSelectionHandlesAutomatically(); | 46 client_->ShowSelectionHandlesAutomatically(); |
47 anchor_x_ = gesture.x; | 47 anchor_x_ = gesture.x; |
48 anchor_y_ = gesture.y; | 48 anchor_y_ = gesture.y; |
49 break; | 49 break; |
50 } | 50 } |
51 case ui::ET_GESTURE_SCROLL_UPDATE: { | 51 case ui::ET_GESTURE_SCROLL_UPDATE: { |
52 client_->ShowSelectionHandlesAutomatically(); | |
jdduke (slow)
2014/07/25 14:07:27
Any idea why the call to |client_->ShowSelectionHa
jdduke (slow)
2014/07/25 14:25:03
I wonder if the |Unselect()| call is triggering a
Changwan Ryu
2014/07/25 22:12:47
Removed ShowSelectionHandlesAutomatically() from E
| |
52 client_->SelectRange(anchor_x_, anchor_y_, gesture.x, gesture.y); | 53 client_->SelectRange(anchor_x_, anchor_y_, gesture.x, gesture.y); |
53 break; | 54 break; |
54 } | 55 } |
55 default: | 56 default: |
56 // Suppress all other gestures when we are selecting text. | 57 // Suppress all other gestures when we are selecting text. |
57 break; | 58 break; |
58 } | 59 } |
59 return true; | 60 return true; |
60 } | 61 } |
61 | 62 |
62 // static | 63 // static |
63 bool GestureTextSelector::ShouldStartTextSelection( | 64 bool GestureTextSelector::ShouldStartTextSelection( |
64 const ui::MotionEvent& event) { | 65 const ui::MotionEvent& event) { |
65 DCHECK_GT(event.GetPointerCount(), 0u); | 66 DCHECK_GT(event.GetPointerCount(), 0u); |
66 // Currently we are supporting stylus-only cases. | 67 // Currently we are supporting stylus-only cases. |
67 const bool is_stylus = | 68 const bool is_stylus = |
68 event.GetToolType(0) == ui::MotionEvent::TOOL_TYPE_STYLUS; | 69 event.GetToolType(0) == ui::MotionEvent::TOOL_TYPE_STYLUS; |
69 const bool is_only_secondary_button_pressed = | 70 const bool is_only_secondary_button_pressed = |
70 event.GetButtonState() == ui::MotionEvent::BUTTON_SECONDARY; | 71 event.GetButtonState() == ui::MotionEvent::BUTTON_SECONDARY; |
71 return is_stylus && is_only_secondary_button_pressed; | 72 return is_stylus && is_only_secondary_button_pressed; |
72 } | 73 } |
73 | 74 |
74 } // namespace content | 75 } // namespace content |
OLD | NEW |