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

Side by Side Diff: Source/core/events/PointerIdManager.cpp

Issue 1144313003: Added PointerEvent firing on touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased. TODO fixes. 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 unified diff | Download patch
« no previous file with comments | « Source/core/events/PointerIdManager.h ('k') | Source/core/events/ThreadLocalEventNames.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/events/PointerIdManager.h"
7
8 namespace blink {
9
10 PointerIdManager::PointerIdManager()
11 {
12 clear();
13 }
14
15 PointerIdManager::~PointerIdManager()
16 {
17 clear();
18 }
19
20 void PointerIdManager::clear()
21 {
22 for (int type = 0; type < static_cast<int>(PointerTypeLastEntry); type++) {
23 m_ids[type].clear();
24 m_hasPrimaryId[type] = false;
25 }
26 }
27
28 void PointerIdManager::add(PointerType type, unsigned id)
29 {
30 if (m_ids[type].isEmpty())
31 m_hasPrimaryId[type] = true;
32 m_ids[type].add(id);
33 }
34
35 void PointerIdManager::remove(PointerType type, unsigned id)
36 {
37 if (isPrimary(type, id)) {
38 m_ids[type].removeFirst();
39 m_hasPrimaryId[type] = false;
40 } else {
41 // Note that simply counting the number of ids instead of storing all of them is not enough.
42 // When id is absent, remove() should be a no-op.
43 m_ids[type].remove(id);
44 }
45 }
46
47 bool PointerIdManager::isPrimary(PointerType type, unsigned id)
48 {
49 return m_hasPrimaryId[type] && m_ids[type].first() == id;
50 }
51
52 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/PointerIdManager.h ('k') | Source/core/events/ThreadLocalEventNames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698