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

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: Add exception for mac 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_action_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..19c1ce700670e86a4e34d2a664fea14079090121 100644
--- a/content/browser/renderer_host/input/touch_action_filter.cc
+++ b/content/browser/renderer_host/input/touch_action_filter.cc
@@ -44,6 +44,9 @@ bool TouchActionFilter::FilterGestureEvent(WebGestureEvent* gesture_event) {
switch (gesture_event->type) {
case WebInputEvent::GestureScrollBegin:
DCHECK(!drop_scroll_gesture_events_);
+ DCHECK(!drop_pinch_gesture_events_);
+ drop_pinch_gesture_events_ =
+ (allowed_touch_action_ & TOUCH_ACTION_PINCH_ZOOM) == 0;
drop_scroll_gesture_events_ = ShouldSuppressScroll(*gesture_event);
return drop_scroll_gesture_events_;
@@ -87,17 +90,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 +100,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
@@ -156,7 +147,7 @@ bool TouchActionFilter::FilterGestureEvent(WebGestureEvent* gesture_event) {
}
bool TouchActionFilter::FilterScrollEndingGesture() {
- DCHECK(!drop_pinch_gesture_events_);
+ drop_pinch_gesture_events_ = false;
if (drop_scroll_gesture_events_) {
drop_scroll_gesture_events_ = false;
return true;
@@ -188,9 +179,18 @@ void TouchActionFilter::ResetTouchAction() {
bool TouchActionFilter::ShouldSuppressScroll(
const blink::WebGestureEvent& gesture_event) {
DCHECK_EQ(gesture_event.type, WebInputEvent::GestureScrollBegin);
+ // if there are two or more pointers then ensure that we allow panning
+ // if pinch-zoom is allowed. Determine if this should really occur in the
+ // GestureScrollBegin or not; see crbug.com/649034.
+ if (!drop_pinch_gesture_events_ &&
+ gesture_event.data.scrollBegin.pointerCount >= 2) {
+ return false;
+ }
+
if ((allowed_touch_action_ & TOUCH_ACTION_PAN) == TOUCH_ACTION_PAN)
// All possible panning is enabled.
return false;
+
if (!(allowed_touch_action_ & TOUCH_ACTION_PAN))
// No panning is enabled.
return true;
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_action_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698