| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 if (!RuntimeEnabledFeatures::pointerEventEnabled()) | 162 if (!RuntimeEnabledFeatures::pointerEventEnabled()) |
| 163 return WebInputEventResult::NotHandled; | 163 return WebInputEventResult::NotHandled; |
| 164 if (!checkForListener || target->hasEventListeners(eventType)) { | 164 if (!checkForListener || target->hasEventListeners(eventType)) { |
| 165 UseCounter::count(m_frame, UseCounter::PointerEventDispatch); | 165 UseCounter::count(m_frame, UseCounter::PointerEventDispatch); |
| 166 if (eventType == EventTypeNames::pointerdown) | 166 if (eventType == EventTypeNames::pointerdown) |
| 167 UseCounter::count(m_frame, UseCounter::PointerEventDispatchPointerDown); | 167 UseCounter::count(m_frame, UseCounter::PointerEventDispatchPointerDown); |
| 168 | 168 |
| 169 DCHECK(!m_dispatchingPointerId); | 169 DCHECK(!m_dispatchingPointerId); |
| 170 AutoReset<int> dispatchHolder(&m_dispatchingPointerId, pointerId); | 170 AutoReset<int> dispatchHolder(&m_dispatchingPointerId, pointerId); |
| 171 DispatchEventResult dispatchResult = target->dispatchEvent(pointerEvent); | 171 DispatchEventResult dispatchResult = target->dispatchEvent(pointerEvent); |
| 172 |
| 172 return EventHandlingUtil::toWebInputEventResult(dispatchResult); | 173 return EventHandlingUtil::toWebInputEventResult(dispatchResult); |
| 173 } | 174 } |
| 174 return WebInputEventResult::NotHandled; | 175 return WebInputEventResult::NotHandled; |
| 175 } | 176 } |
| 176 | 177 |
| 177 EventTarget* PointerEventManager::getEffectiveTargetForPointerEvent( | 178 EventTarget* PointerEventManager::getEffectiveTargetForPointerEvent( |
| 178 EventTarget* target, | 179 EventTarget* target, |
| 179 int pointerId) { | 180 int pointerId) { |
| 180 if (EventTarget* capturingTarget = getCapturingNode(pointerId)) | 181 if (EventTarget* capturingTarget = getCapturingNode(pointerId)) |
| 181 return capturingTarget; | 182 return capturingTarget; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 500 } |
| 500 result = EventHandlingUtil::mergeEventResult( | 501 result = EventHandlingUtil::mergeEventResult( |
| 501 result, | 502 result, |
| 502 m_mouseEventManager->dispatchMouseEvent( | 503 m_mouseEventManager->dispatchMouseEvent( |
| 503 mouseTarget, mouseEventType, mouseEvent, canvasRegionId, nullptr)); | 504 mouseTarget, mouseEventType, mouseEvent, canvasRegionId, nullptr)); |
| 504 | 505 |
| 505 if (selectionOverLink && mouseTarget && | 506 if (selectionOverLink && mouseTarget && |
| 506 mouseEventType == EventTypeNames::mouseup) { | 507 mouseEventType == EventTypeNames::mouseup) { |
| 507 WebInputEventResult clickEventResult = | 508 WebInputEventResult clickEventResult = |
| 508 m_mouseEventManager->dispatchMouseClickIfNeeded( | 509 m_mouseEventManager->dispatchMouseClickIfNeeded( |
| 509 mouseTarget->toNode(), mouseEvent, canvasRegionId); | 510 mouseTarget->toNode(), mouseEvent, canvasRegionId, target); |
| 510 result = EventHandlingUtil::mergeEventResult(clickEventResult, result); | 511 result = EventHandlingUtil::mergeEventResult(clickEventResult, result); |
| 511 } | 512 } |
| 512 } | 513 } |
| 513 | 514 |
| 514 if (pointerEvent->type() == EventTypeNames::pointerup || | 515 if (pointerEvent->type() == EventTypeNames::pointerup || |
| 515 pointerEvent->type() == EventTypeNames::pointercancel) { | 516 pointerEvent->type() == EventTypeNames::pointercancel) { |
| 516 releasePointerCapture(pointerEvent->pointerId()); | 517 releasePointerCapture(pointerEvent->pointerId()); |
| 517 // Send got/lostpointercapture rightaway if necessary. | 518 // Send got/lostpointercapture rightaway if necessary. |
| 518 processPendingPointerCapture(pointerEvent); | 519 processPendingPointerCapture(pointerEvent); |
| 519 | 520 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 if (firstId > uniqueTouchEventId) | 717 if (firstId > uniqueTouchEventId) |
| 717 return false; | 718 return false; |
| 718 m_touchIdsForCanceledPointerdowns.takeFirst(); | 719 m_touchIdsForCanceledPointerdowns.takeFirst(); |
| 719 if (firstId == uniqueTouchEventId) | 720 if (firstId == uniqueTouchEventId) |
| 720 return true; | 721 return true; |
| 721 } | 722 } |
| 722 return false; | 723 return false; |
| 723 } | 724 } |
| 724 | 725 |
| 725 } // namespace blink | 726 } // namespace blink |
| OLD | NEW |