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

Side by Side Diff: third_party/WebKit/Source/core/input/TouchEventManager.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef TouchEventManager_h
6 #define TouchEventManager_h
7
8 #include "core/CoreExport.h"
9 #include "core/events/PointerEventFactory.h"
10 #include "platform/UserGestureIndicator.h"
11 #include "public/platform/WebInputEventResult.h"
12 #include "wtf/Allocator.h"
13 #include "wtf/HashMap.h"
14
15
16 namespace blink {
17
18 class LocalFrame;
19 class Document;
20 class PlatformTouchEvent;
21 class PointerEventWithTarget;
22
23 // This class takes care of dispatching all touch events and their properties.
mustaq 2016/04/29 15:09:10 Nit: s/and.*$/and maintaining related states\./. (
Navid Zolghadr 2016/04/29 16:31:19 Done.
24 class CORE_EXPORT TouchEventManager {
25 DISALLOW_NEW();
26 public:
27 class TouchInfo {
28 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
29 public:
30 DEFINE_INLINE_TRACE()
31 {
32 visitor->trace(touchNode);
33 visitor->trace(targetFrame);
34 }
35
36 PlatformTouchPoint point;
37 Member<Node> touchNode;
38 Member<LocalFrame> targetFrame;
39 FloatPoint adjustedPagePoint;
40 FloatSize adjustedRadius;
41 bool knownTarget;
42 bool consumed;
43 String region;
44 };
45
46 explicit TouchEventManager(LocalFrame*);
47 ~TouchEventManager();
48 DECLARE_TRACE();
49
50 // Returns true if it succesfully generates touchInfos
tdresser 2016/04/29 15:55:04 Missing .
Navid Zolghadr 2016/04/29 16:31:19 Done.
51 bool generateTouchInfosAfterHittest(
52 const PlatformTouchEvent&,
53 HeapVector<TouchInfo>&);
54
55 WebInputEventResult handleTouchEvent(
56 const PlatformTouchEvent&,
57 const HeapVector<TouchInfo>&);
58
59 // Resets the internal state of this object.
60 void clear();
61
62 // Returns whether there is any touch on the screen.
63 bool isAnyTouchActive() const;
64
65 private:
66
67 void updateTargetAndRegionMapsForTouchStarts(HeapVector<TouchInfo>&);
68 void setAllPropertiesOfTouchInfos(HeapVector<TouchInfo>&);
69
70 WebInputEventResult dispatchTouchEvents(
71 const PlatformTouchEvent&,
72 const HeapVector<TouchInfo>&,
73 bool allTouchReleased);
tdresser 2016/04/29 15:55:04 allTouchesReleased?
Navid Zolghadr 2016/04/29 16:31:19 Done.
74
75
76 // NOTE: If adding a new field to this class please ensure that it is
77 // cleared in |PointerEventManager::clear()|.
tdresser 2016/04/29 15:55:04 PointerEventManager -> TouchEventManager.
Navid Zolghadr 2016/04/29 16:31:19 Done.
78
79 const Member<LocalFrame> m_frame;
80
81 // The target of each active touch point indexed by the touch ID.
82 using TouchTargetMap = HeapHashMap<unsigned, Member<Node>, DefaultHash<unsig ned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
83 TouchTargetMap m_targetForTouchID;
84 using TouchRegionMap = HashMap<unsigned, String, DefaultHash<unsigned>::Hash , WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
85 TouchRegionMap m_regionForTouchID;
86
87 // If set, the document of the active touch sequence. Unset if no touch sequ ence active.
88 Member<Document> m_touchSequenceDocument;
89
90 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken;
91 bool m_touchPressed;
92 // True if waiting on first touch move after a touch start.
93 bool m_waitingForFirstTouchMove;
tdresser 2016/04/29 15:55:04 Remove extra whitespace.
Navid Zolghadr 2016/04/29 16:31:19 Done.
94
95
96 };
97
98 } // namespace blink
99
100 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo);
101
102 #endif // TouchEventManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698