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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 void clear(); | 58 void clear(); |
| 59 | 59 |
| 60 void elementRemoved(EventTarget*); | 60 void elementRemoved(EventTarget*); |
| 61 void setPointerCapture(int, EventTarget*); | 61 void setPointerCapture(int, EventTarget*); |
| 62 void releasePointerCapture(int, EventTarget*); | 62 void releasePointerCapture(int, EventTarget*); |
| 63 bool isActive(const int) const; | 63 bool isActive(const int) const; |
| 64 | 64 |
| 65 // Returns whether there is any touch on the screen. | 65 // Returns whether there is any touch on the screen. |
| 66 bool isAnyTouchActive() const; | 66 bool isAnyTouchActive() const; |
| 67 | 67 |
| 68 // TODO(crbug.com/625843): This can be hidden when mouse refactoring in Even tHandler is done. | |
| 69 EventTarget* getMouseCapturingNode() const; | |
|
dtapuska
2016/07/22 15:57:39
This is odd; returning a ptr from a const object;
Navid Zolghadr
2016/07/22 16:39:24
Done.
| |
| 70 | |
| 68 // Returns true if the primary pointerdown corresponding to the given | 71 // Returns true if the primary pointerdown corresponding to the given |
| 69 // |uniqueTouchEventId| was canceled. Also drops stale ids from | 72 // |uniqueTouchEventId| was canceled. Also drops stale ids from |
| 70 // |m_touchIdsForCanceledPointerdowns|. | 73 // |m_touchIdsForCanceledPointerdowns|. |
| 71 bool primaryPointerdownCanceled(uint32_t uniqueTouchEventId); | 74 bool primaryPointerdownCanceled(uint32_t uniqueTouchEventId); |
| 72 | 75 |
| 73 // Try to immediately send the got/lostpointercapture without boundary | 76 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget| |
| 74 // events. | 77 // and sends the got/lostpointercapture events, as per the spec: |
| 78 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture | |
| 75 // TODO(crbug.com/629935): This function should be private as soon as Pointe rEventManager | 79 // TODO(crbug.com/629935): This function should be private as soon as Pointe rEventManager |
| 76 // a GC managed object and postTask can be done internally in this class. | 80 // a GC managed object and postTask can be done internally in this class. |
| 77 void immediatelyProcessPendingPointerCapture(int pointerId); | 81 void processPendingPointerCapture(int pointerId); |
| 78 | 82 |
| 79 private: | 83 private: |
| 80 typedef HeapHashMap<int, Member<EventTarget>, WTF::IntHash<int>, | 84 typedef HeapHashMap<int, Member<EventTarget>, WTF::IntHash<int>, |
| 81 WTF::UnsignedWithZeroKeyHashTraits<int>> PointerCapturingMap; | 85 WTF::UnsignedWithZeroKeyHashTraits<int>> PointerCapturingMap; |
| 82 class EventTargetAttributes { | 86 class EventTargetAttributes { |
| 83 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 87 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 84 public: | 88 public: |
| 85 DEFINE_INLINE_TRACE() | 89 DEFINE_INLINE_TRACE() |
| 86 { | 90 { |
| 87 visitor->trace(target); | 91 visitor->trace(target); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 114 // Returns whether the event is consumed or not. | 118 // Returns whether the event is consumed or not. |
| 115 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*); | 119 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*); |
| 116 | 120 |
| 117 void sendBoundaryEvents( | 121 void sendBoundaryEvents( |
| 118 EventTarget* exitedTarget, | 122 EventTarget* exitedTarget, |
| 119 EventTarget* enteredTarget, | 123 EventTarget* enteredTarget, |
| 120 PointerEvent*, | 124 PointerEvent*, |
| 121 const PlatformMouseEvent& = PlatformMouseEvent(), | 125 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 122 bool sendMouseEvent = false); | 126 bool sendMouseEvent = false); |
| 123 void setNodeUnderPointer(PointerEvent*, | 127 void setNodeUnderPointer(PointerEvent*, |
| 124 EventTarget*, bool sendEvent = true); | 128 EventTarget*); |
| 125 | |
| 126 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget| | |
| 127 // and sends the got/lostpointercapture events, as per the spec: | |
| 128 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture | |
| 129 // Returns whether the pointer capture is changed. When pointer capture is c hanged, | |
| 130 // this function will take care of boundary events. | |
| 131 bool processPendingPointerCapture( | |
| 132 PointerEvent*, | |
| 133 EventTarget*, | |
| 134 const PlatformMouseEvent& = PlatformMouseEvent(), | |
| 135 bool sendMouseEvent = false); | |
| 136 | 129 |
| 137 // Processes the capture state of a pointer, updates node under | 130 // Processes the capture state of a pointer, updates node under |
| 138 // pointer, and sends corresponding boundary events for pointer if | 131 // pointer, and sends corresponding boundary events for pointer if |
| 139 // setPointerPosition is true. It also sends corresponding boundary events | 132 // setPointerPosition is true. It also sends corresponding boundary events |
| 140 // for mouse if sendMouseEvent is true. | 133 // for mouse if sendMouseEvent is true. |
| 141 void processCaptureAndPositionOfPointerEvent( | 134 // Returns the target that the pointer event is supposed to be fired at. |
| 135 EventTarget* processCaptureAndPositionOfPointerEvent( | |
| 142 PointerEvent*, | 136 PointerEvent*, |
| 143 EventTarget* hitTestTarget, | 137 EventTarget* hitTestTarget, |
| 144 EventTarget* lastNodeUnderMouse = nullptr, | 138 EventTarget* lastNodeUnderMouse = nullptr, |
| 145 const PlatformMouseEvent& = PlatformMouseEvent(), | 139 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 146 bool sendMouseEvent = false, | 140 bool sendMouseEvent = false, |
| 147 bool setPointerPosition = true); | 141 bool setPointerPosition = true); |
| 148 | 142 |
| 149 void removeTargetFromPointerCapturingMapping( | 143 void removeTargetFromPointerCapturingMapping( |
| 150 PointerCapturingMap&, const EventTarget*); | 144 PointerCapturingMap&, const EventTarget*); |
| 151 EventTarget* getEffectiveTargetForPointerEvent( | 145 EventTarget* getEffectiveTargetForPointerEvent( |
| 152 EventTarget*, int); | 146 EventTarget*, int); |
| 153 EventTarget* getCapturingNode(int); | 147 EventTarget* getCapturingNode(int) const; |
|
dtapuska
2016/07/22 15:57:39
ditto
Navid Zolghadr
2016/07/22 16:39:24
Done.
| |
| 154 void removePointer(PointerEvent*); | 148 void removePointer(PointerEvent*); |
| 155 WebInputEventResult dispatchPointerEvent( | 149 WebInputEventResult dispatchPointerEvent( |
| 156 EventTarget*, | 150 EventTarget*, |
| 157 PointerEvent*, | 151 PointerEvent*, |
| 158 bool checkForListener = false); | 152 bool checkForListener = false); |
| 159 void modifyPendingPointerCapture(int pointerId, EventTarget*); | 153 void modifyPendingPointerCapture(int pointerId, EventTarget*); |
| 160 // Returns true if capture target and pending capture target were different. | 154 // Returns true if capture target and pending capture target were different. |
| 161 bool getPointerCaptureState(int pointerId, | 155 bool getPointerCaptureState(int pointerId, |
| 162 EventTarget** pointerCaptureTarget, | 156 EventTarget** pointerCaptureTarget, |
| 163 EventTarget** pendingPointerCaptureTarget); | 157 EventTarget** pendingPointerCaptureTarget); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 189 PointerCapturingMap m_pointerCaptureTarget; | 183 PointerCapturingMap m_pointerCaptureTarget; |
| 190 PointerCapturingMap m_pendingPointerCaptureTarget; | 184 PointerCapturingMap m_pendingPointerCaptureTarget; |
| 191 | 185 |
| 192 PointerEventFactory m_pointerEventFactory; | 186 PointerEventFactory m_pointerEventFactory; |
| 193 TouchEventManager m_touchEventManager; | 187 TouchEventManager m_touchEventManager; |
| 194 }; | 188 }; |
| 195 | 189 |
| 196 } // namespace blink | 190 } // namespace blink |
| 197 | 191 |
| 198 #endif // PointerEventManager_h | 192 #endif // PointerEventManager_h |
| OLD | NEW |