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

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: Rebased 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..2044ff5415d0ca803c615a0079d4758e9da8d763
--- /dev/null
+++ b/third_party/WebKit/Source/core/input/TouchEventManager.h
@@ -0,0 +1,102 @@
+// 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.
mustaq 2016/04/29 15:09:10 Nit: s/and.*$/and maintaining related states\./. (
Navid Zolghadr 2016/04/29 16:31:19 Done.
+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;
+ bool consumed;
+ String region;
+ };
+
+ explicit TouchEventManager(LocalFrame*);
+ ~TouchEventManager();
+ DECLARE_TRACE();
+
+ // Returns true if it succesfully generates touchInfos
tdresser 2016/04/29 15:55:04 Missing .
Navid Zolghadr 2016/04/29 16:31:19 Done.
+ bool generateTouchInfosAfterHittest(
+ const PlatformTouchEvent&,
+ HeapVector<TouchInfo>&);
+
+ WebInputEventResult handleTouchEvent(
+ const PlatformTouchEvent&,
+ const HeapVector<TouchInfo>&);
+
+ // Resets the internal state of this object.
+ void clear();
+
+ // Returns whether there is any touch on the screen.
+ bool isAnyTouchActive() const;
+
+private:
+
+ void updateTargetAndRegionMapsForTouchStarts(HeapVector<TouchInfo>&);
+ void setAllPropertiesOfTouchInfos(HeapVector<TouchInfo>&);
+
+ WebInputEventResult dispatchTouchEvents(
+ const PlatformTouchEvent&,
+ const HeapVector<TouchInfo>&,
+ bool allTouchReleased);
tdresser 2016/04/29 15:55:04 allTouchesReleased?
Navid Zolghadr 2016/04/29 16:31:19 Done.
+
+
+ // NOTE: If adding a new field to this class please ensure that it is
+ // cleared in |PointerEventManager::clear()|.
tdresser 2016/04/29 15:55:04 PointerEventManager -> TouchEventManager.
Navid Zolghadr 2016/04/29 16:31:19 Done.
+
+ 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 = HashMap<unsigned, String, DefaultHash<unsigned>::Hash, WTF::UnsignedWithZeroKeyHashTraits<unsigned>>;
+ TouchRegionMap m_regionForTouchID;
+
+ // If set, the document of the active touch sequence. Unset if no touch sequence active.
+ Member<Document> m_touchSequenceDocument;
+
+ RefPtr<UserGestureToken> m_touchSequenceUserGestureToken;
+ bool m_touchPressed;
+ // True if waiting on first touch move after a touch start.
+ bool m_waitingForFirstTouchMove;
tdresser 2016/04/29 15:55:04 Remove extra whitespace.
Navid Zolghadr 2016/04/29 16:31:19 Done.
+
+
+};
+
+} // namespace blink
+
+WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo);
+
+#endif // TouchEventManager_h

Powered by Google App Engine
This is Rietveld 408576698