Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 PointerEventFactory(); | 29 PointerEventFactory(); |
| 30 ~PointerEventFactory(); | 30 ~PointerEventFactory(); |
| 31 | 31 |
| 32 PointerEvent* create( | 32 PointerEvent* create( |
| 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 FloatSize& pointRadius, |
| 40 const double clientX, const double clientY); | 40 const FloatPoint& pagePoint); |
|
mustaq
2016/04/20 15:40:01
The name "pagePoint" seems logical to me, but plea
Navid Zolghadr
2016/04/25 15:48:32
It was the name of the variable we were passing. B
| |
| 41 | 41 |
| 42 PointerEvent* createPointerCancelEvent( | 42 PointerEvent* createPointerCancelEvent( |
| 43 const int pointerId, const WebPointerProperties::PointerType); | 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) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 66 | 66 |
| 67 // Returns whether a pointer id exists and active | 67 // Returns whether a pointer id exists and active |
| 68 bool isActive(const int); | 68 bool isActive(const int); |
| 69 | 69 |
| 70 // Returns type of pointer id if exists, otherwise Unknown | 70 // Returns type of pointer id if exists, otherwise Unknown |
| 71 WebPointerProperties::PointerType getPointerType(const int); | 71 WebPointerProperties::PointerType getPointerType(const int); |
| 72 | 72 |
| 73 // 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 |
| 74 bool isActiveButtonsState(const int); | 74 bool isActiveButtonsState(const int); |
| 75 | 75 |
| 76 // Returns the id of the pointer event corresponding to the given pointer | |
| 77 // properties if exists otherwise s_invalidId | |
| 78 int getPointerEventId(const WebPointerProperties&); | |
| 79 | |
| 76 private: | 80 private: |
| 77 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; | 81 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; |
| 78 typedef struct IncomingId : public std::pair<int, int> { | 82 typedef struct IncomingId : public std::pair<int, int> { |
| 79 IncomingId() {} | 83 IncomingId() {} |
| 80 IncomingId(WebPointerProperties::PointerType pointerType, | 84 IncomingId(WebPointerProperties::PointerType pointerType, |
| 81 int rawId) | 85 int rawId) |
| 82 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} | 86 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} |
| 83 int pointerType() const {return first;} | 87 int pointerType() const {return first;} |
| 84 int rawId() const {return second;} | 88 int rawId() const {return second;} |
| 85 } IncomingId; | 89 } IncomingId; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 104 int m_currentId; | 108 int m_currentId; |
| 105 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign edHash, UnsignedHash>> m_pointerIncomingIdMapping; | 109 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign edHash, UnsignedHash>> m_pointerIncomingIdMapping; |
| 106 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId Mapping; | 110 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId Mapping; |
| 107 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr y) + 1]; | 111 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr y) + 1]; |
| 108 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1]; | 112 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1]; |
| 109 }; | 113 }; |
| 110 | 114 |
| 111 } // namespace blink | 115 } // namespace blink |
| 112 | 116 |
| 113 #endif // PointerEventFactory_h | 117 #endif // PointerEventFactory_h |
| OLD | NEW |