| 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 11 matching lines...) Expand all Loading... |
| 22 // similar to MS Edge to have pointer event ids generated by mouse always equal | 22 // similar to MS Edge to have pointer event ids generated by mouse always equal |
| 23 // 1 and those that are generated by touch and pen will have increasing ids from | 23 // 1 and those that are generated by touch and pen will have increasing ids from |
| 24 // 2. | 24 // 2. |
| 25 class CORE_EXPORT PointerEventFactory { | 25 class CORE_EXPORT PointerEventFactory { |
| 26 DISALLOW_NEW(); | 26 DISALLOW_NEW(); |
| 27 public: | 27 public: |
| 28 | 28 |
| 29 PointerEventFactory(); | 29 PointerEventFactory(); |
| 30 ~PointerEventFactory(); | 30 ~PointerEventFactory(); |
| 31 | 31 |
| 32 PassRefPtrWillBeRawPtr<PointerEvent> create( | 32 RawPtr<PointerEvent> create( |
| 33 const AtomicString& mouseEventName, const PlatformMouseEvent&, | 33 const AtomicString& mouseEventName, const PlatformMouseEvent&, |
| 34 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, | 34 RawPtr<EventTarget> relatedTarget, |
| 35 PassRefPtrWillBeRawPtr<AbstractView>); | 35 RawPtr<AbstractView>); |
| 36 | 36 |
| 37 PassRefPtrWillBeRawPtr<PointerEvent> create(const AtomicString& type, | 37 RawPtr<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 PassRefPtrWillBeRawPtr<PointerEvent> createPointerCancelEvent( | 42 RawPtr<PointerEvent> createPointerCancelEvent( |
| 43 const PlatformTouchPoint&); | 43 const PlatformTouchPoint&); |
| 44 | 44 |
| 45 // For creating capture events (i.e got/lostpointercapture) | 45 // For creating capture events (i.e got/lostpointercapture) |
| 46 PassRefPtrWillBeRawPtr<PointerEvent> createPointerCaptureEvent( | 46 RawPtr<PointerEvent> createPointerCaptureEvent( |
| 47 PassRefPtrWillBeRawPtr<PointerEvent>, | 47 RawPtr<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 PassRefPtrWillBeRawPtr<PointerEvent> createPointerTransitionEvent( | 51 RawPtr<PointerEvent> createPointerTransitionEvent( |
| 52 PassRefPtrWillBeRawPtr<PointerEvent>, | 52 RawPtr<PointerEvent>, |
| 53 const AtomicString&, | 53 const AtomicString&, |
| 54 PassRefPtrWillBeRawPtr<EventTarget>); | 54 RawPtr<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 // Returns true if pointerEvent is removed. When a pointerEvent with a |
| 60 // particular id is removed that id is considered free even though there | 60 // particular id is removed that id is considered free even though there |
| 61 // might have been other PointerEvents that were generated with the same id | 61 // might have been other PointerEvents that were generated with the same id |
| 62 // before. | 62 // before. |
| 63 bool remove(const PassRefPtrWillBeRawPtr<PointerEvent>); | 63 bool remove(const RawPtr<PointerEvent>); |
| 64 | 64 |
| 65 // Returns whether a pointer id exists and active | 65 // Returns whether a pointer id exists and active |
| 66 bool isActive(const int); | 66 bool isActive(const int); |
| 67 | 67 |
| 68 // Returns whether a pointer id exists and has at least one pressed button | 68 // Returns whether a pointer id exists and has at least one pressed button |
| 69 bool isActiveButtonsState(const int); | 69 bool isActiveButtonsState(const int); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; | 72 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; |
| 73 typedef struct IncomingId : public std::pair<int, int> { | 73 typedef struct IncomingId : public std::pair<int, int> { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 98 int m_currentId; | 98 int m_currentId; |
| 99 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; | 99 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign
edHash, UnsignedHash>> m_pointerIncomingIdMapping; |
| 100 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; | 100 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId
Mapping; |
| 101 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; | 101 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr
y) + 1]; |
| 102 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; | 102 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry)
+ 1]; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace blink | 105 } // namespace blink |
| 106 | 106 |
| 107 #endif // PointerEventFactory_h | 107 #endif // PointerEventFactory_h |
| OLD | NEW |