Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/input/touch_action_filter.h" | 5 #include "content/browser/renderer_host/input/touch_action_filter.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "third_party/WebKit/public/web/WebInputEvent.h" | 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 gesture_event->type = WebInputEvent::GestureScrollEnd; | 81 gesture_event->type = WebInputEvent::GestureScrollEnd; |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 return FilterScrollEndingGesture(); | 84 return FilterScrollEndingGesture(); |
| 85 | 85 |
| 86 case WebInputEvent::GestureScrollEnd: | 86 case WebInputEvent::GestureScrollEnd: |
| 87 return FilterScrollEndingGesture(); | 87 return FilterScrollEndingGesture(); |
| 88 | 88 |
| 89 case WebInputEvent::GesturePinchBegin: | 89 case WebInputEvent::GesturePinchBegin: |
| 90 DCHECK(!drop_pinch_gesture_events_); | 90 DCHECK(!drop_pinch_gesture_events_); |
| 91 if (allowed_touch_action_ & TOUCH_ACTION_PINCH_ZOOM) { | 91 drop_pinch_gesture_events_ = |
| 92 // Pinch events are always bracketed by scroll events, and the W3C | 92 (allowed_touch_action_ & TOUCH_ACTION_PINCH_ZOOM) != 0; |
|
Rick Byers
2016/07/07 21:09:14
Ah crap, I forgot about this comment I left.
I th
| |
| 93 // standard touch-action provides no way to disable scrolling without | |
| 94 // also disabling pinching (validated by the IPC ENUM traits). | |
| 95 DCHECK(allowed_touch_action_ == TOUCH_ACTION_AUTO || | |
| 96 allowed_touch_action_ == TOUCH_ACTION_MANIPULATION); | |
| 97 DCHECK(!drop_scroll_gesture_events_); | |
| 98 } else { | |
| 99 drop_pinch_gesture_events_ = true; | |
| 100 } | |
| 101 return drop_pinch_gesture_events_; | 93 return drop_pinch_gesture_events_; |
| 102 | 94 |
| 103 case WebInputEvent::GesturePinchUpdate: | 95 case WebInputEvent::GesturePinchUpdate: |
| 104 return drop_pinch_gesture_events_; | 96 return drop_pinch_gesture_events_; |
| 105 | 97 |
| 106 case WebInputEvent::GesturePinchEnd: | 98 case WebInputEvent::GesturePinchEnd: |
| 107 if (drop_pinch_gesture_events_) { | 99 if (drop_pinch_gesture_events_) { |
| 108 drop_pinch_gesture_events_ = false; | 100 drop_pinch_gesture_events_ = false; |
| 109 return true; | 101 return true; |
| 110 } | 102 } |
| 111 DCHECK(!drop_scroll_gesture_events_); | |
| 112 break; | 103 break; |
| 113 | 104 |
| 114 // The double tap gesture is a tap ending event. If a double tap gesture is | 105 // The double tap gesture is a tap ending event. If a double tap gesture is |
| 115 // filtered out, replace it with a tap event. | 106 // filtered out, replace it with a tap event. |
| 116 case WebInputEvent::GestureDoubleTap: | 107 case WebInputEvent::GestureDoubleTap: |
| 117 DCHECK_EQ(1, gesture_event->data.tap.tapCount); | 108 DCHECK_EQ(1, gesture_event->data.tap.tapCount); |
| 118 if (!allow_current_double_tap_event_) | 109 if (!allow_current_double_tap_event_) |
| 119 gesture_event->type = WebInputEvent::GestureTap; | 110 gesture_event->type = WebInputEvent::GestureTap; |
| 120 allow_current_double_tap_event_ = true; | 111 allow_current_double_tap_event_ = true; |
| 121 break; | 112 break; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 } else if (gesture_event.data.scrollBegin.deltaYHint < 0 && | 211 } else if (gesture_event.data.scrollBegin.deltaYHint < 0 && |
| 221 allowed_touch_action_ & TOUCH_ACTION_PAN_DOWN) { | 212 allowed_touch_action_ & TOUCH_ACTION_PAN_DOWN) { |
| 222 return false; | 213 return false; |
| 223 } else { | 214 } else { |
| 224 return true; | 215 return true; |
| 225 } | 216 } |
| 226 } | 217 } |
| 227 } | 218 } |
| 228 | 219 |
| 229 } // namespace content | 220 } // namespace content |
| OLD | NEW |