OLD | NEW |
(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/PointerEventUtils.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 m_ids.clear(); |
| 23 m_hasPrimaryId = false; |
| 24 } |
| 25 |
| 26 void PointerIdManager::add(unsigned id) |
| 27 { |
| 28 if (m_ids.isEmpty()) |
| 29 m_hasPrimaryId = true; |
| 30 m_ids.add(id); |
| 31 } |
| 32 |
| 33 void PointerIdManager::remove(unsigned id) |
| 34 { |
| 35 if (isPrimary(id)) |
| 36 m_hasPrimaryId = false; |
| 37 m_ids.remove(id); |
| 38 } |
| 39 |
| 40 bool PointerIdManager::isPrimary(unsigned id) |
| 41 { |
| 42 return m_hasPrimaryId && m_ids.first() == id; |
| 43 } |
| 44 |
| 45 } // namespace blink |
OLD | NEW |