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 11 matching lines...) Expand all Loading... | |
| 22 DISALLOW_NEW(); | 22 DISALLOW_NEW(); |
| 23 public: | 23 public: |
| 24 PointerEventManager(); | 24 PointerEventManager(); |
| 25 ~PointerEventManager(); | 25 ~PointerEventManager(); |
| 26 DECLARE_TRACE(); | 26 DECLARE_TRACE(); |
| 27 | 27 |
| 28 WebInputEventResult sendMousePointerEvent( | 28 WebInputEventResult sendMousePointerEvent( |
| 29 PassRefPtrWillBeRawPtr<Node>, const AtomicString& type, | 29 PassRefPtrWillBeRawPtr<Node>, const AtomicString& type, |
| 30 int clickCount, const PlatformMouseEvent&, | 30 int clickCount, const PlatformMouseEvent&, |
| 31 PassRefPtrWillBeRawPtr<Node> relatedTarget, | 31 PassRefPtrWillBeRawPtr<Node> relatedTarget, |
| 32 PassRefPtrWillBeRawPtr<AbstractView>); | 32 PassRefPtrWillBeRawPtr<AbstractView>, |
| 33 PassRefPtrWillBeRawPtr<Node> lastNodeUnderMouse); | |
| 33 | 34 |
| 34 // Returns whether the event is consumed or not | 35 // Returns whether the event is consumed or not |
| 35 WebInputEventResult sendTouchPointerEvent( | 36 WebInputEventResult sendTouchPointerEvent( |
| 36 PassRefPtrWillBeRawPtr<EventTarget>, | 37 PassRefPtrWillBeRawPtr<EventTarget>, |
| 37 const PlatformTouchPoint&, PlatformEvent::Modifiers, | 38 const PlatformTouchPoint&, PlatformEvent::Modifiers, |
| 38 const double width, const double height, | 39 const double width, const double height, |
| 39 const double clientX, const double clientY); | 40 const double clientX, const double clientY); |
| 40 | 41 |
| 41 void sendTouchCancelPointerEvent(PassRefPtrWillBeRawPtr<EventTarget>, | 42 void sendTouchCancelPointerEvent(PassRefPtrWillBeRawPtr<EventTarget>, |
| 42 const PlatformTouchPoint&); | 43 const PlatformTouchPoint&); |
| 43 | 44 |
| 44 // Sends node transition events (pointer|mouse)(out|leave|over|enter) to the corresponding targets | 45 // Sends node transition events mouseout/leave/over/enter to the |
| 45 void sendNodeTransitionEvents(PassRefPtrWillBeRawPtr<Node> exitedNode, | 46 // corresponding targets. This function does send pointerout/leave/over/ente r |
| 47 // only when the transition is beyond the document boundary which is specifi ed | |
|
mustaq
2016/03/23 18:49:07
The last line is not clear to me, should perhaps s
Navid Zolghadr
2016/03/23 19:47:48
I changed the wording of the last sentence. Does i
mustaq
2016/03/23 20:02:33
Yes, this is clear now.
| |
| 48 // by isFrameBoundaryTransition. | |
| 49 void sendMouseAndPossiblyPointerNodeTransitionEvents( | |
| 50 PassRefPtrWillBeRawPtr<Node> exitedNode, | |
| 46 PassRefPtrWillBeRawPtr<Node> enteredNode, | 51 PassRefPtrWillBeRawPtr<Node> enteredNode, |
| 47 const PlatformMouseEvent&, | 52 const PlatformMouseEvent&, |
| 48 PassRefPtrWillBeRawPtr<AbstractView>); | 53 PassRefPtrWillBeRawPtr<AbstractView>, bool isFrameBoundaryTransition); |
| 49 | 54 |
| 50 // Clear all the existing ids. | 55 // Clear all the existing ids. |
| 51 void clear(); | 56 void clear(); |
| 52 | 57 |
| 53 // May clear PREVENT MOUSE EVENT flag as per pointer event spec: | |
| 54 // https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-eve nts | |
| 55 void conditionallyEnableMouseEventForPointerTypeMouse(unsigned); | |
| 56 | |
| 57 void elementRemoved(EventTarget*); | 58 void elementRemoved(EventTarget*); |
| 58 void setPointerCapture(int, EventTarget*); | 59 void setPointerCapture(int, EventTarget*); |
| 59 void releasePointerCapture(int, EventTarget*); | 60 void releasePointerCapture(int, EventTarget*); |
| 60 bool isActive(const int); | 61 bool isActive(const int); |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> PointerCaptu ringMap; | 64 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> PointerCaptu ringMap; |
| 64 class EventTargetAttributes { | 65 class EventTargetAttributes { |
| 65 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 66 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 66 public: | 67 public: |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 79 , hasRecievedOverEvent(hasRecievedOverEvent) {} | 80 , hasRecievedOverEvent(hasRecievedOverEvent) {} |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 void sendNodeTransitionEvents( | 83 void sendNodeTransitionEvents( |
| 83 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget, | 84 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget, |
| 84 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget, | 85 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget, |
| 85 PassRefPtrWillBeRawPtr<PointerEvent>, | 86 PassRefPtrWillBeRawPtr<PointerEvent>, |
| 86 const PlatformMouseEvent& = PlatformMouseEvent(), | 87 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 87 bool sendMouseEvent = false); | 88 bool sendMouseEvent = false); |
| 88 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>, | 89 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>, |
| 89 PassRefPtrWillBeRawPtr<EventTarget>); | 90 PassRefPtrWillBeRawPtr<EventTarget>, bool sendEvent = true); |
| 90 void processPendingPointerCapture( | 91 |
| 92 // Returns whether the pointer capture is changed. In this case this | |
| 93 // function will take care of transition events and setNodeUnderPointer | |
| 94 // should not send transition events. | |
| 95 bool processPendingPointerCapture( | |
| 91 const PassRefPtrWillBeRawPtr<PointerEvent>, | 96 const PassRefPtrWillBeRawPtr<PointerEvent>, |
| 92 const PassRefPtrWillBeRawPtr<EventTarget>, | 97 const PassRefPtrWillBeRawPtr<EventTarget>, |
| 93 const PlatformMouseEvent& = PlatformMouseEvent(), | 98 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 94 bool sendMouseEvent = false); | 99 bool sendMouseEvent = false); |
| 100 | |
| 101 // Processes the capture state of a pointer, updates node under | |
| 102 // pointer, and sends corresponding transition events for pointer and mouse | |
| 103 // if necessary. | |
|
mustaq
2016/03/23 18:49:07
Comment on the |setPointerPosition| param.
Navid Zolghadr
2016/03/23 19:47:48
Done.
| |
| 104 void processCaptureAndPositionOfPointerEvent( | |
| 105 const PassRefPtrWillBeRawPtr<PointerEvent>, | |
| 106 const PassRefPtrWillBeRawPtr<EventTarget> hitTestTarget, | |
| 107 const PassRefPtrWillBeRawPtr<EventTarget> lastNodeUnderMouse = nullptr, | |
| 108 const PlatformMouseEvent& = PlatformMouseEvent(), | |
| 109 bool sendMouseEvent = false, | |
| 110 bool setPointerPosition = true); | |
| 111 | |
| 95 void removeTargetFromPointerCapturingMapping( | 112 void removeTargetFromPointerCapturingMapping( |
| 96 PointerCapturingMap&, const EventTarget*); | 113 PointerCapturingMap&, const EventTarget*); |
| 97 PassRefPtrWillBeRawPtr<EventTarget> getEffectiveTargetForPointerEvent( | 114 PassRefPtrWillBeRawPtr<EventTarget> getEffectiveTargetForPointerEvent( |
| 98 PassRefPtrWillBeRawPtr<EventTarget>, int); | 115 PassRefPtrWillBeRawPtr<EventTarget>, int); |
| 99 EventTarget* getCapturingNode(int); | 116 EventTarget* getCapturingNode(int); |
| 100 void removePointer(const PassRefPtrWillBeRawPtr<PointerEvent>); | 117 void removePointer(const PassRefPtrWillBeRawPtr<PointerEvent>); |
| 101 WebInputEventResult dispatchPointerEvent( | 118 WebInputEventResult dispatchPointerEvent( |
| 102 PassRefPtrWillBeRawPtr<EventTarget>, | 119 PassRefPtrWillBeRawPtr<EventTarget>, |
| 103 PassRefPtrWillBeRawPtr<PointerEvent>, | 120 PassRefPtrWillBeRawPtr<PointerEvent>, |
| 104 bool checkForListener = false); | 121 bool checkForListener = false); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 116 WillBeHeapHashMap<int, EventTargetAttributes> m_nodeUnderPointer; | 133 WillBeHeapHashMap<int, EventTargetAttributes> m_nodeUnderPointer; |
| 117 | 134 |
| 118 PointerCapturingMap m_pointerCaptureTarget; | 135 PointerCapturingMap m_pointerCaptureTarget; |
| 119 PointerCapturingMap m_pendingPointerCaptureTarget; | 136 PointerCapturingMap m_pendingPointerCaptureTarget; |
| 120 PointerEventFactory m_pointerEventFactory; | 137 PointerEventFactory m_pointerEventFactory; |
| 121 }; | 138 }; |
| 122 | 139 |
| 123 } // namespace blink | 140 } // namespace blink |
| 124 | 141 |
| 125 #endif // PointerEventManager_h | 142 #endif // PointerEventManager_h |
| OLD | NEW |