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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // correct state, i.e. the touch-points that moved in the last event, but | 230 // correct state, i.e. the touch-points that moved in the last event, but |
231 // didn't change in the current event, will have Stationary state. It is | 231 // didn't change in the current event, will have Stationary state. It is |
232 // necessary to change them back to Moved state. | 232 // necessary to change them back to Moved state. |
233 WebTouchEvent old_event = *event; | 233 WebTouchEvent old_event = *event; |
234 *event = event_to_coalesce; | 234 *event = event_to_coalesce; |
235 for (unsigned i = 0; i < event->touchesLength; ++i) { | 235 for (unsigned i = 0; i < event->touchesLength; ++i) { |
236 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id); | 236 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id); |
237 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved) | 237 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved) |
238 event->touches[i].state = blink::WebTouchPoint::StateMoved; | 238 event->touches[i].state = blink::WebTouchPoint::StateMoved; |
239 } | 239 } |
| 240 event->causesScrollingIfUncanceled |= old_event.causesScrollingIfUncanceled; |
240 } | 241 } |
241 | 242 |
242 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, | 243 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, |
243 const WebGestureEvent& event) { | 244 const WebGestureEvent& event) { |
244 if (event.type != event_to_coalesce.type || | 245 if (event.type != event_to_coalesce.type || |
245 event.sourceDevice != event_to_coalesce.sourceDevice || | 246 event.sourceDevice != event_to_coalesce.sourceDevice || |
246 event.modifiers != event_to_coalesce.modifiers) | 247 event.modifiers != event_to_coalesce.modifiers) |
247 return false; | 248 return false; |
248 | 249 |
249 if (event.type == WebInputEvent::GestureScrollUpdate) | 250 if (event.type == WebInputEvent::GestureScrollUpdate) |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 case WebInputEvent::TouchStart: | 479 case WebInputEvent::TouchStart: |
479 case WebInputEvent::TouchMove: | 480 case WebInputEvent::TouchMove: |
480 case WebInputEvent::TouchEnd: | 481 case WebInputEvent::TouchEnd: |
481 return !static_cast<const WebTouchEvent&>(event).cancelable; | 482 return !static_cast<const WebTouchEvent&>(event).cancelable; |
482 default: | 483 default: |
483 return false; | 484 return false; |
484 } | 485 } |
485 } | 486 } |
486 | 487 |
487 } // namespace content | 488 } // namespace content |
OLD | NEW |