Chromium Code Reviews| Index: third_party/WebKit/Source/core/events/PointerEventFactory.h |
| diff --git a/third_party/WebKit/Source/core/events/PointerEventManager.h b/third_party/WebKit/Source/core/events/PointerEventFactory.h |
| similarity index 62% |
| rename from third_party/WebKit/Source/core/events/PointerEventManager.h |
| rename to third_party/WebKit/Source/core/events/PointerEventFactory.h |
| index ea851f1b29d581ad7efb15ad4820d0df00c51af3..ea69f0ef00e5bf261980b80d04cc97878c1eac13 100644 |
| --- a/third_party/WebKit/Source/core/events/PointerEventManager.h |
| +++ b/third_party/WebKit/Source/core/events/PointerEventFactory.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef PointerEventManager_h |
| -#define PointerEventManager_h |
| +#ifndef PointerEventFactory_h |
| +#define PointerEventFactory_h |
| #include "core/CoreExport.h" |
| #include "core/events/PointerEvent.h" |
| @@ -23,10 +23,13 @@ namespace blink { |
| pointer event ids generated by mouse always equal 1 and those that are generated |
| by touch and pen will have increasing ids from 2. |
| */ |
| -class CORE_EXPORT PointerEventManager { |
| +class CORE_EXPORT PointerEventFactory { |
| DISALLOW_NEW(); |
| public: |
| + PointerEventFactory(); |
| + ~PointerEventFactory(); |
| + |
| PassRefPtrWillBeRawPtr<PointerEvent> create(const AtomicString& type, |
| const PlatformMouseEvent&, PassRefPtrWillBeRawPtr<Node> relatedTarget, |
| PassRefPtrWillBeRawPtr<AbstractView>); |
| @@ -36,13 +39,17 @@ public: |
| const double width, const double height, |
| const double clientX, const double clientY); |
| - PassRefPtrWillBeRawPtr<PointerEvent> createPointerCancel(const PlatformTouchPoint&); |
| + PassRefPtrWillBeRawPtr<PointerEvent> createPointerCancel( |
| + const PlatformTouchPoint&); |
| - PointerEventManager(); |
| - ~PointerEventManager(); |
| + PassRefPtrWillBeRawPtr<PointerEvent> create( |
| + PassRefPtrWillBeRawPtr<PointerEvent>, |
| + const AtomicString& type, |
| + PassRefPtrWillBeRawPtr<EventTarget>); |
| // Clear all the existing ids. |
| void clear(); |
| + |
| /* |
| * When a pointerEvent with a particular id is removed that id is considered |
| * free even though there might have been other PointerEvents that were |
| @@ -50,27 +57,24 @@ public: |
| */ |
| void remove(const PassRefPtrWillBeRawPtr<PointerEvent>); |
| - // Returns the node capturing this pointer id, and null if no node is capturing it. |
| - EventTarget* getCapturingNode(PassRefPtrWillBeRawPtr<PointerEvent>); |
| - |
| private: |
| - typedef long MappedId; |
| typedef std::pair<int, int> IncomingId; |
| + typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; |
| - MappedId add(const IncomingId); |
| - bool isPrimary(const MappedId) const; |
| + int add(const IncomingId); |
| + bool isPrimary(const int) const; |
| void setIdAndType(PointerEventInit &, const WebPointerProperties &); |
| - static const MappedId s_invalidId; |
| - static const MappedId s_mouseId; |
| + static const int s_invalidId; |
| + static const int s_mouseId; |
| - PointerEventManager::MappedId m_currentId; |
| - HashMap<IncomingId, MappedId, WTF::PairHash<int, int>, WTF::PairHashTraits<WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::UnsignedWithZeroKeyHashTraits<int>>> m_idMapping; |
| - HashMap<MappedId, IncomingId, WTF::IntHash<MappedId>, WTF::UnsignedWithZeroKeyHashTraits<MappedId>> m_idReverseMapping; |
| - MappedId m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1]; |
| - MappedId m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1]; |
| + int m_currentId; |
| + HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<PointerEventFactory::UnsignedHash, PointerEventFactory::UnsignedHash>> m_idMapping; |
|
mustaq
2016/02/11 16:15:16
Do you think "PointerEventFactory::" is redundant
Navid Zolghadr
2016/02/11 16:34:51
It definitely works without. I intentionally added
mustaq
2016/02/11 16:51:12
Yes please (I might have thought otherwise for non
Navid Zolghadr
2016/02/11 17:47:49
Done.
|
| + HashMap<int, IncomingId, WTF::IntHash<int>, PointerEventFactory::UnsignedHash> m_idReverseMapping; |
| + int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1]; |
| + int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1]; |
| }; |
| } // namespace blink |
| -#endif // PointerEventManager_h |
| +#endif // PointerEventFactory_h |