OLD | NEW |
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 TouchEventManager_h | 5 #ifndef TouchEventManager_h |
6 #define TouchEventManager_h | 6 #define TouchEventManager_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/events/PointerEventFactory.h" | 9 #include "core/events/PointerEventFactory.h" |
10 #include "platform/UserGestureIndicator.h" | 10 #include "platform/UserGestureIndicator.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 // Resets the internal state of this object. | 62 // Resets the internal state of this object. |
63 void clear(); | 63 void clear(); |
64 | 64 |
65 // Returns whether there is any touch on the screen. | 65 // Returns whether there is any touch on the screen. |
66 bool isAnyTouchActive() const; | 66 bool isAnyTouchActive() const; |
67 | 67 |
68 // Indicate that a touch scroll has started. | 68 // Indicate that a touch scroll has started. |
69 void setTouchScrollStarted() { m_touchScrollStarted = true; } | 69 void setTouchScrollStarted() { m_touchScrollStarted = true; } |
70 | 70 |
71 // Invoked when a UserGestureIndicator corresponding to a touch event is utili
zed. | 71 // Invoked when a UserGestureIndicator corresponding to a touch event is |
| 72 // utilized. |
72 void userGestureUtilized() override; | 73 void userGestureUtilized() override; |
73 | 74 |
74 private: | 75 private: |
75 void updateTargetAndRegionMapsForTouchStarts(HeapVector<TouchInfo>&); | 76 void updateTargetAndRegionMapsForTouchStarts(HeapVector<TouchInfo>&); |
76 void setAllPropertiesOfTouchInfos(HeapVector<TouchInfo>&); | 77 void setAllPropertiesOfTouchInfos(HeapVector<TouchInfo>&); |
77 | 78 |
78 WebInputEventResult dispatchTouchEvents(const PlatformTouchEvent&, | 79 WebInputEventResult dispatchTouchEvents(const PlatformTouchEvent&, |
79 const HeapVector<TouchInfo>&, | 80 const HeapVector<TouchInfo>&, |
80 bool allTouchesReleased); | 81 bool allTouchesReleased); |
81 | 82 |
82 // NOTE: If adding a new field to this class please ensure that it is | 83 // NOTE: If adding a new field to this class please ensure that it is |
83 // cleared in |TouchEventManager::clear()|. | 84 // cleared in |TouchEventManager::clear()|. |
84 | 85 |
85 const Member<LocalFrame> m_frame; | 86 const Member<LocalFrame> m_frame; |
86 | 87 |
87 // The target of each active touch point indexed by the touch ID. | 88 // The target of each active touch point indexed by the touch ID. |
88 using TouchTargetMap = | 89 using TouchTargetMap = |
89 HeapHashMap<unsigned, | 90 HeapHashMap<unsigned, |
90 Member<Node>, | 91 Member<Node>, |
91 DefaultHash<unsigned>::Hash, | 92 DefaultHash<unsigned>::Hash, |
92 WTF::UnsignedWithZeroKeyHashTraits<unsigned>>; | 93 WTF::UnsignedWithZeroKeyHashTraits<unsigned>>; |
93 TouchTargetMap m_targetForTouchID; | 94 TouchTargetMap m_targetForTouchID; |
94 using TouchRegionMap = HashMap<unsigned, | 95 using TouchRegionMap = HashMap<unsigned, |
95 String, | 96 String, |
96 DefaultHash<unsigned>::Hash, | 97 DefaultHash<unsigned>::Hash, |
97 WTF::UnsignedWithZeroKeyHashTraits<unsigned>>; | 98 WTF::UnsignedWithZeroKeyHashTraits<unsigned>>; |
98 TouchRegionMap m_regionForTouchID; | 99 TouchRegionMap m_regionForTouchID; |
99 | 100 |
100 // If set, the document of the active touch sequence. Unset if no touch sequen
ce active. | 101 // If set, the document of the active touch sequence. Unset if no touch |
| 102 // sequence active. |
101 Member<Document> m_touchSequenceDocument; | 103 Member<Document> m_touchSequenceDocument; |
102 | 104 |
103 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken; | 105 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken; |
104 bool m_touchPressed; | 106 bool m_touchPressed; |
105 // True if a touch is active but scrolling/zooming has started. | 107 // True if a touch is active but scrolling/zooming has started. |
106 bool m_touchScrollStarted; | 108 bool m_touchScrollStarted; |
107 // The touch event currently being handled or NoType if none. | 109 // The touch event currently being handled or NoType if none. |
108 PlatformEvent::EventType m_currentEvent; | 110 PlatformEvent::EventType m_currentEvent; |
109 }; | 111 }; |
110 | 112 |
111 } // namespace blink | 113 } // namespace blink |
112 | 114 |
113 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo); | 115 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo); |
114 | 116 |
115 #endif // TouchEventManager_h | 117 #endif // TouchEventManager_h |
OLD | NEW |