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 1f1855df7ea59de6478281efe61abd61c423e350..17f7ef3019e01e9c845052522278b782523b8ac1 100644 |
--- a/content/browser/renderer_host/input/touch_action_filter.cc |
+++ b/content/browser/renderer_host/input/touch_action_filter.cc |
@@ -35,10 +35,12 @@ bool TouchActionFilter::FilterGestureEvent(WebGestureEvent* gesture_event) { |
if (drop_scroll_gesture_events_) |
return true; |
else { |
- if (allowed_touch_action_ == TOUCH_ACTION_PAN_X) { |
+ if (allowed_touch_action_ & TOUCH_ACTION_PAN_X && |
Rick Byers
2015/05/07 20:37:37
This is now sufficiently non-trivial that I think
dtapuska
2015/05/07 21:03:07
Done.
|
+ !(allowed_touch_action_ & ~TOUCH_ACTION_PAN_X)) { |
gesture_event->data.scrollUpdate.deltaY = 0; |
gesture_event->data.scrollUpdate.velocityY = 0; |
- } else if (allowed_touch_action_ == TOUCH_ACTION_PAN_Y) { |
+ } else if (allowed_touch_action_ & TOUCH_ACTION_PAN_Y && |
+ !(allowed_touch_action_ & ~TOUCH_ACTION_PAN_Y)) { |
gesture_event->data.scrollUpdate.deltaX = 0; |
gesture_event->data.scrollUpdate.velocityX = 0; |
} |
@@ -52,10 +54,13 @@ bool TouchActionFilter::FilterGestureEvent(WebGestureEvent* gesture_event) { |
DCHECK(gesture_event->data.flingStart.velocityX || |
gesture_event->data.flingStart.velocityY); |
if (!drop_scroll_gesture_events_) { |
- if (allowed_touch_action_ == TOUCH_ACTION_PAN_X) |
+ if (allowed_touch_action_ & TOUCH_ACTION_PAN_X && |
+ !(allowed_touch_action_ & ~TOUCH_ACTION_PAN_X)) { |
gesture_event->data.flingStart.velocityY = 0; |
- if (allowed_touch_action_ == TOUCH_ACTION_PAN_Y) |
+ } else if (allowed_touch_action_ & TOUCH_ACTION_PAN_Y && |
+ !(allowed_touch_action_ & ~TOUCH_ACTION_PAN_Y)) { |
gesture_event->data.flingStart.velocityX = 0; |
+ } |
// As the renderer expects a scroll-ending event, but does not expect a |
// zero-velocity fling, convert the now zero-velocity fling accordingly. |
if (!gesture_event->data.flingStart.velocityX && |
@@ -184,9 +189,31 @@ bool TouchActionFilter::ShouldSuppressScroll( |
// Determine the primary initial axis of the scroll, and check whether |
// panning along that axis is permitted. |
if (fabs(gesture_event.data.scrollBegin.deltaXHint) > |
- fabs(gesture_event.data.scrollBegin.deltaYHint)) |
- return !(allowed_touch_action_ & TOUCH_ACTION_PAN_X); |
- return !(allowed_touch_action_ & TOUCH_ACTION_PAN_Y); |
+ fabs(gesture_event.data.scrollBegin.deltaYHint)) { |
+ if ((allowed_touch_action_ & TOUCH_ACTION_PAN_X) == TOUCH_ACTION_PAN_X) { |
Rick Byers
2015/05/07 20:37:37
nit: You could remove this case (it's covered by t
dtapuska
2015/05/07 21:03:07
Done.
|
+ return false; |
+ } else if (gesture_event.data.scrollBegin.deltaXHint > 0 && |
dtapuska
2015/05/07 19:06:30
Please check this logic..
I originally wrote it a
Rick Byers
2015/05/07 20:37:37
Yes, this is correct but I've got a bug in the spe
dtapuska
2015/05/07 21:03:07
Acknowledged.
|
+ allowed_touch_action_ & TOUCH_ACTION_PAN_LEFT) { |
+ return false; |
+ } else if (gesture_event.data.scrollBegin.deltaXHint < 0 && |
+ allowed_touch_action_ & TOUCH_ACTION_PAN_RIGHT) { |
+ return false; |
+ } else { |
+ return true; |
+ } |
+ } else { |
+ if ((allowed_touch_action_ & TOUCH_ACTION_PAN_Y) == TOUCH_ACTION_PAN_Y) { |
+ return false; |
Rick Byers
2015/05/07 20:37:37
ditto
dtapuska
2015/05/07 21:03:07
Done.
|
+ } else if (gesture_event.data.scrollBegin.deltaYHint > 0 && |
+ allowed_touch_action_ & TOUCH_ACTION_PAN_UP) { |
+ return false; |
+ } else if (gesture_event.data.scrollBegin.deltaYHint < 0 && |
+ allowed_touch_action_ & TOUCH_ACTION_PAN_DOWN) { |
+ return false; |
+ } else { |
+ return true; |
+ } |
+ } |
} |
TouchAction TouchActionFilter::Intersect(TouchAction ta1, TouchAction ta2) { |