Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.h

Issue 1892653003: Extract touch handling logic from EventHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODO Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 #if OS(WIN) 104 #if OS(WIN)
105 void startPanScrolling(LayoutObject*); 105 void startPanScrolling(LayoutObject*);
106 #endif 106 #endif
107 107
108 void stopAutoscroll(); 108 void stopAutoscroll();
109 109
110 void dispatchFakeMouseMoveEventSoon(); 110 void dispatchFakeMouseMoveEventSoon();
111 void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); 111 void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
112 112
113 static HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, H itTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRe quest::Active);
114
113 HitTestResult hitTestResultAtPoint(const LayoutPoint&, 115 HitTestResult hitTestResultAtPoint(const LayoutPoint&,
114 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, 116 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active,
115 const LayoutSize& padding = LayoutSize()); 117 const LayoutSize& padding = LayoutSize());
116 118
117 bool mousePressed() const { return m_mousePressed; } 119 bool mousePressed() const { return m_mousePressed; }
118 120
119 void setCapturingMouseEventsNode(Node*); // A caller is responsible for rese tting capturing node to 0. 121 void setCapturingMouseEventsNode(Node*); // A caller is responsible for rese tting capturing node to 0.
120 122
121 WebInputEventResult updateDragAndDrop(const PlatformMouseEvent&, DataTransfe r*); 123 WebInputEventResult updateDragAndDrop(const PlatformMouseEvent&, DataTransfe r*);
122 void cancelDragAndDrop(const PlatformMouseEvent&, DataTransfer*); 124 void cancelDragAndDrop(const PlatformMouseEvent&, DataTransfer*);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 LayoutBox*, 322 LayoutBox*,
321 ScrollGranularity, 323 ScrollGranularity,
322 const FloatSize& delta, 324 const FloatSize& delta,
323 const FloatPoint& position, 325 const FloatPoint& position,
324 const FloatSize& velocity, 326 const FloatSize& velocity,
325 bool* wasRootScroller); 327 bool* wasRootScroller);
326 328
327 bool isRootScroller(const Node&) const; 329 bool isRootScroller(const Node&) const;
328 void customizedScroll(const Node& startNode, ScrollState&); 330 void customizedScroll(const Node& startNode, ScrollState&);
329 331
330 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestR equest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest:: Active);
331
332 void invalidateClick(); 332 void invalidateClick();
333 333
334 Node* updateMouseEventTargetNode(Node*, const PlatformMouseEvent&); 334 Node* updateMouseEventTargetNode(Node*, const PlatformMouseEvent&);
335 void updateMouseEventTargetNodeAndSendEvents(Node*, const PlatformMouseEvent &, bool isFrameBoundaryTransition = false); 335 void updateMouseEventTargetNodeAndSendEvents(Node*, const PlatformMouseEvent &, bool isFrameBoundaryTransition = false);
336 336
337 337
338 MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&); 338 MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&);
339 339
340 WebInputEventResult dispatchMouseEvent(const AtomicString& eventType, Node* target, int clickCount, const PlatformMouseEvent&); 340 WebInputEventResult dispatchMouseEvent(const AtomicString& eventType, Node* target, int clickCount, const PlatformMouseEvent&);
341 341
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 bool panScrollInProgress() const; 387 bool panScrollInProgress() const;
388 void setLastKnownMousePosition(const PlatformMouseEvent&); 388 void setLastKnownMousePosition(const PlatformMouseEvent&);
389 389
390 bool shouldTopControlsConsumeScroll(FloatSize) const; 390 bool shouldTopControlsConsumeScroll(FloatSize) const;
391 391
392 // If the given element is a shadow host and its root has delegatesFocus=fal se flag, 392 // If the given element is a shadow host and its root has delegatesFocus=fal se flag,
393 // slide focus to its inner element. Returns true if the resulting focus is different from 393 // slide focus to its inner element. Returns true if the resulting focus is different from
394 // the given element. 394 // the given element.
395 bool slideFocusOnShadowHostIfNecessary(const Element&); 395 bool slideFocusOnShadowHostIfNecessary(const Element&);
396 396
397 void dispatchPointerEvents(const PlatformTouchEvent&, HeapVector<TouchInfo>& );
398
399 WebInputEventResult dispatchTouchEvents(const PlatformTouchEvent&, HeapVecto r<TouchInfo>&, bool);
400
401 FrameHost* frameHost(); 397 FrameHost* frameHost();
402 398
403 // NOTE: If adding a new field to this class please ensure that it is 399 // NOTE: If adding a new field to this class please ensure that it is
404 // cleared in |EventHandler::clear()|. 400 // cleared in |EventHandler::clear()|.
405 401
406 const Member<LocalFrame> m_frame; 402 const Member<LocalFrame> m_frame;
407 403
408 // Current button-press state for mouse/mouse-like-stylus. 404 // Current button-press state for mouse/mouse-like-stylus.
409 // TODO(crbug.com/563676): Buggy for chorded buttons. 405 // TODO(crbug.com/563676): Buggy for chorded buttons.
410 bool m_mousePressed; 406 bool m_mousePressed;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 448
453 bool m_mousePositionIsUnknown; 449 bool m_mousePositionIsUnknown;
454 // The last mouse movement position this frame has seen in root frame coordi nates. 450 // The last mouse movement position this frame has seen in root frame coordi nates.
455 IntPoint m_lastKnownMousePosition; 451 IntPoint m_lastKnownMousePosition;
456 IntPoint m_lastKnownMouseGlobalPosition; 452 IntPoint m_lastKnownMouseGlobalPosition;
457 IntPoint m_mouseDownPos; // In our view's coords. 453 IntPoint m_mouseDownPos; // In our view's coords.
458 double m_mouseDownTimestamp; 454 double m_mouseDownTimestamp;
459 PlatformMouseEvent m_mouseDown; 455 PlatformMouseEvent m_mouseDown;
460 RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken; 456 RefPtr<UserGestureToken> m_lastMouseDownUserGestureToken;
461 457
462 // The target of each active touch point indexed by the touch ID.
463 using TouchTargetMap = HeapHashMap<unsigned, Member<EventTarget>, DefaultHas h<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
464 TouchTargetMap m_targetForTouchID;
465 using TouchRegionMap = HashMap<unsigned, String, DefaultHash<unsigned>::Hash , WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
466 TouchRegionMap m_regionForTouchID;
467
468 // If set, the document of the active touch sequence. Unset if no touch sequ ence active.
469 Member<Document> m_touchSequenceDocument;
470 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken;
471
472 bool m_touchPressed;
473
474 PointerEventManager m_pointerEventManager; 458 PointerEventManager m_pointerEventManager;
475 459
476 Member<Node> m_scrollGestureHandlingNode; 460 Member<Node> m_scrollGestureHandlingNode;
477 bool m_lastGestureScrollOverWidget; 461 bool m_lastGestureScrollOverWidget;
478 // The most recent element to scroll natively during this scroll 462 // The most recent element to scroll natively during this scroll
479 // sequence. Null if no native element has scrolled this scroll 463 // sequence. Null if no native element has scrolled this scroll
480 // sequence, or if the most recent element to scroll used scroll 464 // sequence, or if the most recent element to scroll used scroll
481 // customization. 465 // customization.
482 Member<Node> m_previousGestureScrolledNode; 466 Member<Node> m_previousGestureScrolledNode;
483 Member<Scrollbar> m_scrollbarHandlingScrollGesture; 467 Member<Scrollbar> m_scrollbarHandlingScrollGesture;
484 468
485 double m_maxMouseMovedDuration; 469 double m_maxMouseMovedDuration;
486 470
487 bool m_longTapShouldInvokeContextMenu; 471 bool m_longTapShouldInvokeContextMenu;
488 472
489 Timer<EventHandler> m_activeIntervalTimer; 473 Timer<EventHandler> m_activeIntervalTimer;
490 double m_lastShowPressTimestamp; 474 double m_lastShowPressTimestamp;
491 Member<Element> m_lastDeferredTapElement; 475 Member<Element> m_lastDeferredTapElement;
492 476
493 // Only used with the ScrollCustomization runtime enabled feature. 477 // Only used with the ScrollCustomization runtime enabled feature.
494 std::deque<int> m_currentScrollChain; 478 std::deque<int> m_currentScrollChain;
495 // True iff some of the delta has been consumed for the current 479 // True iff some of the delta has been consumed for the current
496 // scroll sequence in this frame, or any child frames. Only used 480 // scroll sequence in this frame, or any child frames. Only used
497 // with ScrollCustomization. If some delta has been consumed, a 481 // with ScrollCustomization. If some delta has been consumed, a
498 // scroll which shouldn't propagate can't cause any element to 482 // scroll which shouldn't propagate can't cause any element to
499 // scroll other than the |m_previousGestureScrolledNode|. 483 // scroll other than the |m_previousGestureScrolledNode|.
500 bool m_deltaConsumedForScrollSequence; 484 bool m_deltaConsumedForScrollSequence;
501
502 // True if waiting on first touch move after a touch start.
503 bool m_waitingForFirstTouchMove;
504 }; 485 };
505 486
506 } // namespace blink 487 } // namespace blink
507 488
508 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::EventHandler::TouchInfo); 489 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::EventHandler::TouchInfo);
509 490
510 #endif // EventHandler_h 491 #endif // EventHandler_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698