| 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 22 matching lines...) Expand all Loading... |
| 33 const AtomicString& mouseEventName, const PlatformMouseEvent&, | 33 const AtomicString& mouseEventName, const PlatformMouseEvent&, |
| 34 EventTarget* relatedTarget, | 34 EventTarget* relatedTarget, |
| 35 AbstractView*); | 35 AbstractView*); |
| 36 | 36 |
| 37 PointerEvent* create(const AtomicString& type, | 37 PointerEvent* create(const AtomicString& type, |
| 38 const PlatformTouchPoint&, PlatformEvent::Modifiers, | 38 const PlatformTouchPoint&, PlatformEvent::Modifiers, |
| 39 const double width, const double height, | 39 const double width, const double height, |
| 40 const double clientX, const double clientY); | 40 const double clientX, const double clientY); |
| 41 | 41 |
| 42 PointerEvent* createPointerCancelEvent( | 42 PointerEvent* createPointerCancelEvent( |
| 43 const PlatformTouchPoint&); | 43 const int pointerId, const WebPointerProperties::PointerType); |
| 44 | 44 |
| 45 // For creating capture events (i.e got/lostpointercapture) | 45 // For creating capture events (i.e got/lostpointercapture) |
| 46 PointerEvent* createPointerCaptureEvent( | 46 PointerEvent* createPointerCaptureEvent( |
| 47 PointerEvent*, | 47 PointerEvent*, |
| 48 const AtomicString&); | 48 const AtomicString&); |
| 49 | 49 |
| 50 // For creating transition events (i.e pointerout/leave/over/enter) | 50 // For creating transition events (i.e pointerout/leave/over/enter) |
| 51 PointerEvent* createPointerTransitionEvent( | 51 PointerEvent* createPointerTransitionEvent( |
| 52 PointerEvent*, | 52 PointerEvent*, |
| 53 const AtomicString&, | 53 const AtomicString&, |
| 54 EventTarget*); | 54 EventTarget*); |
| 55 | 55 |
| 56 // Clear all the existing ids. | 56 // Clear all the existing ids. |
| 57 void clear(); | 57 void clear(); |
| 58 | 58 |
| 59 // Returns true if pointerEvent is removed. When a pointerEvent with a | 59 // When a particular pointerId is removed, the id is considered free even |
| 60 // particular id is removed that id is considered free even though there | 60 // though there might have been other PointerEvents that were generated with |
| 61 // might have been other PointerEvents that were generated with the same id | 61 // the same id before. |
| 62 // before. | 62 bool remove(const int); |
| 63 bool remove(const PointerEvent*); | 63 |
| 64 // Returns all ids of the given pointerType. |
| 65 HeapVector<int> getPointerIdsOfType(WebPointerProperties::PointerType); |
| 64 | 66 |
| 65 // Returns whether a pointer id exists and active | 67 // Returns whether a pointer id exists and active |
| 66 bool isActive(const int); | 68 bool isActive(const int); |
| 67 | 69 |
| 68 // Returns type of pointer id if exists, otherwise Unknown | 70 // Returns type of pointer id if exists, otherwise Unknown |
| 69 WebPointerProperties::PointerType getPointerType(const int); | 71 WebPointerProperties::PointerType getPointerType(const int); |
| 70 | 72 |
| 71 // Returns whether a pointer id exists and has at least one pressed button | 73 // Returns whether a pointer id exists and has at least one pressed button |
| 72 bool isActiveButtonsState(const int); | 74 bool isActiveButtonsState(const int); |
| 73 | 75 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 85 IncomingId incomingId; | 87 IncomingId incomingId; |
| 86 bool isActiveButtons; | 88 bool isActiveButtons; |
| 87 PointerAttributes() {} | 89 PointerAttributes() {} |
| 88 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) | 90 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) |
| 89 : incomingId(incomingId) | 91 : incomingId(incomingId) |
| 90 , isActiveButtons(isActiveButtons) {} | 92 , isActiveButtons(isActiveButtons) {} |
| 91 } PointerAttributes; | 93 } PointerAttributes; |
| 92 | 94 |
| 93 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons); | 95 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons); |
| 94 bool isPrimary(const int) const; | 96 bool isPrimary(const int) const; |
| 95 void setIdTypeButtons(PointerEventInit &, const WebPointerProperties &, | 97 void setIdTypeButtons(PointerEventInit&, const WebPointerProperties&, |
| 96 unsigned buttons); | 98 unsigned buttons); |
| 99 void setBubblesAndCancelable(PointerEventInit&, const AtomicString& type); |
| 97 | 100 |
| 98 static const int s_invalidId; | 101 static const int s_invalidId; |
| 99 static const int s_mouseId; | 102 static const int s_mouseId; |
| 100 | 103 |
| 101 int m_currentId; | 104 int m_currentId; |
| 102 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; | 105 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; |
| 103 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; | 106 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; |
| 104 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; | 107 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; |
| 105 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; | 108 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 } // namespace blink | 111 } // namespace blink |
| 109 | 112 |
| 110 #endif // PointerEventFactory_h | 113 #endif // PointerEventFactory_h |
| OLD | NEW |