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

Unified Diff: content/browser/renderer_host/input/touch_action_filter.cc

Issue 170603002: Make touch-action apply to double-tap zoom (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert filtered double tap gesture into tap cancel. Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/touch_action_filter.cc
diff --git a/content/browser/renderer_host/input/touch_action_filter.cc b/content/browser/renderer_host/input/touch_action_filter.cc
index 14e84229faf57abec6ef384a58fad69c162fef1e..eea8082cf90a8e9357d79ed71d983fd5d08256c1 100644
--- a/content/browser/renderer_host/input/touch_action_filter.cc
+++ b/content/browser/renderer_host/input/touch_action_filter.cc
@@ -17,6 +17,7 @@ namespace content {
TouchActionFilter::TouchActionFilter() :
drop_scroll_gesture_events_(false),
drop_pinch_gesture_events_(false),
+ drop_current_tap_ending_event_(false),
allowed_touch_action_(TOUCH_ACTION_AUTO) {
}
@@ -80,6 +81,33 @@ bool TouchActionFilter::FilterGestureEvent(WebGestureEvent* gesture_event) {
DCHECK(!drop_scroll_gesture_events_);
break;
+ // The double tap gesture is a tap ending event. If a double tap gesture is
+ // filtered out, replace it with a tap cancel.
+ case WebInputEvent::GestureDoubleTap:
+ if (allowed_touch_action_ != TOUCH_ACTION_AUTO)
+ gesture_event->type = WebInputEvent::GestureTapCancel;
+ break;
+
+ // If double tap is disabled, there's no reason for the tap delay.
+ case WebInputEvent::GestureTapUnconfirmed:
+ if (allowed_touch_action_ != TOUCH_ACTION_AUTO) {
+ gesture_event->type = WebInputEvent::GestureTap;
+ drop_current_tap_ending_event_ = true;
+ }
+ break;
+
+ case WebInputEvent::GestureTap:
+ case WebInputEvent::GestureTapCancel:
+ if (drop_current_tap_ending_event_) {
+ drop_current_tap_ending_event_ = false;
+ return true;
+ }
+ break;
+
+ case WebInputEvent::GestureTapDown:
+ DCHECK(!drop_current_tap_ending_event_);
+ break;
+
default:
// Gesture events unrelated to touch actions (panning/zooming) are left
// alone.

Powered by Google App Engine
This is Rietveld 408576698