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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (allowed_touch_action_ == TOUCH_ACTION_PAN_Y) | 54 if (allowed_touch_action_ == TOUCH_ACTION_PAN_Y) |
55 gesture_event->data.flingStart.velocityX = 0; | 55 gesture_event->data.flingStart.velocityX = 0; |
56 } | 56 } |
57 return FilterScrollEndingGesture(); | 57 return FilterScrollEndingGesture(); |
58 | 58 |
59 case WebInputEvent::GestureScrollEnd: | 59 case WebInputEvent::GestureScrollEnd: |
60 return FilterScrollEndingGesture(); | 60 return FilterScrollEndingGesture(); |
61 | 61 |
62 case WebInputEvent::GesturePinchBegin: | 62 case WebInputEvent::GesturePinchBegin: |
63 DCHECK(!drop_pinch_gesture_events_); | 63 DCHECK(!drop_pinch_gesture_events_); |
64 if (allowed_touch_action_ == TOUCH_ACTION_AUTO) { | 64 if (allowed_touch_action_ == TOUCH_ACTION_AUTO || |
| 65 allowed_touch_action_ & TOUCH_ACTION_PINCH_ZOOM) { |
65 // Pinch events are always bracketed by scroll events, and the W3C | 66 // Pinch events are always bracketed by scroll events, and the W3C |
66 // standard touch-action provides no way to disable scrolling without | 67 // standard touch-action provides no way to disable scrolling without |
67 // also disabling pinching. | 68 // also disabling pinching (validated by the IPC ENUM traits). |
| 69 DCHECK(allowed_touch_action_ == TOUCH_ACTION_AUTO || |
| 70 allowed_touch_action_ == TOUCH_ACTION_MANIPULATION); |
68 DCHECK(!drop_scroll_gesture_events_); | 71 DCHECK(!drop_scroll_gesture_events_); |
69 } else { | 72 } else { |
70 drop_pinch_gesture_events_ = true; | 73 drop_pinch_gesture_events_ = true; |
71 } | 74 } |
72 return drop_pinch_gesture_events_; | 75 return drop_pinch_gesture_events_; |
73 | 76 |
74 case WebInputEvent::GesturePinchUpdate: | 77 case WebInputEvent::GesturePinchUpdate: |
75 return drop_pinch_gesture_events_; | 78 return drop_pinch_gesture_events_; |
76 | 79 |
77 case WebInputEvent::GesturePinchEnd: | 80 case WebInputEvent::GesturePinchEnd: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 if (ta2 == TOUCH_ACTION_AUTO) | 186 if (ta2 == TOUCH_ACTION_AUTO) |
184 return ta1; | 187 return ta1; |
185 | 188 |
186 // Only the true flags are left - take their intersection. | 189 // Only the true flags are left - take their intersection. |
187 if (!(ta1 & ta2)) | 190 if (!(ta1 & ta2)) |
188 return TOUCH_ACTION_NONE; | 191 return TOUCH_ACTION_NONE; |
189 return static_cast<TouchAction>(ta1 & ta2); | 192 return static_cast<TouchAction>(ta1 & ta2); |
190 } | 193 } |
191 | 194 |
192 } | 195 } |
OLD | NEW |