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

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

Issue 2650403006: Remove PlatformMouseEvent and use WebMouseEvent instead (Closed)
Patch Set: Created 3 years, 10 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 MouseEventManager_h 5 #ifndef MouseEventManager_h
6 #define MouseEventManager_h 6 #define MouseEventManager_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/dom/SynchronousMutationObserver.h" 9 #include "core/dom/SynchronousMutationObserver.h"
10 #include "core/input/BoundaryEventDispatcher.h" 10 #include "core/input/BoundaryEventDispatcher.h"
11 #include "core/page/DragActions.h" 11 #include "core/page/DragActions.h"
12 #include "core/page/EventWithHitTestResults.h" 12 #include "core/page/EventWithHitTestResults.h"
13 #include "platform/PlatformMouseEvent.h"
14 #include "platform/Timer.h" 13 #include "platform/Timer.h"
15 #include "public/platform/WebInputEventResult.h" 14 #include "public/platform/WebInputEventResult.h"
15 #include "public/platform/WebMouseEvent.h"
16 #include "wtf/Allocator.h" 16 #include "wtf/Allocator.h"
17 #include "wtf/Time.h" 17 #include "wtf/Time.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 class ContainerNode; 21 class ContainerNode;
22 class DragState; 22 class DragState;
23 class DataTransfer; 23 class DataTransfer;
24 class Element; 24 class Element;
25 class FloatQuad; 25 class FloatQuad;
(...skipping 12 matching lines...) Expand all
38 WTF_MAKE_NONCOPYABLE(MouseEventManager); 38 WTF_MAKE_NONCOPYABLE(MouseEventManager);
39 USING_GARBAGE_COLLECTED_MIXIN(MouseEventManager); 39 USING_GARBAGE_COLLECTED_MIXIN(MouseEventManager);
40 40
41 public: 41 public:
42 MouseEventManager(LocalFrame&, ScrollManager&); 42 MouseEventManager(LocalFrame&, ScrollManager&);
43 virtual ~MouseEventManager(); 43 virtual ~MouseEventManager();
44 DECLARE_TRACE(); 44 DECLARE_TRACE();
45 45
46 WebInputEventResult dispatchMouseEvent(EventTarget*, 46 WebInputEventResult dispatchMouseEvent(EventTarget*,
47 const AtomicString&, 47 const AtomicString&,
48 const PlatformMouseEvent&, 48 const WebMouseEvent&,
49 const String& canvasRegionId,
49 EventTarget* relatedTarget, 50 EventTarget* relatedTarget,
50 bool checkForListener = false); 51 bool checkForListener = false);
51 52
52 WebInputEventResult setMousePositionAndDispatchMouseEvent( 53 WebInputEventResult setMousePositionAndDispatchMouseEvent(
53 Node* targetNode, 54 Node* targetNode,
55 const String& canvasRegionId,
54 const AtomicString& eventType, 56 const AtomicString& eventType,
55 const PlatformMouseEvent&); 57 const WebMouseEvent&);
56 58
57 WebInputEventResult dispatchMouseClickIfNeeded( 59 WebInputEventResult dispatchMouseClickIfNeeded(
58 const MouseEventWithHitTestResults&); 60 const MouseEventWithHitTestResults&);
59 61
60 WebInputEventResult dispatchDragSrcEvent(const AtomicString& eventType, 62 WebInputEventResult dispatchDragSrcEvent(const AtomicString& eventType,
61 const PlatformMouseEvent&); 63 const WebMouseEvent&);
62 WebInputEventResult dispatchDragEvent(const AtomicString& eventType, 64 WebInputEventResult dispatchDragEvent(const AtomicString& eventType,
63 Node* target, 65 Node* target,
64 const PlatformMouseEvent&, 66 const WebMouseEvent&,
65 DataTransfer*); 67 DataTransfer*);
66 68
67 // Resets the internal state of this object. 69 // Resets the internal state of this object.
68 void clear(); 70 void clear();
69 71
70 void sendBoundaryEvents(EventTarget* exitedTarget, 72 void sendBoundaryEvents(EventTarget* exitedTarget,
71 EventTarget* enteredTarget, 73 EventTarget* enteredTarget,
72 const PlatformMouseEvent& mousePlatformEvent); 74 const String& canvasRegionId,
75 const WebMouseEvent&);
73 76
74 void setNodeUnderMouse(Node*, const PlatformMouseEvent&); 77 void setNodeUnderMouse(Node*,
78 const String& canvasRegionId,
79 const WebMouseEvent&);
75 80
76 WebInputEventResult handleMouseFocus( 81 WebInputEventResult handleMouseFocus(
77 const HitTestResult&, 82 const HitTestResult&,
78 InputDeviceCapabilities* sourceCapabilities); 83 InputDeviceCapabilities* sourceCapabilities);
79 84
80 void fakeMouseMoveEventTimerFired(TimerBase*); 85 void fakeMouseMoveEventTimerFired(TimerBase*);
81 86
82 void cancelFakeMouseMoveEvent(); 87 void cancelFakeMouseMoveEvent();
83 void dispatchFakeMouseMoveEventSoon(); 88 void dispatchFakeMouseMoveEventSoon();
84 void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); 89 void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
85 90
86 void setLastKnownMousePosition(const PlatformMouseEvent&); 91 void setLastKnownMousePosition(const WebMouseEvent&);
87 92
88 bool handleDragDropIfPossible(const GestureEventWithHitTestResults&); 93 bool handleDragDropIfPossible(const GestureEventWithHitTestResults&);
89 94
90 WebInputEventResult handleMouseDraggedEvent( 95 WebInputEventResult handleMouseDraggedEvent(
91 const MouseEventWithHitTestResults&); 96 const MouseEventWithHitTestResults&);
92 WebInputEventResult handleMousePressEvent( 97 WebInputEventResult handleMousePressEvent(
93 const MouseEventWithHitTestResults&); 98 const MouseEventWithHitTestResults&);
94 WebInputEventResult handleMouseReleaseEvent( 99 WebInputEventResult handleMouseReleaseEvent(
95 const MouseEventWithHitTestResults&); 100 const MouseEventWithHitTestResults&);
96 101
97 static DragState& dragState(); 102 static DragState& dragState();
98 103
99 void focusDocumentView(); 104 void focusDocumentView();
100 105
101 // Resets the state that indicates the next events could cause a drag. It is 106 // Resets the state that indicates the next events could cause a drag. It is
102 // called when we realize the next events should not cause drag based on the 107 // called when we realize the next events should not cause drag based on the
103 // drag heuristics. 108 // drag heuristics.
104 void clearDragHeuristicState(); 109 void clearDragHeuristicState();
105 110
106 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); 111 void dragSourceEndedAt(const WebMouseEvent&, DragOperation);
107 112
108 void updateSelectionForMouseDrag(); 113 void updateSelectionForMouseDrag();
109 114
110 void handleMousePressEventUpdateStates(const PlatformMouseEvent&); 115 void handleMousePressEventUpdateStates(const WebMouseEvent&);
111 116
112 // Returns whether pan is handled and resets the state on release. 117 // Returns whether pan is handled and resets the state on release.
113 bool handleSvgPanIfNeeded(bool isReleaseEvent); 118 bool handleSvgPanIfNeeded(bool isReleaseEvent);
114 119
115 void invalidateClick(); 120 void invalidateClick();
116 121
117 // TODO: These functions ideally should be private but the code needs more 122 // TODO: These functions ideally should be private but the code needs more
118 // refactoring to be able to remove the dependency from EventHandler. 123 // refactoring to be able to remove the dependency from EventHandler.
119 Node* getNodeUnderMouse(); 124 Node* getNodeUnderMouse();
120 bool isMousePositionUnknown(); 125 bool isMousePositionUnknown();
(...skipping 16 matching lines...) Expand all
137 void setClickCount(int); 142 void setClickCount(int);
138 143
139 bool mouseDownMayStartDrag(); 144 bool mouseDownMayStartDrag();
140 145
141 private: 146 private:
142 class MouseEventBoundaryEventDispatcher : public BoundaryEventDispatcher { 147 class MouseEventBoundaryEventDispatcher : public BoundaryEventDispatcher {
143 WTF_MAKE_NONCOPYABLE(MouseEventBoundaryEventDispatcher); 148 WTF_MAKE_NONCOPYABLE(MouseEventBoundaryEventDispatcher);
144 149
145 public: 150 public:
146 MouseEventBoundaryEventDispatcher(MouseEventManager*, 151 MouseEventBoundaryEventDispatcher(MouseEventManager*,
147 const PlatformMouseEvent*, 152 const WebMouseEvent*,
148 EventTarget* exitedTarget); 153 EventTarget* exitedTarget,
154 const String& canvasRegionId);
149 155
150 protected: 156 protected:
151 void dispatchOut(EventTarget*, EventTarget* relatedTarget) override; 157 void dispatchOut(EventTarget*, EventTarget* relatedTarget) override;
152 void dispatchOver(EventTarget*, EventTarget* relatedTarget) override; 158 void dispatchOver(EventTarget*, EventTarget* relatedTarget) override;
153 void dispatchLeave(EventTarget*, 159 void dispatchLeave(EventTarget*,
154 EventTarget* relatedTarget, 160 EventTarget* relatedTarget,
155 bool checkForListener) override; 161 bool checkForListener) override;
156 void dispatchEnter(EventTarget*, 162 void dispatchEnter(EventTarget*,
157 EventTarget* relatedTarget, 163 EventTarget* relatedTarget,
158 bool checkForListener) override; 164 bool checkForListener) override;
159 AtomicString getLeaveEvent() override; 165 AtomicString getLeaveEvent() override;
160 AtomicString getEnterEvent() override; 166 AtomicString getEnterEvent() override;
161 167
162 private: 168 private:
163 void dispatch(EventTarget*, 169 void dispatch(EventTarget*,
164 EventTarget* relatedTarget, 170 EventTarget* relatedTarget,
165 const AtomicString&, 171 const AtomicString&,
166 const PlatformMouseEvent&, 172 const String& canvasRegionId,
173 const WebMouseEvent&,
167 bool checkForListener); 174 bool checkForListener);
168 Member<MouseEventManager> m_mouseEventManager; 175 Member<MouseEventManager> m_mouseEventManager;
169 const PlatformMouseEvent* m_platformMouseEvent; 176 const WebMouseEvent* m_webMouseEvent;
170 Member<EventTarget> m_exitedTarget; 177 Member<EventTarget> m_exitedTarget;
178 String m_canvasRegionId;
171 }; 179 };
172 180
173 // If the given element is a shadow host and its root has delegatesFocus=false 181 // If the given element is a shadow host and its root has delegatesFocus=false
174 // flag, slide focus to its inner element. Returns true if the resulting focus 182 // flag, slide focus to its inner element. Returns true if the resulting focus
175 // is different from the given element. 183 // is different from the given element.
176 bool slideFocusOnShadowHostIfNecessary(const Element&); 184 bool slideFocusOnShadowHostIfNecessary(const Element&);
177 185
178 bool dragThresholdExceeded(const IntPoint&) const; 186 bool dragThresholdExceeded(const IntPoint&) const;
179 bool handleDrag(const MouseEventWithHitTestResults&, DragInitiator); 187 bool handleDrag(const MouseEventWithHitTestResults&, DragInitiator);
180 bool tryStartDrag(const MouseEventWithHitTestResults&); 188 bool tryStartDrag(const MouseEventWithHitTestResults&);
(...skipping 30 matching lines...) Expand all
211 unsigned m_capturesDragging : 1; 219 unsigned m_capturesDragging : 1;
212 unsigned m_mouseDownMayStartDrag : 1; 220 unsigned m_mouseDownMayStartDrag : 1;
213 221
214 Member<Node> m_mousePressNode; 222 Member<Node> m_mousePressNode;
215 223
216 int m_clickCount; 224 int m_clickCount;
217 Member<Node> m_clickNode; 225 Member<Node> m_clickNode;
218 226
219 IntPoint m_mouseDownPos; // In our view's coords. 227 IntPoint m_mouseDownPos; // In our view's coords.
220 TimeTicks m_mouseDownTimestamp; 228 TimeTicks m_mouseDownTimestamp;
221 PlatformMouseEvent m_mouseDown; 229 WebMouseEvent m_mouseDown;
222 230
223 LayoutPoint m_dragStartPos; 231 LayoutPoint m_dragStartPos;
224 232
225 TaskRunnerTimer<MouseEventManager> m_fakeMouseMoveEventTimer; 233 TaskRunnerTimer<MouseEventManager> m_fakeMouseMoveEventTimer;
226 }; 234 };
227 235
228 } // namespace blink 236 } // namespace blink
229 237
230 #endif // MouseEventManager_h 238 #endif // MouseEventManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698