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