| 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 sends pointerout/leave/over/enter |
| 47 // only when isFrameBoundaryTransition is true which indicates the |
| 48 // transition is over the document boundary and not only the elements border |
| 49 // inside the document. If isFrameBoundaryTransition is false, |
| 50 // then the event is a compatibility event like those created by touch |
| 51 // and in that case the corresponding pointer events will be handled by |
| 52 // sendTouchPointerEvent for example and there is no need to send pointer |
| 53 // transition events. Note that normal mouse events (e.g. mousemove/down/up) |
| 54 // and their corresponding transition events will be handled altogether by |
| 55 // sendMousePointerEvent function. |
| 56 void sendMouseAndPossiblyPointerNodeTransitionEvents( |
| 57 PassRefPtrWillBeRawPtr<Node> exitedNode, |
| 46 PassRefPtrWillBeRawPtr<Node> enteredNode, | 58 PassRefPtrWillBeRawPtr<Node> enteredNode, |
| 47 const PlatformMouseEvent&, | 59 const PlatformMouseEvent&, |
| 48 PassRefPtrWillBeRawPtr<AbstractView>); | 60 PassRefPtrWillBeRawPtr<AbstractView>, bool isFrameBoundaryTransition); |
| 49 | 61 |
| 50 // Clear all the existing ids. | 62 // Clear all the existing ids. |
| 51 void clear(); | 63 void clear(); |
| 52 | 64 |
| 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*); | 65 void elementRemoved(EventTarget*); |
| 58 void setPointerCapture(int, EventTarget*); | 66 void setPointerCapture(int, EventTarget*); |
| 59 void releasePointerCapture(int, EventTarget*); | 67 void releasePointerCapture(int, EventTarget*); |
| 60 bool isActive(const int); | 68 bool isActive(const int); |
| 61 | 69 |
| 62 private: | 70 private: |
| 63 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> PointerCaptu
ringMap; | 71 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> PointerCaptu
ringMap; |
| 64 class EventTargetAttributes { | 72 class EventTargetAttributes { |
| 65 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 73 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 66 public: | 74 public: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 , hasRecievedOverEvent(hasRecievedOverEvent) {} | 87 , hasRecievedOverEvent(hasRecievedOverEvent) {} |
| 80 }; | 88 }; |
| 81 | 89 |
| 82 void sendNodeTransitionEvents( | 90 void sendNodeTransitionEvents( |
| 83 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget, | 91 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget, |
| 84 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget, | 92 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget, |
| 85 PassRefPtrWillBeRawPtr<PointerEvent>, | 93 PassRefPtrWillBeRawPtr<PointerEvent>, |
| 86 const PlatformMouseEvent& = PlatformMouseEvent(), | 94 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 87 bool sendMouseEvent = false); | 95 bool sendMouseEvent = false); |
| 88 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>, | 96 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>, |
| 89 PassRefPtrWillBeRawPtr<EventTarget>); | 97 PassRefPtrWillBeRawPtr<EventTarget>, bool sendEvent = true); |
| 90 void processPendingPointerCapture( | 98 |
| 99 // Returns whether the pointer capture is changed. In this case this |
| 100 // function will take care of transition events and setNodeUnderPointer |
| 101 // should not send transition events. |
| 102 bool processPendingPointerCapture( |
| 91 const PassRefPtrWillBeRawPtr<PointerEvent>, | 103 const PassRefPtrWillBeRawPtr<PointerEvent>, |
| 92 const PassRefPtrWillBeRawPtr<EventTarget>, | 104 const PassRefPtrWillBeRawPtr<EventTarget>, |
| 93 const PlatformMouseEvent& = PlatformMouseEvent(), | 105 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 94 bool sendMouseEvent = false); | 106 bool sendMouseEvent = false); |
| 107 |
| 108 // Processes the capture state of a pointer, updates node under |
| 109 // pointer, and sends corresponding transition events for pointer if |
| 110 // setPointerPosition is true. It also sends corresponding transition events |
| 111 // for mouse if sendMouseEvent is true. |
| 112 void processCaptureAndPositionOfPointerEvent( |
| 113 const PassRefPtrWillBeRawPtr<PointerEvent>, |
| 114 const PassRefPtrWillBeRawPtr<EventTarget> hitTestTarget, |
| 115 const PassRefPtrWillBeRawPtr<EventTarget> lastNodeUnderMouse = nullptr, |
| 116 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 117 bool sendMouseEvent = false, |
| 118 bool setPointerPosition = true); |
| 119 |
| 95 void removeTargetFromPointerCapturingMapping( | 120 void removeTargetFromPointerCapturingMapping( |
| 96 PointerCapturingMap&, const EventTarget*); | 121 PointerCapturingMap&, const EventTarget*); |
| 97 PassRefPtrWillBeRawPtr<EventTarget> getEffectiveTargetForPointerEvent( | 122 PassRefPtrWillBeRawPtr<EventTarget> getEffectiveTargetForPointerEvent( |
| 98 PassRefPtrWillBeRawPtr<EventTarget>, int); | 123 PassRefPtrWillBeRawPtr<EventTarget>, int); |
| 99 EventTarget* getCapturingNode(int); | 124 EventTarget* getCapturingNode(int); |
| 100 void removePointer(const PassRefPtrWillBeRawPtr<PointerEvent>); | 125 void removePointer(const PassRefPtrWillBeRawPtr<PointerEvent>); |
| 101 WebInputEventResult dispatchPointerEvent( | 126 WebInputEventResult dispatchPointerEvent( |
| 102 PassRefPtrWillBeRawPtr<EventTarget>, | 127 PassRefPtrWillBeRawPtr<EventTarget>, |
| 103 PassRefPtrWillBeRawPtr<PointerEvent>, | 128 PassRefPtrWillBeRawPtr<PointerEvent>, |
| 104 bool checkForListener = false); | 129 bool checkForListener = false); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 116 WillBeHeapHashMap<int, EventTargetAttributes> m_nodeUnderPointer; | 141 WillBeHeapHashMap<int, EventTargetAttributes> m_nodeUnderPointer; |
| 117 | 142 |
| 118 PointerCapturingMap m_pointerCaptureTarget; | 143 PointerCapturingMap m_pointerCaptureTarget; |
| 119 PointerCapturingMap m_pendingPointerCaptureTarget; | 144 PointerCapturingMap m_pendingPointerCaptureTarget; |
| 120 PointerEventFactory m_pointerEventFactory; | 145 PointerEventFactory m_pointerEventFactory; |
| 121 }; | 146 }; |
| 122 | 147 |
| 123 } // namespace blink | 148 } // namespace blink |
| 124 | 149 |
| 125 #endif // PointerEventManager_h | 150 #endif // PointerEventManager_h |
| OLD | NEW |