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