blob: c69275b5baaa6a1ebd9b1c0b1bba32d2d032ba98 [file] [log] [blame]
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +01001/*
2 * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Ben Murdoch02772c62013-07-26 10:21:05 +010023 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010024 */
25
26#ifndef EventHandler_h
27#define EventHandler_h
28
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010029#include "core/editing/TextGranularity.h"
Torne (Richard Coles)1e202182013-10-18 15:46:42 +010030#include "core/events/TextEventInputType.h"
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010031#include "core/page/DragActions.h"
Torne (Richard Coles)09380292014-02-21 12:17:33 +000032#include "core/page/FocusType.h"
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010033#include "core/rendering/HitTestRequest.h"
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000034#include "core/rendering/style/RenderStyleConstants.h"
35#include "platform/Cursor.h"
Torne (Richard Coles)1e202182013-10-18 15:46:42 +010036#include "platform/PlatformMouseEvent.h"
37#include "platform/Timer.h"
38#include "platform/UserGestureIndicator.h"
39#include "platform/geometry/LayoutPoint.h"
Bo Liuf91f5fa2014-05-01 10:37:55 -070040#include "platform/heap/Handle.h"
Torne (Richard Coles)1e202182013-10-18 15:46:42 +010041#include "platform/scroll/ScrollTypes.h"
Ben Murdoch591b9582013-07-10 11:41:44 +010042#include "wtf/Forward.h"
43#include "wtf/HashMap.h"
Torne (Richard Coles)32348042014-05-14 12:12:57 +010044#include "wtf/HashTraits.h"
Ben Murdoch591b9582013-07-10 11:41:44 +010045#include "wtf/RefPtr.h"
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010046
47namespace WebCore {
48
Torne (Richard Coles)19cde672013-11-06 12:28:04 +000049class AutoscrollController;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010050class Clipboard;
51class Document;
52class Element;
53class Event;
54class EventTarget;
55class FloatPoint;
56class FloatQuad;
Torne (Richard Coles)f5e4ad52013-08-05 13:57:57 +010057class FullscreenElementStack;
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +000058class LocalFrame;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010059class HTMLFrameSetElement;
60class HitTestRequest;
61class HitTestResult;
62class KeyboardEvent;
63class MouseEventWithHitTestResults;
64class Node;
65class OptionalCursor;
66class PlatformGestureEvent;
67class PlatformKeyboardEvent;
68class PlatformTouchEvent;
69class PlatformWheelEvent;
70class RenderLayer;
Torne (Richard Coles)f79f16f2013-10-31 11:16:44 +000071class RenderLayerScrollableArea;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010072class RenderObject;
73class RenderWidget;
Torne (Richard Coles)e1f1df52013-08-23 16:39:30 +010074class ScrollableArea;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010075class Scrollbar;
76class TextEvent;
77class TouchEvent;
78class VisibleSelection;
79class WheelEvent;
80class Widget;
81
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +000082class DragState;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010083
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010084enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace };
85enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis };
86
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +010087class EventHandler : public NoBaseWillBeGarbageCollectedFinalized<EventHandler> {
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010088 WTF_MAKE_NONCOPYABLE(EventHandler);
89public:
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +000090 explicit EventHandler(LocalFrame*);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010091 ~EventHandler();
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +010092 void trace(Visitor*);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010093
94 void clear();
Torne (Richard Coles)19cde672013-11-06 12:28:04 +000095 void nodeWillBeRemoved(Node&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010096
97 void updateSelectionForMouseDrag();
98
99 Node* mousePressNode() const;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100100
Torne (Richard Coles)8abfc582013-09-12 12:10:38 +0100101#if OS(WIN)
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100102 void startPanScrolling(RenderObject*);
103#endif
104
Torne (Richard Coles)19cde672013-11-06 12:28:04 +0000105 void stopAutoscroll();
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100106
107 void dispatchFakeMouseMoveEventSoon();
108 void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
109
110 HitTestResult hitTestResultAtPoint(const LayoutPoint&,
Ben Murdoch591b9582013-07-10 11:41:44 +0100111 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active,
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100112 const LayoutSize& padding = LayoutSize());
113
114 bool mousePressed() const { return m_mousePressed; }
115 void setMousePressed(bool pressed) { m_mousePressed = pressed; }
116
Torne (Richard Coles)d6cdb822014-06-03 10:59:05 +0100117 void setCapturingMouseEventsNode(PassRefPtrWillBeRawPtr<Node>); // A caller is responsible for resetting capturing node to 0.
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100118
119 bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*);
120 void cancelDragAndDrop(const PlatformMouseEvent&, Clipboard*);
121 bool performDragAndDrop(const PlatformMouseEvent&, Clipboard*);
122 void updateDragStateAfterEditDragIfNeeded(Element* rootEditableElement);
123
124 void scheduleHoverStateUpdate();
Torne (Richard Coles)1e202182013-10-18 15:46:42 +0100125 void scheduleCursorUpdate();
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100126
127 void setResizingFrameSet(HTMLFrameSetElement*);
128
Torne (Richard Coles)f79f16f2013-10-31 11:16:44 +0000129 void resizeScrollableAreaDestroyed();
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100130
131 IntPoint lastKnownMousePosition() const;
132 Cursor currentMouseCursor() const { return m_currentMouseCursor; }
133
Torne (Richard Coles)09380292014-02-21 12:17:33 +0000134 // Attempts to scroll the DOM tree. If that fails, scrolls the view.
135 // If the view can't be scrolled either, recursively bubble to the parent frame.
136 bool bubblingScroll(ScrollDirection, ScrollGranularity, Node* startingNode = 0);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100137
Torne (Richard Coles)c0e19a62013-08-30 15:15:11 +0100138 bool handleMouseMoveEvent(const PlatformMouseEvent&);
139 void handleMouseLeaveEvent(const PlatformMouseEvent&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100140
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100141 bool handleMousePressEvent(const PlatformMouseEvent&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100142 bool handleMouseReleaseEvent(const PlatformMouseEvent&);
143 bool handleWheelEvent(const PlatformWheelEvent&);
144 void defaultWheelEventHandler(Node*, WheelEvent*);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100145
146 bool handleGestureEvent(const PlatformGestureEvent&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100147 bool handleGestureScrollEnd(const PlatformGestureEvent&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100148 bool isScrollbarHandlingGestures() const;
149
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100150 bool bestClickableNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode);
151 bool bestContextMenuNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode);
152 bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntRect& targetArea, Node*& targetNode);
153
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +0000154 void adjustGesturePosition(const PlatformGestureEvent&, IntPoint& adjustedPoint);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100155
156 bool sendContextMenuEvent(const PlatformMouseEvent&);
157 bool sendContextMenuEventForKey();
158 bool sendContextMenuEventForGesture(const PlatformGestureEvent&);
159
160 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true; }
161
162 static unsigned accessKeyModifiers();
163 bool handleAccessKey(const PlatformKeyboardEvent&);
164 bool keyEvent(const PlatformKeyboardEvent&);
165 void defaultKeyboardEventHandler(KeyboardEvent*);
166
167 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, TextEventInputType = TextEventInputKeyboard);
168 void defaultTextInputEventHandler(TextEvent*);
169
170 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation);
171
172 void focusDocumentView();
173
174 void capsLockStateMayHaveChanged(); // Only called by FrameSelection
175
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100176 bool handleTouchEvent(const PlatformTouchEvent&);
177
Ben Murdoch6f543c72014-04-16 11:17:22 +0100178 bool useHandCursor(Node*, bool isOverLink);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100179
Torne (Richard Coles)a854de02013-12-18 16:25:25 +0000180 void notifyElementActivated();
181
Ben Murdoch10f88d52014-04-24 10:50:33 +0100182 PassRefPtr<UserGestureToken> takeLastMouseDownGestureToken() { return m_lastMouseDownUserGestureToken.release(); }
183
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100184private:
185 static DragState& dragState();
Ben Murdoch02772c62013-07-26 10:21:05 +0100186
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +0000187 PassRefPtrWillBeRawPtr<Clipboard> createDraggingClipboard() const;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100188
189 bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleSelection&, TextGranularity);
190 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace);
Torne (Richard Coles)5267f702013-06-11 10:57:24 +0100191 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100192 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&);
Torne (Richard Coles)5267f702013-06-11 10:57:24 +0100193 void selectClosestMisspellingFromMouseEvent(const MouseEventWithHitTestResults&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100194 void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults&);
195
Torne (Richard Coles)c0e19a62013-08-30 15:15:11 +0100196 bool handleMouseMoveOrLeaveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0, bool onlyUpdateScrollbars = false);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100197 bool handleMousePressEvent(const MouseEventWithHitTestResults&);
198 bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
199 bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
200 bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
Ben Murdoch6f543c72014-04-16 11:17:22 +0100201 bool handleMouseFocus(const PlatformMouseEvent&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100202 bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&);
203 bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
204
Torne (Richard Coles)1e202182013-10-18 15:46:42 +0100205 bool handlePasteGlobalSelection(const PlatformMouseEvent&);
206
Torne (Richard Coles)a854de02013-12-18 16:25:25 +0000207 bool handleGestureTap(const PlatformGestureEvent&, const IntPoint& adjustedPoint);
Torne (Richard Coles)51b29062013-11-28 11:56:03 +0000208 bool handleGestureLongPress(const PlatformGestureEvent&, const IntPoint& adjustedPoint);
209 bool handleGestureLongTap(const PlatformGestureEvent&, const IntPoint& adjustedPoint);
210 bool handleGestureTwoFingerTap(const PlatformGestureEvent&, const IntPoint& adjustedPoint);
Torne (Richard Coles)1e202182013-10-18 15:46:42 +0100211 bool handleGestureScrollUpdate(const PlatformGestureEvent&);
212 bool handleGestureScrollBegin(const PlatformGestureEvent&);
213 void clearGestureScrollNodes();
214
215 bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const;
216
Ben Murdoch6f543c72014-04-16 11:17:22 +0100217 OptionalCursor selectCursor(const HitTestResult&);
218 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& iBeam);
Torne (Richard Coles)1e202182013-10-18 15:46:42 +0100219
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100220 void hoverTimerFired(Timer<EventHandler>*);
Torne (Richard Coles)1e202182013-10-18 15:46:42 +0100221 void cursorUpdateTimerFired(Timer<EventHandler>*);
Torne (Richard Coles)a854de02013-12-18 16:25:25 +0000222 void activeIntervalTimerFired(Timer<EventHandler>*);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100223
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100224 bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; }
225
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100226 void fakeMouseMoveEventTimerFired(Timer<EventHandler>*);
227 void cancelFakeMouseMoveEvent();
228 bool isCursorVisible() const;
Torne (Richard Coles)1e202182013-10-18 15:46:42 +0100229 void updateCursor();
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100230
231 bool isInsideScrollbar(const IntPoint&) const;
232
Torne (Richard Coles)e1f1df52013-08-23 16:39:30 +0100233 ScrollableArea* associatedScrollableArea(const RenderLayer*) const;
234
Torne (Richard Coles)09380292014-02-21 12:17:33 +0000235 // Scrolls the elements of the DOM tree. Returns true if a node was scrolled.
236 // False if we reached the root and couldn't scroll anything.
237 // direction - The direction to scroll in. If this is a logicl direction, it will be
238 // converted to the physical direction based on a node's writing mode.
239 // granularity - The units that the scroll delta parameter is in.
240 // startNode - The node to start bubbling the scroll from. If a node can't scroll,
241 // the scroll bubbles up to the containing block.
242 // stopNode - On input, if provided and non-null, the node at which we should stop bubbling on input.
243 // On output, if provided and a node was scrolled stopNode will point to that node.
244 // delta - The delta to scroll by, in the units of the granularity parameter. (e.g. pixels, lines, pages, etc.)
245 // absolutePoint - For wheel scrolls - the location, in absolute coordinates, where the event occured.
246 bool scroll(ScrollDirection, ScrollGranularity, Node* startNode = 0, Node** stopNode = 0, float delta = 1.0f, IntPoint absolutePoint = IntPoint());
247
Torne (Richard Coles)09380292014-02-21 12:17:33 +0000248 TouchAction intersectTouchAction(const TouchAction, const TouchAction);
Torne (Richard Coles)5d92fed2014-06-20 14:52:37 +0100249 TouchAction computeEffectiveTouchAction(const Node&);
Torne (Richard Coles)a854de02013-12-18 16:25:25 +0000250
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +0000251 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100252
253 void invalidateClick();
254
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100255 void updateMouseEventTargetNode(Node*, const PlatformMouseEvent&, bool fireMouseOverOut);
Ben Murdoch02772c62013-07-26 10:21:05 +0100256
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100257 MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&);
258
Ben Murdocha9984bf2014-04-10 11:22:39 +0100259 bool dispatchMouseEvent(const AtomicString& eventType, Node* target, int clickCount, const PlatformMouseEvent&, bool setUnder);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100260 bool dispatchDragEvent(const AtomicString& eventType, Node* target, const PlatformMouseEvent&, Clipboard*);
261
262 void freeClipboard();
263
264 bool handleDrag(const MouseEventWithHitTestResults&, CheckDragHysteresis);
Ben Murdoche69819b2013-07-17 14:56:49 +0100265 bool tryStartDrag(const MouseEventWithHitTestResults&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100266 void clearDragState();
267
268 bool dispatchDragSrcEvent(const AtomicString& eventType, const PlatformMouseEvent&);
269
270 bool dragHysteresisExceeded(const FloatPoint&) const;
271 bool dragHysteresisExceeded(const IntPoint&) const;
272
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +0000273 bool passMousePressEventToSubframe(MouseEventWithHitTestResults&, LocalFrame* subframe);
274 bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, LocalFrame* subframe, HitTestResult* hoveredNode = 0);
275 bool passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&, LocalFrame* subframe);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100276
Torne (Richard Coles)5d92fed2014-06-20 14:52:37 +0100277 bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100278
279 bool passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&);
280
281 bool passWheelEventToWidget(const PlatformWheelEvent&, Widget*);
282
283 void defaultSpaceEventHandler(KeyboardEvent*);
284 void defaultBackspaceEventHandler(KeyboardEvent*);
285 void defaultTabEventHandler(KeyboardEvent*);
Torne (Richard Coles)c0e19a62013-08-30 15:15:11 +0100286 void defaultEscapeEventHandler(KeyboardEvent*);
Torne (Richard Coles)09380292014-02-21 12:17:33 +0000287 void defaultArrowEventHandler(FocusType, KeyboardEvent*);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100288
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100289 void updateSelectionForMouseDrag(const HitTestResult&);
290
291 void updateLastScrollbarUnderMouse(Scrollbar*, bool);
Ben Murdoch02772c62013-07-26 10:21:05 +0100292
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100293 void setFrameWasScrolledByUser();
294
295 bool capturesDragging() const { return m_capturesDragging; }
296
Torne (Richard Coles)f5e4ad52013-08-05 13:57:57 +0100297 bool isKeyEventAllowedInFullScreen(FullscreenElementStack*, const PlatformKeyboardEvent&) const;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100298
Torne (Richard Coles)1e202182013-10-18 15:46:42 +0100299 bool handleGestureShowPress();
Torne (Richard Coles)81a51572013-05-13 16:52:28 +0100300
301 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&);
302
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100303 bool passGestureEventToWidget(const PlatformGestureEvent&, Widget*);
304 bool passGestureEventToWidgetIfPossible(const PlatformGestureEvent&, RenderObject*);
305 bool sendScrollEventToView(const PlatformGestureEvent&, const FloatSize&);
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +0000306 LocalFrame* getSubFrameForGestureEvent(const IntPoint& touchAdjustedPoint, const PlatformGestureEvent&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100307
Torne (Richard Coles)19cde672013-11-06 12:28:04 +0000308 AutoscrollController* autoscrollController() const;
Torne (Richard Coles)5267f702013-06-11 10:57:24 +0100309 bool panScrollInProgress() const;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100310 void setLastKnownMousePosition(const PlatformMouseEvent&);
311
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +0000312 LocalFrame* const m_frame;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100313
314 bool m_mousePressed;
315 bool m_capturesDragging;
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100316 RefPtrWillBeMember<Node> m_mousePressNode;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100317
318 bool m_mouseDownMayStartSelect;
319 bool m_mouseDownMayStartDrag;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100320 bool m_mouseDownWasSingleClickInSelection;
321 enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, ExtendedSelection };
322 SelectionInitiationState m_selectionInitiationState;
323
324 LayoutPoint m_dragStartPos;
325
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100326 Timer<EventHandler> m_hoverTimer;
Torne (Richard Coles)1e202182013-10-18 15:46:42 +0100327 Timer<EventHandler> m_cursorUpdateTimer;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100328
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100329 bool m_mouseDownMayStartAutoscroll;
330 bool m_mouseDownWasInSubframe;
331
332 Timer<EventHandler> m_fakeMouseMoveEventTimer;
333
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100334 bool m_svgPan;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100335
Torne (Richard Coles)f79f16f2013-10-31 11:16:44 +0000336 RenderLayerScrollableArea* m_resizeScrollableArea;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100337
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100338 RefPtrWillBeMember<Node> m_capturingMouseEventsNode;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100339 bool m_eventHandlerWillResetCapturingMouseEventsNode;
Ben Murdoch02772c62013-07-26 10:21:05 +0100340
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100341 RefPtrWillBeMember<Node> m_nodeUnderMouse;
342 RefPtrWillBeMember<Node> m_lastNodeUnderMouse;
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +0000343 RefPtr<LocalFrame> m_lastMouseMoveEventSubframe;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100344 RefPtr<Scrollbar> m_lastScrollbarUnderMouse;
345 Cursor m_currentMouseCursor;
346
347 int m_clickCount;
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100348 RefPtrWillBeMember<Node> m_clickNode;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100349
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100350 RefPtrWillBeMember<Node> m_dragTarget;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100351 bool m_shouldOnlyFireDragOverEvent;
Ben Murdoch02772c62013-07-26 10:21:05 +0100352
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100353 RefPtrWillBeMember<HTMLFrameSetElement> m_frameSetBeingResized;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100354
Torne (Richard Coles)f79f16f2013-10-31 11:16:44 +0000355 LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeScrollableArea.
Ben Murdoch02772c62013-07-26 10:21:05 +0100356
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100357 bool m_mousePositionIsUnknown;
358 IntPoint m_lastKnownMousePosition;
359 IntPoint m_lastKnownMouseGlobalPosition;
360 IntPoint m_mouseDownPos; // In our view's coords.
361 double m_mouseDownTimestamp;
362 PlatformMouseEvent m_mouseDown;
363 RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken;
364
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100365 RefPtrWillBeMember<Node> m_latchedWheelEventNode;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100366 bool m_widgetIsLatched;
367
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100368 RefPtrWillBeMember<Node> m_previousWheelScrolledNode;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100369
Torne (Richard Coles)32348042014-05-14 12:12:57 +0100370 // The target of each active touch point indexed by the touch ID.
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100371 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<EventTarget>, DefaultHash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned> > TouchTargetMap;
Torne (Richard Coles)32348042014-05-14 12:12:57 +0100372 TouchTargetMap m_targetForTouchID;
373
374 // If set, the document of the active touch sequence. Unset if no touch sequence active.
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100375 RefPtrWillBeMember<Document> m_touchSequenceDocument;
Torne (Richard Coles)5d92fed2014-06-20 14:52:37 +0100376 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken;
Torne (Richard Coles)32348042014-05-14 12:12:57 +0100377
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100378 bool m_touchPressed;
379
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100380 RefPtrWillBeMember<Node> m_scrollGestureHandlingNode;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100381 bool m_lastHitTestResultOverWidget;
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100382 RefPtrWillBeMember<Node> m_previousGestureScrolledNode;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100383 RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture;
384
385 double m_maxMouseMovedDuration;
386 PlatformEvent::Type m_baseEventType;
387 bool m_didStartDrag;
388
389 bool m_longTapShouldInvokeContextMenu;
Torne (Richard Coles)a854de02013-12-18 16:25:25 +0000390
391 Timer<EventHandler> m_activeIntervalTimer;
392 double m_lastShowPressTimestamp;
Torne (Richard Coles)f6b7aed2014-06-09 12:01:17 +0100393 RefPtrWillBeMember<Element> m_lastDeferredTapElement;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +0100394};
395
396} // namespace WebCore
397
398#endif // EventHandler_h