OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include "ui/events/blink/blink_event_util.h" | 8 #include "ui/events/blink/blink_event_util.h" |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 // The WebTouchPoints include absolute position information. So it is | 326 // The WebTouchPoints include absolute position information. So it is |
327 // sufficient to simply replace the previous event with the new event-> | 327 // sufficient to simply replace the previous event with the new event-> |
328 // However, it is necessary to make sure that all the points have the | 328 // However, it is necessary to make sure that all the points have the |
329 // correct state, i.e. the touch-points that moved in the last event, but | 329 // correct state, i.e. the touch-points that moved in the last event, but |
330 // didn't change in the current event, will have Stationary state. It is | 330 // didn't change in the current event, will have Stationary state. It is |
331 // necessary to change them back to Moved state. | 331 // necessary to change them back to Moved state. |
332 WebTouchEvent old_event = *event; | 332 WebTouchEvent old_event = *event; |
333 *event = event_to_coalesce; | 333 *event = event_to_coalesce; |
334 for (unsigned i = 0; i < event->touchesLength; ++i) { | 334 for (unsigned i = 0; i < event->touchesLength; ++i) { |
335 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id); | 335 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id); |
336 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved) | 336 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved) { |
337 event->touches[i].state = blink::WebTouchPoint::StateMoved; | 337 event->touches[i].state = blink::WebTouchPoint::StateMoved; |
338 event->touches[i].movementX += old_event.touches[i_old].movementX; | |
339 event->touches[i].movementY += old_event.touches[i_old].movementY; | |
340 } | |
sadrul
2017/02/07 03:48:30
Mind adding a test for this in blink_event_util_un
Navid Zolghadr
2017/02/08 17:18:49
Done.
| |
338 } | 341 } |
339 event->movedBeyondSlopRegion |= old_event.movedBeyondSlopRegion; | 342 event->movedBeyondSlopRegion |= old_event.movedBeyondSlopRegion; |
340 event->dispatchType = MergeDispatchTypes(old_event.dispatchType, | 343 event->dispatchType = MergeDispatchTypes(old_event.dispatchType, |
341 event_to_coalesce.dispatchType); | 344 event_to_coalesce.dispatchType); |
342 } | 345 } |
343 | 346 |
344 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, | 347 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, |
345 const WebGestureEvent& event) { | 348 const WebGestureEvent& event) { |
346 if (event.type() != event_to_coalesce.type() || | 349 if (event.type() != event_to_coalesce.type() || |
347 event.sourceDevice != event_to_coalesce.sourceDevice || | 350 event.sourceDevice != event_to_coalesce.sourceDevice || |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 switch (type) { | 964 switch (type) { |
962 case blink::WebGestureEvent::GestureScrollUpdate: | 965 case blink::WebGestureEvent::GestureScrollUpdate: |
963 case blink::WebGestureEvent::GesturePinchUpdate: | 966 case blink::WebGestureEvent::GesturePinchUpdate: |
964 return true; | 967 return true; |
965 default: | 968 default: |
966 return false; | 969 return false; |
967 } | 970 } |
968 } | 971 } |
969 | 972 |
970 } // namespace ui | 973 } // namespace ui |
OLD | NEW |