| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "wtf/Forward.h" | 42 #include "wtf/Forward.h" |
| 43 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
| 44 #include "wtf/HashTraits.h" | 44 #include "wtf/HashTraits.h" |
| 45 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
| 46 | 46 |
| 47 namespace WebCore { | 47 namespace WebCore { |
| 48 | 48 |
| 49 class AutoscrollController; | 49 class AutoscrollController; |
| 50 class DataTransfer; | 50 class DataTransfer; |
| 51 class Document; | 51 class Document; |
| 52 class DragState; |
| 52 class Element; | 53 class Element; |
| 53 class Event; | 54 class Event; |
| 54 class EventTarget; | 55 class EventTarget; |
| 56 template <typename EventType> |
| 57 class EventWithHitTestResults; |
| 55 class FloatPoint; | 58 class FloatPoint; |
| 56 class FloatQuad; | 59 class FloatQuad; |
| 57 class FullscreenElementStack; | 60 class FullscreenElementStack; |
| 58 class LocalFrame; | |
| 59 class HTMLFrameSetElement; | 61 class HTMLFrameSetElement; |
| 60 class HitTestRequest; | 62 class HitTestRequest; |
| 61 class HitTestResult; | 63 class HitTestResult; |
| 62 class KeyboardEvent; | 64 class KeyboardEvent; |
| 63 class MouseEventWithHitTestResults; | 65 class LocalFrame; |
| 64 class Node; | 66 class Node; |
| 65 class OptionalCursor; | 67 class OptionalCursor; |
| 66 class PlatformGestureEvent; | 68 class PlatformGestureEvent; |
| 67 class PlatformKeyboardEvent; | 69 class PlatformKeyboardEvent; |
| 68 class PlatformTouchEvent; | 70 class PlatformTouchEvent; |
| 69 class PlatformWheelEvent; | 71 class PlatformWheelEvent; |
| 70 class RenderLayer; | 72 class RenderLayer; |
| 71 class RenderLayerScrollableArea; | 73 class RenderLayerScrollableArea; |
| 72 class RenderObject; | 74 class RenderObject; |
| 73 class RenderWidget; | 75 class RenderWidget; |
| 74 class ScrollableArea; | 76 class ScrollableArea; |
| 75 class Scrollbar; | 77 class Scrollbar; |
| 76 class TextEvent; | 78 class TextEvent; |
| 77 class TouchEvent; | 79 class TouchEvent; |
| 78 class VisibleSelection; | 80 class VisibleSelection; |
| 79 class WheelEvent; | 81 class WheelEvent; |
| 80 class Widget; | 82 class Widget; |
| 81 | 83 |
| 82 class DragState; | 84 typedef EventWithHitTestResults<PlatformGestureEvent> GestureEventWithHitTestRes
ults; |
| 85 typedef EventWithHitTestResults<PlatformMouseEvent> MouseEventWithHitTestResults
; |
| 83 | 86 |
| 84 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili
ngWhitespace }; | 87 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili
ngWhitespace }; |
| 85 enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis }; | 88 enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis }; |
| 86 | 89 |
| 87 class EventHandler : public NoBaseWillBeGarbageCollectedFinalized<EventHandler>
{ | 90 class EventHandler : public NoBaseWillBeGarbageCollectedFinalized<EventHandler>
{ |
| 88 WTF_MAKE_NONCOPYABLE(EventHandler); | 91 WTF_MAKE_NONCOPYABLE(EventHandler); |
| 89 public: | 92 public: |
| 90 explicit EventHandler(LocalFrame*); | 93 explicit EventHandler(LocalFrame*); |
| 91 ~EventHandler(); | 94 ~EventHandler(); |
| 92 void trace(Visitor*); | 95 void trace(Visitor*); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 bool bubblingScroll(ScrollDirection, ScrollGranularity, Node* startingNode =
0); | 139 bool bubblingScroll(ScrollDirection, ScrollGranularity, Node* startingNode =
0); |
| 137 | 140 |
| 138 bool handleMouseMoveEvent(const PlatformMouseEvent&); | 141 bool handleMouseMoveEvent(const PlatformMouseEvent&); |
| 139 void handleMouseLeaveEvent(const PlatformMouseEvent&); | 142 void handleMouseLeaveEvent(const PlatformMouseEvent&); |
| 140 | 143 |
| 141 bool handleMousePressEvent(const PlatformMouseEvent&); | 144 bool handleMousePressEvent(const PlatformMouseEvent&); |
| 142 bool handleMouseReleaseEvent(const PlatformMouseEvent&); | 145 bool handleMouseReleaseEvent(const PlatformMouseEvent&); |
| 143 bool handleWheelEvent(const PlatformWheelEvent&); | 146 bool handleWheelEvent(const PlatformWheelEvent&); |
| 144 void defaultWheelEventHandler(Node*, WheelEvent*); | 147 void defaultWheelEventHandler(Node*, WheelEvent*); |
| 145 | 148 |
| 149 // Called on the local root frame exactly once per gesture event. |
| 146 bool handleGestureEvent(const PlatformGestureEvent&); | 150 bool handleGestureEvent(const PlatformGestureEvent&); |
| 151 |
| 152 // Hit-test the provided (non-scroll) gesture event, applying touch-adjustme
nt and updating |
| 153 // hover/active state across all frames if necessary. This should be called
at most once |
| 154 // per gesture event, and called on the local root frame. |
| 155 // Note: This is similar to (the less clearly named) prepareMouseEvent. |
| 156 // FIXME: Remove readOnly param when there is only ever a single call to thi
s. |
| 157 GestureEventWithHitTestResults targetGestureEvent(const PlatformGestureEvent
&, bool readOnly = false); |
| 158 |
| 159 // Handle the provided non-scroll gesture event. Should be called only on th
e inner frame. |
| 160 bool handleGestureEventInFrame(const GestureEventWithHitTestResults&); |
| 161 |
| 162 // Handle the provided scroll gesture event, propagating down to child frame
s as necessary. |
| 163 bool handleGestureScrollEvent(const PlatformGestureEvent&); |
| 147 bool handleGestureScrollEnd(const PlatformGestureEvent&); | 164 bool handleGestureScrollEnd(const PlatformGestureEvent&); |
| 148 bool isScrollbarHandlingGestures() const; | 165 bool isScrollbarHandlingGestures() const; |
| 149 | 166 |
| 150 bool bestClickableNodeForTouchPoint(const IntPoint& touchCenter, const IntSi
ze& touchRadius, IntPoint& targetPoint, Node*& targetNode); | 167 bool bestClickableNodeForHitTestResult(const HitTestResult&, IntPoint& targe
tPoint, Node*& targetNode); |
| 151 bool bestContextMenuNodeForTouchPoint(const IntPoint& touchCenter, const Int
Size& touchRadius, IntPoint& targetPoint, Node*& targetNode); | 168 bool bestContextMenuNodeForHitTestResult(const HitTestResult&, IntPoint& tar
getPoint, Node*& targetNode); |
| 169 // FIXME: This doesn't appear to be used outside tests anymore, what path ar
e we using now and is it tested? |
| 152 bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSiz
e& touchRadius, IntRect& targetArea, Node*& targetNode); | 170 bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSiz
e& touchRadius, IntRect& targetArea, Node*& targetNode); |
| 153 | 171 |
| 154 void adjustGesturePosition(const PlatformGestureEvent&, IntPoint& adjustedPo
int); | |
| 155 | |
| 156 bool sendContextMenuEvent(const PlatformMouseEvent&); | 172 bool sendContextMenuEvent(const PlatformMouseEvent&); |
| 157 bool sendContextMenuEventForKey(); | 173 bool sendContextMenuEventForKey(); |
| 158 bool sendContextMenuEventForGesture(const PlatformGestureEvent&); | 174 bool sendContextMenuEventForGesture(const GestureEventWithHitTestResults&); |
| 159 | 175 |
| 160 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true
; } | 176 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true
; } |
| 161 | 177 |
| 162 static unsigned accessKeyModifiers(); | 178 static unsigned accessKeyModifiers(); |
| 163 bool handleAccessKey(const PlatformKeyboardEvent&); | 179 bool handleAccessKey(const PlatformKeyboardEvent&); |
| 164 bool keyEvent(const PlatformKeyboardEvent&); | 180 bool keyEvent(const PlatformKeyboardEvent&); |
| 165 void defaultKeyboardEventHandler(KeyboardEvent*); | 181 void defaultKeyboardEventHandler(KeyboardEvent*); |
| 166 | 182 |
| 167 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te
xtEventInputType = TextEventInputKeyboard); | 183 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te
xtEventInputType = TextEventInputKeyboard); |
| 168 void defaultTextInputEventHandler(TextEvent*); | 184 void defaultTextInputEventHandler(TextEvent*); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 197 bool handleMousePressEvent(const MouseEventWithHitTestResults&); | 213 bool handleMousePressEvent(const MouseEventWithHitTestResults&); |
| 198 bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&); | 214 bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&); |
| 199 bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&); | 215 bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&); |
| 200 bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&); | 216 bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&); |
| 201 bool handleMouseFocus(const PlatformMouseEvent&); | 217 bool handleMouseFocus(const PlatformMouseEvent&); |
| 202 bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&); | 218 bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&); |
| 203 bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&); | 219 bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&); |
| 204 | 220 |
| 205 bool handlePasteGlobalSelection(const PlatformMouseEvent&); | 221 bool handlePasteGlobalSelection(const PlatformMouseEvent&); |
| 206 | 222 |
| 207 bool handleGestureTap(const PlatformGestureEvent&, const IntPoint& adjustedP
oint); | 223 HitTestRequest::HitTestRequestType getHitTypeForGestureType(PlatformEvent::T
ype); |
| 208 bool handleGestureLongPress(const PlatformGestureEvent&, const IntPoint& adj
ustedPoint); | 224 void applyTouchAdjustment(PlatformGestureEvent*, HitTestResult*); |
| 209 bool handleGestureLongTap(const PlatformGestureEvent&, const IntPoint& adjus
tedPoint); | 225 bool handleGestureTap(const GestureEventWithHitTestResults&); |
| 210 bool handleGestureTwoFingerTap(const PlatformGestureEvent&, const IntPoint&
adjustedPoint); | 226 bool handleGestureLongPress(const GestureEventWithHitTestResults&); |
| 227 bool handleGestureLongTap(const GestureEventWithHitTestResults&); |
| 211 bool handleGestureScrollUpdate(const PlatformGestureEvent&); | 228 bool handleGestureScrollUpdate(const PlatformGestureEvent&); |
| 212 bool handleGestureScrollBegin(const PlatformGestureEvent&); | 229 bool handleGestureScrollBegin(const PlatformGestureEvent&); |
| 213 void clearGestureScrollNodes(); | 230 void clearGestureScrollNodes(); |
| 214 | 231 |
| 215 bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const; | 232 bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const; |
| 216 | 233 |
| 217 OptionalCursor selectCursor(const HitTestResult&); | 234 OptionalCursor selectCursor(const HitTestResult&); |
| 218 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i
Beam); | 235 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i
Beam); |
| 219 | 236 |
| 220 void hoverTimerFired(Timer<EventHandler>*); | 237 void hoverTimerFired(Timer<EventHandler>*); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 void setFrameWasScrolledByUser(); | 309 void setFrameWasScrolledByUser(); |
| 293 | 310 |
| 294 bool capturesDragging() const { return m_capturesDragging; } | 311 bool capturesDragging() const { return m_capturesDragging; } |
| 295 | 312 |
| 296 bool isKeyEventAllowedInFullScreen(FullscreenElementStack*, const PlatformKe
yboardEvent&) const; | 313 bool isKeyEventAllowedInFullScreen(FullscreenElementStack*, const PlatformKe
yboardEvent&) const; |
| 297 | 314 |
| 298 bool handleGestureShowPress(); | 315 bool handleGestureShowPress(); |
| 299 | 316 |
| 300 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); | 317 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); |
| 301 | 318 |
| 302 bool passGestureEventToWidget(const PlatformGestureEvent&, Widget*); | 319 bool passScrollGestureEventToWidget(const PlatformGestureEvent&, RenderObjec
t*); |
| 303 bool passGestureEventToWidgetIfPossible(const PlatformGestureEvent&, RenderO
bject*); | |
| 304 bool sendScrollEventToView(const PlatformGestureEvent&, const FloatSize&); | 320 bool sendScrollEventToView(const PlatformGestureEvent&, const FloatSize&); |
| 305 LocalFrame* getSubFrameForGestureEvent(const IntPoint& touchAdjustedPoint, c
onst PlatformGestureEvent&); | |
| 306 | 321 |
| 307 AutoscrollController* autoscrollController() const; | 322 AutoscrollController* autoscrollController() const; |
| 308 bool panScrollInProgress() const; | 323 bool panScrollInProgress() const; |
| 309 void setLastKnownMousePosition(const PlatformMouseEvent&); | 324 void setLastKnownMousePosition(const PlatformMouseEvent&); |
| 310 | 325 |
| 311 LocalFrame* const m_frame; | 326 LocalFrame* const m_frame; |
| 312 | 327 |
| 313 bool m_mousePressed; | 328 bool m_mousePressed; |
| 314 bool m_capturesDragging; | 329 bool m_capturesDragging; |
| 315 RefPtrWillBeMember<Node> m_mousePressNode; | 330 RefPtrWillBeMember<Node> m_mousePressNode; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<EventTarget>, Default
Hash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned> > TouchTarget
Map; | 385 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<EventTarget>, Default
Hash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned> > TouchTarget
Map; |
| 371 TouchTargetMap m_targetForTouchID; | 386 TouchTargetMap m_targetForTouchID; |
| 372 | 387 |
| 373 // If set, the document of the active touch sequence. Unset if no touch sequ
ence active. | 388 // If set, the document of the active touch sequence. Unset if no touch sequ
ence active. |
| 374 RefPtrWillBeMember<Document> m_touchSequenceDocument; | 389 RefPtrWillBeMember<Document> m_touchSequenceDocument; |
| 375 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken; | 390 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken; |
| 376 | 391 |
| 377 bool m_touchPressed; | 392 bool m_touchPressed; |
| 378 | 393 |
| 379 RefPtrWillBeMember<Node> m_scrollGestureHandlingNode; | 394 RefPtrWillBeMember<Node> m_scrollGestureHandlingNode; |
| 380 bool m_lastHitTestResultOverWidget; | 395 bool m_lastGestureScrollOverWidget; |
| 381 RefPtrWillBeMember<Node> m_previousGestureScrolledNode; | 396 RefPtrWillBeMember<Node> m_previousGestureScrolledNode; |
| 382 RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture; | 397 RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture; |
| 383 | 398 |
| 384 double m_maxMouseMovedDuration; | 399 double m_maxMouseMovedDuration; |
| 385 PlatformEvent::Type m_baseEventType; | |
| 386 bool m_didStartDrag; | 400 bool m_didStartDrag; |
| 387 | 401 |
| 388 bool m_longTapShouldInvokeContextMenu; | 402 bool m_longTapShouldInvokeContextMenu; |
| 389 | 403 |
| 390 Timer<EventHandler> m_activeIntervalTimer; | 404 Timer<EventHandler> m_activeIntervalTimer; |
| 391 double m_lastShowPressTimestamp; | 405 double m_lastShowPressTimestamp; |
| 392 RefPtrWillBeMember<Element> m_lastDeferredTapElement; | 406 RefPtrWillBeMember<Element> m_lastDeferredTapElement; |
| 393 }; | 407 }; |
| 394 | 408 |
| 395 } // namespace WebCore | 409 } // namespace WebCore |
| 396 | 410 |
| 397 #endif // EventHandler_h | 411 #endif // EventHandler_h |
| OLD | NEW |