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

Unified 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: clarification comments added. 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc
diff --git a/content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc b/content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc
index a5ffc019ad91b39128190cafc9384d7c20fce670..45d52128ee86a6db2ecc9bedf03ba0428c3680e0 100644
--- a/content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc
+++ b/content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc
@@ -44,12 +44,24 @@ bool TouchscreenTapSuppressionController::FilterTapEvent(
stashed_show_press_.reset(new GestureEventWithLatencyInfo(event));
return true;
+ case WebInputEvent::GestureLongPress:
+ // It is possible that a GestureLongPress arrives after tapDownTimer
+ // expiration, in this case it should still get filtered if the
+ // controller suppresses the tap end events.
+ if (!stashed_tap_down_)
+ return controller_.ShouldSuppressTapEnd();
+
+ stashed_long_press_.reset(new GestureEventWithLatencyInfo(event));
+ return true;
+
case WebInputEvent::GestureTapUnconfirmed:
return !!stashed_tap_down_;
case WebInputEvent::GestureTapCancel:
case WebInputEvent::GestureTap:
case WebInputEvent::GestureDoubleTap:
+ case WebInputEvent::GestureLongTap:
+ case WebInputEvent::GestureTwoFingerTap:
return controller_.ShouldSuppressTapEnd();
default:
@@ -61,15 +73,27 @@ bool TouchscreenTapSuppressionController::FilterTapEvent(
void TouchscreenTapSuppressionController::DropStashedTapDown() {
stashed_tap_down_.reset();
stashed_show_press_.reset();
+ stashed_long_press_.reset();
}
-void TouchscreenTapSuppressionController::ForwardStashedTapDown() {
+void TouchscreenTapSuppressionController::ForwardStashedGestureEvents() {
DCHECK(stashed_tap_down_);
ScopedGestureEvent tap_down = std::move(stashed_tap_down_);
ScopedGestureEvent show_press = std::move(stashed_show_press_);
+ ScopedGestureEvent long_press = std::move(stashed_long_press_);
gesture_event_queue_->ForwardGestureEvent(*tap_down);
if (show_press)
gesture_event_queue_->ForwardGestureEvent(*show_press);
+ if (long_press)
+ gesture_event_queue_->ForwardGestureEvent(*long_press);
+}
+
+void TouchscreenTapSuppressionController::ForwardStashedTapDown() {
+ DCHECK(stashed_tap_down_);
+ ScopedGestureEvent tap_down = std::move(stashed_tap_down_);
+ gesture_event_queue_->ForwardGestureEvent(*tap_down);
+ stashed_show_press_.reset();
+ stashed_long_press_.reset();
}
} // namespace content
« 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