| 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 #ifndef PointerEventManager_h | 5 #ifndef PointerEventManager_h |
| 6 #define PointerEventManager_h | 6 #define PointerEventManager_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/events/PointerEvent.h" | 9 #include "core/events/PointerEvent.h" |
| 10 #include "core/events/PointerEventFactory.h" | 10 #include "core/events/PointerEventFactory.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 const PlatformMouseEvent&, | 47 const PlatformMouseEvent&, |
| 48 PassRefPtrWillBeRawPtr<AbstractView>); | 48 PassRefPtrWillBeRawPtr<AbstractView>); |
| 49 | 49 |
| 50 // Clear all the existing ids. | 50 // Clear all the existing ids. |
| 51 void clear(); | 51 void clear(); |
| 52 | 52 |
| 53 // May clear PREVENT MOUSE EVENT flag as per pointer event spec: | 53 // May clear PREVENT MOUSE EVENT flag as per pointer event spec: |
| 54 // https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-eve
nts | 54 // https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-eve
nts |
| 55 void conditionallyEnableMouseEventForPointerTypeMouse(unsigned); | 55 void conditionallyEnableMouseEventForPointerTypeMouse(unsigned); |
| 56 | 56 |
| 57 void elementRemoved(EventTarget*); |
| 58 void setPointerCapture(int, EventTarget*); |
| 59 void releasePointerCapture(int, EventTarget*); |
| 60 bool isActive(const int); |
| 57 | 61 |
| 58 private: | 62 private: |
| 59 PassRefPtrWillBeRawPtr<Node> getEffectiveTargetForPointerEvent( | 63 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> PointerCaptu
ringMap; |
| 60 PassRefPtrWillBeRawPtr<Node>, | 64 class EventTargetAttributes { |
| 61 PassRefPtrWillBeRawPtr<PointerEvent>); | 65 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 66 public: |
| 67 DEFINE_INLINE_TRACE() |
| 68 { |
| 69 visitor->trace(target); |
| 70 } |
| 71 RefPtrWillBeMember<EventTarget> target; |
| 72 bool hasRecievedOverEvent; |
| 73 EventTargetAttributes() {} |
| 74 EventTargetAttributes(PassRefPtrWillBeRawPtr<EventTarget> target, |
| 75 bool hasRecievedOverEvent) |
| 76 : target(target) |
| 77 , hasRecievedOverEvent(hasRecievedOverEvent) {} |
| 78 }; |
| 79 |
| 62 void sendNodeTransitionEvents( | 80 void sendNodeTransitionEvents( |
| 63 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget, | 81 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget, |
| 64 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget, | 82 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget, |
| 65 PassRefPtrWillBeRawPtr<PointerEvent>, | 83 PassRefPtrWillBeRawPtr<PointerEvent>, |
| 66 const PlatformMouseEvent& = PlatformMouseEvent(), | 84 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 67 bool sendMouseEvent = false); | 85 bool sendMouseEvent = false); |
| 68 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>, | 86 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>, |
| 69 PassRefPtrWillBeRawPtr<EventTarget>); | 87 PassRefPtrWillBeRawPtr<EventTarget>); |
| 88 void processPendingPointerCapture( |
| 89 const PassRefPtrWillBeRawPtr<PointerEvent>, |
| 90 const PassRefPtrWillBeRawPtr<EventTarget>, |
| 91 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 92 bool sendMouseEvent = false); |
| 93 void removeTargetFromPointerCapturingMapping( |
| 94 PointerCapturingMap&, const EventTarget*); |
| 95 PassRefPtrWillBeRawPtr<EventTarget> getEffectiveTargetForPointerEvent( |
| 96 PassRefPtrWillBeRawPtr<EventTarget>, int); |
| 97 EventTarget* getCapturingNode(int); |
| 98 void removePointer(const PassRefPtrWillBeRawPtr<PointerEvent>); |
| 99 WebInputEventResult dispatchPointerEvent( |
| 100 PassRefPtrWillBeRawPtr<EventTarget>, |
| 101 PassRefPtrWillBeRawPtr<PointerEvent>, |
| 102 bool checkForListener = false); |
| 103 void releasePointerCapture(int); |
| 70 | 104 |
| 71 // Prevents firing mousedown, mousemove & mouseup in-between a canceled poin
terdown and next pointerup/pointercancel. | 105 // Prevents firing mousedown, mousemove & mouseup in-between a canceled poin
terdown and next pointerup/pointercancel. |
| 72 // See "PREVENT MOUSE EVENT flag" in the spec: | 106 // See "PREVENT MOUSE EVENT flag" in the spec: |
| 73 // https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-e
vents | 107 // https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-e
vents |
| 74 bool m_preventMouseEventForPointerTypeMouse; | 108 bool m_preventMouseEventForPointerTypeMouse; |
| 75 | 109 |
| 76 // Note that this map keeps track of node under pointer with id=1 as well | 110 // Note that this map keeps track of node under pointer with id=1 as well |
| 77 // which might be different than m_nodeUnderMouse in EventHandler. That one | 111 // which might be different than m_nodeUnderMouse in EventHandler. That one |
| 78 // keeps track of any compatibility mouse event positions but this map for | 112 // keeps track of any compatibility mouse event positions but this map for |
| 79 // the pointer with id=1 is only taking care of true mouse related events. | 113 // the pointer with id=1 is only taking care of true mouse related events. |
| 80 WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> m_nodeUnderPointer; | 114 WillBeHeapHashMap<int, EventTargetAttributes> m_nodeUnderPointer; |
| 81 | 115 |
| 116 PointerCapturingMap m_pointerCaptureTarget; |
| 117 PointerCapturingMap m_pendingPointerCaptureTarget; |
| 82 PointerEventFactory m_pointerEventFactory; | 118 PointerEventFactory m_pointerEventFactory; |
| 83 }; | 119 }; |
| 84 | 120 |
| 85 } // namespace blink | 121 } // namespace blink |
| 86 | 122 |
| 87 #endif // PointerEventManager_h | 123 #endif // PointerEventManager_h |
| OLD | NEW |