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

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

Issue 2174863002: Change mouse pointer event targets to the capturing node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Variable name change 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"
(...skipping 10 matching lines...) Expand all
21 // This class takes care of dispatching all pointer events and keeps track of 21 // This class takes care of dispatching all pointer events and keeps track of
22 // properties of active pointer events. 22 // properties of active pointer events.
23 class CORE_EXPORT PointerEventManager { 23 class CORE_EXPORT PointerEventManager {
24 WTF_MAKE_NONCOPYABLE(PointerEventManager); 24 WTF_MAKE_NONCOPYABLE(PointerEventManager);
25 DISALLOW_NEW(); 25 DISALLOW_NEW();
26 public: 26 public:
27 explicit PointerEventManager(LocalFrame*); 27 explicit PointerEventManager(LocalFrame*);
28 ~PointerEventManager(); 28 ~PointerEventManager();
29 DECLARE_TRACE(); 29 DECLARE_TRACE();
30 30
31 // Sends the mouse pointer events and the boundary events
32 // that it may cause. It also sends the compat mouse events
33 // and sets the newNodeUnderMouse if the capturing is set
34 // in this function.
31 WebInputEventResult sendMousePointerEvent( 35 WebInputEventResult sendMousePointerEvent(
32 Node*, const AtomicString& type, 36 Node* target, const AtomicString& type,
33 int clickCount, const PlatformMouseEvent&, 37 int clickCount, const PlatformMouseEvent&,
34 Node* relatedTarget, 38 Node* relatedTarget,
35 Node* lastNodeUnderMouse); 39 Node* lastNodeUnderMouse,
40 Node** newNodeUnderMouse);
36 41
37 WebInputEventResult handleTouchEvents( 42 WebInputEventResult handleTouchEvents(
38 const PlatformTouchEvent&); 43 const PlatformTouchEvent&);
39 44
40 // Sends boundary events mouseout/leave/over/enter to the 45 // Sends boundary events mouseout/leave/over/enter to the
41 // corresponding targets. This function sends pointerout/leave/over/enter 46 // corresponding targets. This function sends pointerout/leave/over/enter
42 // only when isFrameBoundaryTransition is true which indicates the 47 // only when isFrameBoundaryTransition is true which indicates the
43 // transition is over the document boundary and not only the elements border 48 // transition is over the document boundary and not only the elements border
44 // inside the document. If isFrameBoundaryTransition is false, 49 // inside the document. If isFrameBoundaryTransition is false,
45 // then the event is a compatibility event like those created by touch 50 // then the event is a compatibility event like those created by touch
(...skipping 12 matching lines...) Expand all
58 void clear(); 63 void clear();
59 64
60 void elementRemoved(EventTarget*); 65 void elementRemoved(EventTarget*);
61 void setPointerCapture(int, EventTarget*); 66 void setPointerCapture(int, EventTarget*);
62 void releasePointerCapture(int, EventTarget*); 67 void releasePointerCapture(int, EventTarget*);
63 bool isActive(const int) const; 68 bool isActive(const int) const;
64 69
65 // Returns whether there is any touch on the screen. 70 // Returns whether there is any touch on the screen.
66 bool isAnyTouchActive() const; 71 bool isAnyTouchActive() const;
67 72
73 // TODO(crbug.com/625843): This can be hidden when mouse refactoring in Even tHandler is done.
74 EventTarget* getMouseCapturingNode();
75
68 // Returns true if the primary pointerdown corresponding to the given 76 // Returns true if the primary pointerdown corresponding to the given
69 // |uniqueTouchEventId| was canceled. Also drops stale ids from 77 // |uniqueTouchEventId| was canceled. Also drops stale ids from
70 // |m_touchIdsForCanceledPointerdowns|. 78 // |m_touchIdsForCanceledPointerdowns|.
71 bool primaryPointerdownCanceled(uint32_t uniqueTouchEventId); 79 bool primaryPointerdownCanceled(uint32_t uniqueTouchEventId);
72 80
73 private: 81 private:
74 typedef HeapHashMap<int, Member<EventTarget>, WTF::IntHash<int>, 82 typedef HeapHashMap<int, Member<EventTarget>, WTF::IntHash<int>,
75 WTF::UnsignedWithZeroKeyHashTraits<int>> PointerCapturingMap; 83 WTF::UnsignedWithZeroKeyHashTraits<int>> PointerCapturingMap;
76 class EventTargetAttributes { 84 class EventTargetAttributes {
77 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 85 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
(...skipping 30 matching lines...) Expand all
108 // Returns whether the event is consumed or not. 116 // Returns whether the event is consumed or not.
109 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*); 117 WebInputEventResult sendTouchPointerEvent(EventTarget*, PointerEvent*);
110 118
111 void sendBoundaryEvents( 119 void sendBoundaryEvents(
112 EventTarget* exitedTarget, 120 EventTarget* exitedTarget,
113 EventTarget* enteredTarget, 121 EventTarget* enteredTarget,
114 PointerEvent*, 122 PointerEvent*,
115 const PlatformMouseEvent& = PlatformMouseEvent(), 123 const PlatformMouseEvent& = PlatformMouseEvent(),
116 bool sendMouseEvent = false); 124 bool sendMouseEvent = false);
117 void setNodeUnderPointer(PointerEvent*, 125 void setNodeUnderPointer(PointerEvent*,
118 EventTarget*, bool sendEvent = true); 126 EventTarget*);
119 127
120 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget| 128 // Processes the assignment of |m_pointerCaptureTarget| from |m_pendingPoint erCaptureTarget|
121 // and sends the got/lostpointercapture events, as per the spec: 129 // and sends the got/lostpointercapture events, as per the spec:
122 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture 130 // https://w3c.github.io/pointerevents/#process-pending-pointer-capture
123 // Returns whether the pointer capture is changed. When pointer capture is c hanged, 131 void processPendingPointerCapture(PointerEvent*);
124 // this function will take care of boundary events.
125 bool processPendingPointerCapture(
126 PointerEvent*,
127 EventTarget*,
128 const PlatformMouseEvent& = PlatformMouseEvent(),
129 bool sendMouseEvent = false);
130 132
131 // Processes the capture state of a pointer, updates node under 133 // Processes the capture state of a pointer, updates node under
132 // pointer, and sends corresponding boundary events for pointer if 134 // pointer, and sends corresponding boundary events for pointer if
133 // setPointerPosition is true. It also sends corresponding boundary events 135 // setPointerPosition is true. It also sends corresponding boundary events
134 // for mouse if sendMouseEvent is true. 136 // for mouse if sendMouseEvent is true.
135 void processCaptureAndPositionOfPointerEvent( 137 // Returns the target that the pointer event is supposed to be fired at.
138 EventTarget* processCaptureAndPositionOfPointerEvent(
136 PointerEvent*, 139 PointerEvent*,
137 EventTarget* hitTestTarget, 140 EventTarget* hitTestTarget,
138 EventTarget* lastNodeUnderMouse = nullptr, 141 EventTarget* lastNodeUnderMouse = nullptr,
139 const PlatformMouseEvent& = PlatformMouseEvent(), 142 const PlatformMouseEvent& = PlatformMouseEvent(),
140 bool sendMouseEvent = false, 143 bool sendMouseEvent = false,
141 bool setPointerPosition = true); 144 bool setPointerPosition = true);
142 145
143 void removeTargetFromPointerCapturingMapping( 146 void removeTargetFromPointerCapturingMapping(
144 PointerCapturingMap&, const EventTarget*); 147 PointerCapturingMap&, const EventTarget*);
145 EventTarget* getEffectiveTargetForPointerEvent( 148 EventTarget* getEffectiveTargetForPointerEvent(
146 EventTarget*, int); 149 EventTarget*, int);
147 EventTarget* getCapturingNode(int); 150 EventTarget* getCapturingNode(int);
148 void removePointer(PointerEvent*); 151 void removePointer(PointerEvent*);
149 WebInputEventResult dispatchPointerEvent( 152 WebInputEventResult dispatchPointerEvent(
150 EventTarget*, 153 EventTarget*,
151 PointerEvent*, 154 PointerEvent*,
152 bool checkForListener = false); 155 bool checkForListener = false);
153 void releasePointerCapture(int); 156 void releasePointerCapture(int);
157 // Returns true if capture target and pending capture target were different.
158 bool getPointerCaptureState(int pointerId,
159 EventTarget** pointerCaptureTarget,
160 EventTarget** pendingPointerCaptureTarget);
154 161
155 // NOTE: If adding a new field to this class please ensure that it is 162 // NOTE: If adding a new field to this class please ensure that it is
156 // cleared in |PointerEventManager::clear()|. 163 // cleared in |PointerEventManager::clear()|.
157 164
158 const Member<LocalFrame> m_frame; 165 const Member<LocalFrame> m_frame;
159 166
160 // Prevents firing mousedown, mousemove & mouseup in-between a canceled poin terdown and next pointerup/pointercancel. 167 // Prevents firing mousedown, mousemove & mouseup in-between a canceled poin terdown and next pointerup/pointercancel.
161 // See "PREVENT MOUSE EVENT flag" in the spec: 168 // See "PREVENT MOUSE EVENT flag" in the spec:
162 // https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-e vents 169 // https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-e vents
163 bool m_preventMouseEventForPointerType[static_cast<size_t>(WebPointerPropert ies::PointerType::LastEntry) + 1]; 170 bool m_preventMouseEventForPointerType[static_cast<size_t>(WebPointerPropert ies::PointerType::LastEntry) + 1];
(...skipping 15 matching lines...) Expand all
179 PointerCapturingMap m_pointerCaptureTarget; 186 PointerCapturingMap m_pointerCaptureTarget;
180 PointerCapturingMap m_pendingPointerCaptureTarget; 187 PointerCapturingMap m_pendingPointerCaptureTarget;
181 188
182 PointerEventFactory m_pointerEventFactory; 189 PointerEventFactory m_pointerEventFactory;
183 TouchEventManager m_touchEventManager; 190 TouchEventManager m_touchEventManager;
184 }; 191 };
185 192
186 } // namespace blink 193 } // namespace blink
187 194
188 #endif // PointerEventManager_h 195 #endif // PointerEventManager_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | third_party/WebKit/Source/core/input/PointerEventManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698