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

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

Issue 2126323002: Add support for touch-action: pinch-zoom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check in scroll begin for pointer count and add test Created 4 years, 3 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 e8f23354bd6a27e205fc3d3cad77030a70268ff8..25eef984c91b792bb122d6a74f06971df5fee8bf 100644
--- a/content/browser/renderer_host/input/touch_action_filter.cc
+++ b/content/browser/renderer_host/input/touch_action_filter.cc
@@ -44,7 +44,18 @@ bool TouchActionFilter::FilterGestureEvent(WebGestureEvent* gesture_event) {
switch (gesture_event->type) {
case WebInputEvent::GestureScrollBegin:
DCHECK(!drop_scroll_gesture_events_);
+ DCHECK(!drop_pinch_gesture_events_);
drop_scroll_gesture_events_ = ShouldSuppressScroll(*gesture_event);
+ drop_pinch_gesture_events_ =
+ (allowed_touch_action_ & TOUCH_ACTION_PINCH_ZOOM) == 0;
+
+ // if there are two or more pointers then ensure that we allow panning
Rick Byers 2016/09/14 15:47:51 nit: wouldn't this make more sense in ShouldSuppre
dtapuska 2016/09/21 19:29:37 Done.
+ // if pinch-zoom is allowed.
Rick Byers 2016/09/14 15:47:51 You were going to file a bug to track the subtle b
dtapuska 2016/09/21 19:29:37 Done.
+ if (!drop_pinch_gesture_events_ && drop_scroll_gesture_events_ &&
+ gesture_event->data.scrollBegin.pointerCount >= 2) {
+ drop_scroll_gesture_events_ = false;
+ }
+
return drop_scroll_gesture_events_;
case WebInputEvent::GestureScrollUpdate:
@@ -87,17 +98,6 @@ bool TouchActionFilter::FilterGestureEvent(WebGestureEvent* gesture_event) {
return FilterScrollEndingGesture();
case WebInputEvent::GesturePinchBegin:
- DCHECK(!drop_pinch_gesture_events_);
- if (allowed_touch_action_ & TOUCH_ACTION_PINCH_ZOOM) {
- // Pinch events are always bracketed by scroll events, and the W3C
- // standard touch-action provides no way to disable scrolling without
- // also disabling pinching (validated by the IPC ENUM traits).
- DCHECK(allowed_touch_action_ == TOUCH_ACTION_AUTO ||
- allowed_touch_action_ == TOUCH_ACTION_MANIPULATION);
- DCHECK(!drop_scroll_gesture_events_);
- } else {
- drop_pinch_gesture_events_ = true;
- }
return drop_pinch_gesture_events_;
case WebInputEvent::GesturePinchUpdate:
@@ -108,7 +108,6 @@ bool TouchActionFilter::FilterGestureEvent(WebGestureEvent* gesture_event) {
drop_pinch_gesture_events_ = false;
return true;
}
- DCHECK(!drop_scroll_gesture_events_);
break;
// The double tap gesture is a tap ending event. If a double tap gesture is
@@ -188,6 +187,7 @@ void TouchActionFilter::ResetTouchAction() {
bool TouchActionFilter::ShouldSuppressScroll(
const blink::WebGestureEvent& gesture_event) {
DCHECK_EQ(gesture_event.type, WebInputEvent::GestureScrollBegin);
+ LOG(ERROR) << "Got scroll begin";
Rick Byers 2016/09/14 15:47:50 remove
dtapuska 2016/09/21 19:29:37 Done.
if ((allowed_touch_action_ & TOUCH_ACTION_PAN) == TOUCH_ACTION_PAN)
// All possible panning is enabled.
return false;
« no previous file with comments | « no previous file | content/common/input_messages.h » ('j') | third_party/WebKit/LayoutTests/fast/css/touch-action-parsing.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698