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

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: Created 4 years, 4 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/EventHandlingUtil.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 {
24 WTF_MAKE_NONCOPYABLE(PointerEventManager); 26 WTF_MAKE_NONCOPYABLE(PointerEventManager);
25 DISALLOW_NEW(); 27 DISALLOW_NEW();
26 public: 28 public:
27 explicit PointerEventManager(LocalFrame*); 29 explicit PointerEventManager(LocalFrame*, MouseEventManager*);
28 ~PointerEventManager(); 30 ~PointerEventManager();
29 DECLARE_TRACE(); 31 DECLARE_TRACE();
30 32
31 // Sends the mouse pointer events and the boundary events 33 // Sends the mouse pointer events and the boundary events
32 // that it may cause. It also sends the compat mouse events 34 // that it may cause. It also sends the compat mouse events
33 // and sets the newNodeUnderMouse if the capturing is set 35 // and sets the newNodeUnderMouse if the capturing is set
34 // in this function. 36 // in this function.
35 WebInputEventResult sendMousePointerEvent( 37 WebInputEventResult sendMousePointerEvent(
36 Node* target, const AtomicString& type, 38 Node* target, const AtomicString& type,
37 int clickCount, const PlatformMouseEvent&, 39 int clickCount, const PlatformMouseEvent&,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool hasRecievedOverEvent; 97 bool hasRecievedOverEvent;
96 EventTargetAttributes() 98 EventTargetAttributes()
97 : target(nullptr) 99 : target(nullptr)
98 , hasRecievedOverEvent(false) {} 100 , hasRecievedOverEvent(false) {}
99 EventTargetAttributes(EventTarget* target, 101 EventTargetAttributes(EventTarget* target,
100 bool hasRecievedOverEvent) 102 bool hasRecievedOverEvent)
101 : target(target) 103 : target(target)
102 , hasRecievedOverEvent(hasRecievedOverEvent) {} 104 , hasRecievedOverEvent(hasRecievedOverEvent) {}
103 }; 105 };
104 106
107 class PointerEventBoundaryEventDispatcher : public EventHandlingUtil::Bounda ryEventDispatcher {
108 WTF_MAKE_NONCOPYABLE(PointerEventBoundaryEventDispatcher);
109 DISALLOW_NEW();
110
111 public:
112 DEFINE_INLINE_TRACE()
113 {
114 visitor->trace(m_pointerEvent);
115 EventHandlingUtil::BoundaryEventDispatcher::trace(visitor);
116 }
117 PointerEventBoundaryEventDispatcher(PointerEventManager*, PointerEvent*) ;
118 void dispatchOut(EventTarget*, EventTarget* relatedTarget);
119 void dispatchOver(EventTarget*, EventTarget* relatedTarget);
120 void dispatchLeave(EventTarget*, EventTarget* relatedTarget, bool checkF orListener);
121 void dispatchEnter(EventTarget*, EventTarget* relatedTarget, bool checkF orListener);
122
123 private:
124 void dispatch(EventTarget*, EventTarget* relatedTarget, const AtomicStri ng&, bool checkForListener);
125 PointerEventManager* m_pointerEventManager;
126 Member<PointerEvent> m_pointerEvent;
127 };
128
105 // Inhibits firing of touch-type PointerEvents until unblocked by unblockTou chPointers(). Also 129 // Inhibits firing of touch-type PointerEvents until unblocked by unblockTou chPointers(). Also
106 // sends pointercancels for existing touch-type PointerEvents. 130 // sends pointercancels for existing touch-type PointerEvents.
107 // See: www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default -touch-behaviors 131 // See: www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default -touch-behaviors
108 void blockTouchPointers(); 132 void blockTouchPointers();
109 133
110 // Enables firing of touch-type PointerEvents after they were inhibited by b lockTouchPointers(). 134 // Enables firing of touch-type PointerEvents after they were inhibited by b lockTouchPointers().
111 void unblockTouchPointers(); 135 void unblockTouchPointers();
112 136
113 // Sends touch pointer events and sets consumed bits in TouchInfo array 137 // Sends touch pointer events and sets consumed bits in TouchInfo array
114 // based on the return value of pointer event handlers. 138 // based on the return value of pointer event handlers.
115 void dispatchTouchPointerEvents( 139 void dispatchTouchPointerEvents(
116 const PlatformTouchEvent&, 140 const PlatformTouchEvent&,
117 HeapVector<TouchEventManager::TouchInfo>&); 141 HeapVector<TouchEventManager::TouchInfo>&);
118 142
119 // Returns whether the event is consumed or not. 143 // Returns whether the event is consumed or not.
120 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*); 144 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*);
121 145
122 void sendBoundaryEvents( 146 void sendBoundaryEvents(
123 EventTarget* exitedTarget, 147 EventTarget* exitedTarget,
124 EventTarget* enteredTarget, 148 EventTarget* enteredTarget,
125 PointerEvent*, 149 PointerEvent*);
126 const PlatformMouseEvent& = PlatformMouseEvent(),
127 bool sendMouseEvent = false);
128 void setNodeUnderPointer(PointerEvent*, 150 void setNodeUnderPointer(PointerEvent*,
129 EventTarget*); 151 EventTarget*);
130 152
131 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget| 153 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget|
132 // and sends the got/lostpointercapture events, as per the spec: 154 // and sends the got/lostpointercapture events, as per the spec:
133 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture 155 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture
134 void processPendingPointerCapture(PointerEvent*); 156 void processPendingPointerCapture(PointerEvent*);
135 157
136 // Processes the capture state of a pointer, updates node under 158 // Processes the capture state of a pointer, updates node under
137 // pointer, and sends corresponding boundary events for pointer if 159 // pointer, and sends corresponding boundary events for pointer if
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // the pointer with id=1 is only taking care of true mouse related events. 206 // the pointer with id=1 is only taking care of true mouse related events.
185 using NodeUnderPointerMap = HeapHashMap<int, EventTargetAttributes, 207 using NodeUnderPointerMap = HeapHashMap<int, EventTargetAttributes,
186 WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>>; 208 WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>>;
187 NodeUnderPointerMap m_nodeUnderPointer; 209 NodeUnderPointerMap m_nodeUnderPointer;
188 210
189 PointerCapturingMap m_pointerCaptureTarget; 211 PointerCapturingMap m_pointerCaptureTarget;
190 PointerCapturingMap m_pendingPointerCaptureTarget; 212 PointerCapturingMap m_pendingPointerCaptureTarget;
191 213
192 PointerEventFactory m_pointerEventFactory; 214 PointerEventFactory m_pointerEventFactory;
193 TouchEventManager m_touchEventManager; 215 TouchEventManager m_touchEventManager;
216 MouseEventManager* m_mouseEventManager;
194 }; 217 };
195 218
196 } // namespace blink 219 } // namespace blink
197 220
198 #endif // PointerEventManager_h 221 #endif // PointerEventManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698