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

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

Issue 1892653003: Extract touch handling logic from EventHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add TODO Created 4 years, 7 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 18 matching lines...) Expand all
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);
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)
51 PointerEvent* createPointerTransitionEvent( 51 PointerEvent* createPointerTransitionEvent(
52 PointerEvent*, 52 PointerEvent*,
53 const AtomicString&, 53 const AtomicString&,
54 EventTarget*); 54 EventTarget*);
55 55
56 // Clear all the existing ids. 56 // Clear all the existing ids.
57 void clear(); 57 void clear();
58 58
59 // When a particular pointerId is removed, the id is considered free even 59 // When a particular pointerId is removed, the id is considered free even
60 // though there might have been other PointerEvents that were generated with 60 // though there might have been other PointerEvents that were generated with
61 // the same id before. 61 // the same id before.
62 bool remove(const int); 62 bool remove(const int);
63 63
64 // Returns all ids of the given pointerType. 64 // Returns all ids of the given pointerType.
65 Vector<int> getPointerIdsOfType(WebPointerProperties::PointerType); 65 Vector<int> getPointerIdsOfType(WebPointerProperties::PointerType) const;
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) const;
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) const;
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) const;
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&) const;
75 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;}
(...skipping 19 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/events/PointerEventFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698