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

Unified Diff: Source/core/events/PointerEventUtils.h

Issue 1144313003: Added PointerEvent firing on touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed primary pointer id on reuse, for each type of Pointers. Created 5 years, 6 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: Source/core/events/PointerEventUtils.h
diff --git a/Source/core/events/PointerEventUtils.h b/Source/core/events/PointerEventUtils.h
new file mode 100644
index 0000000000000000000000000000000000000000..84d5427112d97bd5fc192323733042026c0e18d3
--- /dev/null
+++ b/Source/core/events/PointerEventUtils.h
@@ -0,0 +1,41 @@
+// Copyright 2015 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 PointerEventUtils_h
+#define PointerEventUtils_h
+
+#include "wtf/ListHashSet.h"
+
+namespace blink {
+
+/**
+ Helper class for tracking the primary pointer id for each type of PointerEvents.
+*/
+class PointerIdManager {
+public:
+ // TODO(mustaq): This should live in PointerEvent.h but can't use it there
+ // w/o changing the corresponding type in PointerEvent.idl. Investigate.
Rick Byers 2015/06/16 17:25:39 Note there is a difference. At the PointerEvent A
mustaq 2015/06/16 20:18:43 What about adding a new method pointerTypeEnum() i
Rick Byers 2015/06/18 17:40:07 It's because we want script to be able to fire dif
mustaq 2015/06/18 18:20:53 Acknowledged.
+ enum PointerType {
+ PointerTypeUnknown = 0,
+ PointerTypeMouse,
+ PointerTypePen,
+ PointerTypeTouch,
+ PointerTypeLastEntry // Must be the last entry in the list
+ };
+
+ PointerIdManager();
+ ~PointerIdManager();
+ void clear();
+ void add(PointerType, unsigned);
+ void remove(PointerType, unsigned);
+ bool isPrimary(PointerType, unsigned);
+
+private:
+ ListHashSet<unsigned> m_ids[PointerTypeLastEntry];
+ bool m_hasPrimaryId[PointerTypeLastEntry];
+};
+
+} // namespace blink
+
+#endif // PointerEventUtils_h

Powered by Google App Engine
This is Rietveld 408576698