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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 WebInputEventResult updateDragAndDrop(const PlatformMouseEvent&, | 119 WebInputEventResult updateDragAndDrop(const PlatformMouseEvent&, |
120 DataTransfer*); | 120 DataTransfer*); |
121 void cancelDragAndDrop(const PlatformMouseEvent&, DataTransfer*); | 121 void cancelDragAndDrop(const PlatformMouseEvent&, DataTransfer*); |
122 WebInputEventResult performDragAndDrop(const PlatformMouseEvent&, | 122 WebInputEventResult performDragAndDrop(const PlatformMouseEvent&, |
123 DataTransfer*); | 123 DataTransfer*); |
124 void updateDragStateAfterEditDragIfNeeded(Element* rootEditableElement); | 124 void updateDragStateAfterEditDragIfNeeded(Element* rootEditableElement); |
125 | 125 |
126 void scheduleHoverStateUpdate(); | 126 void scheduleHoverStateUpdate(); |
127 void scheduleCursorUpdate(); | 127 void scheduleCursorUpdate(); |
128 | 128 |
129 // Return whether a mouse cursor update is currently pending. Used for testin
g. | 129 // Return whether a mouse cursor update is currently pending. Used for |
| 130 // testing. |
130 bool cursorUpdatePending(); | 131 bool cursorUpdatePending(); |
131 | 132 |
132 void setResizingFrameSet(HTMLFrameSetElement*); | 133 void setResizingFrameSet(HTMLFrameSetElement*); |
133 | 134 |
134 void resizeScrollableAreaDestroyed(); | 135 void resizeScrollableAreaDestroyed(); |
135 | 136 |
136 IntPoint lastKnownMousePosition() const; | 137 IntPoint lastKnownMousePosition() const; |
137 | 138 |
138 IntPoint dragDataTransferLocationForTesting(); | 139 IntPoint dragDataTransferLocationForTesting(); |
139 | 140 |
140 // Performs a logical scroll that chains, crossing frames, starting from | 141 // Performs a logical scroll that chains, crossing frames, starting from |
141 // the given node or a reasonable default (focus/last clicked). | 142 // the given node or a reasonable default (focus/last clicked). |
142 bool bubblingScroll(ScrollDirection, | 143 bool bubblingScroll(ScrollDirection, |
143 ScrollGranularity, | 144 ScrollGranularity, |
144 Node* startingNode = nullptr); | 145 Node* startingNode = nullptr); |
145 | 146 |
146 WebInputEventResult handleMouseMoveEvent(const PlatformMouseEvent&); | 147 WebInputEventResult handleMouseMoveEvent(const PlatformMouseEvent&); |
147 void handleMouseLeaveEvent(const PlatformMouseEvent&); | 148 void handleMouseLeaveEvent(const PlatformMouseEvent&); |
148 | 149 |
149 WebInputEventResult handleMousePressEvent(const PlatformMouseEvent&); | 150 WebInputEventResult handleMousePressEvent(const PlatformMouseEvent&); |
150 WebInputEventResult handleMouseReleaseEvent(const PlatformMouseEvent&); | 151 WebInputEventResult handleMouseReleaseEvent(const PlatformMouseEvent&); |
151 WebInputEventResult handleWheelEvent(const PlatformWheelEvent&); | 152 WebInputEventResult handleWheelEvent(const PlatformWheelEvent&); |
152 | 153 |
153 // Called on the local root frame exactly once per gesture event. | 154 // Called on the local root frame exactly once per gesture event. |
154 WebInputEventResult handleGestureEvent(const PlatformGestureEvent&); | 155 WebInputEventResult handleGestureEvent(const PlatformGestureEvent&); |
155 WebInputEventResult handleGestureEvent(const GestureEventWithHitTestResults&); | 156 WebInputEventResult handleGestureEvent(const GestureEventWithHitTestResults&); |
156 | 157 |
157 // Clear the old hover/active state within frames before moving the hover stat
e to the another frame | 158 // Clear the old hover/active state within frames before moving the hover |
| 159 // state to the another frame |
158 void updateGestureHoverActiveState(const HitTestRequest&, Element*); | 160 void updateGestureHoverActiveState(const HitTestRequest&, Element*); |
159 | 161 |
160 // Hit-test the provided (non-scroll) gesture event, applying touch-adjustment
and updating | 162 // Hit-test the provided (non-scroll) gesture event, applying touch-adjustment |
161 // hover/active state across all frames if necessary. This should be called at
most once | 163 // and updating hover/active state across all frames if necessary. This should |
162 // per gesture event, and called on the local root frame. | 164 // be called at most once per gesture event, and called on the local root |
| 165 // frame. |
163 // Note: This is similar to (the less clearly named) prepareMouseEvent. | 166 // Note: This is similar to (the less clearly named) prepareMouseEvent. |
164 // FIXME: Remove readOnly param when there is only ever a single call to this. | 167 // FIXME: Remove readOnly param when there is only ever a single call to this. |
165 GestureEventWithHitTestResults targetGestureEvent(const PlatformGestureEvent&, | 168 GestureEventWithHitTestResults targetGestureEvent(const PlatformGestureEvent&, |
166 bool readOnly = false); | 169 bool readOnly = false); |
167 GestureEventWithHitTestResults hitTestResultForGestureEvent( | 170 GestureEventWithHitTestResults hitTestResultForGestureEvent( |
168 const PlatformGestureEvent&, | 171 const PlatformGestureEvent&, |
169 HitTestRequest::HitTestRequestType); | 172 HitTestRequest::HitTestRequestType); |
170 // Handle the provided non-scroll gesture event. Should be called only on the
inner frame. | 173 // Handle the provided non-scroll gesture event. Should be called only on the |
| 174 // inner frame. |
171 WebInputEventResult handleGestureEventInFrame( | 175 WebInputEventResult handleGestureEventInFrame( |
172 const GestureEventWithHitTestResults&); | 176 const GestureEventWithHitTestResults&); |
173 | 177 |
174 // Handle the provided scroll gesture event, propagating down to child frames
as necessary. | 178 // Handle the provided scroll gesture event, propagating down to child frames |
| 179 // as necessary. |
175 WebInputEventResult handleGestureScrollEvent(const PlatformGestureEvent&); | 180 WebInputEventResult handleGestureScrollEvent(const PlatformGestureEvent&); |
176 WebInputEventResult handleGestureScrollEnd(const PlatformGestureEvent&); | 181 WebInputEventResult handleGestureScrollEnd(const PlatformGestureEvent&); |
177 bool isScrollbarHandlingGestures() const; | 182 bool isScrollbarHandlingGestures() const; |
178 | 183 |
179 bool bestClickableNodeForHitTestResult(const HitTestResult&, | 184 bool bestClickableNodeForHitTestResult(const HitTestResult&, |
180 IntPoint& targetPoint, | 185 IntPoint& targetPoint, |
181 Node*& targetNode); | 186 Node*& targetNode); |
182 bool bestContextMenuNodeForHitTestResult(const HitTestResult&, | 187 bool bestContextMenuNodeForHitTestResult(const HitTestResult&, |
183 IntPoint& targetPoint, | 188 IntPoint& targetPoint, |
184 Node*& targetNode); | 189 Node*& targetNode); |
185 // FIXME: This doesn't appear to be used outside tests anymore, what path are
we using now and is it tested? | 190 // FIXME: This doesn't appear to be used outside tests anymore, what path are |
| 191 // we using now and is it tested? |
186 bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, | 192 bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, |
187 const IntSize& touchRadius, | 193 const IntSize& touchRadius, |
188 IntRect& targetArea, | 194 IntRect& targetArea, |
189 Node*& targetNode); | 195 Node*& targetNode); |
190 | 196 |
191 WebInputEventResult sendContextMenuEvent(const PlatformMouseEvent&, | 197 WebInputEventResult sendContextMenuEvent(const PlatformMouseEvent&, |
192 Node* overrideTargetNode = nullptr); | 198 Node* overrideTargetNode = nullptr); |
193 WebInputEventResult sendContextMenuEventForKey( | 199 WebInputEventResult sendContextMenuEventForKey( |
194 Element* overrideTargetElement = nullptr); | 200 Element* overrideTargetElement = nullptr); |
195 | 201 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // a physical direction for each LayoutBox we try to scroll | 249 // a physical direction for each LayoutBox we try to scroll |
244 // based on that box's writing mode. | 250 // based on that box's writing mode. |
245 // granularity - The units that the scroll delta parameter is in. | 251 // granularity - The units that the scroll delta parameter is in. |
246 // startNode - Optional. If provided, start chaining from the given node. | 252 // startNode - Optional. If provided, start chaining from the given node. |
247 // If not, use the current focus or last clicked node. | 253 // If not, use the current focus or last clicked node. |
248 bool logicalScroll(ScrollDirection, | 254 bool logicalScroll(ScrollDirection, |
249 ScrollGranularity, | 255 ScrollGranularity, |
250 Node* startNode = nullptr); | 256 Node* startNode = nullptr); |
251 | 257 |
252 private: | 258 private: |
253 | |
254 WebInputEventResult handleMouseMoveOrLeaveEvent( | 259 WebInputEventResult handleMouseMoveOrLeaveEvent( |
255 const PlatformMouseEvent&, | 260 const PlatformMouseEvent&, |
256 HitTestResult* hoveredNode = nullptr, | 261 HitTestResult* hoveredNode = nullptr, |
257 bool onlyUpdateScrollbars = false, | 262 bool onlyUpdateScrollbars = false, |
258 bool forceLeave = false); | 263 bool forceLeave = false); |
259 | 264 |
260 HitTestRequest::HitTestRequestType getHitTypeForGestureType( | 265 HitTestRequest::HitTestRequestType getHitTypeForGestureType( |
261 PlatformEvent::EventType); | 266 PlatformEvent::EventType); |
262 void applyTouchAdjustment(PlatformGestureEvent*, HitTestResult*); | 267 void applyTouchAdjustment(PlatformGestureEvent*, HitTestResult*); |
263 WebInputEventResult handleGestureTapDown( | 268 WebInputEventResult handleGestureTapDown( |
(...skipping 17 matching lines...) Expand all Loading... |
281 void hoverTimerFired(TimerBase*); | 286 void hoverTimerFired(TimerBase*); |
282 void cursorUpdateTimerFired(TimerBase*); | 287 void cursorUpdateTimerFired(TimerBase*); |
283 void activeIntervalTimerFired(TimerBase*); | 288 void activeIntervalTimerFired(TimerBase*); |
284 | 289 |
285 void updateCursor(); | 290 void updateCursor(); |
286 | 291 |
287 ScrollableArea* associatedScrollableArea(const PaintLayer*) const; | 292 ScrollableArea* associatedScrollableArea(const PaintLayer*) const; |
288 | 293 |
289 Node* updateMouseEventTargetNode(Node*); | 294 Node* updateMouseEventTargetNode(Node*); |
290 | 295 |
291 // Dispatches ME after corresponding PE provided the PE has not been canceled.
The eventType arg | 296 // Dispatches ME after corresponding PE provided the PE has not been canceled. |
292 // must be a mouse event that can be gated though a preventDefaulted pointerdo
wn (i.e., one of | 297 // The eventType arg must be a mouse event that can be gated though a |
| 298 // preventDefaulted pointerdown (i.e., one of |
293 // {mousedown, mousemove, mouseup}). | 299 // {mousedown, mousemove, mouseup}). |
294 // TODO(mustaq): Can we avoid the clickCount param, instead use PlatformMouseE
vent's count? | 300 // TODO(mustaq): Can we avoid the clickCount param, instead use |
| 301 // PlatformMouseEvent's count? |
295 // Same applied to dispatchMouseEvent() above. | 302 // Same applied to dispatchMouseEvent() above. |
296 WebInputEventResult updatePointerTargetAndDispatchEvents( | 303 WebInputEventResult updatePointerTargetAndDispatchEvents( |
297 const AtomicString& mouseEventType, | 304 const AtomicString& mouseEventType, |
298 Node* target, | 305 Node* target, |
299 const PlatformMouseEvent&); | 306 const PlatformMouseEvent&); |
300 | 307 |
301 // Clears drag target and related states. It is called when drag is done or ca
nceled. | 308 // Clears drag target and related states. It is called when drag is done or |
| 309 // canceled. |
302 void clearDragState(); | 310 void clearDragState(); |
303 | 311 |
304 WebInputEventResult passMousePressEventToSubframe( | 312 WebInputEventResult passMousePressEventToSubframe( |
305 MouseEventWithHitTestResults&, | 313 MouseEventWithHitTestResults&, |
306 LocalFrame* subframe); | 314 LocalFrame* subframe); |
307 WebInputEventResult passMouseMoveEventToSubframe( | 315 WebInputEventResult passMouseMoveEventToSubframe( |
308 MouseEventWithHitTestResults&, | 316 MouseEventWithHitTestResults&, |
309 LocalFrame* subframe, | 317 LocalFrame* subframe, |
310 HitTestResult* hoveredNode = nullptr); | 318 HitTestResult* hoveredNode = nullptr); |
311 WebInputEventResult passMouseReleaseEventToSubframe( | 319 WebInputEventResult passMouseReleaseEventToSubframe( |
(...skipping 18 matching lines...) Expand all Loading... |
330 | 338 |
331 // NOTE: If adding a new field to this class please ensure that it is | 339 // NOTE: If adding a new field to this class please ensure that it is |
332 // cleared in |EventHandler::clear()|. | 340 // cleared in |EventHandler::clear()|. |
333 | 341 |
334 const Member<LocalFrame> m_frame; | 342 const Member<LocalFrame> m_frame; |
335 | 343 |
336 const Member<SelectionController> m_selectionController; | 344 const Member<SelectionController> m_selectionController; |
337 | 345 |
338 Timer<EventHandler> m_hoverTimer; | 346 Timer<EventHandler> m_hoverTimer; |
339 | 347 |
340 // TODO(rbyers): Mouse cursor update is page-wide, not per-frame. Page-wide s
tate | 348 // TODO(rbyers): Mouse cursor update is page-wide, not per-frame. Page-wide |
341 // should move out of EventHandler to a new PageEventHandler class. crbug.com/
449649 | 349 // state should move out of EventHandler to a new PageEventHandler class. |
| 350 // crbug.com/449649 |
342 Timer<EventHandler> m_cursorUpdateTimer; | 351 Timer<EventHandler> m_cursorUpdateTimer; |
343 | 352 |
344 Member<Node> m_capturingMouseEventsNode; | 353 Member<Node> m_capturingMouseEventsNode; |
345 bool m_eventHandlerWillResetCapturingMouseEventsNode; | 354 bool m_eventHandlerWillResetCapturingMouseEventsNode; |
346 | 355 |
347 Member<LocalFrame> m_lastMouseMoveEventSubframe; | 356 Member<LocalFrame> m_lastMouseMoveEventSubframe; |
348 Member<Scrollbar> m_lastScrollbarUnderMouse; | 357 Member<Scrollbar> m_lastScrollbarUnderMouse; |
349 | 358 |
350 Member<Node> m_dragTarget; | 359 Member<Node> m_dragTarget; |
351 bool m_shouldOnlyFireDragOverEvent; | 360 bool m_shouldOnlyFireDragOverEvent; |
(...skipping 13 matching lines...) Expand all Loading... |
365 bool m_longTapShouldInvokeContextMenu; | 374 bool m_longTapShouldInvokeContextMenu; |
366 | 375 |
367 Timer<EventHandler> m_activeIntervalTimer; | 376 Timer<EventHandler> m_activeIntervalTimer; |
368 double m_lastShowPressTimestamp; | 377 double m_lastShowPressTimestamp; |
369 Member<Element> m_lastDeferredTapElement; | 378 Member<Element> m_lastDeferredTapElement; |
370 | 379 |
371 // Set on GestureTapDown if the |pointerdown| event corresponding to the | 380 // Set on GestureTapDown if the |pointerdown| event corresponding to the |
372 // triggering |touchstart| event was canceled. This suppresses mouse event | 381 // triggering |touchstart| event was canceled. This suppresses mouse event |
373 // firing for the current gesture sequence (i.e. until next GestureTapDown). | 382 // firing for the current gesture sequence (i.e. until next GestureTapDown). |
374 bool m_suppressMouseEventsFromGestures; | 383 bool m_suppressMouseEventsFromGestures; |
375 | |
376 }; | 384 }; |
377 | 385 |
378 } // namespace blink | 386 } // namespace blink |
379 | 387 |
380 #endif // EventHandler_h | 388 #endif // EventHandler_h |
OLD | NEW |