Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc

Issue 2613533003: Tap suppression controller forwards the next TapCancel when the stashed TapDown is forwarded. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/input/touchscreen_tap_suppression_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
26 26
27 void TouchscreenTapSuppressionController::GestureFlingCancelAck( 27 void TouchscreenTapSuppressionController::GestureFlingCancelAck(
28 bool processed) { 28 bool processed) {
29 controller_.GestureFlingCancelAck(processed); 29 controller_.GestureFlingCancelAck(processed);
30 } 30 }
31 31
32 bool TouchscreenTapSuppressionController::FilterTapEvent( 32 bool TouchscreenTapSuppressionController::FilterTapEvent(
33 const GestureEventWithLatencyInfo& event) { 33 const GestureEventWithLatencyInfo& event) {
34 switch (event.event.type) { 34 switch (event.event.type) {
35 case WebInputEvent::GestureTapDown: 35 case WebInputEvent::GestureTapDown:
36 forward_next_tap_cancel_ = false;
36 if (!controller_.ShouldDeferTapDown()) 37 if (!controller_.ShouldDeferTapDown())
37 return false; 38 return false;
38 stashed_tap_down_.reset(new GestureEventWithLatencyInfo(event)); 39 stashed_tap_down_.reset(new GestureEventWithLatencyInfo(event));
39 return true; 40 return true;
40 41
41 case WebInputEvent::GestureShowPress: 42 case WebInputEvent::GestureShowPress:
42 if (!stashed_tap_down_) 43 if (!stashed_tap_down_)
43 return false; 44 return false;
44 stashed_show_press_.reset(new GestureEventWithLatencyInfo(event)); 45 stashed_show_press_.reset(new GestureEventWithLatencyInfo(event));
45 return true; 46 return true;
46 47
47 case WebInputEvent::GestureLongPress: 48 case WebInputEvent::GestureLongPress:
48 // It is possible that a GestureLongPress arrives after tapDownTimer 49 // It is possible that a GestureLongPress arrives after tapDownTimer
49 // expiration, in this case it should still get filtered if the 50 // expiration, in this case it should still get filtered if the
50 // controller suppresses the tap end events. 51 // controller suppresses the tap end events.
51 if (!stashed_tap_down_) 52 if (!stashed_tap_down_)
52 return controller_.ShouldSuppressTapEnd(); 53 return controller_.ShouldSuppressTapEnd();
53 54
54 stashed_long_press_.reset(new GestureEventWithLatencyInfo(event)); 55 stashed_long_press_.reset(new GestureEventWithLatencyInfo(event));
55 return true; 56 return true;
56 57
57 case WebInputEvent::GestureTapUnconfirmed: 58 case WebInputEvent::GestureTapUnconfirmed:
58 return !!stashed_tap_down_; 59 return !!stashed_tap_down_;
59 60
60 case WebInputEvent::GestureTapCancel: 61 case WebInputEvent::GestureTapCancel:
62 return !forward_next_tap_cancel_ && controller_.ShouldSuppressTapEnd();
63
61 case WebInputEvent::GestureTap: 64 case WebInputEvent::GestureTap:
62 case WebInputEvent::GestureDoubleTap: 65 case WebInputEvent::GestureDoubleTap:
63 case WebInputEvent::GestureLongTap: 66 case WebInputEvent::GestureLongTap:
64 case WebInputEvent::GestureTwoFingerTap: 67 case WebInputEvent::GestureTwoFingerTap:
65 return controller_.ShouldSuppressTapEnd(); 68 return controller_.ShouldSuppressTapEnd();
66 69
67 default: 70 default:
68 break; 71 break;
69 } 72 }
70 return false; 73 return false;
(...skipping 16 matching lines...) Expand all
87 if (long_press) 90 if (long_press)
88 gesture_event_queue_->ForwardGestureEvent(*long_press); 91 gesture_event_queue_->ForwardGestureEvent(*long_press);
89 } 92 }
90 93
91 void TouchscreenTapSuppressionController::ForwardStashedTapDown() { 94 void TouchscreenTapSuppressionController::ForwardStashedTapDown() {
92 DCHECK(stashed_tap_down_); 95 DCHECK(stashed_tap_down_);
93 ScopedGestureEvent tap_down = std::move(stashed_tap_down_); 96 ScopedGestureEvent tap_down = std::move(stashed_tap_down_);
94 gesture_event_queue_->ForwardGestureEvent(*tap_down); 97 gesture_event_queue_->ForwardGestureEvent(*tap_down);
95 stashed_show_press_.reset(); 98 stashed_show_press_.reset();
96 stashed_long_press_.reset(); 99 stashed_long_press_.reset();
100 forward_next_tap_cancel_ = true;
97 } 101 }
98 102
99 } // namespace content 103 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/touchscreen_tap_suppression_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698