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