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

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

Issue 2542453003: Suppress LongPress/Tap, and TwoFingerTap when TapDown cancels a fling. (Closed)
Patch Set: Created 4 years 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
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 26 matching lines...) Expand all
37 return false; 37 return false;
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::GestureLongPress:
48 if (!stashed_tap_down_)
49 return false;
50 stashed_long_press_.reset(new GestureEventWithLatencyInfo(event));
51 return true;
52
47 case WebInputEvent::GestureTapUnconfirmed: 53 case WebInputEvent::GestureTapUnconfirmed:
48 return !!stashed_tap_down_; 54 return !!stashed_tap_down_;
49 55
50 case WebInputEvent::GestureTapCancel: 56 case WebInputEvent::GestureTapCancel:
51 case WebInputEvent::GestureTap: 57 case WebInputEvent::GestureTap:
52 case WebInputEvent::GestureDoubleTap: 58 case WebInputEvent::GestureDoubleTap:
59 case WebInputEvent::GestureLongTap:
60 case WebInputEvent::GestureTwoFingerTap:
53 return controller_.ShouldSuppressTapEnd(); 61 return controller_.ShouldSuppressTapEnd();
54 62
55 default: 63 default:
56 break; 64 break;
57 } 65 }
58 return false; 66 return false;
59 } 67 }
60 68
61 void TouchscreenTapSuppressionController::DropStashedTapDown() { 69 void TouchscreenTapSuppressionController::DropStashedTapDown() {
62 stashed_tap_down_.reset(); 70 stashed_tap_down_.reset();
63 stashed_show_press_.reset(); 71 stashed_show_press_.reset();
72 stashed_long_press_.reset();
73 }
74
75 void TouchscreenTapSuppressionController::ForwardStashedGestureEvents() {
76 DCHECK(stashed_tap_down_);
77 ScopedGestureEvent tap_down = std::move(stashed_tap_down_);
78 ScopedGestureEvent show_press = std::move(stashed_show_press_);
79 ScopedGestureEvent long_press = std::move(stashed_long_press_);
80 gesture_event_queue_->ForwardGestureEvent(*tap_down);
81 if (show_press)
82 gesture_event_queue_->ForwardGestureEvent(*show_press);
83 if (long_press)
84 gesture_event_queue_->ForwardGestureEvent(*long_press);
64 } 85 }
65 86
66 void TouchscreenTapSuppressionController::ForwardStashedTapDown() { 87 void TouchscreenTapSuppressionController::ForwardStashedTapDown() {
67 DCHECK(stashed_tap_down_); 88 DCHECK(stashed_tap_down_);
68 ScopedGestureEvent tap_down = std::move(stashed_tap_down_); 89 ScopedGestureEvent tap_down = std::move(stashed_tap_down_);
69 ScopedGestureEvent show_press = std::move(stashed_show_press_);
70 gesture_event_queue_->ForwardGestureEvent(*tap_down); 90 gesture_event_queue_->ForwardGestureEvent(*tap_down);
71 if (show_press) 91 stashed_show_press_.reset();
72 gesture_event_queue_->ForwardGestureEvent(*show_press); 92 stashed_long_press_.reset();
73 } 93 }
74 94
75 } // namespace content 95 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698