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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/input/TouchEventManager.h
diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.h b/third_party/WebKit/Source/core/input/TouchEventManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..a20abd1e609f4ec2e7d3fd6da683e5872ae13d4f
--- /dev/null
+++ b/third_party/WebKit/Source/core/input/TouchEventManager.h
@@ -0,0 +1,93 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TouchEventManager_h
+#define TouchEventManager_h
+
+#include "core/CoreExport.h"
+#include "core/events/PointerEventFactory.h"
+#include "platform/UserGestureIndicator.h"
+#include "public/platform/WebInputEventResult.h"
+#include "wtf/Allocator.h"
+#include "wtf/HashMap.h"
+
+
+namespace blink {
+
+class LocalFrame;
+class Document;
+class PlatformTouchEvent;
+class PointerEventWithTarget;
+
+// This class takes care of dispatching all touch events and their properties.
+class CORE_EXPORT TouchEventManager {
+ DISALLOW_NEW();
+public:
+ class TouchInfo {
+ DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
+ public:
+ DEFINE_INLINE_TRACE()
+ {
+ visitor->trace(touchNode);
+ visitor->trace(targetFrame);
+ }
+
+ PlatformTouchPoint point;
+ Member<Node> touchNode;
+ Member<LocalFrame> targetFrame;
+ FloatPoint adjustedPagePoint;
+ FloatSize adjustedRadius;
+ bool knownTarget;
+ String region;
+ };
+
+ explicit TouchEventManager(LocalFrame*);
+ ~TouchEventManager();
+ DECLARE_TRACE();
+
+ WebInputEventResult handleTouchEvent(
mustaq 2016/04/20 15:40:01 Since handlerTouchEvent() is the main service prov
Navid Zolghadr 2016/04/25 15:48:32 I just wanted to follow the PointerEventManager cl
+ const PlatformTouchEvent&,
+ HeapVector<TouchInfo>&);
+
+ // Resets the internal state of this object.
+ void clear();
+
+ // Returns whether there is any touch on the screen.
+ bool isAnyTouchActive();
+
+private:
+
+ void updateTargetAndRegionMapsForTouchStarts(HeapVector<TouchInfo>&);
+ void setAllPropertiesofTouchInfos(HeapVector<TouchInfo>&);
mustaq 2016/04/20 15:40:01 s/of/Of/
+
+ WebInputEventResult dispatchTouchEvents(
+ const PlatformTouchEvent&,
+ HeapVector<TouchInfo>&,
+ bool allTouchReleased);
+
+
+ // NOTE: If adding a new field to this class please ensure that it is
+ // cleared in |PointerEventManager::clear()|.
+
+ const Member<LocalFrame> m_frame;
+
+ // The target of each active touch point indexed by the touch ID.
+ using TouchTargetMap = HeapHashMap<unsigned, Member<Node>, DefaultHash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
+ TouchTargetMap m_targetForTouchID;
+ using TouchRegionMap = HeapHashMap<unsigned, String, DefaultHash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
+ TouchRegionMap m_regionForTouchID;
+
+ bool m_touchPressed;
+
+ // If set, the document of the active touch sequence. Unset if no touch sequence active.
+ Member<Document> m_touchSequenceDocument;
+ RefPtr<UserGestureToken> m_touchSequenceUserGestureToken;
+
+};
+
+} // namespace blink
+
+WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo);
+
+#endif // TouchEventManager_h

Powered by Google App Engine
This is Rietveld 408576698