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

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

Issue 2414273003: Remove UserGesture on touch scrolls (Closed)
Patch Set: Improve comments Created 4 years, 1 month 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 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"
11 #include "public/platform/WebInputEventResult.h" 10 #include "public/platform/WebInputEventResult.h"
12 #include "wtf/Allocator.h" 11 #include "wtf/Allocator.h"
13 #include "wtf/HashMap.h" 12 #include "wtf/HashMap.h"
14 13
15 namespace blink { 14 namespace blink {
16 15
17 class LocalFrame; 16 class LocalFrame;
18 class Document; 17 class Document;
19 class PlatformTouchEvent; 18 class PlatformTouchEvent;
20 19
21 // This class takes care of dispatching all touch events and 20 // This class takes care of dispatching all touch events and
22 // maintaining related states. 21 // maintaining related states.
23 class CORE_EXPORT TouchEventManager 22 class CORE_EXPORT TouchEventManager
24 : public GarbageCollectedFinalized<TouchEventManager>, 23 : public GarbageCollectedFinalized<TouchEventManager> {
25 public UserGestureUtilizedCallback {
26 WTF_MAKE_NONCOPYABLE(TouchEventManager); 24 WTF_MAKE_NONCOPYABLE(TouchEventManager);
27 25
28 public: 26 public:
29 class TouchInfo { 27 class TouchInfo {
30 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 28 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
31 29
32 public: 30 public:
33 DEFINE_INLINE_TRACE() { 31 DEFINE_INLINE_TRACE() {
34 visitor->trace(touchNode); 32 visitor->trace(touchNode);
35 visitor->trace(targetFrame); 33 visitor->trace(targetFrame);
(...skipping 22 matching lines...) Expand all
58 // TouchInfo objects. 56 // TouchInfo objects.
59 WebInputEventResult handleTouchEvent(const PlatformTouchEvent&, 57 WebInputEventResult handleTouchEvent(const PlatformTouchEvent&,
60 HeapVector<TouchInfo>&); 58 HeapVector<TouchInfo>&);
61 59
62 // Resets the internal state of this object. 60 // Resets the internal state of this object.
63 void clear(); 61 void clear();
64 62
65 // Returns whether there is any touch on the screen. 63 // Returns whether there is any touch on the screen.
66 bool isAnyTouchActive() const; 64 bool isAnyTouchActive() const;
67 65
68 // Indicate that a touch scroll has started.
69 void setTouchScrollStarted() { m_touchScrollStarted = true; }
70
71 // Invoked when a UserGestureIndicator corresponding to a touch event is
72 // utilized.
73 void userGestureUtilized() override;
74
75 private: 66 private:
76 void updateTargetAndRegionMapsForTouchStarts(HeapVector<TouchInfo>&); 67 void updateTargetAndRegionMapsForTouchStarts(HeapVector<TouchInfo>&);
77 void setAllPropertiesOfTouchInfos(HeapVector<TouchInfo>&); 68 void setAllPropertiesOfTouchInfos(HeapVector<TouchInfo>&);
78 69
79 WebInputEventResult dispatchTouchEvents(const PlatformTouchEvent&, 70 WebInputEventResult dispatchTouchEvents(const PlatformTouchEvent&,
80 const HeapVector<TouchInfo>&, 71 const HeapVector<TouchInfo>&,
81 bool allTouchesReleased); 72 bool allTouchesReleased);
82 73
83 // NOTE: If adding a new field to this class please ensure that it is 74 // NOTE: If adding a new field to this class please ensure that it is
84 // cleared in |TouchEventManager::clear()|. 75 // cleared in |TouchEventManager::clear()|.
(...skipping 10 matching lines...) Expand all
95 using TouchRegionMap = HashMap<unsigned, 86 using TouchRegionMap = HashMap<unsigned,
96 String, 87 String,
97 DefaultHash<unsigned>::Hash, 88 DefaultHash<unsigned>::Hash,
98 WTF::UnsignedWithZeroKeyHashTraits<unsigned>>; 89 WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
99 TouchRegionMap m_regionForTouchID; 90 TouchRegionMap m_regionForTouchID;
100 91
101 // If set, the document of the active touch sequence. Unset if no touch 92 // If set, the document of the active touch sequence. Unset if no touch
102 // sequence active. 93 // sequence active.
103 Member<Document> m_touchSequenceDocument; 94 Member<Document> m_touchSequenceDocument;
104 95
105 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken;
106 bool m_touchPressed; 96 bool m_touchPressed;
107 // True if a touch is active but scrolling/zooming has started.
108 bool m_touchScrollStarted;
109 // The touch event currently being handled or NoType if none. 97 // The touch event currently being handled or NoType if none.
110 PlatformEvent::EventType m_currentEvent; 98 PlatformEvent::EventType m_currentEvent;
111 }; 99 };
112 100
113 } // namespace blink 101 } // namespace blink
114 102
115 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo); 103 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo);
116 104
117 #endif // TouchEventManager_h 105 #endif // TouchEventManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698