Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: third_party/WebKit/Source/core/events/PointerEventManager.h

Issue 1635863006: Pointerevent capture APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 PointerEventManager_h 5 #ifndef PointerEventManager_h
6 #define PointerEventManager_h 6 #define PointerEventManager_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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 /* 46 /*
47 * When a pointerEvent with a particular id is removed that id is considered 47 * When a pointerEvent with a particular id is removed that id is considered
48 * free even though there might have been other PointerEvents that were 48 * free even though there might have been other PointerEvents that were
49 * generated with the same id before. 49 * generated with the same id before.
50 */ 50 */
51 void remove(const PassRefPtrWillBeRawPtr<PointerEvent>); 51 void remove(const PassRefPtrWillBeRawPtr<PointerEvent>);
52 52
53 // Returns the node capturing this pointer id, and null if no node is captur ing it. 53 // Returns the node capturing this pointer id, and null if no node is captur ing it.
54 EventTarget* getCapturingNode(PassRefPtrWillBeRawPtr<PointerEvent>); 54 EventTarget* getCapturingNode(PassRefPtrWillBeRawPtr<PointerEvent>);
55 55
56 void elementRemoved(EventTarget*);
57 void setPointerCapture(int, EventTarget*);
58 void releasePointerCapture(int, EventTarget*);
59 void implicitReleasePointerCapture(int);
60 bool isActive(const int);
61 EventTarget* getMouseCapturingNode();
62
56 private: 63 private:
57 typedef long MappedId;
58 typedef std::pair<int, int> IncomingId; 64 typedef std::pair<int, int> IncomingId;
65 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<EventTarget>> PointerCaptu ringMap;
59 66
60 MappedId add(const IncomingId); 67 int addAndUpdateButtons(const IncomingId, const int);
61 bool isPrimary(const MappedId) const; 68 int add(const IncomingId);
62 void setIdAndType(PointerEventInit &, const WebPointerProperties &); 69 bool isPrimary(const int) const;
70 void setIdAndType(PointerEventInit &, const WebPointerProperties &, int);
71 bool isActiveButtons(const int);
72 void processPendingPointerCapture(int);
73 void removeTargetFromPointerCapturingMapping(PointerCapturingMap&, EventTarg et*);
63 74
64 static const MappedId s_invalidId; 75 static const int s_invalidId;
65 static const MappedId s_mouseId; 76 static const int s_mouseId;
66 77
67 PointerEventManager::MappedId m_currentId; 78 int m_currentId;
68 HashMap<IncomingId, MappedId, WTF::PairHash<int, int>, WTF::PairHashTraits<W TF::UnsignedWithZeroKeyHashTraits<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> > m_idMapping; 79 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<WTF::U nsignedWithZeroKeyHashTraits<int>, WTF::UnsignedWithZeroKeyHashTraits<int>>> m_i dMapping;
mustaq 2016/02/06 04:36:31 Please combine the next two hashmaps into one, thi
Navid Zolghadr 2016/02/08 15:58:42 Did you mean m_idReverseMapping and m_lastButtons
69 HashMap<MappedId, IncomingId, WTF::IntHash<MappedId>, WTF::UnsignedWithZeroK eyHashTraits<MappedId>> m_idReverseMapping; 80 HashMap<int, IncomingId, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTrai ts<int>> m_idReverseMapping;
70 MappedId m_primaryId[static_cast<int>(WebPointerProperties::PointerType::Las tEntry) + 1]; 81 HashMap<int, int, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int> > m_lastButtons;
mustaq 2016/02/06 04:36:31 Can you make it <int, bool>? s/m_lastButtons/m_isA
Navid Zolghadr 2016/02/08 15:58:42 Although right now I only use it as bool. But I th
71 MappedId m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastE ntry) + 1]; 82 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr y) + 1];
83 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1];
84 PointerCapturingMap m_pointerCaptureTarget;
85 PointerCapturingMap m_pendingPointerCaptureTarget;
72 }; 86 };
73 87
74 } // namespace blink 88 } // namespace blink
75 89
76 #endif // PointerEventManager_h 90 #endif // PointerEventManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698