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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 IncomingId() {} | 82 IncomingId() {} |
83 IncomingId(WebPointerProperties::PointerType pointerType, | 83 IncomingId(WebPointerProperties::PointerType pointerType, |
84 int rawId) | 84 int rawId) |
85 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} | 85 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} |
86 int pointerType() const {return first;} | 86 int pointerType() const {return first;} |
87 int rawId() const {return second;} | 87 int rawId() const {return second;} |
88 } IncomingId; | 88 } IncomingId; |
89 typedef struct PointerAttributes { | 89 typedef struct PointerAttributes { |
90 IncomingId incomingId; | 90 IncomingId incomingId; |
91 bool isActiveButtons; | 91 bool isActiveButtons; |
92 PointerAttributes() {} | 92 PointerAttributes() |
| 93 : incomingId() |
| 94 , isActiveButtons(false) {} |
93 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) | 95 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) |
94 : incomingId(incomingId) | 96 : incomingId(incomingId) |
95 , isActiveButtons(isActiveButtons) {} | 97 , isActiveButtons(isActiveButtons) {} |
96 } PointerAttributes; | 98 } PointerAttributes; |
97 | 99 |
98 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons); | 100 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons); |
99 bool isPrimary(const int) const; | 101 bool isPrimary(const int) const; |
100 void setIdTypeButtons(PointerEventInit&, const WebPointerProperties&, | 102 void setIdTypeButtons(PointerEventInit&, const WebPointerProperties&, |
101 unsigned buttons); | 103 unsigned buttons); |
102 void setBubblesAndCancelable(PointerEventInit&, const AtomicString& type); | 104 void setBubblesAndCancelable(PointerEventInit&, const AtomicString& type); |
103 | 105 |
104 // Creates pointerevents like boundary and capture events from another | 106 // Creates pointerevents like boundary and capture events from another |
105 // pointerevent (i.e. up/down/move events). | 107 // pointerevent (i.e. up/down/move events). |
106 PointerEvent* createPointerEventFrom( | 108 PointerEvent* createPointerEventFrom( |
107 PointerEvent*, const AtomicString&, EventTarget*); | 109 PointerEvent*, const AtomicString&, EventTarget*); |
108 | 110 |
109 static const int s_invalidId; | 111 static const int s_invalidId; |
110 | 112 |
111 int m_currentId; | 113 int m_currentId; |
112 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; | 114 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; |
113 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; | 115 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; |
114 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; | 116 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; |
115 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; | 117 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; |
116 }; | 118 }; |
117 | 119 |
118 } // namespace blink | 120 } // namespace blink |
119 | 121 |
120 #endif // PointerEventFactory_h | 122 #endif // PointerEventFactory_h |
OLD | NEW |