OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/events/PointerEventFactory.h" | 5 #include "core/events/PointerEventFactory.h" |
6 | 6 |
7 namespace blink { | 7 namespace blink { |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 IncomingId p = m_pointerIdMapping.get(mappedId).incomingId; | 302 IncomingId p = m_pointerIdMapping.get(mappedId).incomingId; |
303 int type = p.pointerType(); | 303 int type = p.pointerType(); |
304 m_pointerIdMapping.remove(mappedId); | 304 m_pointerIdMapping.remove(mappedId); |
305 m_pointerIncomingIdMapping.remove(p); | 305 m_pointerIncomingIdMapping.remove(p); |
306 if (m_primaryId[type] == mappedId) | 306 if (m_primaryId[type] == mappedId) |
307 m_primaryId[type] = PointerEventFactory::s_invalidId; | 307 m_primaryId[type] = PointerEventFactory::s_invalidId; |
308 m_idCount[type]--; | 308 m_idCount[type]--; |
309 return true; | 309 return true; |
310 } | 310 } |
311 | 311 |
312 HeapVector<int> PointerEventFactory::getPointerIdsOfType(WebPointerProperties::P
ointerType pointerType) | 312 Vector<int> PointerEventFactory::getPointerIdsOfType(WebPointerProperties::Point
erType pointerType) |
313 { | 313 { |
314 HeapVector<int> mappedIds; | 314 Vector<int> mappedIds; |
315 | 315 |
316 for (auto iter = m_pointerIdMapping.begin(); iter != m_pointerIdMapping.end(
); ++iter) { | 316 for (auto iter = m_pointerIdMapping.begin(); iter != m_pointerIdMapping.end(
); ++iter) { |
317 int mappedId = iter->key; | 317 int mappedId = iter->key; |
318 if (iter->value.incomingId.pointerType() == static_cast<int>(pointerType
)) | 318 if (iter->value.incomingId.pointerType() == static_cast<int>(pointerType
)) |
319 mappedIds.append(mappedId); | 319 mappedIds.append(mappedId); |
320 } | 320 } |
321 | 321 |
322 // Sorting for a predictable ordering. | 322 // Sorting for a predictable ordering. |
323 std::sort(mappedIds.begin(), mappedIds.end()); | 323 std::sort(mappedIds.begin(), mappedIds.end()); |
324 return mappedIds; | 324 return mappedIds; |
(...skipping 23 matching lines...) Expand all Loading... |
348 return m_pointerIdMapping.contains(pointerId); | 348 return m_pointerIdMapping.contains(pointerId); |
349 } | 349 } |
350 | 350 |
351 bool PointerEventFactory::isActiveButtonsState(const int pointerId) | 351 bool PointerEventFactory::isActiveButtonsState(const int pointerId) |
352 { | 352 { |
353 return m_pointerIdMapping.contains(pointerId) | 353 return m_pointerIdMapping.contains(pointerId) |
354 && m_pointerIdMapping.get(pointerId).isActiveButtons; | 354 && m_pointerIdMapping.get(pointerId).isActiveButtons; |
355 } | 355 } |
356 | 356 |
357 } // namespace blink | 357 } // namespace blink |
OLD | NEW |