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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef EventHandler_h 26 #ifndef EventHandler_h
27 #define EventHandler_h 27 #define EventHandler_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/events/TextEventInputType.h" 30 #include "core/events/TextEventInputType.h"
31 #include "core/input/GestureManager.h" 31 #include "core/input/GestureManager.h"
32 #include "core/input/KeyboardEventManager.h" 32 #include "core/input/KeyboardEventManager.h"
33 #include "core/input/MouseEventManager.h"
33 #include "core/input/PointerEventManager.h" 34 #include "core/input/PointerEventManager.h"
34 #include "core/input/ScrollManager.h" 35 #include "core/input/ScrollManager.h"
35 #include "core/layout/HitTestRequest.h" 36 #include "core/layout/HitTestRequest.h"
36 #include "core/page/DragActions.h" 37 #include "core/page/DragActions.h"
37 #include "core/page/EventWithHitTestResults.h" 38 #include "core/page/EventWithHitTestResults.h"
38 #include "core/style/ComputedStyleConstants.h" 39 #include "core/style/ComputedStyleConstants.h"
39 #include "platform/Cursor.h" 40 #include "platform/Cursor.h"
40 #include "platform/PlatformMouseEvent.h" 41 #include "platform/PlatformMouseEvent.h"
41 #include "platform/PlatformTouchPoint.h" 42 #include "platform/PlatformTouchPoint.h"
42 #include "platform/Timer.h" 43 #include "platform/Timer.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // TODO(nzolghadr): Some of the APIs in this class only forward the action 105 // TODO(nzolghadr): Some of the APIs in this class only forward the action
105 // to the corresponding Manager class. We need to investigate whether it is 106 // to the corresponding Manager class. We need to investigate whether it is
106 // better to expose the manager instance itself later or can the access to 107 // better to expose the manager instance itself later or can the access to
107 // those APIs be more limited or removed. 108 // those APIs be more limited or removed.
108 109
109 void stopAutoscroll(); 110 void stopAutoscroll();
110 111
111 void dispatchFakeMouseMoveEventSoon(); 112 void dispatchFakeMouseMoveEventSoon();
112 void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); 113 void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
113 114
114 static HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, H itTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRe quest::Active);
115
116 HitTestResult hitTestResultAtPoint(const LayoutPoint&, 115 HitTestResult hitTestResultAtPoint(const LayoutPoint&,
117 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, 116 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active,
118 const LayoutSize& padding = LayoutSize()); 117 const LayoutSize& padding = LayoutSize());
119 118
120 bool mousePressed() const { return m_mousePressed; } 119 bool mousePressed() const { return m_mousePressed; }
121 120
122 void setCapturingMouseEventsNode(Node*); // A caller is responsible for rese tting capturing node to 0. 121 void setCapturingMouseEventsNode(Node*); // A caller is responsible for rese tting capturing node to 0.
123 122
124 WebInputEventResult updateDragAndDrop(const PlatformMouseEvent&, DataTransfe r*); 123 WebInputEventResult updateDragAndDrop(const PlatformMouseEvent&, DataTransfe r*);
125 void cancelDragAndDrop(const PlatformMouseEvent&, DataTransfer*); 124 void cancelDragAndDrop(const PlatformMouseEvent&, DataTransfer*);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 185
187 void setPointerCapture(int, EventTarget*); 186 void setPointerCapture(int, EventTarget*);
188 void releasePointerCapture(int, EventTarget*); 187 void releasePointerCapture(int, EventTarget*);
189 bool hasPointerCapture(int, const EventTarget*) const; 188 bool hasPointerCapture(int, const EventTarget*) const;
190 bool hasProcessedPointerCapture(int, const EventTarget*) const; 189 bool hasProcessedPointerCapture(int, const EventTarget*) const;
191 190
192 void elementRemoved(EventTarget*); 191 void elementRemoved(EventTarget*);
193 192
194 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true ; } 193 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true ; }
195 194
196 static WebInputEventResult mergeEventResult(WebInputEventResult resultA, Web InputEventResult resultB);
197 static WebInputEventResult toWebInputEventResult(DispatchEventResult);
198
199 bool handleAccessKey(const WebKeyboardEvent&); 195 bool handleAccessKey(const WebKeyboardEvent&);
200 WebInputEventResult keyEvent(const WebKeyboardEvent&); 196 WebInputEventResult keyEvent(const WebKeyboardEvent&);
201 void defaultKeyboardEventHandler(KeyboardEvent*); 197 void defaultKeyboardEventHandler(KeyboardEvent*);
202 198
203 bool handleTextInputEvent(const String& text, Event* underlyingEvent = nullp tr, TextEventInputType = TextEventInputKeyboard); 199 bool handleTextInputEvent(const String& text, Event* underlyingEvent = nullp tr, TextEventInputType = TextEventInputKeyboard);
204 void defaultTextInputEventHandler(TextEvent*); 200 void defaultTextInputEventHandler(TextEvent*);
205 201
206 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); 202 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation);
207 203
208 void focusDocumentView(); 204 void focusDocumentView();
209 205
210 void capsLockStateMayHaveChanged(); // Only called by FrameSelection 206 void capsLockStateMayHaveChanged(); // Only called by FrameSelection
211 207
212 WebInputEventResult handleTouchEvent(const PlatformTouchEvent&); 208 WebInputEventResult handleTouchEvent(const PlatformTouchEvent&);
213 209
214 bool useHandCursor(Node*, bool isOverLink); 210 bool useHandCursor(Node*, bool isOverLink);
215 211
216 void notifyElementActivated(); 212 void notifyElementActivated();
217 213
218 PassRefPtr<UserGestureToken> takeLastMouseDownGestureToken() { return m_last MouseDownUserGestureToken.release(); } 214 PassRefPtr<UserGestureToken> takeLastMouseDownGestureToken() { return m_last MouseDownUserGestureToken.release(); }
219 215
220 int clickCount() { return m_clickCount; }
221
222 SelectionController& selectionController() const { return *m_selectionContro ller; } 216 SelectionController& selectionController() const { return *m_selectionContro ller; }
223 217
224 // FIXME(nzolghadr): This function is technically a private function of 218 // FIXME(nzolghadr): This function is technically a private function of
225 // EventHandler class. Making it public temporary to make it possible to 219 // EventHandler class. Making it public temporary to make it possible to
226 // move some code around in the refactoring process. 220 // move some code around in the refactoring process.
227 // Performs a chaining logical scroll, within a *single* frame, starting 221 // Performs a chaining logical scroll, within a *single* frame, starting
228 // from either a provided starting node or a default based on the focused or 222 // from either a provided starting node or a default based on the focused or
229 // most recently clicked node, falling back to the frame. 223 // most recently clicked node, falling back to the frame.
230 // Returns true if the scroll was consumed. 224 // Returns true if the scroll was consumed.
231 // direction - The logical direction to scroll in. This will be converted to 225 // direction - The logical direction to scroll in. This will be converted to
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 360
367 bool m_mouseDownMayStartAutoscroll; 361 bool m_mouseDownMayStartAutoscroll;
368 362
369 Timer<EventHandler> m_fakeMouseMoveEventTimer; 363 Timer<EventHandler> m_fakeMouseMoveEventTimer;
370 364
371 bool m_svgPan; 365 bool m_svgPan;
372 366
373 Member<Node> m_capturingMouseEventsNode; 367 Member<Node> m_capturingMouseEventsNode;
374 bool m_eventHandlerWillResetCapturingMouseEventsNode; 368 bool m_eventHandlerWillResetCapturingMouseEventsNode;
375 369
370 // TODO(nzolghadr): Refactor the mouse related fields to MouseEventManager.
376 // Note the difference of this and m_nodeUnderPointer in PointerEventManager 371 // Note the difference of this and m_nodeUnderPointer in PointerEventManager
377 Member<Node> m_nodeUnderMouse; 372 Member<Node> m_nodeUnderMouse;
378 373
379 Member<LocalFrame> m_lastMouseMoveEventSubframe; 374 Member<LocalFrame> m_lastMouseMoveEventSubframe;
380 Member<Scrollbar> m_lastScrollbarUnderMouse; 375 Member<Scrollbar> m_lastScrollbarUnderMouse;
381 376
382 int m_clickCount; 377 int m_clickCount;
383 Member<Node> m_clickNode; 378 Member<Node> m_clickNode;
384 379
385 Member<Node> m_dragTarget; 380 Member<Node> m_dragTarget;
386 bool m_shouldOnlyFireDragOverEvent; 381 bool m_shouldOnlyFireDragOverEvent;
387 382
388 Member<HTMLFrameSetElement> m_frameSetBeingResized; 383 Member<HTMLFrameSetElement> m_frameSetBeingResized;
389 384
390 bool m_mousePositionIsUnknown; 385 bool m_mousePositionIsUnknown;
391 // The last mouse movement position this frame has seen in root frame coordi nates. 386 // The last mouse movement position this frame has seen in root frame coordi nates.
392 IntPoint m_lastKnownMousePosition; 387 IntPoint m_lastKnownMousePosition;
393 IntPoint m_lastKnownMouseGlobalPosition; 388 IntPoint m_lastKnownMouseGlobalPosition;
394 IntPoint m_mouseDownPos; // In our view's coords. 389 IntPoint m_mouseDownPos; // In our view's coords.
395 double m_mouseDownTimestamp; 390 double m_mouseDownTimestamp;
396 PlatformMouseEvent m_mouseDown; 391 PlatformMouseEvent m_mouseDown;
397 RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken; 392 RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken;
398 393
394 ScrollManager m_scrollManager;
bokan 2016/09/01 13:50:13 I just realized, these classes have on-heap member
haraken 2016/09/01 17:12:47 You must trace these objects because they are a-pa
395 MouseEventManager m_mouseEventManager;
396 KeyboardEventManager m_keyboardEventManager;
399 PointerEventManager m_pointerEventManager; 397 PointerEventManager m_pointerEventManager;
400 ScrollManager m_scrollManager;
401 KeyboardEventManager m_keyboardEventManager;
402 GestureManager m_gestureManager; 398 GestureManager m_gestureManager;
403 399
404 double m_maxMouseMovedDuration; 400 double m_maxMouseMovedDuration;
405 401
406 bool m_longTapShouldInvokeContextMenu; 402 bool m_longTapShouldInvokeContextMenu;
407 403
408 Timer<EventHandler> m_activeIntervalTimer; 404 Timer<EventHandler> m_activeIntervalTimer;
409 double m_lastShowPressTimestamp; 405 double m_lastShowPressTimestamp;
410 Member<Element> m_lastDeferredTapElement; 406 Member<Element> m_lastDeferredTapElement;
411 407
412 // Set on GestureTapDown if the |pointerdown| event corresponding to the 408 // Set on GestureTapDown if the |pointerdown| event corresponding to the
413 // triggering |touchstart| event was canceled. This suppresses mouse event 409 // triggering |touchstart| event was canceled. This suppresses mouse event
414 // firing for the current gesture sequence (i.e. until next GestureTapDown). 410 // firing for the current gesture sequence (i.e. until next GestureTapDown).
415 bool m_suppressMouseEventsFromGestures; 411 bool m_suppressMouseEventsFromGestures;
416 412
417 // TODO(nzolghadr): Temporary until further refactoring 413 // TODO(nzolghadr): Temporary until further refactoring
418 friend GestureManager; 414 friend GestureManager;
419 }; 415 };
420 416
421 } // namespace blink 417 } // namespace blink
422 418
423 #endif // EventHandler_h 419 #endif // EventHandler_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698