Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 1 | /* |
| 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 Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 24 | */ |
| 25 | |
| 26 | #ifndef EventHandler_h |
| 27 | #define EventHandler_h |
| 28 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 29 | #include "core/editing/TextGranularity.h" |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 30 | #include "core/events/TextEventInputType.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 31 | #include "core/page/DragActions.h" |
| 32 | #include "core/page/FocusDirection.h" |
| 33 | #include "core/platform/Cursor.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 34 | #include "core/rendering/HitTestRequest.h" |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 35 | #include "platform/PlatformMouseEvent.h" |
| 36 | #include "platform/Timer.h" |
| 37 | #include "platform/UserGestureIndicator.h" |
| 38 | #include "platform/geometry/LayoutPoint.h" |
| 39 | #include "platform/scroll/ScrollTypes.h" |
Ben Murdoch | 591b958 | 2013-07-10 11:41:44 +0100 | [diff] [blame] | 40 | #include "wtf/Forward.h" |
| 41 | #include "wtf/HashMap.h" |
| 42 | #include "wtf/RefPtr.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 43 | |
| 44 | namespace WebCore { |
| 45 | |
Torne (Richard Coles) | 19cde67 | 2013-11-06 12:28:04 +0000 | [diff] [blame] | 46 | class AutoscrollController; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 47 | class Clipboard; |
| 48 | class Document; |
| 49 | class Element; |
| 50 | class Event; |
| 51 | class EventTarget; |
| 52 | class FloatPoint; |
| 53 | class FloatQuad; |
Torne (Richard Coles) | f5e4ad5 | 2013-08-05 13:57:57 +0100 | [diff] [blame] | 54 | class FullscreenElementStack; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 55 | class Frame; |
| 56 | class HTMLFrameSetElement; |
| 57 | class HitTestRequest; |
| 58 | class HitTestResult; |
| 59 | class KeyboardEvent; |
| 60 | class MouseEventWithHitTestResults; |
| 61 | class Node; |
| 62 | class OptionalCursor; |
| 63 | class PlatformGestureEvent; |
| 64 | class PlatformKeyboardEvent; |
| 65 | class PlatformTouchEvent; |
| 66 | class PlatformWheelEvent; |
| 67 | class RenderLayer; |
Torne (Richard Coles) | f79f16f | 2013-10-31 11:16:44 +0000 | [diff] [blame] | 68 | class RenderLayerScrollableArea; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 69 | class RenderObject; |
| 70 | class RenderWidget; |
| 71 | class SVGElementInstance; |
Torne (Richard Coles) | e1f1df5 | 2013-08-23 16:39:30 +0100 | [diff] [blame] | 72 | class ScrollableArea; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 73 | class Scrollbar; |
| 74 | class TextEvent; |
| 75 | class TouchEvent; |
| 76 | class VisibleSelection; |
| 77 | class WheelEvent; |
| 78 | class Widget; |
| 79 | |
| 80 | struct DragState; |
| 81 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 82 | enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace }; |
| 83 | enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis }; |
| 84 | |
| 85 | class EventHandler { |
| 86 | WTF_MAKE_NONCOPYABLE(EventHandler); |
| 87 | public: |
| 88 | explicit EventHandler(Frame*); |
| 89 | ~EventHandler(); |
| 90 | |
| 91 | void clear(); |
Torne (Richard Coles) | 19cde67 | 2013-11-06 12:28:04 +0000 | [diff] [blame] | 92 | void nodeWillBeRemoved(Node&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 93 | |
| 94 | void updateSelectionForMouseDrag(); |
| 95 | |
| 96 | Node* mousePressNode() const; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 97 | |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 98 | #if OS(WIN) |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 99 | void startPanScrolling(RenderObject*); |
| 100 | #endif |
| 101 | |
Torne (Richard Coles) | 19cde67 | 2013-11-06 12:28:04 +0000 | [diff] [blame] | 102 | void stopAutoscroll(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 103 | |
| 104 | void dispatchFakeMouseMoveEventSoon(); |
| 105 | void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); |
| 106 | |
| 107 | HitTestResult hitTestResultAtPoint(const LayoutPoint&, |
Ben Murdoch | 591b958 | 2013-07-10 11:41:44 +0100 | [diff] [blame] | 108 | HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 109 | const LayoutSize& padding = LayoutSize()); |
| 110 | |
| 111 | bool mousePressed() const { return m_mousePressed; } |
| 112 | void setMousePressed(bool pressed) { m_mousePressed = pressed; } |
| 113 | |
| 114 | void setCapturingMouseEventsNode(PassRefPtr<Node>); // A caller is responsible for resetting capturing node to 0. |
| 115 | |
| 116 | bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*); |
| 117 | void cancelDragAndDrop(const PlatformMouseEvent&, Clipboard*); |
| 118 | bool performDragAndDrop(const PlatformMouseEvent&, Clipboard*); |
| 119 | void updateDragStateAfterEditDragIfNeeded(Element* rootEditableElement); |
| 120 | |
| 121 | void scheduleHoverStateUpdate(); |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 122 | void scheduleCursorUpdate(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 123 | |
| 124 | void setResizingFrameSet(HTMLFrameSetElement*); |
| 125 | |
Torne (Richard Coles) | f79f16f | 2013-10-31 11:16:44 +0000 | [diff] [blame] | 126 | void resizeScrollableAreaDestroyed(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 127 | |
| 128 | IntPoint lastKnownMousePosition() const; |
| 129 | Cursor currentMouseCursor() const { return m_currentMouseCursor; } |
| 130 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 131 | bool scrollOverflow(ScrollDirection, ScrollGranularity, Node* startingNode = 0); |
| 132 | bool scrollRecursively(ScrollDirection, ScrollGranularity, Node* startingNode = 0); |
| 133 | bool logicalScrollRecursively(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0); |
| 134 | |
Torne (Richard Coles) | c0e19a6 | 2013-08-30 15:15:11 +0100 | [diff] [blame] | 135 | bool handleMouseMoveEvent(const PlatformMouseEvent&); |
| 136 | void handleMouseLeaveEvent(const PlatformMouseEvent&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 137 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 138 | bool handleMousePressEvent(const PlatformMouseEvent&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 139 | bool handleMouseReleaseEvent(const PlatformMouseEvent&); |
| 140 | bool handleWheelEvent(const PlatformWheelEvent&); |
| 141 | void defaultWheelEventHandler(Node*, WheelEvent*); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 142 | |
| 143 | bool handleGestureEvent(const PlatformGestureEvent&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 144 | bool handleGestureScrollEnd(const PlatformGestureEvent&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 145 | bool isScrollbarHandlingGestures() const; |
| 146 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 147 | bool bestClickableNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode); |
| 148 | bool bestContextMenuNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode); |
| 149 | bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntRect& targetArea, Node*& targetNode); |
| 150 | |
| 151 | bool adjustGesturePosition(const PlatformGestureEvent&, IntPoint& adjustedPoint); |
| 152 | |
| 153 | bool sendContextMenuEvent(const PlatformMouseEvent&); |
| 154 | bool sendContextMenuEventForKey(); |
| 155 | bool sendContextMenuEventForGesture(const PlatformGestureEvent&); |
| 156 | |
| 157 | void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true; } |
| 158 | |
| 159 | static unsigned accessKeyModifiers(); |
| 160 | bool handleAccessKey(const PlatformKeyboardEvent&); |
| 161 | bool keyEvent(const PlatformKeyboardEvent&); |
| 162 | void defaultKeyboardEventHandler(KeyboardEvent*); |
| 163 | |
| 164 | bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, TextEventInputType = TextEventInputKeyboard); |
| 165 | void defaultTextInputEventHandler(TextEvent*); |
| 166 | |
| 167 | void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); |
| 168 | |
| 169 | void focusDocumentView(); |
| 170 | |
| 171 | void capsLockStateMayHaveChanged(); // Only called by FrameSelection |
| 172 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame^] | 173 | void sendScrollEvent(); // Only called in FrameView |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 174 | |
| 175 | bool handleTouchEvent(const PlatformTouchEvent&); |
| 176 | |
| 177 | bool useHandCursor(Node*, bool isOverLink, bool shiftKey); |
| 178 | |
| 179 | private: |
| 180 | static DragState& dragState(); |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 181 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 182 | PassRefPtr<Clipboard> createDraggingClipboard() const; |
| 183 | |
| 184 | bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleSelection&, TextGranularity); |
| 185 | void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 186 | void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 187 | void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 188 | void selectClosestMisspellingFromMouseEvent(const MouseEventWithHitTestResults&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 189 | void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults&); |
| 190 | |
Torne (Richard Coles) | c0e19a6 | 2013-08-30 15:15:11 +0100 | [diff] [blame] | 191 | bool handleMouseMoveOrLeaveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0, bool onlyUpdateScrollbars = false); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 192 | bool handleMousePressEvent(const MouseEventWithHitTestResults&); |
| 193 | bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&); |
| 194 | bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&); |
| 195 | bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&); |
| 196 | bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&); |
| 197 | bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&); |
| 198 | |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 199 | bool handlePasteGlobalSelection(const PlatformMouseEvent&); |
| 200 | |
| 201 | bool handleGestureTap(const PlatformGestureEvent&); |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame^] | 202 | bool handleGestureLongPress(const PlatformGestureEvent&, const IntPoint& adjustedPoint); |
| 203 | bool handleGestureLongTap(const PlatformGestureEvent&, const IntPoint& adjustedPoint); |
| 204 | bool handleGestureTwoFingerTap(const PlatformGestureEvent&, const IntPoint& adjustedPoint); |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 205 | bool handleGestureScrollUpdate(const PlatformGestureEvent&); |
| 206 | bool handleGestureScrollBegin(const PlatformGestureEvent&); |
| 207 | void clearGestureScrollNodes(); |
| 208 | |
| 209 | bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const; |
| 210 | |
| 211 | OptionalCursor selectCursor(const HitTestResult&, bool shiftKey); |
Torne (Richard Coles) | bfe3590 | 2013-10-22 16:41:51 +0100 | [diff] [blame] | 212 | OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& iBeam, bool shiftKey); |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 213 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 214 | void hoverTimerFired(Timer<EventHandler>*); |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 215 | void cursorUpdateTimerFired(Timer<EventHandler>*); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 216 | |
| 217 | bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0); |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 218 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 219 | bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const; |
| 220 | bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; } |
| 221 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 222 | void fakeMouseMoveEventTimerFired(Timer<EventHandler>*); |
| 223 | void cancelFakeMouseMoveEvent(); |
| 224 | bool isCursorVisible() const; |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 225 | void updateCursor(); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 226 | |
| 227 | bool isInsideScrollbar(const IntPoint&) const; |
| 228 | |
Torne (Richard Coles) | e1f1df5 | 2013-08-23 16:39:30 +0100 | [diff] [blame] | 229 | ScrollableArea* associatedScrollableArea(const RenderLayer*) const; |
| 230 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 231 | bool dispatchSyntheticTouchEventIfEnabled(const PlatformMouseEvent&); |
Torne (Richard Coles) | 19cde67 | 2013-11-06 12:28:04 +0000 | [diff] [blame] | 232 | bool handleMouseEventAsEmulatedGesture(const PlatformMouseEvent&); |
| 233 | bool handleWheelEventAsEmulatedGesture(const PlatformWheelEvent&); |
| 234 | HitTestResult hitTestResultInFrame(Frame*, const LayoutPoint&, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 235 | |
| 236 | void invalidateClick(); |
| 237 | |
| 238 | Node* nodeUnderMouse() const; |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 239 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 240 | void updateMouseEventTargetNode(Node*, const PlatformMouseEvent&, bool fireMouseOverOut); |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 241 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 242 | MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&); |
| 243 | |
| 244 | bool dispatchMouseEvent(const AtomicString& eventType, Node* target, bool cancelable, int clickCount, const PlatformMouseEvent&, bool setUnder); |
| 245 | bool dispatchDragEvent(const AtomicString& eventType, Node* target, const PlatformMouseEvent&, Clipboard*); |
| 246 | |
| 247 | void freeClipboard(); |
| 248 | |
| 249 | bool handleDrag(const MouseEventWithHitTestResults&, CheckDragHysteresis); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 250 | bool tryStartDrag(const MouseEventWithHitTestResults&); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 251 | void clearDragState(); |
| 252 | |
| 253 | bool dispatchDragSrcEvent(const AtomicString& eventType, const PlatformMouseEvent&); |
| 254 | |
| 255 | bool dragHysteresisExceeded(const FloatPoint&) const; |
| 256 | bool dragHysteresisExceeded(const IntPoint&) const; |
| 257 | |
| 258 | bool passMousePressEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe); |
| 259 | bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult* hoveredNode = 0); |
| 260 | bool passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe); |
| 261 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 262 | bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&, Scrollbar*); |
| 263 | |
| 264 | bool passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&); |
| 265 | |
| 266 | bool passWheelEventToWidget(const PlatformWheelEvent&, Widget*); |
| 267 | |
| 268 | void defaultSpaceEventHandler(KeyboardEvent*); |
| 269 | void defaultBackspaceEventHandler(KeyboardEvent*); |
| 270 | void defaultTabEventHandler(KeyboardEvent*); |
Torne (Richard Coles) | c0e19a6 | 2013-08-30 15:15:11 +0100 | [diff] [blame] | 271 | void defaultEscapeEventHandler(KeyboardEvent*); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 272 | void defaultArrowEventHandler(FocusDirection, KeyboardEvent*); |
| 273 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 274 | void updateSelectionForMouseDrag(const HitTestResult&); |
| 275 | |
| 276 | void updateLastScrollbarUnderMouse(Scrollbar*, bool); |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 277 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 278 | void setFrameWasScrolledByUser(); |
| 279 | |
| 280 | bool capturesDragging() const { return m_capturesDragging; } |
| 281 | |
Torne (Richard Coles) | f5e4ad5 | 2013-08-05 13:57:57 +0100 | [diff] [blame] | 282 | bool isKeyEventAllowedInFullScreen(FullscreenElementStack*, const PlatformKeyboardEvent&) const; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 283 | |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 284 | bool handleGestureShowPress(); |
Torne (Richard Coles) | 81a5157 | 2013-05-13 16:52:28 +0100 | [diff] [blame] | 285 | |
| 286 | bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); |
| 287 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 288 | bool passGestureEventToWidget(const PlatformGestureEvent&, Widget*); |
| 289 | bool passGestureEventToWidgetIfPossible(const PlatformGestureEvent&, RenderObject*); |
| 290 | bool sendScrollEventToView(const PlatformGestureEvent&, const FloatSize&); |
| 291 | Frame* getSubFrameForGestureEvent(const IntPoint& touchAdjustedPoint, const PlatformGestureEvent&); |
| 292 | |
Torne (Richard Coles) | 19cde67 | 2013-11-06 12:28:04 +0000 | [diff] [blame] | 293 | AutoscrollController* autoscrollController() const; |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 294 | bool panScrollInProgress() const; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 295 | void setLastKnownMousePosition(const PlatformMouseEvent&); |
| 296 | |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 297 | Frame* const m_frame; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 298 | |
| 299 | bool m_mousePressed; |
| 300 | bool m_capturesDragging; |
| 301 | RefPtr<Node> m_mousePressNode; |
| 302 | |
| 303 | bool m_mouseDownMayStartSelect; |
| 304 | bool m_mouseDownMayStartDrag; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 305 | bool m_mouseDownWasSingleClickInSelection; |
| 306 | enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, ExtendedSelection }; |
| 307 | SelectionInitiationState m_selectionInitiationState; |
| 308 | |
| 309 | LayoutPoint m_dragStartPos; |
| 310 | |
| 311 | bool m_panScrollButtonPressed; |
| 312 | |
| 313 | Timer<EventHandler> m_hoverTimer; |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 314 | Timer<EventHandler> m_cursorUpdateTimer; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 315 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 316 | bool m_mouseDownMayStartAutoscroll; |
| 317 | bool m_mouseDownWasInSubframe; |
| 318 | |
| 319 | Timer<EventHandler> m_fakeMouseMoveEventTimer; |
| 320 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 321 | bool m_svgPan; |
| 322 | RefPtr<SVGElementInstance> m_instanceUnderMouse; |
| 323 | RefPtr<SVGElementInstance> m_lastInstanceUnderMouse; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 324 | |
Torne (Richard Coles) | f79f16f | 2013-10-31 11:16:44 +0000 | [diff] [blame] | 325 | RenderLayerScrollableArea* m_resizeScrollableArea; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 326 | |
| 327 | RefPtr<Node> m_capturingMouseEventsNode; |
| 328 | bool m_eventHandlerWillResetCapturingMouseEventsNode; |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 329 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 330 | RefPtr<Node> m_nodeUnderMouse; |
| 331 | RefPtr<Node> m_lastNodeUnderMouse; |
| 332 | RefPtr<Frame> m_lastMouseMoveEventSubframe; |
| 333 | RefPtr<Scrollbar> m_lastScrollbarUnderMouse; |
| 334 | Cursor m_currentMouseCursor; |
| 335 | |
| 336 | int m_clickCount; |
| 337 | RefPtr<Node> m_clickNode; |
| 338 | |
| 339 | RefPtr<Node> m_dragTarget; |
| 340 | bool m_shouldOnlyFireDragOverEvent; |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 341 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 342 | RefPtr<HTMLFrameSetElement> m_frameSetBeingResized; |
| 343 | |
Torne (Richard Coles) | f79f16f | 2013-10-31 11:16:44 +0000 | [diff] [blame] | 344 | LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeScrollableArea. |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 345 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 346 | bool m_mousePositionIsUnknown; |
| 347 | IntPoint m_lastKnownMousePosition; |
| 348 | IntPoint m_lastKnownMouseGlobalPosition; |
| 349 | IntPoint m_mouseDownPos; // In our view's coords. |
| 350 | double m_mouseDownTimestamp; |
| 351 | PlatformMouseEvent m_mouseDown; |
| 352 | RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken; |
| 353 | |
| 354 | RefPtr<Node> m_latchedWheelEventNode; |
| 355 | bool m_widgetIsLatched; |
| 356 | |
| 357 | RefPtr<Node> m_previousWheelScrolledNode; |
| 358 | |
| 359 | typedef HashMap<int, RefPtr<EventTarget> > TouchTargetMap; |
| 360 | TouchTargetMap m_originatingTouchPointTargets; |
| 361 | RefPtr<Document> m_originatingTouchPointDocument; |
| 362 | unsigned m_originatingTouchPointTargetKey; |
| 363 | bool m_touchPressed; |
| 364 | |
| 365 | RefPtr<Node> m_scrollGestureHandlingNode; |
| 366 | bool m_lastHitTestResultOverWidget; |
| 367 | RefPtr<Node> m_previousGestureScrolledNode; |
| 368 | RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture; |
| 369 | |
| 370 | double m_maxMouseMovedDuration; |
| 371 | PlatformEvent::Type m_baseEventType; |
| 372 | bool m_didStartDrag; |
| 373 | |
| 374 | bool m_longTapShouldInvokeContextMenu; |
Torne (Richard Coles) | 19cde67 | 2013-11-06 12:28:04 +0000 | [diff] [blame] | 375 | OwnPtr<IntPoint> m_lastSyntheticPinchAnchorCss; |
| 376 | OwnPtr<IntPoint> m_lastSyntheticPinchAnchorDip; |
| 377 | OwnPtr<IntPoint> m_lastSyntheticPanLocation; |
| 378 | float m_syntheticPageScaleFactor; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 379 | }; |
| 380 | |
| 381 | } // namespace WebCore |
| 382 | |
| 383 | #endif // EventHandler_h |