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 |