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

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: 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.
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
51 bool generateTouchInfos(
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
74
75 // NOTE: If adding a new field to this class please ensure that it is
76 // cleared in |PointerEventManager::clear()|.
77
78 const Member<LocalFrame> m_frame;
79
80 // The target of each active touch point indexed by the touch ID.
81 using TouchTargetMap = HeapHashMap<unsigned, Member<Node>, DefaultHash<unsig ned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
82 TouchTargetMap m_targetForTouchID;
83 using TouchRegionMap = HashMap<unsigned, String, DefaultHash<unsigned>::Hash , WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
84 TouchRegionMap m_regionForTouchID;
85
86 bool m_touchPressed;
dtapuska 2016/04/27 17:07:05 Put the two bools together. Should allow this obje
Navid Zolghadr 2016/04/28 15:13:11 Done.
87
88 // If set, the document of the active touch sequence. Unset if no touch sequ ence active.
89 Member<Document> m_touchSequenceDocument;
90 RefPtr<UserGestureToken> m_touchSequenceUserGestureToken;
91
92 // True if waiting on first touch move after a touch start.
93 bool m_waitingForFirstTouchMove;
94
95 };
96
97 } // namespace blink
98
99 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo);
100
101 #endif // TouchEventManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698