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

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

Issue 1809603003: Separate mouse transition events from pointerevent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applying the comments Created 4 years, 9 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PointerEventManager_h 5 #ifndef PointerEventManager_h
6 #define PointerEventManager_h 6 #define PointerEventManager_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/events/PointerEvent.h" 9 #include "core/events/PointerEvent.h"
10 #include "core/events/PointerEventFactory.h" 10 #include "core/events/PointerEventFactory.h"
(...skipping 11 matching lines...) Expand all
22 DISALLOW_NEW(); 22 DISALLOW_NEW();
23 public: 23 public:
24 PointerEventManager(); 24 PointerEventManager();
25 ~PointerEventManager(); 25 ~PointerEventManager();
26 DECLARE_TRACE(); 26 DECLARE_TRACE();
27 27
28 WebInputEventResult sendMousePointerEvent( 28 WebInputEventResult sendMousePointerEvent(
29 PassRefPtrWillBeRawPtr<Node>, const AtomicString& type, 29 PassRefPtrWillBeRawPtr<Node>, const AtomicString& type,
30 int clickCount, const PlatformMouseEvent&, 30 int clickCount, const PlatformMouseEvent&,
31 PassRefPtrWillBeRawPtr<Node> relatedTarget, 31 PassRefPtrWillBeRawPtr<Node> relatedTarget,
32 PassRefPtrWillBeRawPtr<AbstractView>); 32 PassRefPtrWillBeRawPtr<AbstractView>,
33 PassRefPtrWillBeRawPtr<Node> lastNodeUnderMouse);
33 34
34 // Returns whether the event is consumed or not 35 // Returns whether the event is consumed or not
35 WebInputEventResult sendTouchPointerEvent( 36 WebInputEventResult sendTouchPointerEvent(
36 PassRefPtrWillBeRawPtr<EventTarget>, 37 PassRefPtrWillBeRawPtr<EventTarget>,
37 const PlatformTouchPoint&, PlatformEvent::Modifiers, 38 const PlatformTouchPoint&, PlatformEvent::Modifiers,
38 const double width, const double height, 39 const double width, const double height,
39 const double clientX, const double clientY); 40 const double clientX, const double clientY);
40 41
41 void sendTouchCancelPointerEvent(PassRefPtrWillBeRawPtr<EventTarget>, 42 void sendTouchCancelPointerEvent(PassRefPtrWillBeRawPtr<EventTarget>,
42 const PlatformTouchPoint&); 43 const PlatformTouchPoint&);
43 44
44 // Sends node transition events (pointer|mouse)(out|leave|over|enter) to the corresponding targets 45 // Sends node transition events mouseout/leave/over/enter to the
45 void sendNodeTransitionEvents(PassRefPtrWillBeRawPtr<Node> exitedNode, 46 // corresponding targets. This function sends pointerout/leave/over/enter
47 // only when isFrameBoundaryTransition is true which indicates the
Rick Byers 2016/03/29 16:37:14 nit: can you add a little more detail on why the f
Navid Zolghadr 2016/03/29 17:44:03 I explained a bit more here in this comment. Essen
48 // transition is over the document boundary and not only the elements border
49 // inside the document.
50 void sendMouseAndPossiblyPointerNodeTransitionEvents(
51 PassRefPtrWillBeRawPtr<Node> exitedNode,
46 PassRefPtrWillBeRawPtr<Node> enteredNode, 52 PassRefPtrWillBeRawPtr<Node> enteredNode,
47 const PlatformMouseEvent&, 53 const PlatformMouseEvent&,
48 PassRefPtrWillBeRawPtr<AbstractView>); 54 PassRefPtrWillBeRawPtr<AbstractView>, bool isFrameBoundaryTransition);
49 55
50 // Clear all the existing ids. 56 // Clear all the existing ids.
51 void clear(); 57 void clear();
52 58
53 // May clear PREVENT MOUSE EVENT flag as per pointer event spec:
54 // https://w3c.github.io/pointerevents/#compatibility-mapping-with-mouse-eve nts
55 void conditionallyEnableMouseEventForPointerTypeMouse(unsigned);
56
57 void elementRemoved(EventTarget*); 59 void elementRemoved(EventTarget*);
58 void setPointerCapture(int, EventTarget*); 60 void setPointerCapture(int, EventTarget*);
59 void releasePointerCapture(int, EventTarget*); 61 void releasePointerCapture(int, EventTarget*);
60 bool isActive(const int); 62 bool isActive(const int);
61 63
62 private: 64 private:
63 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> PointerCaptu ringMap; 65 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> PointerCaptu ringMap;
64 class EventTargetAttributes { 66 class EventTargetAttributes {
65 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 67 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
66 public: 68 public:
(...skipping 12 matching lines...) Expand all
79 , hasRecievedOverEvent(hasRecievedOverEvent) {} 81 , hasRecievedOverEvent(hasRecievedOverEvent) {}
80 }; 82 };
81 83
82 void sendNodeTransitionEvents( 84 void sendNodeTransitionEvents(
83 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget, 85 PassRefPtrWillBeRawPtr<EventTarget> exitedTarget,
84 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget, 86 PassRefPtrWillBeRawPtr<EventTarget> enteredTarget,
85 PassRefPtrWillBeRawPtr<PointerEvent>, 87 PassRefPtrWillBeRawPtr<PointerEvent>,
86 const PlatformMouseEvent& = PlatformMouseEvent(), 88 const PlatformMouseEvent& = PlatformMouseEvent(),
87 bool sendMouseEvent = false); 89 bool sendMouseEvent = false);
88 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>, 90 void setNodeUnderPointer(PassRefPtrWillBeRawPtr<PointerEvent>,
89 PassRefPtrWillBeRawPtr<EventTarget>); 91 PassRefPtrWillBeRawPtr<EventTarget>, bool sendEvent = true);
90 void processPendingPointerCapture( 92
93 // Returns whether the pointer capture is changed. In this case this
94 // function will take care of transition events and setNodeUnderPointer
95 // should not send transition events.
96 bool processPendingPointerCapture(
91 const PassRefPtrWillBeRawPtr<PointerEvent>, 97 const PassRefPtrWillBeRawPtr<PointerEvent>,
92 const PassRefPtrWillBeRawPtr<EventTarget>, 98 const PassRefPtrWillBeRawPtr<EventTarget>,
93 const PlatformMouseEvent& = PlatformMouseEvent(), 99 const PlatformMouseEvent& = PlatformMouseEvent(),
94 bool sendMouseEvent = false); 100 bool sendMouseEvent = false);
101
102 // Processes the capture state of a pointer, updates node under
103 // pointer, and sends corresponding transition events for pointer if
104 // setPointerPosition is true. It also sends corresponding transition events
105 // for mouse if sendMouseEvent is true.
106 void processCaptureAndPositionOfPointerEvent(
107 const PassRefPtrWillBeRawPtr<PointerEvent>,
108 const PassRefPtrWillBeRawPtr<EventTarget> hitTestTarget,
109 const PassRefPtrWillBeRawPtr<EventTarget> lastNodeUnderMouse = nullptr,
110 const PlatformMouseEvent& = PlatformMouseEvent(),
111 bool sendMouseEvent = false,
112 bool setPointerPosition = true);
113
95 void removeTargetFromPointerCapturingMapping( 114 void removeTargetFromPointerCapturingMapping(
96 PointerCapturingMap&, const EventTarget*); 115 PointerCapturingMap&, const EventTarget*);
97 PassRefPtrWillBeRawPtr<EventTarget> getEffectiveTargetForPointerEvent( 116 PassRefPtrWillBeRawPtr<EventTarget> getEffectiveTargetForPointerEvent(
98 PassRefPtrWillBeRawPtr<EventTarget>, int); 117 PassRefPtrWillBeRawPtr<EventTarget>, int);
99 EventTarget* getCapturingNode(int); 118 EventTarget* getCapturingNode(int);
100 void removePointer(const PassRefPtrWillBeRawPtr<PointerEvent>); 119 void removePointer(const PassRefPtrWillBeRawPtr<PointerEvent>);
101 WebInputEventResult dispatchPointerEvent( 120 WebInputEventResult dispatchPointerEvent(
102 PassRefPtrWillBeRawPtr<EventTarget>, 121 PassRefPtrWillBeRawPtr<EventTarget>,
103 PassRefPtrWillBeRawPtr<PointerEvent>, 122 PassRefPtrWillBeRawPtr<PointerEvent>,
104 bool checkForListener = false); 123 bool checkForListener = false);
(...skipping 11 matching lines...) Expand all
116 WillBeHeapHashMap<int, EventTargetAttributes> m_nodeUnderPointer; 135 WillBeHeapHashMap<int, EventTargetAttributes> m_nodeUnderPointer;
117 136
118 PointerCapturingMap m_pointerCaptureTarget; 137 PointerCapturingMap m_pointerCaptureTarget;
119 PointerCapturingMap m_pendingPointerCaptureTarget; 138 PointerCapturingMap m_pendingPointerCaptureTarget;
120 PointerEventFactory m_pointerEventFactory; 139 PointerEventFactory m_pointerEventFactory;
121 }; 140 };
122 141
123 } // namespace blink 142 } // namespace blink
124 143
125 #endif // PointerEventManager_h 144 #endif // PointerEventManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698