| 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/ElementTraversal.h" | 7 #include "core/dom/ElementTraversal.h" |
| 8 #include "core/dom/shadow/FlatTreeTraversal.h" | 8 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 9 #include "core/events/MouseEvent.h" | 9 #include "core/events/MouseEvent.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 for (int pointerId : touchPointerIds) { | 257 for (int pointerId : touchPointerIds) { |
| 258 PointerEvent* pointerEvent = m_pointerEventFactory.createPointerCancelEvent( | 258 PointerEvent* pointerEvent = m_pointerEventFactory.createPointerCancelEvent( |
| 259 pointerId, WebPointerProperties::PointerType::Touch); | 259 pointerId, WebPointerProperties::PointerType::Touch); |
| 260 | 260 |
| 261 DCHECK(m_nodeUnderPointer.contains(pointerId)); | 261 DCHECK(m_nodeUnderPointer.contains(pointerId)); |
| 262 EventTarget* target = m_nodeUnderPointer.get(pointerId).target; | 262 EventTarget* target = m_nodeUnderPointer.get(pointerId).target; |
| 263 | 263 |
| 264 processCaptureAndPositionOfPointerEvent(pointerEvent, target); | 264 processCaptureAndPositionOfPointerEvent(pointerEvent, target); |
| 265 | 265 |
| 266 // TODO(nzolghadr): This event follows implicit TE capture. The actual targe
t | 266 // TODO(nzolghadr): This event follows implicit TE capture. The actual |
| 267 // would depend on PE capturing. Perhaps need to split TE/PE event path upst
ream? | 267 // target would depend on PE capturing. Perhaps need to split TE/PE event |
| 268 // crbug.com/579553. | 268 // path upstream? crbug.com/579553. |
| 269 dispatchPointerEvent( | 269 dispatchPointerEvent( |
| 270 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), | 270 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), |
| 271 pointerEvent); | 271 pointerEvent); |
| 272 | 272 |
| 273 releasePointerCapture(pointerEvent->pointerId()); | 273 releasePointerCapture(pointerEvent->pointerId()); |
| 274 | 274 |
| 275 // Sending the leave/out events and lostpointercapture | 275 // Sending the leave/out events and lostpointercapture |
| 276 // because the next touch event will have a different id. So delayed | 276 // because the next touch event will have a different id. So delayed |
| 277 // sending of lostpointercapture won't work here. | 277 // sending of lostpointercapture won't work here. |
| 278 processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr); | 278 processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 305 HeapVector<TouchEventManager::TouchInfo> touchInfos; | 305 HeapVector<TouchEventManager::TouchInfo> touchInfos; |
| 306 | 306 |
| 307 dispatchTouchPointerEvents(event, touchInfos); | 307 dispatchTouchPointerEvents(event, touchInfos); |
| 308 | 308 |
| 309 return m_touchEventManager->handleTouchEvent(event, touchInfos); | 309 return m_touchEventManager->handleTouchEvent(event, touchInfos); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void PointerEventManager::dispatchTouchPointerEvents( | 312 void PointerEventManager::dispatchTouchPointerEvents( |
| 313 const PlatformTouchEvent& event, | 313 const PlatformTouchEvent& event, |
| 314 HeapVector<TouchEventManager::TouchInfo>& touchInfos) { | 314 HeapVector<TouchEventManager::TouchInfo>& touchInfos) { |
| 315 // Iterate through the touch points, sending PointerEvents to the targets as r
equired. | 315 // Iterate through the touch points, sending PointerEvents to the targets as |
| 316 // required. |
| 316 for (const auto& touchPoint : event.touchPoints()) { | 317 for (const auto& touchPoint : event.touchPoints()) { |
| 317 TouchEventManager::TouchInfo touchInfo; | 318 TouchEventManager::TouchInfo touchInfo; |
| 318 touchInfo.point = touchPoint; | 319 touchInfo.point = touchPoint; |
| 319 | 320 |
| 320 int pointerId = | 321 int pointerId = |
| 321 m_pointerEventFactory.getPointerEventId(touchPoint.pointerProperties()); | 322 m_pointerEventFactory.getPointerEventId(touchPoint.pointerProperties()); |
| 322 // Do the hit test either when the touch first starts or when the touch | 323 // Do the hit test either when the touch first starts or when the touch |
| 323 // is not captured. |m_pendingPointerCaptureTarget| indicates the target | 324 // is not captured. |m_pendingPointerCaptureTarget| indicates the target |
| 324 // that will be capturing this event. |m_pointerCaptureTarget| may not | 325 // that will be capturing this event. |m_pointerCaptureTarget| may not |
| 325 // have this target yet since the processing of that will be done right | 326 // have this target yet since the processing of that will be done right |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 return true; | 674 return true; |
| 674 } | 675 } |
| 675 return false; | 676 return false; |
| 676 } | 677 } |
| 677 | 678 |
| 678 EventTarget* PointerEventManager::getMouseCapturingNode() { | 679 EventTarget* PointerEventManager::getMouseCapturingNode() { |
| 679 return getCapturingNode(PointerEventFactory::s_mouseId); | 680 return getCapturingNode(PointerEventFactory::s_mouseId); |
| 680 } | 681 } |
| 681 | 682 |
| 682 } // namespace blink | 683 } // namespace blink |
| OLD | NEW |