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