Chromium Code Reviews| 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 void implicitReleasePointerCapture(int); | |
|
mustaq
2016/02/29 19:55:41
implicitReleasePointerCapture could be private.
Navid Zolghadr
2016/02/29 20:10:42
Yup. I forgot to move it to private.
| |
| 61 bool isActive(const int); | |
| 57 | 62 |
| 58 private: | 63 private: |
| 59 PassRefPtrWillBeRawPtr<Node> getEffectiveTargetForPointerEvent( | 64 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> PointerCaptu ringMap; |
| 60 PassRefPtrWillBeRawPtr<Node>, | 65 class NodeUnderPointerAttributes { |
|
mustaq
2016/02/29 19:55:40
EventTargetAttributes?
Navid Zolghadr
2016/02/29 20:10:42
Sure. I Will rename.
| |
| 61 PassRefPtrWillBeRawPtr<PointerEvent>); | 66 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 67 public: | |
| 68 DEFINE_INLINE_TRACE() | |
| 69 { | |
| 70 visitor->trace(target); | |
| 71 } | |
| 72 RefPtrWillBeMember<EventTarget> target; | |
| 73 bool hasRecievedOverEvent; | |
| 74 NodeUnderPointerAttributes() {} | |
| 75 NodeUnderPointerAttributes(PassRefPtrWillBeRawPtr<EventTarget> target, | |
| 76 bool hasRecievedOverEvent) | |
| 77 : target(target) | |
| 78 , hasRecievedOverEvent(hasRecievedOverEvent) {} | |
| 79 }; | |
| 80 | |
| 62 void sendNodeTransitionEvents( | 81 void sendNodeTransitionEvents( |
| 63 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget, | 82 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget, |
| 64 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget, | 83 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget, |
| 65 PassRefPtrWillBeRawPtr<PointerEvent>, | 84 PassRefPtrWillBeRawPtr<PointerEvent>, |
| 66 const PlatformMouseEvent& = PlatformMouseEvent(), | 85 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 67 bool sendMouseEvent = false); | 86 bool sendMouseEvent = false); |
| 68 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>, | 87 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>, |
| 69 PassRefPtrWillBeRawPtr<EventTarget>); | 88 PassRefPtrWillBeRawPtr<EventTarget>); |
| 89 void processPendingPointerCapture( | |
| 90 const PassRefPtrWillBeRawPtr<PointerEvent>, | |
| 91 PassRefPtrWillBeRawPtr<EventTarget>, | |
| 92 const PlatformMouseEvent& = PlatformMouseEvent(), | |
| 93 bool sendMouseEvent = false); | |
| 94 void removeTargetFromPointerCapturingMapping(PointerCapturingMap&, EventTarg et*); | |
| 95 PassRefPtrWillBeRawPtr<EventTarget> getEffectiveTargetForPointerEvent( | |
| 96 PassRefPtrWillBeRawPtr<EventTarget>, int); | |
| 97 EventTarget* getCapturingNode(int); | |
| 98 void removePointerEvent(const PassRefPtrWillBeRawPtr<PointerEvent>); | |
| 99 WebInputEventResult dispatchPointerEvent( | |
| 100 PassRefPtrWillBeRawPtr<EventTarget>, | |
| 101 PassRefPtrWillBeRawPtr<PointerEvent>, | |
| 102 bool checkForListener = false); | |
| 103 | |
| 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, NodeUnderPointerAttributes> 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 |