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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 // Returns whether a pointer id exists and active. | 66 // Returns whether a pointer id exists and active. |
67 bool isActive(const int) const; | 67 bool isActive(const int) const; |
68 | 68 |
69 // Returns whether a pointer id exists and has at least one pressed button. | 69 // Returns whether a pointer id exists and has at least one pressed button. |
70 bool isActiveButtonsState(const int) const; | 70 bool isActiveButtonsState(const int) const; |
71 | 71 |
72 // Returns the id of the pointer event corresponding to the given pointer | 72 // Returns the id of the pointer event corresponding to the given pointer |
73 // properties if exists otherwise s_invalidId. | 73 // properties if exists otherwise s_invalidId. |
74 int getPointerEventId(const WebPointerProperties&) const; | 74 int getPointerEventId(const WebPointerProperties&) const; |
75 | 75 |
76 WebPointerProperties::PointerType getPointerType(int pointerId) const; | |
mustaq
2016/10/17 20:18:56
Document that it returns Unknown for an inactive i
Navid Zolghadr
2016/10/18 14:18:11
Done.
| |
77 | |
76 static const int s_mouseId; | 78 static const int s_mouseId; |
77 | 79 |
78 private: | 80 private: |
79 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; | 81 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; |
80 typedef struct IncomingId : public std::pair<int, int> { | 82 typedef struct IncomingId : public std::pair<int, int> { |
81 IncomingId() {} | 83 IncomingId() {} |
82 IncomingId(WebPointerProperties::PointerType pointerType, int rawId) | 84 IncomingId(WebPointerProperties::PointerType pointerType, int rawId) |
83 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} | 85 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} |
84 int pointerType() const { return first; } | 86 int pointerTypeInt() const { return first; } |
87 WebPointerProperties::PointerType pointerType() const { | |
88 return static_cast<WebPointerProperties::PointerType>(first); | |
89 } | |
85 int rawId() const { return second; } | 90 int rawId() const { return second; } |
86 } IncomingId; | 91 } IncomingId; |
87 typedef struct PointerAttributes { | 92 typedef struct PointerAttributes { |
88 IncomingId incomingId; | 93 IncomingId incomingId; |
89 bool isActiveButtons; | 94 bool isActiveButtons; |
90 PointerAttributes() : incomingId(), isActiveButtons(false) {} | 95 PointerAttributes() : incomingId(), isActiveButtons(false) {} |
91 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) | 96 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) |
92 : incomingId(incomingId), isActiveButtons(isActiveButtons) {} | 97 : incomingId(incomingId), isActiveButtons(isActiveButtons) {} |
93 } PointerAttributes; | 98 } PointerAttributes; |
94 | 99 |
(...skipping 23 matching lines...) Expand all Loading... | |
118 int m_primaryId[static_cast<int>( | 123 int m_primaryId[static_cast<int>( |
119 WebPointerProperties::PointerType::LastEntry) + | 124 WebPointerProperties::PointerType::LastEntry) + |
120 1]; | 125 1]; |
121 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + | 126 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + |
122 1]; | 127 1]; |
123 }; | 128 }; |
124 | 129 |
125 } // namespace blink | 130 } // namespace blink |
126 | 131 |
127 #endif // PointerEventFactory_h | 132 #endif // PointerEventFactory_h |
OLD | NEW |