| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 | 437 |
| 438 return result; | 438 return result; |
| 439 } | 439 } |
| 440 | 440 |
| 441 WebInputEventResult PointerEventManager::sendMousePointerEvent( | 441 WebInputEventResult PointerEventManager::sendMousePointerEvent( |
| 442 Node* target, | 442 Node* target, |
| 443 const String& canvasRegionId, | 443 const String& canvasRegionId, |
| 444 const AtomicString& mouseEventType, | 444 const AtomicString& mouseEventType, |
| 445 const WebMouseEvent& mouseEvent, | 445 const WebMouseEvent& mouseEvent, |
| 446 const Vector<WebMouseEvent>& coalescedEvents) { | 446 const Vector<WebMouseEvent>& coalescedEvents, |
| 447 bool sendClickIfNeeded) { |
| 447 PointerEvent* pointerEvent = | 448 PointerEvent* pointerEvent = |
| 448 m_pointerEventFactory.create(mouseEventType, mouseEvent, coalescedEvents, | 449 m_pointerEventFactory.create(mouseEventType, mouseEvent, coalescedEvents, |
| 449 m_frame->document()->domWindow()); | 450 m_frame->document()->domWindow()); |
| 450 | 451 |
| 451 // This is for when the mouse is released outside of the page. | 452 // This is for when the mouse is released outside of the page. |
| 452 if (pointerEvent->type() == EventTypeNames::pointermove && | 453 if (pointerEvent->type() == EventTypeNames::pointermove && |
| 453 !pointerEvent->buttons()) { | 454 !pointerEvent->buttons()) { |
| 454 releasePointerCapture(pointerEvent->pointerId()); | 455 releasePointerCapture(pointerEvent->pointerId()); |
| 455 // Send got/lostpointercapture rightaway if necessary. | 456 // Send got/lostpointercapture rightaway if necessary. |
| 456 processPendingPointerCapture(pointerEvent); | 457 processPendingPointerCapture(pointerEvent); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 if (isInDocument(context.node())) { | 490 if (isInDocument(context.node())) { |
| 490 mouseTarget = context.node(); | 491 mouseTarget = context.node(); |
| 491 break; | 492 break; |
| 492 } | 493 } |
| 493 } | 494 } |
| 494 } | 495 } |
| 495 result = EventHandlingUtil::mergeEventResult( | 496 result = EventHandlingUtil::mergeEventResult( |
| 496 result, | 497 result, |
| 497 m_mouseEventManager->dispatchMouseEvent( | 498 m_mouseEventManager->dispatchMouseEvent( |
| 498 mouseTarget, mouseEventType, mouseEvent, canvasRegionId, nullptr)); | 499 mouseTarget, mouseEventType, mouseEvent, canvasRegionId, nullptr)); |
| 500 |
| 501 if (sendClickIfNeeded && mouseTarget && |
| 502 mouseEventType == EventTypeNames::mouseup) { |
| 503 WebInputEventResult clickEventResult = |
| 504 m_mouseEventManager->dispatchMouseClickIfNeeded( |
| 505 mouseTarget->toNode(), mouseEvent, canvasRegionId); |
| 506 result = EventHandlingUtil::mergeEventResult(clickEventResult, result); |
| 507 } |
| 499 } | 508 } |
| 500 | 509 |
| 501 if (pointerEvent->type() == EventTypeNames::pointerup || | 510 if (pointerEvent->type() == EventTypeNames::pointerup || |
| 502 pointerEvent->type() == EventTypeNames::pointercancel) { | 511 pointerEvent->type() == EventTypeNames::pointercancel) { |
| 503 releasePointerCapture(pointerEvent->pointerId()); | 512 releasePointerCapture(pointerEvent->pointerId()); |
| 504 // Send got/lostpointercapture rightaway if necessary. | 513 // Send got/lostpointercapture rightaway if necessary. |
| 505 processPendingPointerCapture(pointerEvent); | 514 processPendingPointerCapture(pointerEvent); |
| 506 | 515 |
| 507 if (pointerEvent->isPrimary()) { | 516 if (pointerEvent->isPrimary()) { |
| 508 m_preventMouseEventForPointerType[toPointerTypeIndex( | 517 m_preventMouseEventForPointerType[toPointerTypeIndex( |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 if (firstId > uniqueTouchEventId) | 707 if (firstId > uniqueTouchEventId) |
| 699 return false; | 708 return false; |
| 700 m_touchIdsForCanceledPointerdowns.takeFirst(); | 709 m_touchIdsForCanceledPointerdowns.takeFirst(); |
| 701 if (firstId == uniqueTouchEventId) | 710 if (firstId == uniqueTouchEventId) |
| 702 return true; | 711 return true; |
| 703 } | 712 } |
| 704 return false; | 713 return false; |
| 705 } | 714 } |
| 706 | 715 |
| 707 } // namespace blink | 716 } // namespace blink |
| OLD | NEW |