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

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: Rebasing 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 : public GarbageCollectedFinalized<Pointer EventManager> {
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 DECLARE_TRACE(); 29 DECLARE_TRACE();
30 30
31 // Sends the mouse pointer events and the boundary events 31 // Sends the mouse pointer events and the boundary events
32 // that it may cause. It also sends the compat mouse events 32 // that it may cause. It also sends the compat mouse events
33 // and sets the newNodeUnderMouse if the capturing is set 33 // and sets the newNodeUnderMouse if the capturing is set
34 // in this function. 34 // in this function.
35 WebInputEventResult sendMousePointerEvent( 35 WebInputEventResult sendMousePointerEvent(
36 Node* target, const AtomicString& type, 36 Node* target, const AtomicString& type,
37 int clickCount, const PlatformMouseEvent&, 37 int clickCount, const PlatformMouseEvent&,
38 Node* lastNodeUnderMouse, 38 Node* lastNodeUnderMouse,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 bool hasRecievedOverEvent; 99 bool hasRecievedOverEvent;
100 EventTargetAttributes() 100 EventTargetAttributes()
101 : target(nullptr) 101 : target(nullptr)
102 , hasRecievedOverEvent(false) {} 102 , hasRecievedOverEvent(false) {}
103 EventTargetAttributes(EventTarget* target, 103 EventTargetAttributes(EventTarget* target,
104 bool hasRecievedOverEvent) 104 bool hasRecievedOverEvent)
105 : target(target) 105 : target(target)
106 , hasRecievedOverEvent(hasRecievedOverEvent) {} 106 , hasRecievedOverEvent(hasRecievedOverEvent) {}
107 }; 107 };
108 108
109 class PointerEventBoundaryEventDispatcher : public BoundaryEventDispatcher {
110 WTF_MAKE_NONCOPYABLE(PointerEventBoundaryEventDispatcher);
111
112 public:
113 PointerEventBoundaryEventDispatcher(PointerEventManager*, PointerEvent*) ;
114
115 protected:
116 void dispatchOut(EventTarget*, EventTarget* relatedTarget) override;
117 void dispatchOver(EventTarget*, EventTarget* relatedTarget) override;
118 void dispatchLeave(EventTarget*, EventTarget* relatedTarget, bool checkF orListener) override;
119 void dispatchEnter(EventTarget*, EventTarget* relatedTarget, bool checkF orListener) override;
120 AtomicString getLeaveEvent() override;
121 AtomicString getEnterEvent() override;
122
123 private:
124 void dispatch(EventTarget*, EventTarget* relatedTarget, const AtomicStri ng&, bool checkForListener);
125 Member<PointerEventManager> m_pointerEventManager;
126 Member<PointerEvent> m_pointerEvent;
127 };
128
109 // 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
110 // sends pointercancels for existing touch-type PointerEvents. 130 // sends pointercancels for existing touch-type PointerEvents.
111 // 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
112 void blockTouchPointers(); 132 void blockTouchPointers();
113 133
114 // 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().
115 void unblockTouchPointers(); 135 void unblockTouchPointers();
116 136
117 // Sends touch pointer events and sets consumed bits in TouchInfo array 137 // Sends touch pointer events and sets consumed bits in TouchInfo array
118 // based on the return value of pointer event handlers. 138 // based on the return value of pointer event handlers.
119 void dispatchTouchPointerEvents( 139 void dispatchTouchPointerEvents(
120 const PlatformTouchEvent&, 140 const PlatformTouchEvent&,
121 HeapVector<TouchEventManager::TouchInfo>&); 141 HeapVector<TouchEventManager::TouchInfo>&);
122 142
123 // Returns whether the event is consumed or not. 143 // Returns whether the event is consumed or not.
124 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*); 144 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*);
125 145
126 void sendBoundaryEvents( 146 void sendBoundaryEvents(
127 EventTarget* exitedTarget, 147 EventTarget* exitedTarget,
128 EventTarget* enteredTarget, 148 EventTarget* enteredTarget,
129 PointerEvent*, 149 PointerEvent*);
130 const PlatformMouseEvent& = PlatformMouseEvent(),
131 bool sendMouseEvent = false);
132 void setNodeUnderPointer(PointerEvent*, 150 void setNodeUnderPointer(PointerEvent*,
133 EventTarget*); 151 EventTarget*);
134 152
135 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget| 153 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget|
136 // and sends the got/lostpointercapture events, as per the spec: 154 // and sends the got/lostpointercapture events, as per the spec:
137 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture 155 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture
138 void processPendingPointerCapture(PointerEvent*); 156 void processPendingPointerCapture(PointerEvent*);
139 157
140 // Processes the capture state of a pointer, updates node under 158 // Processes the capture state of a pointer, updates node under
141 // pointer, and sends corresponding boundary events for pointer if 159 // 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 205 // 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. 206 // the pointer with id=1 is only taking care of true mouse related events.
189 using NodeUnderPointerMap = HeapHashMap<int, EventTargetAttributes, 207 using NodeUnderPointerMap = HeapHashMap<int, EventTargetAttributes,
190 WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>>; 208 WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>>;
191 NodeUnderPointerMap m_nodeUnderPointer; 209 NodeUnderPointerMap m_nodeUnderPointer;
192 210
193 PointerCapturingMap m_pointerCaptureTarget; 211 PointerCapturingMap m_pointerCaptureTarget;
194 PointerCapturingMap m_pendingPointerCaptureTarget; 212 PointerCapturingMap m_pendingPointerCaptureTarget;
195 213
196 PointerEventFactory m_pointerEventFactory; 214 PointerEventFactory m_pointerEventFactory;
197 TouchEventManager m_touchEventManager; 215 Member<TouchEventManager> m_touchEventManager;
216 Member<MouseEventManager> m_mouseEventManager;
198 }; 217 };
199 218
200 } // namespace blink 219 } // namespace blink
201 220
202 #endif // PointerEventManager_h 221 #endif // PointerEventManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698