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 Clipboard; | 50 class Clipboard; |
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 handleScrollGestureEvent(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 bool handleGestureTap(const GestureEventWithHitTestResults&); |
208 bool handleGestureLongPress(const PlatformGestureEvent&, const IntPoint& adj
ustedPoint); | 224 bool handleGestureLongPress(const GestureEventWithHitTestResults&); |
209 bool handleGestureLongTap(const PlatformGestureEvent&, const IntPoint& adjus
tedPoint); | 225 bool handleGestureLongTap(const GestureEventWithHitTestResults&); |
210 bool handleGestureTwoFingerTap(const PlatformGestureEvent&, const IntPoint&
adjustedPoint); | |
211 bool handleGestureScrollUpdate(const PlatformGestureEvent&); | 226 bool handleGestureScrollUpdate(const PlatformGestureEvent&); |
212 bool handleGestureScrollBegin(const PlatformGestureEvent&); | 227 bool handleGestureScrollBegin(const PlatformGestureEvent&); |
213 void clearGestureScrollNodes(); | 228 void clearGestureScrollNodes(); |
214 | 229 |
215 bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const; | 230 bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const; |
216 | 231 |
217 OptionalCursor selectCursor(const HitTestResult&); | 232 OptionalCursor selectCursor(const HitTestResult&); |
218 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i
Beam); | 233 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i
Beam); |
219 | 234 |
220 void hoverTimerFired(Timer<EventHandler>*); | 235 void hoverTimerFired(Timer<EventHandler>*); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 void setFrameWasScrolledByUser(); | 308 void setFrameWasScrolledByUser(); |
294 | 309 |
295 bool capturesDragging() const { return m_capturesDragging; } | 310 bool capturesDragging() const { return m_capturesDragging; } |
296 | 311 |
297 bool isKeyEventAllowedInFullScreen(FullscreenElementStack*, const PlatformKe
yboardEvent&) const; | 312 bool isKeyEventAllowedInFullScreen(FullscreenElementStack*, const PlatformKe
yboardEvent&) const; |
298 | 313 |
299 bool handleGestureShowPress(); | 314 bool handleGestureShowPress(); |
300 | 315 |
301 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); | 316 bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&); |
302 | 317 |
303 bool passGestureEventToWidget(const PlatformGestureEvent&, Widget*); | 318 bool passScrollGestureEventToWidget(const PlatformGestureEvent&, RenderObjec
t*); |
304 bool passGestureEventToWidgetIfPossible(const PlatformGestureEvent&, RenderO
bject*); | |
305 bool sendScrollEventToView(const PlatformGestureEvent&, const FloatSize&); | 319 bool sendScrollEventToView(const PlatformGestureEvent&, const FloatSize&); |
306 LocalFrame* getSubFrameForGestureEvent(const IntPoint& touchAdjustedPoint, c
onst PlatformGestureEvent&); | |
307 | 320 |
308 AutoscrollController* autoscrollController() const; | 321 AutoscrollController* autoscrollController() const; |
309 bool panScrollInProgress() const; | 322 bool panScrollInProgress() const; |
310 void setLastKnownMousePosition(const PlatformMouseEvent&); | 323 void setLastKnownMousePosition(const PlatformMouseEvent&); |
311 | 324 |
312 LocalFrame* const m_frame; | 325 LocalFrame* const m_frame; |
313 | 326 |
314 bool m_mousePressed; | 327 bool m_mousePressed; |
315 bool m_capturesDragging; | 328 bool m_capturesDragging; |
316 RefPtrWillBeMember<Node> m_mousePressNode; | 329 RefPtrWillBeMember<Node> m_mousePressNode; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<EventTarget>, Default
Hash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned> > TouchTarget
Map; | 384 typedef WillBeHeapHashMap<unsigned, RefPtrWillBeMember<EventTarget>, Default
Hash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned> > TouchTarget
Map; |
372 TouchTargetMap m_targetForTouchID; | 385 TouchTargetMap m_targetForTouchID; |
373 | 386 |
374 // If set, the document of the active touch sequence. Unset if no touch sequ
ence active. | 387 // If set, the document of the active touch sequence. Unset if no touch sequ
ence active. |
375 RefPtrWillBeMember<Document> m_touchSequenceDocument; | 388 RefPtrWillBeMember<Document> m_touchSequenceDocument; |
376 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken; | 389 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken; |
377 | 390 |
378 bool m_touchPressed; | 391 bool m_touchPressed; |
379 | 392 |
380 RefPtrWillBeMember<Node> m_scrollGestureHandlingNode; | 393 RefPtrWillBeMember<Node> m_scrollGestureHandlingNode; |
381 bool m_lastHitTestResultOverWidget; | 394 bool m_lastGestureScrollOverWidget; |
382 RefPtrWillBeMember<Node> m_previousGestureScrolledNode; | 395 RefPtrWillBeMember<Node> m_previousGestureScrolledNode; |
383 RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture; | 396 RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture; |
384 | 397 |
385 double m_maxMouseMovedDuration; | 398 double m_maxMouseMovedDuration; |
386 PlatformEvent::Type m_baseEventType; | |
387 bool m_didStartDrag; | 399 bool m_didStartDrag; |
388 | 400 |
389 bool m_longTapShouldInvokeContextMenu; | 401 bool m_longTapShouldInvokeContextMenu; |
390 | 402 |
391 Timer<EventHandler> m_activeIntervalTimer; | 403 Timer<EventHandler> m_activeIntervalTimer; |
392 double m_lastShowPressTimestamp; | 404 double m_lastShowPressTimestamp; |
393 RefPtrWillBeMember<Element> m_lastDeferredTapElement; | 405 RefPtrWillBeMember<Element> m_lastDeferredTapElement; |
394 }; | 406 }; |
395 | 407 |
396 } // namespace WebCore | 408 } // namespace WebCore |
397 | 409 |
398 #endif // EventHandler_h | 410 #endif // EventHandler_h |
OLD | NEW |