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

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

Powered by Google App Engine
This is Rietveld 408576698