OLD | NEW |
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 20 matching lines...) Expand all Loading... |
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/MouseEventManager.h" |
34 #include "core/input/PointerEventManager.h" | 34 #include "core/input/PointerEventManager.h" |
35 #include "core/input/ScrollManager.h" | 35 #include "core/input/ScrollManager.h" |
36 #include "core/layout/HitTestRequest.h" | 36 #include "core/layout/HitTestRequest.h" |
37 #include "core/page/DragActions.h" | 37 #include "core/page/DragActions.h" |
38 #include "core/page/EventWithHitTestResults.h" | 38 #include "core/page/EventWithHitTestResults.h" |
39 #include "core/style/ComputedStyleConstants.h" | 39 #include "core/style/ComputedStyleConstants.h" |
40 #include "platform/Cursor.h" | 40 #include "platform/Cursor.h" |
41 #include "platform/PlatformMouseEvent.h" | |
42 #include "platform/UserGestureIndicator.h" | 41 #include "platform/UserGestureIndicator.h" |
43 #include "platform/geometry/LayoutPoint.h" | 42 #include "platform/geometry/LayoutPoint.h" |
44 #include "platform/heap/Handle.h" | 43 #include "platform/heap/Handle.h" |
45 #include "platform/scroll/ScrollTypes.h" | 44 #include "platform/scroll/ScrollTypes.h" |
46 #include "public/platform/WebInputEvent.h" | 45 #include "public/platform/WebInputEvent.h" |
47 #include "public/platform/WebInputEventResult.h" | 46 #include "public/platform/WebInputEventResult.h" |
48 #include "wtf/Forward.h" | 47 #include "wtf/Forward.h" |
49 #include "wtf/HashMap.h" | 48 #include "wtf/HashMap.h" |
50 #include "wtf/HashTraits.h" | 49 #include "wtf/HashTraits.h" |
51 #include "wtf/RefPtr.h" | 50 #include "wtf/RefPtr.h" |
(...skipping 14 matching lines...) Expand all Loading... |
66 class HitTestResult; | 65 class HitTestResult; |
67 class LayoutObject; | 66 class LayoutObject; |
68 class LocalFrame; | 67 class LocalFrame; |
69 class Node; | 68 class Node; |
70 class OptionalCursor; | 69 class OptionalCursor; |
71 class ScrollableArea; | 70 class ScrollableArea; |
72 class Scrollbar; | 71 class Scrollbar; |
73 class SelectionController; | 72 class SelectionController; |
74 class TextEvent; | 73 class TextEvent; |
75 class WebGestureEvent; | 74 class WebGestureEvent; |
| 75 class WebMouseEvent; |
76 class WebMouseWheelEvent; | 76 class WebMouseWheelEvent; |
77 class WebTouchEvent; | 77 class WebTouchEvent; |
78 | 78 |
79 class CORE_EXPORT EventHandler final | 79 class CORE_EXPORT EventHandler final |
80 : public GarbageCollectedFinalized<EventHandler> { | 80 : public GarbageCollectedFinalized<EventHandler> { |
81 WTF_MAKE_NONCOPYABLE(EventHandler); | 81 WTF_MAKE_NONCOPYABLE(EventHandler); |
82 | 82 |
83 public: | 83 public: |
84 explicit EventHandler(LocalFrame&); | 84 explicit EventHandler(LocalFrame&); |
85 DECLARE_TRACE(); | 85 DECLARE_TRACE(); |
(...skipping 20 matching lines...) Expand all Loading... |
106 const LayoutSize& padding = LayoutSize()); | 106 const LayoutSize& padding = LayoutSize()); |
107 | 107 |
108 bool mousePressed() const { return m_mouseEventManager->mousePressed(); } | 108 bool mousePressed() const { return m_mouseEventManager->mousePressed(); } |
109 bool isMousePositionUnknown() const { | 109 bool isMousePositionUnknown() const { |
110 return m_mouseEventManager->isMousePositionUnknown(); | 110 return m_mouseEventManager->isMousePositionUnknown(); |
111 } | 111 } |
112 void clearMouseEventManager() const { m_mouseEventManager->clear(); } | 112 void clearMouseEventManager() const { m_mouseEventManager->clear(); } |
113 void setCapturingMouseEventsNode( | 113 void setCapturingMouseEventsNode( |
114 Node*); // A caller is responsible for resetting capturing node to 0. | 114 Node*); // A caller is responsible for resetting capturing node to 0. |
115 | 115 |
116 WebInputEventResult updateDragAndDrop(const PlatformMouseEvent&, | 116 WebInputEventResult updateDragAndDrop(const WebMouseEvent&, DataTransfer*); |
117 DataTransfer*); | 117 void cancelDragAndDrop(const WebMouseEvent&, DataTransfer*); |
118 void cancelDragAndDrop(const PlatformMouseEvent&, DataTransfer*); | 118 WebInputEventResult performDragAndDrop(const WebMouseEvent&, DataTransfer*); |
119 WebInputEventResult performDragAndDrop(const PlatformMouseEvent&, | |
120 DataTransfer*); | |
121 void updateDragStateAfterEditDragIfNeeded(Element* rootEditableElement); | 119 void updateDragStateAfterEditDragIfNeeded(Element* rootEditableElement); |
122 | 120 |
123 void scheduleHoverStateUpdate(); | 121 void scheduleHoverStateUpdate(); |
124 void scheduleCursorUpdate(); | 122 void scheduleCursorUpdate(); |
125 | 123 |
126 // Return whether a mouse cursor update is currently pending. Used for | 124 // Return whether a mouse cursor update is currently pending. Used for |
127 // testing. | 125 // testing. |
128 bool cursorUpdatePending(); | 126 bool cursorUpdatePending(); |
129 | 127 |
130 void setResizingFrameSet(HTMLFrameSetElement*); | 128 void setResizingFrameSet(HTMLFrameSetElement*); |
131 | 129 |
132 void resizeScrollableAreaDestroyed(); | 130 void resizeScrollableAreaDestroyed(); |
133 | 131 |
134 IntPoint lastKnownMousePosition() const; | 132 IntPoint lastKnownMousePosition() const; |
135 | 133 |
136 IntPoint dragDataTransferLocationForTesting(); | 134 IntPoint dragDataTransferLocationForTesting(); |
137 | 135 |
138 // Performs a logical scroll that chains, crossing frames, starting from | 136 // Performs a logical scroll that chains, crossing frames, starting from |
139 // the given node or a reasonable default (focus/last clicked). | 137 // the given node or a reasonable default (focus/last clicked). |
140 bool bubblingScroll(ScrollDirection, | 138 bool bubblingScroll(ScrollDirection, |
141 ScrollGranularity, | 139 ScrollGranularity, |
142 Node* startingNode = nullptr); | 140 Node* startingNode = nullptr); |
143 | 141 |
144 WebInputEventResult handleMouseMoveEvent( | 142 WebInputEventResult handleMouseMoveEvent( |
145 const PlatformMouseEvent&, | 143 const WebMouseEvent&, |
146 const Vector<PlatformMouseEvent>& coalescedEvents); | 144 const Vector<WebMouseEvent>& coalescedEvents); |
147 void handleMouseLeaveEvent(const PlatformMouseEvent&); | 145 void handleMouseLeaveEvent(const WebMouseEvent&); |
148 | 146 |
149 WebInputEventResult handleMousePressEvent(const PlatformMouseEvent&); | 147 WebInputEventResult handleMousePressEvent(const WebMouseEvent&); |
150 WebInputEventResult handleMouseReleaseEvent(const PlatformMouseEvent&); | 148 WebInputEventResult handleMouseReleaseEvent(const WebMouseEvent&); |
151 WebInputEventResult handleWheelEvent(const WebMouseWheelEvent&); | 149 WebInputEventResult handleWheelEvent(const WebMouseWheelEvent&); |
152 | 150 |
153 // Called on the local root frame exactly once per gesture event. | 151 // Called on the local root frame exactly once per gesture event. |
154 WebInputEventResult handleGestureEvent(const WebGestureEvent&); | 152 WebInputEventResult handleGestureEvent(const WebGestureEvent&); |
155 WebInputEventResult handleGestureEvent(const GestureEventWithHitTestResults&); | 153 WebInputEventResult handleGestureEvent(const GestureEventWithHitTestResults&); |
156 | 154 |
157 // Clear the old hover/active state within frames before moving the hover | 155 // Clear the old hover/active state within frames before moving the hover |
158 // state to the another frame | 156 // state to the another frame |
159 void updateGestureHoverActiveState(const HitTestRequest&, Element*); | 157 void updateGestureHoverActiveState(const HitTestRequest&, Element*); |
160 | 158 |
(...skipping 25 matching lines...) Expand all Loading... |
186 bool bestContextMenuNodeForHitTestResult(const HitTestResult&, | 184 bool bestContextMenuNodeForHitTestResult(const HitTestResult&, |
187 IntPoint& targetPoint, | 185 IntPoint& targetPoint, |
188 Node*& targetNode); | 186 Node*& targetNode); |
189 // FIXME: This doesn't appear to be used outside tests anymore, what path are | 187 // FIXME: This doesn't appear to be used outside tests anymore, what path are |
190 // we using now and is it tested? | 188 // we using now and is it tested? |
191 bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, | 189 bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, |
192 const IntSize& touchRadius, | 190 const IntSize& touchRadius, |
193 IntRect& targetArea, | 191 IntRect& targetArea, |
194 Node*& targetNode); | 192 Node*& targetNode); |
195 | 193 |
196 WebInputEventResult sendContextMenuEvent(const PlatformMouseEvent&, | 194 WebInputEventResult sendContextMenuEvent(const WebMouseEvent&, |
197 Node* overrideTargetNode = nullptr); | 195 Node* overrideTargetNode = nullptr); |
198 WebInputEventResult sendContextMenuEventForKey( | 196 WebInputEventResult sendContextMenuEventForKey( |
199 Element* overrideTargetElement = nullptr); | 197 Element* overrideTargetElement = nullptr); |
200 | 198 |
201 // Returns whether pointerId is active or not | 199 // Returns whether pointerId is active or not |
202 bool isPointerEventActive(int); | 200 bool isPointerEventActive(int); |
203 | 201 |
204 void setPointerCapture(int, EventTarget*); | 202 void setPointerCapture(int, EventTarget*); |
205 void releasePointerCapture(int, EventTarget*); | 203 void releasePointerCapture(int, EventTarget*); |
206 bool hasPointerCapture(int, const EventTarget*) const; | 204 bool hasPointerCapture(int, const EventTarget*) const; |
207 bool hasProcessedPointerCapture(int, const EventTarget*) const; | 205 bool hasProcessedPointerCapture(int, const EventTarget*) const; |
208 | 206 |
209 void elementRemoved(EventTarget*); | 207 void elementRemoved(EventTarget*); |
210 | 208 |
211 void setMouseDownMayStartAutoscroll(); | 209 void setMouseDownMayStartAutoscroll(); |
212 | 210 |
213 bool handleAccessKey(const WebKeyboardEvent&); | 211 bool handleAccessKey(const WebKeyboardEvent&); |
214 WebInputEventResult keyEvent(const WebKeyboardEvent&); | 212 WebInputEventResult keyEvent(const WebKeyboardEvent&); |
215 void defaultKeyboardEventHandler(KeyboardEvent*); | 213 void defaultKeyboardEventHandler(KeyboardEvent*); |
216 | 214 |
217 bool handleTextInputEvent(const String& text, | 215 bool handleTextInputEvent(const String& text, |
218 Event* underlyingEvent = nullptr, | 216 Event* underlyingEvent = nullptr, |
219 TextEventInputType = TextEventInputKeyboard); | 217 TextEventInputType = TextEventInputKeyboard); |
220 void defaultTextInputEventHandler(TextEvent*); | 218 void defaultTextInputEventHandler(TextEvent*); |
221 | 219 |
222 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); | 220 void dragSourceEndedAt(const WebMouseEvent&, DragOperation); |
223 | 221 |
224 void capsLockStateMayHaveChanged(); // Only called by FrameSelection | 222 void capsLockStateMayHaveChanged(); // Only called by FrameSelection |
225 | 223 |
226 WebInputEventResult handleTouchEvent( | 224 WebInputEventResult handleTouchEvent( |
227 const WebTouchEvent&, | 225 const WebTouchEvent&, |
228 const Vector<WebTouchEvent>& coalescedEvents); | 226 const Vector<WebTouchEvent>& coalescedEvents); |
229 | 227 |
230 bool useHandCursor(Node*, bool isOverLink); | 228 bool useHandCursor(Node*, bool isOverLink); |
231 | 229 |
232 void notifyElementActivated(); | 230 void notifyElementActivated(); |
(...skipping 20 matching lines...) Expand all Loading... |
253 // startNode - Optional. If provided, start chaining from the given node. | 251 // startNode - Optional. If provided, start chaining from the given node. |
254 // If not, use the current focus or last clicked node. | 252 // If not, use the current focus or last clicked node. |
255 bool logicalScroll(ScrollDirection, | 253 bool logicalScroll(ScrollDirection, |
256 ScrollGranularity, | 254 ScrollGranularity, |
257 Node* startNode = nullptr); | 255 Node* startNode = nullptr); |
258 | 256 |
259 bool isTouchPointerIdActiveOnFrame(int, LocalFrame*) const; | 257 bool isTouchPointerIdActiveOnFrame(int, LocalFrame*) const; |
260 | 258 |
261 private: | 259 private: |
262 WebInputEventResult handleMouseMoveOrLeaveEvent( | 260 WebInputEventResult handleMouseMoveOrLeaveEvent( |
263 const PlatformMouseEvent&, | 261 const WebMouseEvent&, |
264 const Vector<PlatformMouseEvent>&, | 262 const Vector<WebMouseEvent>&, |
265 HitTestResult* hoveredNode = nullptr, | 263 HitTestResult* hoveredNode = nullptr, |
266 bool onlyUpdateScrollbars = false, | 264 bool onlyUpdateScrollbars = false, |
267 bool forceLeave = false); | 265 bool forceLeave = false); |
268 | 266 |
269 HitTestRequest::HitTestRequestType getHitTypeForGestureType( | 267 HitTestRequest::HitTestRequestType getHitTypeForGestureType( |
270 PlatformEvent::EventType); | 268 PlatformEvent::EventType); |
271 void applyTouchAdjustment(WebGestureEvent*, HitTestResult*); | 269 void applyTouchAdjustment(WebGestureEvent*, HitTestResult*); |
272 WebInputEventResult handleGestureTapDown( | 270 WebInputEventResult handleGestureTapDown( |
273 const GestureEventWithHitTestResults&); | 271 const GestureEventWithHitTestResults&); |
274 WebInputEventResult handleGestureTap(const GestureEventWithHitTestResults&); | 272 WebInputEventResult handleGestureTap(const GestureEventWithHitTestResults&); |
(...skipping 20 matching lines...) Expand all Loading... |
295 | 293 |
296 ScrollableArea* associatedScrollableArea(const PaintLayer*) const; | 294 ScrollableArea* associatedScrollableArea(const PaintLayer*) const; |
297 | 295 |
298 Node* updateMouseEventTargetNode(Node*); | 296 Node* updateMouseEventTargetNode(Node*); |
299 | 297 |
300 // Dispatches ME after corresponding PE provided the PE has not been canceled. | 298 // Dispatches ME after corresponding PE provided the PE has not been canceled. |
301 // The eventType arg must be a mouse event that can be gated though a | 299 // The eventType arg must be a mouse event that can be gated though a |
302 // preventDefaulted pointerdown (i.e., one of | 300 // preventDefaulted pointerdown (i.e., one of |
303 // {mousedown, mousemove, mouseup}). | 301 // {mousedown, mousemove, mouseup}). |
304 // TODO(mustaq): Can we avoid the clickCount param, instead use | 302 // TODO(mustaq): Can we avoid the clickCount param, instead use |
305 // PlatformMouseEvent's count? | 303 // WebmMouseEvent's count? |
306 // Same applied to dispatchMouseEvent() above. | 304 // Same applied to dispatchMouseEvent() above. |
307 WebInputEventResult updatePointerTargetAndDispatchEvents( | 305 WebInputEventResult updatePointerTargetAndDispatchEvents( |
308 const AtomicString& mouseEventType, | 306 const AtomicString& mouseEventType, |
309 Node* target, | 307 Node* target, |
310 const PlatformMouseEvent&, | 308 const String& canvasRegionId, |
311 const Vector<PlatformMouseEvent>& coalescedEvents); | 309 const WebMouseEvent&, |
| 310 const Vector<WebMouseEvent>& coalescedEvents); |
312 | 311 |
313 // Clears drag target and related states. It is called when drag is done or | 312 // Clears drag target and related states. It is called when drag is done or |
314 // canceled. | 313 // canceled. |
315 void clearDragState(); | 314 void clearDragState(); |
316 | 315 |
317 WebInputEventResult passMousePressEventToSubframe( | 316 WebInputEventResult passMousePressEventToSubframe( |
318 MouseEventWithHitTestResults&, | 317 MouseEventWithHitTestResults&, |
319 LocalFrame* subframe); | 318 LocalFrame* subframe); |
320 WebInputEventResult passMouseMoveEventToSubframe( | 319 WebInputEventResult passMouseMoveEventToSubframe( |
321 MouseEventWithHitTestResults&, | 320 MouseEventWithHitTestResults&, |
322 const Vector<PlatformMouseEvent>&, | 321 const Vector<WebMouseEvent>&, |
323 LocalFrame* subframe, | 322 LocalFrame* subframe, |
324 HitTestResult* hoveredNode = nullptr); | 323 HitTestResult* hoveredNode = nullptr); |
325 WebInputEventResult passMouseReleaseEventToSubframe( | 324 WebInputEventResult passMouseReleaseEventToSubframe( |
326 MouseEventWithHitTestResults&, | 325 MouseEventWithHitTestResults&, |
327 LocalFrame* subframe); | 326 LocalFrame* subframe); |
328 | 327 |
329 bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&); | 328 bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&); |
330 | 329 |
331 void defaultSpaceEventHandler(KeyboardEvent*); | 330 void defaultSpaceEventHandler(KeyboardEvent*); |
332 void defaultBackspaceEventHandler(KeyboardEvent*); | 331 void defaultBackspaceEventHandler(KeyboardEvent*); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 386 |
388 // Set on GestureTapDown if the |pointerdown| event corresponding to the | 387 // Set on GestureTapDown if the |pointerdown| event corresponding to the |
389 // triggering |touchstart| event was canceled. This suppresses mouse event | 388 // triggering |touchstart| event was canceled. This suppresses mouse event |
390 // firing for the current gesture sequence (i.e. until next GestureTapDown). | 389 // firing for the current gesture sequence (i.e. until next GestureTapDown). |
391 bool m_suppressMouseEventsFromGestures; | 390 bool m_suppressMouseEventsFromGestures; |
392 }; | 391 }; |
393 | 392 |
394 } // namespace blink | 393 } // namespace blink |
395 | 394 |
396 #endif // EventHandler_h | 395 #endif // EventHandler_h |
OLD | NEW |