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 #ifndef PointerEventFactory_h | 5 #ifndef PointerEventFactory_h |
6 #define PointerEventFactory_h | 6 #define PointerEventFactory_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/events/PointerEvent.h" | 9 #include "core/events/PointerEvent.h" |
10 #include "public/platform/WebPointerProperties.h" | 10 #include "public/platform/WebPointerProperties.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 // Returns true if pointerEvent is removed. When a pointerEvent with a | 59 // Returns true if pointerEvent is removed. When a pointerEvent with a |
60 // particular id is removed that id is considered free even though there | 60 // particular id is removed that id is considered free even though there |
61 // might have been other PointerEvents that were generated with the same id | 61 // might have been other PointerEvents that were generated with the same id |
62 // before. | 62 // before. |
63 bool remove(const PassRefPtrWillBeRawPtr<PointerEvent>); | 63 bool remove(const PassRefPtrWillBeRawPtr<PointerEvent>); |
64 | 64 |
65 // Returns whether a pointer id exists and active | 65 // Returns whether a pointer id exists and active |
66 bool isActive(const int); | 66 bool isActive(const int); |
67 | 67 |
| 68 // Returns type of pointer id if exists, otherwise Unknown |
| 69 WebPointerProperties::PointerType getPointerType(const int); |
| 70 |
68 // Returns whether a pointer id exists and has at least one pressed button | 71 // Returns whether a pointer id exists and has at least one pressed button |
69 bool isActiveButtonsState(const int); | 72 bool isActiveButtonsState(const int); |
70 | 73 |
71 private: | 74 private: |
72 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; | 75 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; |
73 typedef struct IncomingId : public std::pair<int, int> { | 76 typedef struct IncomingId : public std::pair<int, int> { |
74 IncomingId() {} | 77 IncomingId() {} |
75 IncomingId(WebPointerProperties::PointerType pointerType, | 78 IncomingId(WebPointerProperties::PointerType pointerType, |
76 int rawId) | 79 int rawId) |
77 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} | 80 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} |
(...skipping 20 matching lines...) Expand all Loading... |
98 int m_currentId; | 101 int m_currentId; |
99 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; | 102 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; |
100 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; | 103 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; |
101 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; | 104 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; |
102 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; | 105 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; |
103 }; | 106 }; |
104 | 107 |
105 } // namespace blink | 108 } // namespace blink |
106 | 109 |
107 #endif // PointerEventFactory_h | 110 #endif // PointerEventFactory_h |
OLD | NEW |