| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/input/PointerEventManager.h" | 5 #include "core/input/PointerEventManager.h" |
| 6 | 6 |
| 7 #include "core/dom/DocumentUserGestureToken.h" | 7 #include "core/dom/DocumentUserGestureToken.h" |
| 8 #include "core/dom/ElementTraversal.h" | 8 #include "core/dom/ElementTraversal.h" |
| 9 #include "core/dom/shadow/FlatTreeTraversal.h" | 9 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 10 #include "core/events/MouseEvent.h" | 10 #include "core/events/MouseEvent.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 Vector<PlatformTouchPoint> getCoalescedPoints( | 35 Vector<PlatformTouchPoint> getCoalescedPoints( |
| 36 const Vector<PlatformTouchEvent>& coalescedEvents, | 36 const Vector<PlatformTouchEvent>& coalescedEvents, |
| 37 int id) { | 37 int id) { |
| 38 Vector<PlatformTouchPoint> relatedPoints; | 38 Vector<PlatformTouchPoint> relatedPoints; |
| 39 for (const auto& touchEvent : coalescedEvents) { | 39 for (const auto& touchEvent : coalescedEvents) { |
| 40 for (auto& point : touchEvent.touchPoints()) { | 40 for (auto& point : touchEvent.touchPoints()) { |
| 41 // TODO(nzolghadr): Need to filter out stationary points | 41 // TODO(nzolghadr): Need to filter out stationary points |
| 42 if (point.id() == id) | 42 if (point.id() == id) |
| 43 relatedPoints.append(point); | 43 relatedPoints.push_back(point); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 return relatedPoints; | 46 return relatedPoints; |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 PointerEventManager::PointerEventManager(LocalFrame& frame, | 51 PointerEventManager::PointerEventManager(LocalFrame& frame, |
| 52 MouseEventManager& mouseEventManager) | 52 MouseEventManager& mouseEventManager) |
| 53 : m_frame(frame), | 53 : m_frame(frame), |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 359 } |
| 360 } else { | 360 } else { |
| 361 // Set the target of pointer event to the captured node as this | 361 // Set the target of pointer event to the captured node as this |
| 362 // pointer is captured otherwise it would have gone to the if block | 362 // pointer is captured otherwise it would have gone to the if block |
| 363 // and perform a hit-test. | 363 // and perform a hit-test. |
| 364 touchInfo.touchNode = | 364 touchInfo.touchNode = |
| 365 m_pendingPointerCaptureTarget.get(pointerId)->toNode(); | 365 m_pendingPointerCaptureTarget.get(pointerId)->toNode(); |
| 366 touchInfo.targetFrame = touchInfo.touchNode->document().frame(); | 366 touchInfo.targetFrame = touchInfo.touchNode->document().frame(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 touchInfos.append(touchInfo); | 369 touchInfos.push_back(touchInfo); |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 | 372 |
| 373 void PointerEventManager::dispatchTouchPointerEvents( | 373 void PointerEventManager::dispatchTouchPointerEvents( |
| 374 const PlatformTouchEvent& event, | 374 const PlatformTouchEvent& event, |
| 375 const Vector<PlatformTouchEvent>& coalescedEvents, | 375 const Vector<PlatformTouchEvent>& coalescedEvents, |
| 376 HeapVector<TouchEventManager::TouchInfo>& touchInfos) { | 376 HeapVector<TouchEventManager::TouchInfo>& touchInfos) { |
| 377 // Iterate through the touch points, sending PointerEvents to the targets as | 377 // Iterate through the touch points, sending PointerEvents to the targets as |
| 378 // required. | 378 // required. |
| 379 for (auto touchInfo : touchInfos) { | 379 for (auto touchInfo : touchInfos) { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 if (firstId > uniqueTouchEventId) | 692 if (firstId > uniqueTouchEventId) |
| 693 return false; | 693 return false; |
| 694 m_touchIdsForCanceledPointerdowns.takeFirst(); | 694 m_touchIdsForCanceledPointerdowns.takeFirst(); |
| 695 if (firstId == uniqueTouchEventId) | 695 if (firstId == uniqueTouchEventId) |
| 696 return true; | 696 return true; |
| 697 } | 697 } |
| 698 return false; | 698 return false; |
| 699 } | 699 } |
| 700 | 700 |
| 701 } // namespace blink | 701 } // namespace blink |
| OLD | NEW |