| 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 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "platform/geometry/FloatSize.h" | 8 #include "platform/geometry/FloatSize.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 return mappedId; | 458 return mappedId; |
| 459 } | 459 } |
| 460 | 460 |
| 461 bool PointerEventFactory::remove(const int mappedId) { | 461 bool PointerEventFactory::remove(const int mappedId) { |
| 462 // Do not remove mouse pointer id as it should always be there | 462 // Do not remove mouse pointer id as it should always be there |
| 463 if (mappedId == s_mouseId || !m_pointerIdMapping.contains(mappedId)) | 463 if (mappedId == s_mouseId || !m_pointerIdMapping.contains(mappedId)) |
| 464 return false; | 464 return false; |
| 465 | 465 |
| 466 IncomingId p = m_pointerIdMapping.get(mappedId).incomingId; | 466 IncomingId p = m_pointerIdMapping.get(mappedId).incomingId; |
| 467 int typeInt = p.pointerTypeInt(); | 467 int typeInt = p.pointerTypeInt(); |
| 468 m_pointerIdMapping.remove(mappedId); | 468 m_pointerIdMapping.erase(mappedId); |
| 469 m_pointerIncomingIdMapping.remove(p); | 469 m_pointerIncomingIdMapping.erase(p); |
| 470 if (m_primaryId[typeInt] == mappedId) | 470 if (m_primaryId[typeInt] == mappedId) |
| 471 m_primaryId[typeInt] = PointerEventFactory::s_invalidId; | 471 m_primaryId[typeInt] = PointerEventFactory::s_invalidId; |
| 472 m_idCount[typeInt]--; | 472 m_idCount[typeInt]--; |
| 473 return true; | 473 return true; |
| 474 } | 474 } |
| 475 | 475 |
| 476 Vector<int> PointerEventFactory::getPointerIdsOfType( | 476 Vector<int> PointerEventFactory::getPointerIdsOfType( |
| 477 WebPointerProperties::PointerType pointerType) const { | 477 WebPointerProperties::PointerType pointerType) const { |
| 478 Vector<int> mappedIds; | 478 Vector<int> mappedIds; |
| 479 | 479 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 const WebPointerProperties& properties) const { | 517 const WebPointerProperties& properties) const { |
| 518 if (properties.pointerType == WebPointerProperties::PointerType::Mouse) | 518 if (properties.pointerType == WebPointerProperties::PointerType::Mouse) |
| 519 return PointerEventFactory::s_mouseId; | 519 return PointerEventFactory::s_mouseId; |
| 520 IncomingId id(properties.pointerType, properties.id); | 520 IncomingId id(properties.pointerType, properties.id); |
| 521 if (m_pointerIncomingIdMapping.contains(id)) | 521 if (m_pointerIncomingIdMapping.contains(id)) |
| 522 return m_pointerIncomingIdMapping.get(id); | 522 return m_pointerIncomingIdMapping.get(id); |
| 523 return PointerEventFactory::s_invalidId; | 523 return PointerEventFactory::s_invalidId; |
| 524 } | 524 } |
| 525 | 525 |
| 526 } // namespace blink | 526 } // namespace blink |
| OLD | NEW |