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