| 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" |
| 11 #include "core/input/BoundaryEventDispatcher.h" | 11 #include "core/input/BoundaryEventDispatcher.h" |
| 12 #include "core/input/TouchEventManager.h" | 12 #include "core/input/TouchEventManager.h" |
| 13 #include "public/platform/WebInputEventResult.h" | 13 #include "public/platform/WebInputEventResult.h" |
| 14 #include "public/platform/WebPointerProperties.h" | 14 #include "public/platform/WebPointerProperties.h" |
| 15 #include "wtf/Allocator.h" | 15 #include "wtf/Allocator.h" |
| 16 #include "wtf/HashMap.h" | 16 #include "wtf/HashMap.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class LocalFrame; | 20 class LocalFrame; |
| 21 class MouseEventManager; | 21 class MouseEventManager; |
| 22 | 22 |
| 23 // This class takes care of dispatching all pointer events and keeps track of | 23 // This class takes care of dispatching all pointer events and keeps track of |
| 24 // properties of active pointer events. | 24 // properties of active pointer events. |
| 25 class CORE_EXPORT PointerEventManager | 25 class CORE_EXPORT PointerEventManager |
| 26 : public GarbageCollectedFinalized<PointerEventManager> { | 26 : public GarbageCollectedFinalized<PointerEventManager> { |
| 27 WTF_MAKE_NONCOPYABLE(PointerEventManager); | 27 WTF_MAKE_NONCOPYABLE(PointerEventManager); |
| 28 | 28 |
| 29 public: | 29 public: |
| 30 explicit PointerEventManager(LocalFrame*, MouseEventManager*); | 30 PointerEventManager(LocalFrame*, MouseEventManager*); |
| 31 DECLARE_TRACE(); | 31 DECLARE_TRACE(); |
| 32 | 32 |
| 33 // Sends the mouse pointer events and the boundary events | 33 // Sends the mouse pointer events and the boundary events |
| 34 // that it may cause. It also sends the compat mouse events | 34 // that it may cause. It also sends the compat mouse events |
| 35 // and sets the newNodeUnderMouse if the capturing is set | 35 // and sets the newNodeUnderMouse if the capturing is set |
| 36 // in this function. | 36 // in this function. |
| 37 WebInputEventResult sendMousePointerEvent(Node* target, | 37 WebInputEventResult sendMousePointerEvent(Node* target, |
| 38 const AtomicString& type, | 38 const AtomicString& type, |
| 39 int clickCount, | 39 const PlatformMouseEvent&); |
| 40 const PlatformMouseEvent&, | |
| 41 Node* lastNodeUnderMouse, | |
| 42 Node** newNodeUnderMouse); | |
| 43 | 40 |
| 44 WebInputEventResult handleTouchEvents(const PlatformTouchEvent&); | 41 WebInputEventResult handleTouchEvents(const PlatformTouchEvent&); |
| 45 | 42 |
| 46 // Sends boundary events mouseout/leave/over/enter to the | 43 // Sends boundary events pointerout/leave/over/enter and |
| 47 // corresponding targets. This function sends pointerout/leave/over/enter | 44 // mouseout/leave/over/enter to the corresponding targets. |
| 48 // only when isFrameBoundaryTransition is true which indicates the | 45 // inside the document. This functions handles the cases that pointer is |
| 49 // transition is over the document boundary and not only the elements border | 46 // leaving a frame. Note that normal mouse events (e.g. mousemove/down/up) |
| 50 // inside the document. If isFrameBoundaryTransition is false, | |
| 51 // then the event is a compatibility event like those created by touch | |
| 52 // and in that case the corresponding pointer events will be handled by | |
| 53 // sendTouchPointerEvent for example and there is no need to send pointer | |
| 54 // boundary events. Note that normal mouse events (e.g. mousemove/down/up) | |
| 55 // and their corresponding boundary events will be handled altogether by | 47 // and their corresponding boundary events will be handled altogether by |
| 56 // sendMousePointerEvent function. | 48 // sendMousePointerEvent function. |
| 57 void sendMouseAndPossiblyPointerBoundaryEvents( | 49 void sendMouseAndPointerBoundaryEvents(Node* enteredNode, |
| 58 Node* exitedNode, | 50 const PlatformMouseEvent&); |
| 59 Node* enteredNode, | |
| 60 const PlatformMouseEvent&, | |
| 61 bool isFrameBoundaryTransition); | |
| 62 | 51 |
| 63 // Resets the internal state of this object. | 52 // Resets the internal state of this object. |
| 64 void clear(); | 53 void clear(); |
| 65 | 54 |
| 66 void elementRemoved(EventTarget*); | 55 void elementRemoved(EventTarget*); |
| 67 | 56 |
| 68 void setPointerCapture(int, EventTarget*); | 57 void setPointerCapture(int, EventTarget*); |
| 69 void releasePointerCapture(int, EventTarget*); | 58 void releasePointerCapture(int, EventTarget*); |
| 70 | 59 |
| 71 // See Element::hasPointerCapture(int). | 60 // See Element::hasPointerCapture(int). |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 void processPendingPointerCapture(PointerEvent*); | 148 void processPendingPointerCapture(PointerEvent*); |
| 160 | 149 |
| 161 // Processes the capture state of a pointer, updates node under | 150 // Processes the capture state of a pointer, updates node under |
| 162 // pointer, and sends corresponding boundary events for pointer if | 151 // pointer, and sends corresponding boundary events for pointer if |
| 163 // setPointerPosition is true. It also sends corresponding boundary events | 152 // setPointerPosition is true. It also sends corresponding boundary events |
| 164 // for mouse if sendMouseEvent is true. | 153 // for mouse if sendMouseEvent is true. |
| 165 // Returns the target that the pointer event is supposed to be fired at. | 154 // Returns the target that the pointer event is supposed to be fired at. |
| 166 EventTarget* processCaptureAndPositionOfPointerEvent( | 155 EventTarget* processCaptureAndPositionOfPointerEvent( |
| 167 PointerEvent*, | 156 PointerEvent*, |
| 168 EventTarget* hitTestTarget, | 157 EventTarget* hitTestTarget, |
| 169 EventTarget* lastNodeUnderMouse = nullptr, | |
| 170 const PlatformMouseEvent& = PlatformMouseEvent(), | 158 const PlatformMouseEvent& = PlatformMouseEvent(), |
| 171 bool sendMouseEvent = false, | 159 bool sendMouseEvent = false); |
| 172 bool setPointerPosition = true); | |
| 173 | 160 |
| 174 void removeTargetFromPointerCapturingMapping(PointerCapturingMap&, | 161 void removeTargetFromPointerCapturingMapping(PointerCapturingMap&, |
| 175 const EventTarget*); | 162 const EventTarget*); |
| 176 EventTarget* getEffectiveTargetForPointerEvent(EventTarget*, int); | 163 EventTarget* getEffectiveTargetForPointerEvent(EventTarget*, int); |
| 177 EventTarget* getCapturingNode(int); | 164 EventTarget* getCapturingNode(int); |
| 178 void removePointer(PointerEvent*); | 165 void removePointer(PointerEvent*); |
| 179 WebInputEventResult dispatchPointerEvent(EventTarget*, | 166 WebInputEventResult dispatchPointerEvent(EventTarget*, |
| 180 PointerEvent*, | 167 PointerEvent*, |
| 181 bool checkForListener = false); | 168 bool checkForListener = false); |
| 182 void releasePointerCapture(int); | 169 void releasePointerCapture(int); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 PointerCapturingMap m_pendingPointerCaptureTarget; | 204 PointerCapturingMap m_pendingPointerCaptureTarget; |
| 218 | 205 |
| 219 PointerEventFactory m_pointerEventFactory; | 206 PointerEventFactory m_pointerEventFactory; |
| 220 Member<TouchEventManager> m_touchEventManager; | 207 Member<TouchEventManager> m_touchEventManager; |
| 221 Member<MouseEventManager> m_mouseEventManager; | 208 Member<MouseEventManager> m_mouseEventManager; |
| 222 }; | 209 }; |
| 223 | 210 |
| 224 } // namespace blink | 211 } // namespace blink |
| 225 | 212 |
| 226 #endif // PointerEventManager_h | 213 #endif // PointerEventManager_h |
| OLD | NEW |