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/common/input/web_input_event_traits.h" | 5 #include "content/common/input/web_input_event_traits.h" |
6 | 6 |
7 #include <bitset> | 7 #include <bitset> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 *event = event_to_coalesce; | 140 *event = event_to_coalesce; |
141 for (unsigned i = 0; i < event->touchesLength; ++i) { | 141 for (unsigned i = 0; i < event->touchesLength; ++i) { |
142 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id); | 142 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id); |
143 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved) | 143 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved) |
144 event->touches[i].state = blink::WebTouchPoint::StateMoved; | 144 event->touches[i].state = blink::WebTouchPoint::StateMoved; |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, | 148 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, |
149 const WebGestureEvent& event) { | 149 const WebGestureEvent& event) { |
| 150 CHECK_NE(WebInputEvent::GestureScrollUpdateWithoutPropagation, event.type); |
150 if (event.type != event_to_coalesce.type || | 151 if (event.type != event_to_coalesce.type || |
151 event.sourceDevice != event_to_coalesce.sourceDevice || | 152 event.sourceDevice != event_to_coalesce.sourceDevice || |
152 event.modifiers != event_to_coalesce.modifiers) | 153 event.modifiers != event_to_coalesce.modifiers) |
153 return false; | 154 return false; |
154 | 155 |
155 if (event.type == WebInputEvent::GestureScrollUpdate) | 156 if (event.type == WebInputEvent::GestureScrollUpdate) |
156 return true; | 157 return true; |
157 | 158 |
158 // GesturePinchUpdate scales can be combined only if they share a focal point, | 159 // GesturePinchUpdate scales can be combined only if they share a focal point, |
159 // e.g., with double-tap drag zoom. | 160 // e.g., with double-tap drag zoom. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 CASE_TYPE(MouseLeave); | 271 CASE_TYPE(MouseLeave); |
271 CASE_TYPE(ContextMenu); | 272 CASE_TYPE(ContextMenu); |
272 CASE_TYPE(MouseWheel); | 273 CASE_TYPE(MouseWheel); |
273 CASE_TYPE(RawKeyDown); | 274 CASE_TYPE(RawKeyDown); |
274 CASE_TYPE(KeyDown); | 275 CASE_TYPE(KeyDown); |
275 CASE_TYPE(KeyUp); | 276 CASE_TYPE(KeyUp); |
276 CASE_TYPE(Char); | 277 CASE_TYPE(Char); |
277 CASE_TYPE(GestureScrollBegin); | 278 CASE_TYPE(GestureScrollBegin); |
278 CASE_TYPE(GestureScrollEnd); | 279 CASE_TYPE(GestureScrollEnd); |
279 CASE_TYPE(GestureScrollUpdate); | 280 CASE_TYPE(GestureScrollUpdate); |
| 281 CASE_TYPE(GestureScrollUpdateWithoutPropagation); |
280 CASE_TYPE(GestureFlingStart); | 282 CASE_TYPE(GestureFlingStart); |
281 CASE_TYPE(GestureFlingCancel); | 283 CASE_TYPE(GestureFlingCancel); |
282 CASE_TYPE(GestureShowPress); | 284 CASE_TYPE(GestureShowPress); |
283 CASE_TYPE(GestureTap); | 285 CASE_TYPE(GestureTap); |
284 CASE_TYPE(GestureTapUnconfirmed); | 286 CASE_TYPE(GestureTapUnconfirmed); |
285 CASE_TYPE(GestureTapDown); | 287 CASE_TYPE(GestureTapDown); |
286 CASE_TYPE(GestureTapCancel); | 288 CASE_TYPE(GestureTapCancel); |
287 CASE_TYPE(GestureDoubleTap); | 289 CASE_TYPE(GestureDoubleTap); |
288 CASE_TYPE(GestureTwoFingerTap); | 290 CASE_TYPE(GestureTwoFingerTap); |
289 CASE_TYPE(GestureLongPress); | 291 CASE_TYPE(GestureLongPress); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 case WebInputEvent::TouchStart: | 364 case WebInputEvent::TouchStart: |
363 case WebInputEvent::TouchMove: | 365 case WebInputEvent::TouchMove: |
364 case WebInputEvent::TouchEnd: | 366 case WebInputEvent::TouchEnd: |
365 return !static_cast<const WebTouchEvent&>(event).cancelable; | 367 return !static_cast<const WebTouchEvent&>(event).cancelable; |
366 default: | 368 default: |
367 return false; | 369 return false; |
368 } | 370 } |
369 } | 371 } |
370 | 372 |
371 } // namespace content | 373 } // namespace content |
OLD | NEW |