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

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

Issue 2036643003: Creat a KeyboardEventManager class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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/KeyboardEventManager.h"
31 #include "core/input/PointerEventManager.h" 32 #include "core/input/PointerEventManager.h"
32 #include "core/input/ScrollManager.h" 33 #include "core/input/ScrollManager.h"
33 #include "core/layout/HitTestRequest.h" 34 #include "core/layout/HitTestRequest.h"
34 #include "core/page/DragActions.h" 35 #include "core/page/DragActions.h"
35 #include "core/page/EventWithHitTestResults.h" 36 #include "core/page/EventWithHitTestResults.h"
36 #include "core/style/ComputedStyleConstants.h" 37 #include "core/style/ComputedStyleConstants.h"
37 #include "platform/Cursor.h" 38 #include "platform/Cursor.h"
38 #include "platform/PlatformMouseEvent.h" 39 #include "platform/PlatformMouseEvent.h"
39 #include "platform/PlatformTouchPoint.h" 40 #include "platform/PlatformTouchPoint.h"
40 #include "platform/Timer.h" 41 #include "platform/Timer.h"
41 #include "platform/UserGestureIndicator.h" 42 #include "platform/UserGestureIndicator.h"
42 #include "platform/geometry/LayoutPoint.h" 43 #include "platform/geometry/LayoutPoint.h"
43 #include "platform/heap/Handle.h" 44 #include "platform/heap/Handle.h"
44 #include "platform/scroll/ScrollTypes.h" 45 #include "platform/scroll/ScrollTypes.h"
45 #include "public/platform/WebFocusType.h"
46 #include "public/platform/WebInputEventResult.h" 46 #include "public/platform/WebInputEventResult.h"
47 #include "wtf/Forward.h" 47 #include "wtf/Forward.h"
48 #include "wtf/HashMap.h" 48 #include "wtf/HashMap.h"
49 #include "wtf/HashTraits.h" 49 #include "wtf/HashTraits.h"
50 #include "wtf/RefPtr.h" 50 #include "wtf/RefPtr.h"
51 51
52 namespace blink { 52 namespace blink {
53 53
54 class DataTransfer; 54 class DataTransfer;
55 class PaintLayer; 55 class PaintLayer;
56 class Document; 56 class Document;
57 class DragState; 57 class DragState;
58 class Element; 58 class Element;
59 class Event; 59 class Event;
60 class EventTarget; 60 class EventTarget;
61 template <typename EventType> 61 template <typename EventType>
62 class EventWithHitTestResults; 62 class EventWithHitTestResults;
63 class FloatPoint; 63 class FloatPoint;
64 class FloatQuad; 64 class FloatQuad;
65 class FrameHost; 65 class FrameHost;
66 class HTMLFrameSetElement; 66 class HTMLFrameSetElement;
67 class HitTestRequest; 67 class HitTestRequest;
68 class HitTestResult; 68 class HitTestResult;
69 class KeyboardEvent;
70 class LayoutObject; 69 class LayoutObject;
71 class LocalFrame; 70 class LocalFrame;
72 class Node; 71 class Node;
73 class OptionalCursor; 72 class OptionalCursor;
74 class PlatformGestureEvent; 73 class PlatformGestureEvent;
75 class PlatformKeyboardEvent; 74 class PlatformKeyboardEvent;
76 class PlatformTouchEvent; 75 class PlatformTouchEvent;
77 class PlatformWheelEvent; 76 class PlatformWheelEvent;
78 class ScrollableArea; 77 class ScrollableArea;
79 class Scrollbar; 78 class Scrollbar;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 187
189 void setPointerCapture(int, EventTarget*); 188 void setPointerCapture(int, EventTarget*);
190 void releasePointerCapture(int, EventTarget*); 189 void releasePointerCapture(int, EventTarget*);
191 void elementRemoved(EventTarget*); 190 void elementRemoved(EventTarget*);
192 191
193 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true ; } 192 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true ; }
194 193
195 static WebInputEventResult mergeEventResult(WebInputEventResult resultA, Web InputEventResult resultB); 194 static WebInputEventResult mergeEventResult(WebInputEventResult resultA, Web InputEventResult resultB);
196 static WebInputEventResult toWebInputEventResult(DispatchEventResult); 195 static WebInputEventResult toWebInputEventResult(DispatchEventResult);
197 196
198 static PlatformEvent::Modifiers accessKeyModifiers();
199 bool handleAccessKey(const PlatformKeyboardEvent&); 197 bool handleAccessKey(const PlatformKeyboardEvent&);
200 WebInputEventResult keyEvent(const PlatformKeyboardEvent&); 198 WebInputEventResult keyEvent(const PlatformKeyboardEvent&);
201 void defaultKeyboardEventHandler(KeyboardEvent*); 199 void defaultKeyboardEventHandler(KeyboardEvent*);
202 200
203 bool handleTextInputEvent(const String& text, Event* underlyingEvent = nullp tr, TextEventInputType = TextEventInputKeyboard); 201 bool handleTextInputEvent(const String& text, Event* underlyingEvent = nullp tr, TextEventInputType = TextEventInputKeyboard);
204 void defaultTextInputEventHandler(TextEvent*); 202 void defaultTextInputEventHandler(TextEvent*);
205 203
206 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); 204 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation);
207 205
208 void focusDocumentView(); 206 void focusDocumentView();
209 207
210 void capsLockStateMayHaveChanged(); // Only called by FrameSelection 208 void capsLockStateMayHaveChanged(); // Only called by FrameSelection
211 209
212 WebInputEventResult handleTouchEvent(const PlatformTouchEvent&); 210 WebInputEventResult handleTouchEvent(const PlatformTouchEvent&);
213 211
214 bool useHandCursor(Node*, bool isOverLink); 212 bool useHandCursor(Node*, bool isOverLink);
215 213
216 void notifyElementActivated(); 214 void notifyElementActivated();
217 215
218 PassRefPtr<UserGestureToken> takeLastMouseDownGestureToken() { return m_last MouseDownUserGestureToken.release(); } 216 PassRefPtr<UserGestureToken> takeLastMouseDownGestureToken() { return m_last MouseDownUserGestureToken.release(); }
219 217
220 int clickCount() { return m_clickCount; } 218 int clickCount() { return m_clickCount; }
221 219
222 SelectionController& selectionController() const { return *m_selectionContro ller; } 220 SelectionController& selectionController() const { return *m_selectionContro ller; }
223 221
222 // FIXME(nzolghadr): This function is technically a private function of
223 // EventHandler class. Making it public temporary to make it possible to
224 // move some code around in the refactoring process.
225 // Performs a chaining logical scroll, within a *single* frame, starting
226 // from either a provided starting node or a default based on the focused or
227 // most recently clicked node, falling back to the frame.
228 // Returns true if the scroll was consumed.
229 // direction - The logical direction to scroll in. This will be converted to
230 // a physical direction for each LayoutBox we try to scroll
231 // based on that box's writing mode.
232 // granularity - The units that the scroll delta parameter is in.
233 // startNode - Optional. If provided, start chaining from the given node.
234 // If not, use the current focus or last clicked node.
235 bool logicalScroll(ScrollDirection, ScrollGranularity, Node* startNode = nul lptr);
236
224 private: 237 private:
225 static DragState& dragState(); 238 static DragState& dragState();
226 239
227 DataTransfer* createDraggingDataTransfer() const; 240 DataTransfer* createDraggingDataTransfer() const;
228 241
229 WebInputEventResult handleMouseMoveOrLeaveEvent(const PlatformMouseEvent&, H itTestResult* hoveredNode = nullptr, bool onlyUpdateScrollbars = false, bool for ceLeave = false); 242 WebInputEventResult handleMouseMoveOrLeaveEvent(const PlatformMouseEvent&, H itTestResult* hoveredNode = nullptr, bool onlyUpdateScrollbars = false, bool for ceLeave = false);
230 WebInputEventResult handleMousePressEvent(const MouseEventWithHitTestResults &); 243 WebInputEventResult handleMousePressEvent(const MouseEventWithHitTestResults &);
231 WebInputEventResult handleMouseFocus(const MouseEventWithHitTestResults&, In putDeviceCapabilities* sourceCapabilities); 244 WebInputEventResult handleMouseFocus(const MouseEventWithHitTestResults&, In putDeviceCapabilities* sourceCapabilities);
232 WebInputEventResult handleMouseDraggedEvent(const MouseEventWithHitTestResul ts&); 245 WebInputEventResult handleMouseDraggedEvent(const MouseEventWithHitTestResul ts&);
233 WebInputEventResult handleMouseReleaseEvent(const MouseEventWithHitTestResul ts&); 246 WebInputEventResult handleMouseReleaseEvent(const MouseEventWithHitTestResul ts&);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // The last mouse movement position this frame has seen in root frame coordi nates. 378 // The last mouse movement position this frame has seen in root frame coordi nates.
366 IntPoint m_lastKnownMousePosition; 379 IntPoint m_lastKnownMousePosition;
367 IntPoint m_lastKnownMouseGlobalPosition; 380 IntPoint m_lastKnownMouseGlobalPosition;
368 IntPoint m_mouseDownPos; // In our view's coords. 381 IntPoint m_mouseDownPos; // In our view's coords.
369 double m_mouseDownTimestamp; 382 double m_mouseDownTimestamp;
370 PlatformMouseEvent m_mouseDown; 383 PlatformMouseEvent m_mouseDown;
371 RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken; 384 RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken;
372 385
373 PointerEventManager m_pointerEventManager; 386 PointerEventManager m_pointerEventManager;
374 ScrollManager m_scrollManager; 387 ScrollManager m_scrollManager;
388 KeyboardEventManager m_keyboardEventManager;
375 389
376 double m_maxMouseMovedDuration; 390 double m_maxMouseMovedDuration;
377 391
378 bool m_longTapShouldInvokeContextMenu; 392 bool m_longTapShouldInvokeContextMenu;
379 393
380 Timer<EventHandler> m_activeIntervalTimer; 394 Timer<EventHandler> m_activeIntervalTimer;
381 double m_lastShowPressTimestamp; 395 double m_lastShowPressTimestamp;
382 Member<Element> m_lastDeferredTapElement; 396 Member<Element> m_lastDeferredTapElement;
383 }; 397 };
384 398
385 } // namespace blink 399 } // namespace blink
386 400
387 #endif // EventHandler_h 401 #endif // EventHandler_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698