diff options
Diffstat (limited to 'WebCore/page/EventHandler.h')
| -rw-r--r-- | WebCore/page/EventHandler.h | 77 |
1 files changed, 69 insertions, 8 deletions
diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h index 7fe64ad..0da44f2 100644 --- a/WebCore/page/EventHandler.h +++ b/WebCore/page/EventHandler.h @@ -33,7 +33,7 @@ #include <wtf/Forward.h> #include <wtf/RefPtr.h> -#if PLATFORM(MAC) && !defined(__OBJC__) +#if PLATFORM(MAC) && !defined(__OBJC__) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) class NSView; #endif @@ -66,13 +66,23 @@ class PlatformTouchEvent; class Touch; #endif +#if ENABLE(DRAG_SUPPORT) extern const int LinkDragHysteresis; extern const int ImageDragHysteresis; extern const int TextDragHysteresis; extern const int GeneralDragHysteresis; +#endif // ENABLE(DRAG_SUPPORT) enum HitTestScrollbars { ShouldHitTestScrollbars, DontHitTestScrollbars }; +#if ENABLE(TOUCH_EVENTS) // Android +enum TouchResultMask { + preventTouch = 1 << 0, + preventLongPress = 1 << 1, + preventDoubleTap = 1 << 2, +}; +#endif + class EventHandler : public Noncopyable { public: EventHandler(Frame*); @@ -80,7 +90,9 @@ public: void clear(); +#if ENABLE(DRAG_SUPPORT) void updateSelectionForMouseDrag(); +#endif Node* mousePressNode() const; void setMousePressNode(PassRefPtr<Node>); @@ -99,9 +111,11 @@ public: void setCapturingMouseEventsNode(PassRefPtr<Node>); +#if ENABLE(DRAG_SUPPORT) bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*); void cancelDragAndDrop(const PlatformMouseEvent&, Clipboard*); bool performDragAndDrop(const PlatformMouseEvent&, Clipboard*); +#endif void scheduleHoverStateUpdate(); @@ -113,11 +127,17 @@ public: void setIgnoreWheelEvents(bool); + static Frame* subframeForTargetNode(Node*); + bool scrollOverflow(ScrollDirection, ScrollGranularity); bool scrollRecursively(ScrollDirection, ScrollGranularity); +#if ENABLE(DRAG_SUPPORT) bool shouldDragAutoNode(Node*, const IntPoint&) const; // -webkit-user-drag == auto +#endif + + bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const; bool tabsToLinks(KeyboardEvent*) const; bool tabsToAllControls(KeyboardEvent*) const; @@ -132,10 +152,13 @@ public: bool handleWheelEvent(PlatformWheelEvent&); #if ENABLE(TOUCH_EVENTS) // Android - bool handleTouchEvent(const PlatformTouchEvent&); + // See TouchResultMask for the return value options + int handleTouchEvent(const PlatformTouchEvent&); #endif +#if ENABLE(CONTEXT_MENUS) bool sendContextMenuEvent(const PlatformMouseEvent&); +#endif void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true; } @@ -150,10 +173,11 @@ public: bool isLineBreak = false, bool isBackTab = false); void defaultTextInputEventHandler(TextEvent*); +#if ENABLE(DRAG_SUPPORT) bool eventMayStartDrag(const PlatformMouseEvent&) const; - void dragSourceMovedTo(const PlatformMouseEvent&); void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); +#endif void focusDocumentView(); @@ -162,7 +186,7 @@ public: void sendResizeEvent(); void sendScrollEvent(); -#if PLATFORM(MAC) && defined(__OBJC__) +#if PLATFORM(MAC) && defined(__OBJC__) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) PassRefPtr<KeyboardEvent> currentKeyboardEvent() const; void mouseDown(NSEvent *); @@ -172,7 +196,9 @@ public: bool keyEvent(NSEvent *); bool wheelEvent(NSEvent *); +#if ENABLE(CONTEXT_MENUS) bool sendContextMenuEvent(NSEvent *); +#endif bool eventMayStartDrag(NSEvent *); void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent); @@ -183,7 +209,14 @@ public: #endif private: - struct EventHandlerDragState { +#if ENABLE(DRAG_SUPPORT) + enum DragAndDropHandleType { + UpdateDragAndDrop, + CancelDragAndDrop, + PerformDragAndDrop + }; + + struct EventHandlerDragState : Noncopyable { RefPtr<Node> m_dragSrc; // element that may be a drag source, for the current mouse gesture bool m_dragSrcIsLink; bool m_dragSrcIsImage; @@ -195,8 +228,11 @@ private: }; static EventHandlerDragState& dragState(); static const double TextDragDelay; + + bool canHandleDragAndDropForTarget(DragAndDropHandleType, Node* target, const PlatformMouseEvent&, Clipboard*, bool* accepted = 0); PassRefPtr<Clipboard> createDraggingClipboard() const; +#endif // ENABLE(DRAG_SUPPORT) bool eventActivatedView(const PlatformMouseEvent&) const; void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); @@ -208,7 +244,9 @@ private: bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&); bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&); bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&); +#if ENABLE(DRAG_SUPPORT) bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&); +#endif bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&); void handleKeyboardSelectionMovement(KeyboardEvent*); @@ -221,7 +259,9 @@ private: void hoverTimerFired(Timer<EventHandler>*); static bool canMouseDownStartSelect(Node*); +#if ENABLE(DRAG_SUPPORT) static bool canMouseDragExtendSelect(Node*); +#endif void handleAutoscroll(RenderObject*); void startAutoscrollTimer(); @@ -238,18 +278,22 @@ private: MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&); bool dispatchMouseEvent(const AtomicString& eventType, Node* target, bool cancelable, int clickCount, const PlatformMouseEvent&, bool setUnder); +#if ENABLE(DRAG_SUPPORT) bool dispatchDragEvent(const AtomicString& eventType, Node* target, const PlatformMouseEvent&, Clipboard*); void freeClipboard(); bool handleDrag(const MouseEventWithHitTestResults&); +#endif bool handleMouseUp(const MouseEventWithHitTestResults&); +#if ENABLE(DRAG_SUPPORT) void clearDragState(); bool dispatchDragSrcEvent(const AtomicString& eventType, const PlatformMouseEvent&); bool dragHysteresisExceeded(const FloatPoint&) const; bool dragHysteresisExceeded(const IntPoint&) const; +#endif // ENABLE(DRAG_SUPPORT) bool passMousePressEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe); bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult* hoveredNode = 0); @@ -268,22 +312,30 @@ private: void defaultSpaceEventHandler(KeyboardEvent*); void defaultTabEventHandler(KeyboardEvent*); +#if ENABLE(DRAG_SUPPORT) void allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const; +#endif // The following are called at the beginning of handleMouseUp and handleDrag. // If they return true it indicates that they have consumed the event. bool eventLoopHandleMouseUp(const MouseEventWithHitTestResults&); +#if ENABLE(DRAG_SUPPORT) bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&); +#endif bool invertSenseOfTabsToLinks(KeyboardEvent*) const; +#if ENABLE(DRAG_SUPPORT) void updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint); +#endif void updateLastScrollbarUnderMouse(Scrollbar*, bool); + + void setFrameWasScrolledByUser(); bool capturesDragging() const { return m_capturesDragging; } -#if PLATFORM(MAC) && defined(__OBJC__) +#if PLATFORM(MAC) && defined(__OBJC__) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) NSView *mouseDownViewIfStillGood(); PlatformMouseEvent currentPlatformMouseEvent() const; @@ -296,11 +348,15 @@ private: RefPtr<Node> m_mousePressNode; bool m_mouseDownMayStartSelect; +#if ENABLE(DRAG_SUPPORT) bool m_mouseDownMayStartDrag; +#endif bool m_mouseDownWasSingleClickInSelection; bool m_beganSelectingText; +#if ENABLE(DRAG_SUPPORT) IntPoint m_dragStartPos; +#endif IntPoint m_panScrollStartPos; bool m_panScrollInProgress; @@ -337,7 +393,10 @@ private: RefPtr<Touch> m_touch; #endif +#if ENABLE(DRAG_SUPPORT) RefPtr<Node> m_dragTarget; + bool m_shouldOnlyFireDragOverEvent; +#endif RefPtr<HTMLFrameSetElement> m_frameSetBeingResized; @@ -351,8 +410,10 @@ private: bool m_useLatchedWheelEventNode; RefPtr<Node> m_latchedWheelEventNode; bool m_widgetIsLatched; - -#if PLATFORM(MAC) + + RefPtr<Node> m_previousWheelScrolledNode; + +#if PLATFORM(MAC) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) NSView *m_mouseDownView; bool m_sendingEventToSubview; int m_activationEventNumber; |
