Chromium Code Reviews| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 struct DragState; | 80 struct DragState; |
| 81 | 81 |
| 82 extern const int LinkDragHysteresis; | 82 extern const int LinkDragHysteresis; |
| 83 extern const int ImageDragHysteresis; | 83 extern const int ImageDragHysteresis; |
| 84 extern const int TextDragHysteresis; | 84 extern const int TextDragHysteresis; |
| 85 extern const int GeneralDragHysteresis; | 85 extern const int GeneralDragHysteresis; |
| 86 | 86 |
| 87 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili ngWhitespace }; | 87 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili ngWhitespace }; |
| 88 enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis }; | 88 enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis }; |
| 89 | 89 |
| 90 class EventHandler { | 90 class EventHandler : public HeapAllocatedFinalized<EventHandler> { |
| 91 WTF_MAKE_NONCOPYABLE(EventHandler); | 91 DECLARE_GC_MAP |
| 92 DEFINE_SELF_HANDLE(EventHandler) | |
| 93 WTF_MAKE_NONCOPYABLE(EventHandler) | |
| 92 public: | 94 public: |
| 93 explicit EventHandler(Frame*); | 95 static RESULT(EventHandler) create(Frame* frame) |
| 96 { | |
| 97 return adopt(new EventHandler(frame)); | |
| 98 } | |
| 99 | |
| 94 ~EventHandler(); | 100 ~EventHandler(); |
| 95 | 101 |
| 96 void clear(); | 102 void clear(); |
| 97 void nodeWillBeRemoved(HANDLE_FORMAL(Node)); | 103 void nodeWillBeRemoved(HANDLE_FORMAL(Node)); |
| 98 | 104 |
| 99 void updateSelectionForMouseDrag(); | 105 void updateSelectionForMouseDrag(); |
| 100 | 106 |
| 101 RESULT(Node) mousePressNode() const; | 107 RESULT(Node) mousePressNode() const; |
| 102 void setMousePressNode(HANDLE_FORMAL(Node)); | 108 void setMousePressNode(HANDLE_FORMAL(Node)); |
| 103 | 109 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 | 207 |
| 202 void capsLockStateMayHaveChanged(); // Only called by FrameSelection | 208 void capsLockStateMayHaveChanged(); // Only called by FrameSelection |
| 203 | 209 |
| 204 void sendResizeEvent(); // Only called in FrameView | 210 void sendResizeEvent(); // Only called in FrameView |
| 205 void sendScrollEvent(); // Ditto | 211 void sendScrollEvent(); // Ditto |
| 206 | 212 |
| 207 bool handleTouchEvent(const PlatformTouchEvent&); | 213 bool handleTouchEvent(const PlatformTouchEvent&); |
| 208 | 214 |
| 209 bool useHandCursor(HANDLE_FORMAL(Node), bool isOverLink, bool shiftKey); | 215 bool useHandCursor(HANDLE_FORMAL(Node), bool isOverLink, bool shiftKey); |
| 210 | 216 |
| 217 void accept(Visitor*) const; | |
| 218 | |
| 211 private: | 219 private: |
| 220 explicit EventHandler(Frame*); | |
| 221 | |
| 212 static DragState& dragState(); | 222 static DragState& dragState(); |
| 213 static const double TextDragDelay; | 223 static const double TextDragDelay; |
| 214 | 224 |
| 215 PassRefPtr<Clipboard> createDraggingClipboard() const; | 225 PassRefPtr<Clipboard> createDraggingClipboard() const; |
| 216 | 226 |
| 217 bool eventActivatedView(const PlatformMouseEvent&) const; | 227 bool eventActivatedView(const PlatformMouseEvent&) const; |
| 218 bool updateSelectionForMouseDownDispatchingSelectStart(HANDLE_FORMAL(Node), const VisibleSelection&, TextGranularity); | 228 bool updateSelectionForMouseDownDispatchingSelectStart(HANDLE_FORMAL(Node), const VisibleSelection&, TextGranularity); |
| 219 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing Whitespace); | 229 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing Whitespace); |
| 220 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); | 230 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); |
| 221 void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResult s&); | 231 void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResult s&); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 #if ENABLE(CURSOR_VISIBILITY) | 321 #if ENABLE(CURSOR_VISIBILITY) |
| 312 void startAutoHideCursorTimer(); | 322 void startAutoHideCursorTimer(); |
| 313 void cancelAutoHideCursorTimer(); | 323 void cancelAutoHideCursorTimer(); |
| 314 void autoHideCursorTimerFired(Timer<EventHandler>*); | 324 void autoHideCursorTimerFired(Timer<EventHandler>*); |
| 315 #endif | 325 #endif |
| 316 | 326 |
| 317 Frame* m_frame; | 327 Frame* m_frame; |
| 318 | 328 |
| 319 bool m_mousePressed; | 329 bool m_mousePressed; |
| 320 bool m_capturesDragging; | 330 bool m_capturesDragging; |
| 321 ANNOTATED_FIELD(Persistent<Node>, m_mousePressNode); | 331 Member<Node> m_mousePressNode; |
| 322 | 332 |
| 323 bool m_mouseDownMayStartSelect; | 333 bool m_mouseDownMayStartSelect; |
| 324 bool m_mouseDownMayStartDrag; | 334 bool m_mouseDownMayStartDrag; |
| 325 bool m_dragMayStartSelectionInstead; | 335 bool m_dragMayStartSelectionInstead; |
| 326 bool m_mouseDownWasSingleClickInSelection; | 336 bool m_mouseDownWasSingleClickInSelection; |
| 327 enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, Extend edSelection }; | 337 enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, Extend edSelection }; |
| 328 SelectionInitiationState m_selectionInitiationState; | 338 SelectionInitiationState m_selectionInitiationState; |
| 329 | 339 |
| 330 LayoutPoint m_dragStartPos; | 340 LayoutPoint m_dragStartPos; |
| 331 | 341 |
| 332 bool m_panScrollButtonPressed; | 342 bool m_panScrollButtonPressed; |
| 333 | 343 |
| 334 Timer<EventHandler> m_hoverTimer; | 344 Timer<EventHandler> m_hoverTimer; |
| 335 | 345 |
| 336 OwnPtr<AutoscrollController> m_autoscrollController; | 346 OwnPtr<AutoscrollController> m_autoscrollController; |
| 337 bool m_mouseDownMayStartAutoscroll; | 347 bool m_mouseDownMayStartAutoscroll; |
| 338 bool m_mouseDownWasInSubframe; | 348 bool m_mouseDownWasInSubframe; |
| 339 | 349 |
| 340 Timer<EventHandler> m_fakeMouseMoveEventTimer; | 350 Timer<EventHandler> m_fakeMouseMoveEventTimer; |
| 341 | 351 |
| 342 #if ENABLE(SVG) | 352 #if ENABLE(SVG) |
| 343 bool m_svgPan; | 353 bool m_svgPan; |
| 344 RefPtr<SVGElementInstance> m_instanceUnderMouse; | 354 RefPtr<SVGElementInstance> m_instanceUnderMouse; |
| 345 RefPtr<SVGElementInstance> m_lastInstanceUnderMouse; | 355 RefPtr<SVGElementInstance> m_lastInstanceUnderMouse; |
| 346 #endif | 356 #endif |
| 347 | 357 |
| 348 RenderLayer* m_resizeLayer; | 358 RenderLayer* m_resizeLayer; |
| 349 | 359 |
| 350 ANNOTATED_FIELD(Persistent<Node>, m_capturingMouseEventsNode); | 360 Member<Node> m_capturingMouseEventsNode; |
| 351 bool m_eventHandlerWillResetCapturingMouseEventsNode; | 361 bool m_eventHandlerWillResetCapturingMouseEventsNode; |
| 352 | 362 |
| 353 ANNOTATED_FIELD(Persistent<Node>, m_nodeUnderMouse); | 363 Member<Node> m_nodeUnderMouse; |
| 354 ANNOTATED_FIELD(Persistent<Node>, m_lastNodeUnderMouse); | 364 Member<Node> m_lastNodeUnderMouse; |
| 355 RefPtr<Frame> m_lastMouseMoveEventSubframe; | 365 RefPtr<Frame> m_lastMouseMoveEventSubframe; |
| 356 RefPtr<Scrollbar> m_lastScrollbarUnderMouse; | 366 RefPtr<Scrollbar> m_lastScrollbarUnderMouse; |
| 357 Cursor m_currentMouseCursor; | 367 Cursor m_currentMouseCursor; |
| 358 | 368 |
| 359 int m_clickCount; | 369 int m_clickCount; |
| 360 ANNOTATED_FIELD(Persistent<Node>, m_clickNode); | 370 Member<Node> m_clickNode; |
| 361 | 371 |
| 362 ANNOTATED_FIELD(Persistent<Node>, m_dragTarget); | 372 Member<Node> m_dragTarget; |
| 363 bool m_shouldOnlyFireDragOverEvent; | 373 bool m_shouldOnlyFireDragOverEvent; |
| 364 | 374 |
| 365 ANNOTATED_FIELD(Persistent<HTMLFrameSetElement>, m_frameSetBeingResized); | 375 Member<HTMLFrameSetElement> m_frameSetBeingResized; |
| 366 | 376 |
| 367 LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeLayer. | 377 LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeLayer. |
| 368 | 378 |
| 369 bool m_mousePositionIsUnknown; | 379 bool m_mousePositionIsUnknown; |
| 370 IntPoint m_lastKnownMousePosition; | 380 IntPoint m_lastKnownMousePosition; |
| 371 IntPoint m_lastKnownMouseGlobalPosition; | 381 IntPoint m_lastKnownMouseGlobalPosition; |
| 372 IntPoint m_mouseDownPos; // In our view's coords. | 382 IntPoint m_mouseDownPos; // In our view's coords. |
| 373 double m_mouseDownTimestamp; | 383 double m_mouseDownTimestamp; |
| 374 PlatformMouseEvent m_mouseDown; | 384 PlatformMouseEvent m_mouseDown; |
| 375 RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken; | 385 RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken; |
| 376 | 386 |
| 377 ANNOTATED_FIELD(Persistent<Node>, m_latchedWheelEventNode); | 387 Member<Node> m_latchedWheelEventNode; |
| 378 bool m_widgetIsLatched; | 388 bool m_widgetIsLatched; |
| 379 | 389 |
| 380 ANNOTATED_FIELD(Persistent<Node>, m_previousWheelScrolledNode); | 390 Member<Node> m_previousWheelScrolledNode; |
| 381 | 391 |
| 382 typedef CollectionRoot<HashMap<int, Member<EventTarget> > > TouchTargetMap; | 392 typedef CollectionRoot<HashMap<int, Member<EventTarget> > > TouchTargetMap; |
|
haraken
2013/11/11 12:41:35
oh, I forgot to remove this CollectionRoot. Just a
haraken
2013/11/11 12:45:29
Done.
| |
| 383 ANNOTATED_FIELD(TouchTargetMap, m_originatingTouchPointTargets); | 393 ANNOTATED_FIELD(TouchTargetMap, m_originatingTouchPointTargets); |
| 384 ANNOTATED_FIELD(Persistent<Document>, m_originatingTouchPointDocument); | 394 Member<Document> m_originatingTouchPointDocument; |
| 385 unsigned m_originatingTouchPointTargetKey; | 395 unsigned m_originatingTouchPointTargetKey; |
| 386 bool m_touchPressed; | 396 bool m_touchPressed; |
| 387 | 397 |
| 388 ANNOTATED_FIELD(Persistent<Node>, m_scrollGestureHandlingNode); | 398 Member<Node> m_scrollGestureHandlingNode; |
| 389 bool m_lastHitTestResultOverWidget; | 399 bool m_lastHitTestResultOverWidget; |
| 390 ANNOTATED_FIELD(Persistent<Node>, m_previousGestureScrolledNode); | 400 Member<Node> m_previousGestureScrolledNode; |
| 391 RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture; | 401 RefPtr<Scrollbar> m_scrollbarHandlingScrollGesture; |
| 392 | 402 |
| 393 double m_maxMouseMovedDuration; | 403 double m_maxMouseMovedDuration; |
| 394 PlatformEvent::Type m_baseEventType; | 404 PlatformEvent::Type m_baseEventType; |
| 395 bool m_didStartDrag; | 405 bool m_didStartDrag; |
| 396 bool m_didLongPressInvokeContextMenu; | 406 bool m_didLongPressInvokeContextMenu; |
| 397 | 407 |
| 398 #if ENABLE(CURSOR_VISIBILITY) | 408 #if ENABLE(CURSOR_VISIBILITY) |
| 399 Timer<EventHandler> m_autoHideCursorTimer; | 409 Timer<EventHandler> m_autoHideCursorTimer; |
| 400 #endif | 410 #endif |
| 401 }; | 411 }; |
| 402 | 412 |
| 403 } // namespace WebCore | 413 } // namespace WebCore |
| 404 | 414 |
| 405 #endif // EventHandler_h | 415 #endif // EventHandler_h |
| OLD | NEW |