OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/touchscreen_tap_suppression_contro
ller.h" | 5 #include "content/browser/renderer_host/input/touchscreen_tap_suppression_contro
ller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/browser/renderer_host/input/gesture_event_queue.h" | 9 #include "content/browser/renderer_host/input/gesture_event_queue.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 stashed_tap_down_.reset(new GestureEventWithLatencyInfo(event)); | 38 stashed_tap_down_.reset(new GestureEventWithLatencyInfo(event)); |
39 return true; | 39 return true; |
40 | 40 |
41 case WebInputEvent::GestureShowPress: | 41 case WebInputEvent::GestureShowPress: |
42 if (!stashed_tap_down_) | 42 if (!stashed_tap_down_) |
43 return false; | 43 return false; |
44 stashed_show_press_.reset(new GestureEventWithLatencyInfo(event)); | 44 stashed_show_press_.reset(new GestureEventWithLatencyInfo(event)); |
45 return true; | 45 return true; |
46 | 46 |
47 case WebInputEvent::GestureTapUnconfirmed: | 47 case WebInputEvent::GestureTapUnconfirmed: |
48 return stashed_tap_down_; | 48 return !!stashed_tap_down_; |
49 | 49 |
50 case WebInputEvent::GestureTapCancel: | 50 case WebInputEvent::GestureTapCancel: |
51 case WebInputEvent::GestureTap: | 51 case WebInputEvent::GestureTap: |
52 case WebInputEvent::GestureDoubleTap: | 52 case WebInputEvent::GestureDoubleTap: |
53 return controller_.ShouldSuppressTapEnd(); | 53 return controller_.ShouldSuppressTapEnd(); |
54 | 54 |
55 default: | 55 default: |
56 break; | 56 break; |
57 } | 57 } |
58 return false; | 58 return false; |
59 } | 59 } |
60 | 60 |
61 void TouchscreenTapSuppressionController::DropStashedTapDown() { | 61 void TouchscreenTapSuppressionController::DropStashedTapDown() { |
62 stashed_tap_down_.reset(); | 62 stashed_tap_down_.reset(); |
63 stashed_show_press_.reset(); | 63 stashed_show_press_.reset(); |
64 } | 64 } |
65 | 65 |
66 void TouchscreenTapSuppressionController::ForwardStashedTapDown() { | 66 void TouchscreenTapSuppressionController::ForwardStashedTapDown() { |
67 DCHECK(stashed_tap_down_); | 67 DCHECK(stashed_tap_down_); |
68 ScopedGestureEvent tap_down = std::move(stashed_tap_down_); | 68 ScopedGestureEvent tap_down = std::move(stashed_tap_down_); |
69 ScopedGestureEvent show_press = std::move(stashed_show_press_); | 69 ScopedGestureEvent show_press = std::move(stashed_show_press_); |
70 gesture_event_queue_->ForwardGestureEvent(*tap_down); | 70 gesture_event_queue_->ForwardGestureEvent(*tap_down); |
71 if (show_press) | 71 if (show_press) |
72 gesture_event_queue_->ForwardGestureEvent(*show_press); | 72 gesture_event_queue_->ForwardGestureEvent(*show_press); |
73 } | 73 } |
74 | 74 |
75 } // namespace content | 75 } // namespace content |
OLD | NEW |