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/shadow/FlatTreeTraversal.h" | 7 #include "core/dom/shadow/FlatTreeTraversal.h" |
8 #include "core/events/MouseEvent.h" | 8 #include "core/events/MouseEvent.h" |
9 #include "core/input/EventHandler.h" | 9 #include "core/input/EventHandler.h" |
10 | 10 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventFactory.create PointerCancelEvent(point); | 300 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = m_pointerEventFactory.create PointerCancelEvent(point); |
301 | 301 |
302 | 302 |
303 processCaptureAndPositionOfPointerEvent(pointerEvent, target); | 303 processCaptureAndPositionOfPointerEvent(pointerEvent, target); |
304 | 304 |
305 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing | 305 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing |
306 dispatchPointerEvent( | 306 dispatchPointerEvent( |
307 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), | 307 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), |
308 pointerEvent.get()); | 308 pointerEvent.get()); |
309 | 309 |
310 setNodeUnderPointer(pointerEvent, nullptr); | 310 releasePointerCapture(pointerEvent->pointerId()); |
311 | |
312 // Sending the leave/out events as well as lostpointercapture if required | |
313 processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr); | |
311 | 314 |
312 removePointer(pointerEvent); | 315 removePointer(pointerEvent); |
313 } | 316 } |
314 | 317 |
315 WebInputEventResult PointerEventManager::sendTouchPointerEvent( | 318 WebInputEventResult PointerEventManager::sendTouchPointerEvent( |
mustaq
2016/03/30 21:21:54
Forgot to include the caller?
Navid Zolghadr
2016/03/31 14:41:47
I'm not quite sure what you mean here. Are you tal
mustaq
2016/03/31 15:24:44
EventHandler::handleTouchEvent::freshTouchEvents w
Navid Zolghadr
2016/03/31 16:22:25
That definitely sounds cleaner. I haven't thought
| |
316 PassRefPtrWillBeRawPtr<EventTarget> prpTarget, | 319 PassRefPtrWillBeRawPtr<EventTarget> prpTarget, |
317 const PlatformTouchPoint& touchPoint, PlatformEvent::Modifiers modifiers, | 320 const PlatformTouchPoint& touchPoint, PlatformEvent::Modifiers modifiers, |
318 const double width, const double height, | 321 const double width, const double height, |
319 const double clientX, const double clientY) | 322 const double clientX, const double clientY) |
320 { | 323 { |
321 RefPtrWillBeRawPtr<EventTarget> target = prpTarget; | 324 RefPtrWillBeRawPtr<EventTarget> target = prpTarget; |
325 bool isNew = false; | |
322 | 326 |
323 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = | 327 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = |
324 m_pointerEventFactory.create( | 328 m_pointerEventFactory.create( |
325 pointerEventNameForTouchPointState(touchPoint.state()), | 329 pointerEventNameForTouchPointState(touchPoint.state()), |
326 touchPoint, modifiers, width, height, clientX, clientY); | 330 touchPoint, modifiers, width, height, clientX, clientY, isNew); |
327 | 331 |
328 processCaptureAndPositionOfPointerEvent(pointerEvent, target); | 332 processCaptureAndPositionOfPointerEvent(pointerEvent, target); |
329 | 333 |
330 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing | 334 // TODO(nzolghadr): crbug.com/579553 dealing with implicit touch capturing v s pointer event capturing |
331 WebInputEventResult result = dispatchPointerEvent( | 335 WebInputEventResult result = dispatchPointerEvent( |
332 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), | 336 getEffectiveTargetForPointerEvent(target, pointerEvent->pointerId()), |
333 pointerEvent.get()); | 337 pointerEvent.get()); |
334 | 338 |
339 // Setting the implicit capture for touch | |
340 if (isNew) | |
341 setPointerCapture(pointerEvent->pointerId(), target); | |
342 | |
335 if (touchPoint.state() == PlatformTouchPoint::TouchReleased | 343 if (touchPoint.state() == PlatformTouchPoint::TouchReleased |
336 || touchPoint.state() == PlatformTouchPoint::TouchCancelled) { | 344 || touchPoint.state() == PlatformTouchPoint::TouchCancelled) { |
337 setNodeUnderPointer(pointerEvent, nullptr); | 345 releasePointerCapture(pointerEvent->pointerId()); |
346 | |
347 // Sending the leave/out events as well as lostpointercapture if require d | |
348 processCaptureAndPositionOfPointerEvent(pointerEvent, nullptr); | |
349 | |
338 removePointer(pointerEvent); | 350 removePointer(pointerEvent); |
339 } | 351 } |
340 | 352 |
341 return result; | 353 return result; |
342 } | 354 } |
343 | 355 |
344 WebInputEventResult PointerEventManager::sendMousePointerEvent( | 356 WebInputEventResult PointerEventManager::sendMousePointerEvent( |
345 PassRefPtrWillBeRawPtr<Node> prpTarget, const AtomicString& mouseEventType, | 357 PassRefPtrWillBeRawPtr<Node> prpTarget, const AtomicString& mouseEventType, |
346 int clickCount, const PlatformMouseEvent& mouseEvent, | 358 int clickCount, const PlatformMouseEvent& mouseEvent, |
347 PassRefPtrWillBeRawPtr<Node> relatedTarget, | 359 PassRefPtrWillBeRawPtr<Node> relatedTarget, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
394 | 406 |
395 PointerEventManager::~PointerEventManager() | 407 PointerEventManager::~PointerEventManager() |
396 { | 408 { |
397 } | 409 } |
398 | 410 |
399 void PointerEventManager::clear() | 411 void PointerEventManager::clear() |
400 { | 412 { |
401 m_preventMouseEventForPointerTypeMouse = false; | 413 m_preventMouseEventForPointerTypeMouse = false; |
402 m_pointerEventFactory.clear(); | 414 m_pointerEventFactory.clear(); |
403 m_nodeUnderPointer.clear(); | 415 m_nodeUnderPointer.clear(); |
416 m_pointerCaptureTarget.clear(); | |
417 m_pendingPointerCaptureTarget.clear(); | |
404 } | 418 } |
405 | 419 |
406 void PointerEventManager::processCaptureAndPositionOfPointerEvent( | 420 void PointerEventManager::processCaptureAndPositionOfPointerEvent( |
407 const PassRefPtrWillBeRawPtr<PointerEvent> prpPointerEvent, | 421 const PassRefPtrWillBeRawPtr<PointerEvent> prpPointerEvent, |
408 const PassRefPtrWillBeRawPtr<EventTarget> prpHitTestTarget, | 422 const PassRefPtrWillBeRawPtr<EventTarget> prpHitTestTarget, |
409 const PassRefPtrWillBeRawPtr<EventTarget> lastNodeUnderMouse, | 423 const PassRefPtrWillBeRawPtr<EventTarget> lastNodeUnderMouse, |
410 const PlatformMouseEvent& mouseEvent, | 424 const PlatformMouseEvent& mouseEvent, |
411 bool sendMouseEvent, bool setPointerPosition) | 425 bool sendMouseEvent, bool setPointerPosition) |
412 { | 426 { |
413 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = prpPointerEvent; | 427 RefPtrWillBeRawPtr<PointerEvent> pointerEvent = prpPointerEvent; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 { | 584 { |
571 #if ENABLE(OILPAN) | 585 #if ENABLE(OILPAN) |
572 visitor->trace(m_nodeUnderPointer); | 586 visitor->trace(m_nodeUnderPointer); |
573 visitor->trace(m_pointerCaptureTarget); | 587 visitor->trace(m_pointerCaptureTarget); |
574 visitor->trace(m_pendingPointerCaptureTarget); | 588 visitor->trace(m_pendingPointerCaptureTarget); |
575 #endif | 589 #endif |
576 } | 590 } |
577 | 591 |
578 | 592 |
579 } // namespace blink | 593 } // namespace blink |
OLD | NEW |