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

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

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. 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.cpp
diff --git a/Source/core/events/PointerEventUtils.cpp b/Source/core/events/PointerEventUtils.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..11be154a6eb501754f1f01c5b868f948dbab7f67
--- /dev/null
+++ b/Source/core/events/PointerEventUtils.cpp
@@ -0,0 +1,45 @@
+// 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.
+
+#include "config.h"
+#include "core/events/PointerEventUtils.h"
+
+namespace blink {
+
+PointerIdManager::PointerIdManager()
+{
+ clear();
+}
+
+PointerIdManager::~PointerIdManager()
+{
+ clear();
+}
+
+void PointerIdManager::clear()
+{
+ m_ids.clear();
+ m_hasPrimaryId = false;
+}
+
+void PointerIdManager::add(unsigned id)
+{
+ if (m_ids.isEmpty())
+ m_hasPrimaryId = true;
+ m_ids.add(id);
+}
+
+void PointerIdManager::remove(unsigned id)
+{
+ if (isPrimary(id))
+ m_hasPrimaryId = false;
+ m_ids.remove(id);
+}
+
+bool PointerIdManager::isPrimary(unsigned id)
+{
+ return m_hasPrimaryId && m_ids.first() == id;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698