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

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

Issue 2147263003: Send got/lostpointercapture immediately if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply comments Created 4 years, 5 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 PointerEvent*, 48 const int pointerId,
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 int pointerType() const {return first;} 85 WebPointerProperties::PointerType pointerType() const { return static_ca st<WebPointerProperties::PointerType>(first); }
86 int rawId() const {return second;} 86 int pointerTypeInt() const { return first; }
87 int rawId() const { return second; }
87 } IncomingId; 88 } IncomingId;
88 typedef struct PointerAttributes { 89 typedef struct PointerAttributes {
89 IncomingId incomingId; 90 IncomingId incomingId;
90 bool isActiveButtons; 91 bool isActiveButtons;
91 PointerAttributes() {} 92 PointerAttributes() {}
92 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons) 93 PointerAttributes(IncomingId incomingId, unsigned isActiveButtons)
93 : incomingId(incomingId) 94 : incomingId(incomingId)
94 , isActiveButtons(isActiveButtons) {} 95 , isActiveButtons(isActiveButtons) {}
95 } PointerAttributes; 96 } PointerAttributes;
96 97
97 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons); 98 int addIdAndActiveButtons(const IncomingId, bool isActiveButtons);
98 bool isPrimary(const int) const; 99 bool isPrimary(const int) const;
99 void setIdTypeButtons(PointerEventInit&, const WebPointerProperties&, 100 void setIdTypeButtons(PointerEventInit&, const WebPointerProperties&,
100 unsigned buttons); 101 unsigned buttons);
101 void setBubblesAndCancelable(PointerEventInit&, const AtomicString& type); 102 void setBubblesAndCancelable(PointerEventInit&, const AtomicString& type);
102 103
103 static const int s_invalidId; 104 static const int s_invalidId;
104 static const int s_mouseId; 105 static const int s_mouseId;
105 106
106 int m_currentId; 107 int m_currentId;
107 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign edHash, UnsignedHash>> m_pointerIncomingIdMapping; 108 HashMap<IncomingId, int, WTF::PairHash<int, int>, WTF::PairHashTraits<Unsign edHash, UnsignedHash>> m_pointerIncomingIdMapping;
108 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId Mapping; 109 HashMap<int, PointerAttributes, WTF::IntHash<int>, UnsignedHash> m_pointerId Mapping;
109 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr y) + 1]; 110 int m_primaryId[static_cast<int>(WebPointerProperties::PointerType::LastEntr y) + 1];
110 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1]; 111 int m_idCount[static_cast<int>(WebPointerProperties::PointerType::LastEntry) + 1];
111 }; 112 };
112 113
113 } // namespace blink 114 } // namespace blink
114 115
115 #endif // PointerEventFactory_h 116 #endif // PointerEventFactory_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698