| 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 // Returns pointerType of for the given pointerId if such id is active. |
| 77 // Otherwise it returns WebPointerProperties::PointerType::Unknown. |
| 78 WebPointerProperties::PointerType getPointerType(int pointerId) const; |
| 79 |
| 76 static const int s_mouseId; | 80 static const int s_mouseId; |
| 77 | 81 |
| 78 private: | 82 private: |
| 79 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; | 83 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; |
| 80 typedef struct IncomingId : public std::pair<int, int> { | 84 typedef struct IncomingId : public std::pair<int, int> { |
| 81 IncomingId() {} | 85 IncomingId() {} |
| 82 IncomingId(WebPointerProperties::PointerType pointerType, int rawId) | 86 IncomingId(WebPointerProperties::PointerType pointerType, int rawId) |
| 83 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} | 87 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} |
| 84 int pointerType() const { return first; } | 88 int pointerTypeInt() const { return first; } |
| 89 WebPointerProperties::PointerType pointerType() const { |
| 90 return static_cast<WebPointerProperties::PointerType>(first); |
| 91 } |
| 85 int rawId() const { return second; } | 92 int rawId() const { return second; } |
| 86 } IncomingId; | 93 } IncomingId; |
| 87 typedef struct PointerAttributes { | 94 typedef struct PointerAttributes { |
| 88 IncomingId incomingId; | 95 IncomingId incomingId; |
| 89 bool isActiveButtons; | 96 bool isActiveButtons; |
| 90 PointerAttributes() : incomingId(), isActiveButtons(false) {} | 97 PointerAttributes() : incomingId(), isActiveButtons(false) {} |
| 91 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) | 98 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) |
| 92 : incomingId(incomingId), isActiveButtons(isActiveButtons) {} | 99 : incomingId(incomingId), isActiveButtons(isActiveButtons) {} |
| 93 } PointerAttributes; | 100 } PointerAttributes; |
| 94 | 101 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 118 int m_primaryId[static_cast<int>( | 125 int m_primaryId[static_cast<int>( |
| 119 WebPointerProperties::PointerType::LastEntry) + | 126 WebPointerProperties::PointerType::LastEntry) + |
| 120 1]; | 127 1]; |
| 121 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + | 128 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + |
| 122 1]; | 129 1]; |
| 123 }; | 130 }; |
| 124 | 131 |
| 125 } // namespace blink | 132 } // namespace blink |
| 126 | 133 |
| 127 #endif // PointerEventFactory_h | 134 #endif // PointerEventFactory_h |
| OLD | NEW |