Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/Source/core/input/PointerEventManager.h

Issue 2255323004: Create MouseEventManager and EventHandlingUtil (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make all *Manager classes GarbageCollected Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/TouchEventManager.h" 12 #include "core/input/TouchEventManager.h"
12 #include "public/platform/WebInputEventResult.h" 13 #include "public/platform/WebInputEventResult.h"
13 #include "public/platform/WebPointerProperties.h" 14 #include "public/platform/WebPointerProperties.h"
14 #include "wtf/Allocator.h" 15 #include "wtf/Allocator.h"
15 #include "wtf/HashMap.h" 16 #include "wtf/HashMap.h"
16 17
17 namespace blink { 18 namespace blink {
18 19
19 class LocalFrame; 20 class LocalFrame;
21 class MouseEventManager;
20 22
21 // 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
22 // properties of active pointer events. 24 // properties of active pointer events.
23 class CORE_EXPORT PointerEventManager { 25 class CORE_EXPORT PointerEventManager final : public GarbageCollectedFinalized<P ointerEventManager> {
24 WTF_MAKE_NONCOPYABLE(PointerEventManager); 26 WTF_MAKE_NONCOPYABLE(PointerEventManager);
25 DISALLOW_NEW();
26 public: 27 public:
27 explicit PointerEventManager(LocalFrame*); 28 explicit PointerEventManager(LocalFrame*, MouseEventManager*);
28 ~PointerEventManager(); 29 ~PointerEventManager();
29 DECLARE_TRACE(); 30 DECLARE_TRACE();
30 31
31 // Sends the mouse pointer events and the boundary events 32 // Sends the mouse pointer events and the boundary events
32 // that it may cause. It also sends the compat mouse events 33 // that it may cause. It also sends the compat mouse events
33 // and sets the newNodeUnderMouse if the capturing is set 34 // and sets the newNodeUnderMouse if the capturing is set
34 // in this function. 35 // in this function.
35 WebInputEventResult sendMousePointerEvent( 36 WebInputEventResult sendMousePointerEvent(
36 Node* target, const AtomicString& type, 37 Node* target, const AtomicString& type,
37 int clickCount, const PlatformMouseEvent&, 38 int clickCount, const PlatformMouseEvent&,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 bool hasRecievedOverEvent; 100 bool hasRecievedOverEvent;
100 EventTargetAttributes() 101 EventTargetAttributes()
101 : target(nullptr) 102 : target(nullptr)
102 , hasRecievedOverEvent(false) {} 103 , hasRecievedOverEvent(false) {}
103 EventTargetAttributes(EventTarget* target, 104 EventTargetAttributes(EventTarget* target,
104 bool hasRecievedOverEvent) 105 bool hasRecievedOverEvent)
105 : target(target) 106 : target(target)
106 , hasRecievedOverEvent(hasRecievedOverEvent) {} 107 , hasRecievedOverEvent(hasRecievedOverEvent) {}
107 }; 108 };
108 109
110 class PointerEventBoundaryEventDispatcher : public BoundaryEventDispatcher {
111 WTF_MAKE_NONCOPYABLE(PointerEventBoundaryEventDispatcher);
112
113 public:
114 DEFINE_INLINE_TRACE()
haraken 2016/09/01 23:31:15 We don't need to add TRACE to STACK_ALLOCATED obje
Navid Zolghadr 2016/09/02 16:36:46 Done.
115 {
116 visitor->trace(m_pointerEvent);
117 visitor->trace(m_pointerEventManager);
118 BoundaryEventDispatcher::trace(visitor);
119 }
120 PointerEventBoundaryEventDispatcher(PointerEventManager*, PointerEvent*) ;
121
122 protected:
123 void dispatchOut(EventTarget*, EventTarget* relatedTarget) override;
124 void dispatchOver(EventTarget*, EventTarget* relatedTarget) override;
125 void dispatchLeave(EventTarget*, EventTarget* relatedTarget, bool checkF orListener) override;
126 void dispatchEnter(EventTarget*, EventTarget* relatedTarget, bool checkF orListener) override;
127 AtomicString getLeaveEvent() override;
128 AtomicString getEnterEvent() override;
129
130 private:
131 void dispatch(EventTarget*, EventTarget* relatedTarget, const AtomicStri ng&, bool checkForListener);
132 Member<PointerEventManager> m_pointerEventManager;
133 Member<PointerEvent> m_pointerEvent;
134 };
135
109 // Inhibits firing of touch-type PointerEvents until unblocked by unblockTou chPointers(). Also 136 // Inhibits firing of touch-type PointerEvents until unblocked by unblockTou chPointers(). Also
110 // sends pointercancels for existing touch-type PointerEvents. 137 // sends pointercancels for existing touch-type PointerEvents.
111 // See: www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default -touch-behaviors 138 // See: www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default -touch-behaviors
112 void blockTouchPointers(); 139 void blockTouchPointers();
113 140
114 // Enables firing of touch-type PointerEvents after they were inhibited by b lockTouchPointers(). 141 // Enables firing of touch-type PointerEvents after they were inhibited by b lockTouchPointers().
115 void unblockTouchPointers(); 142 void unblockTouchPointers();
116 143
117 // Sends touch pointer events and sets consumed bits in TouchInfo array 144 // Sends touch pointer events and sets consumed bits in TouchInfo array
118 // based on the return value of pointer event handlers. 145 // based on the return value of pointer event handlers.
119 void dispatchTouchPointerEvents( 146 void dispatchTouchPointerEvents(
120 const PlatformTouchEvent&, 147 const PlatformTouchEvent&,
121 HeapVector<TouchEventManager::TouchInfo>&); 148 HeapVector<TouchEventManager::TouchInfo>&);
122 149
123 // Returns whether the event is consumed or not. 150 // Returns whether the event is consumed or not.
124 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*); 151 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*);
125 152
126 void sendBoundaryEvents( 153 void sendBoundaryEvents(
127 EventTarget* exitedTarget, 154 EventTarget* exitedTarget,
128 EventTarget* enteredTarget, 155 EventTarget* enteredTarget,
129 PointerEvent*, 156 PointerEvent*);
130 const PlatformMouseEvent& = PlatformMouseEvent(),
131 bool sendMouseEvent = false);
132 void setNodeUnderPointer(PointerEvent*, 157 void setNodeUnderPointer(PointerEvent*,
133 EventTarget*); 158 EventTarget*);
134 159
135 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget| 160 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget|
136 // and sends the got/lostpointercapture events, as per the spec: 161 // and sends the got/lostpointercapture events, as per the spec:
137 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture 162 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture
138 void processPendingPointerCapture(PointerEvent*); 163 void processPendingPointerCapture(PointerEvent*);
139 164
140 // Processes the capture state of a pointer, updates node under 165 // Processes the capture state of a pointer, updates node under
141 // pointer, and sends corresponding boundary events for pointer if 166 // pointer, and sends corresponding boundary events for pointer if
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // keeps track of any compatibility mouse event positions but this map for 212 // keeps track of any compatibility mouse event positions but this map for
188 // the pointer with id=1 is only taking care of true mouse related events. 213 // the pointer with id=1 is only taking care of true mouse related events.
189 using NodeUnderPointerMap = HeapHashMap<int, EventTargetAttributes, 214 using NodeUnderPointerMap = HeapHashMap<int, EventTargetAttributes,
190 WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>>; 215 WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>>;
191 NodeUnderPointerMap m_nodeUnderPointer; 216 NodeUnderPointerMap m_nodeUnderPointer;
192 217
193 PointerCapturingMap m_pointerCaptureTarget; 218 PointerCapturingMap m_pointerCaptureTarget;
194 PointerCapturingMap m_pendingPointerCaptureTarget; 219 PointerCapturingMap m_pendingPointerCaptureTarget;
195 220
196 PointerEventFactory m_pointerEventFactory; 221 PointerEventFactory m_pointerEventFactory;
197 TouchEventManager m_touchEventManager; 222 Member<TouchEventManager> m_touchEventManager;
223 Member<MouseEventManager> m_mouseEventManager;
198 }; 224 };
199 225
200 } // namespace blink 226 } // namespace blink
201 227
202 #endif // PointerEventManager_h 228 #endif // PointerEventManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698