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

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

Issue 2193473002: Revert "Send got/lostpointercapture immediately if possible" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 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 27 matching lines...) Expand all
38 const PlatformTouchPoint&, PlatformEvent::Modifiers, 38 const PlatformTouchPoint&, PlatformEvent::Modifiers,
39 const FloatSize& pointRadius, 39 const FloatSize& pointRadius,
40 const FloatPoint& clientPoint, 40 const FloatPoint& clientPoint,
41 DOMWindow*); 41 DOMWindow*);
42 42
43 PointerEvent* createPointerCancelEvent( 43 PointerEvent* createPointerCancelEvent(
44 const int pointerId, const WebPointerProperties::PointerType); 44 const int pointerId, const WebPointerProperties::PointerType);
45 45
46 // For creating capture events (i.e got/lostpointercapture) 46 // For creating capture events (i.e got/lostpointercapture)
47 PointerEvent* createPointerCaptureEvent( 47 PointerEvent* createPointerCaptureEvent(
48 const int pointerId, 48 PointerEvent*,
49 const AtomicString&); 49 const AtomicString&);
50 50
51 // For creating boundary events (i.e pointerout/leave/over/enter) 51 // For creating boundary events (i.e pointerout/leave/over/enter)
52 PointerEvent* createPointerBoundaryEvent( 52 PointerEvent* createPointerBoundaryEvent(
53 PointerEvent*, 53 PointerEvent*,
54 const AtomicString&, 54 const AtomicString&,
55 EventTarget*); 55 EventTarget*);
56 56
57 // Clear all the existing ids. 57 // Clear all the existing ids.
58 void clear(); 58 void clear();
(...skipping 16 matching lines...) Expand all
75 // properties if exists otherwise s_invalidId. 75 // properties if exists otherwise s_invalidId.
76 int getPointerEventId(const WebPointerProperties&) const; 76 int getPointerEventId(const WebPointerProperties&) const;
77 77
78 private: 78 private:
79 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash; 79 typedef WTF::UnsignedWithZeroKeyHashTraits<int> UnsignedHash;
80 typedef struct IncomingId : public std::pair<int, int> { 80 typedef struct IncomingId : public std::pair<int, int> {
81 IncomingId() {} 81 IncomingId() {}
82 IncomingId(WebPointerProperties::PointerType pointerType, 82 IncomingId(WebPointerProperties::PointerType pointerType,
83 int rawId) 83 int rawId)
84 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {} 84 : std::pair<int, int>(static_cast<int>(pointerType), rawId) {}
85 WebPointerProperties::PointerType pointerType() const { return static_ca st<WebPointerProperties::PointerType>(first); } 85 int pointerType() const {return first;}
86 int pointerTypeInt() const { return first; } 86 int rawId() const {return second;}
87 int rawId() const { return second; }
88 } IncomingId; 87 } IncomingId;
89 typedef struct PointerAttributes { 88 typedef struct PointerAttributes {
90 IncomingId incomingId; 89 IncomingId incomingId;
91 bool isActiveButtons; 90 bool isActiveButtons;
92 PointerAttributes() {} 91 PointerAttributes() {}
93 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) 92 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons)
94 : incomingId(incomingId) 93 : incomingId(incomingId)
95 , isActiveButtons(isActiveButtons) {} 94 , isActiveButtons(isActiveButtons) {}
96 } PointerAttributes; 95 } PointerAttributes;
97 96
98 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons); 97 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons);
99 bool isPrimary(const int) const; 98 bool isPrimary(const int) const;
100 void setIdTypeButtons(PointerEventInit&, const WebPointerProperties&, 99 void setIdTypeButtons(PointerEventInit&, const WebPointerProperties&,
101 unsigned buttons); 100 unsigned buttons);
102 void setBubblesAndCancelable(PointerEventInit&, const AtomicString& type); 101 void setBubblesAndCancelable(PointerEventInit&, const AtomicString& type);
103 102
104 static const int s_invalidId; 103 static const int s_invalidId;
105 static const int s_mouseId; 104 static const int s_mouseId;
106 105
107 int m_currentId; 106 int m_currentId;
108 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign edHash, UnsignedHash>> m_pointerIncomingIdMapping; 107 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign edHash, UnsignedHash>> m_pointerIncomingIdMapping;
109 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId Mapping; 108 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId Mapping;
110 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr y) + 1]; 109 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr y) + 1];
111 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1]; 110 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1];
112 }; 111 };
113 112
114 } // namespace blink 113 } // namespace blink
115 114
116 #endif // PointerEventFactory_h 115 #endif // PointerEventFactory_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698