| 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/ElementTraversal.h" | 7 #include "core/dom/ElementTraversal.h" |
| 8 #include "core/dom/shadow/FlatTreeTraversal.h" | 8 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 9 #include "core/events/MouseEvent.h" | 9 #include "core/events/MouseEvent.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 case PlatformTouchPoint::TouchStationary: | 36 case PlatformTouchPoint::TouchStationary: |
| 37 // Fall through to default | 37 // Fall through to default |
| 38 default: | 38 default: |
| 39 ASSERT_NOT_REACHED(); | 39 ASSERT_NOT_REACHED(); |
| 40 return emptyAtom; | 40 return emptyAtom; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool isInDocument(EventTarget* n) | 44 bool isInDocument(EventTarget* n) |
| 45 { | 45 { |
| 46 return n && n->toNode() && n->toNode()->inShadowIncludingDocument(); | 46 return n && n->toNode() && n->toNode()->isConnected(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 WebInputEventResult dispatchMouseEvent( | 49 WebInputEventResult dispatchMouseEvent( |
| 50 EventTarget* target, | 50 EventTarget* target, |
| 51 const AtomicString& mouseEventType, | 51 const AtomicString& mouseEventType, |
| 52 const PlatformMouseEvent& mouseEvent, | 52 const PlatformMouseEvent& mouseEvent, |
| 53 EventTarget* relatedTarget, | 53 EventTarget* relatedTarget, |
| 54 int detail = 0, | 54 int detail = 0, |
| 55 bool checkForListener = false) | 55 bool checkForListener = false) |
| 56 { | 56 { |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 pointerEvent); | 666 pointerEvent); |
| 667 } | 667 } |
| 668 sendBoundaryEvents(nodeUnderPointerAtt.target, nullptr, | 668 sendBoundaryEvents(nodeUnderPointerAtt.target, nullptr, |
| 669 pointerEvent, mouseEvent, sendMouseEvent); | 669 pointerEvent, mouseEvent, sendMouseEvent); |
| 670 } | 670 } |
| 671 if (pointerCaptureTarget) { | 671 if (pointerCaptureTarget) { |
| 672 // Re-target lostpointercapture to the document when the element is | 672 // Re-target lostpointercapture to the document when the element is |
| 673 // no longer participating in the tree. | 673 // no longer participating in the tree. |
| 674 EventTarget* target = pointerCaptureTarget; | 674 EventTarget* target = pointerCaptureTarget; |
| 675 if (target->toNode() | 675 if (target->toNode() |
| 676 && !target->toNode()->inShadowIncludingDocument()) { | 676 && !target->toNode()->isConnected()) { |
| 677 target = target->toNode()->ownerDocument(); | 677 target = target->toNode()->ownerDocument(); |
| 678 } | 678 } |
| 679 dispatchPointerEvent(target, | 679 dispatchPointerEvent(target, |
| 680 m_pointerEventFactory.createPointerCaptureEvent( | 680 m_pointerEventFactory.createPointerCaptureEvent( |
| 681 pointerEvent, EventTypeNames::lostpointercapture)); | 681 pointerEvent, EventTypeNames::lostpointercapture)); |
| 682 } | 682 } |
| 683 } | 683 } |
| 684 | 684 |
| 685 // Set pointerCaptureTarget from pendingPointerCaptureTarget. This does | 685 // Set pointerCaptureTarget from pendingPointerCaptureTarget. This does |
| 686 // affect the behavior of sendBoundaryEvents function. So the | 686 // affect the behavior of sendBoundaryEvents function. So the |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 { | 803 { |
| 804 visitor->trace(m_frame); | 804 visitor->trace(m_frame); |
| 805 visitor->trace(m_nodeUnderPointer); | 805 visitor->trace(m_nodeUnderPointer); |
| 806 visitor->trace(m_pointerCaptureTarget); | 806 visitor->trace(m_pointerCaptureTarget); |
| 807 visitor->trace(m_pendingPointerCaptureTarget); | 807 visitor->trace(m_pendingPointerCaptureTarget); |
| 808 visitor->trace(m_touchEventManager); | 808 visitor->trace(m_touchEventManager); |
| 809 } | 809 } |
| 810 | 810 |
| 811 | 811 |
| 812 } // namespace blink | 812 } // namespace blink |
| OLD | NEW |