| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const PlatformTouchPoint&); | 43 const PlatformTouchPoint&); |
| 44 | 44 |
| 45 PassRefPtrWillBeRawPtr<PointerEvent> create( | 45 PassRefPtrWillBeRawPtr<PointerEvent> create( |
| 46 PassRefPtrWillBeRawPtr<PointerEvent>, | 46 PassRefPtrWillBeRawPtr<PointerEvent>, |
| 47 const AtomicString& type, | 47 const AtomicString& type, |
| 48 PassRefPtrWillBeRawPtr<EventTarget>); | 48 PassRefPtrWillBeRawPtr<EventTarget>); |
| 49 | 49 |
| 50 // Clear all the existing ids. | 50 // Clear all the existing ids. |
| 51 void clear(); | 51 void clear(); |
| 52 | 52 |
| 53 // When a pointerEvent with a particular id is removed that id is considered | 53 // Returns true if pointerEvent is removed. When a pointerEvent with a |
| 54 // free even though there might have been other PointerEvents that were | 54 // particular id is removed that id is considered free even though there |
| 55 // generated with the same id before. | 55 // might have been other PointerEvents that were generated with the same id |
| 56 void remove(const PassRefPtrWillBeRawPtr<PointerEvent>); | 56 // before. |
| 57 bool remove(const PassRefPtrWillBeRawPtr<PointerEvent>); |
| 57 | 58 |
| 58 // Returns whether a pointer id exists and active | 59 // Returns whether a pointer id exists and active |
| 59 bool isActive(const int); | 60 bool isActive(const int); |
| 60 | 61 |
| 61 // Returns whether a pointer id exists and has at least one pressed button | 62 // Returns whether a pointer id exists and has at least one pressed button |
| 62 bool isActiveButtonsState(const int); | 63 bool isActiveButtonsState(const int); |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; | 66 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; |
| 66 typedef struct IncomingId : public std::pair<int, int> { | 67 typedef struct IncomingId : public std::pair<int, int> { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 77 PointerAttributes() {} | 78 PointerAttributes() {} |
| 78 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) | 79 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) |
| 79 : incomingId(incomingId) | 80 : incomingId(incomingId) |
| 80 , isActiveButtons(isActiveButtons) {} | 81 , isActiveButtons(isActiveButtons) {} |
| 81 } PointerAttributes; | 82 } PointerAttributes; |
| 82 | 83 |
| 83 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons); | 84 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons); |
| 84 bool isPrimary(const int) const; | 85 bool isPrimary(const int) const; |
| 85 void setIdTypeButtons(PointerEventInit &, const WebPointerProperties &, | 86 void setIdTypeButtons(PointerEventInit &, const WebPointerProperties &, |
| 86 unsigned buttons); | 87 unsigned buttons); |
| 88 |
| 87 static const int s_invalidId; | 89 static const int s_invalidId; |
| 88 static const int s_mouseId; | 90 static const int s_mouseId; |
| 89 | 91 |
| 90 int m_currentId; | 92 int m_currentId; |
| 91 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; | 93 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; |
| 92 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; | 94 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; |
| 93 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; | 95 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; |
| 94 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; | 96 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 } // namespace blink | 99 } // namespace blink |
| 98 | 100 |
| 99 #endif // PointerEventFactory_h | 101 #endif // PointerEventFactory_h |
| OLD | NEW |