OLD | NEW |
---|---|
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 PointerEvent_h | 5 #ifndef PointerEvent_h |
6 #define PointerEvent_h | 6 #define PointerEvent_h |
7 | 7 |
8 #include "core/events/MouseEvent.h" | 8 #include "core/events/MouseEvent.h" |
9 #include "core/events/PointerEventInit.h" | 9 #include "core/events/PointerEventInit.h" |
10 #include "platform/PlatformTouchPoint.h" | 10 #include "platform/PlatformTouchPoint.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class CORE_EXPORT PointerEvent final : public MouseEvent { | 14 class CORE_EXPORT PointerEvent final : public MouseEvent { |
15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
16 | 16 |
17 public: | 17 public: |
18 static PointerEvent* create(const AtomicString& type, | 18 static PointerEvent* create(const AtomicString& type, |
19 const PointerEventInit& initializer) { | 19 const PointerEventInit& initializer) { |
20 return new PointerEvent(type, initializer); | 20 return new PointerEvent(type, initializer); |
21 } | 21 } |
22 | 22 |
23 int pointerId() const { return m_pointerId; } | 23 int pointerId() const { return m_pointerId; } |
24 double width() const { return m_width; } | 24 double width() const { return m_width; } |
25 double height() const { return m_height; } | 25 double height() const { return m_height; } |
26 float pressure() const { return m_pressure; } | 26 float pressure() const { return m_pressure; } |
27 long tiltX() const { return m_tiltX; } | 27 long tiltX() const { return m_tiltX; } |
28 long tiltY() const { return m_tiltY; } | 28 long tiltY() const { return m_tiltY; } |
29 float tangentialPressure() const { return m_tangentialPressure; } | |
30 long twist() const { return m_twist; } | |
29 const String& pointerType() const { return m_pointerType; } | 31 const String& pointerType() const { return m_pointerType; } |
30 bool isPrimary() const { return m_isPrimary; } | 32 bool isPrimary() const { return m_isPrimary; } |
31 | 33 |
32 short button() const override { return rawButton(); } | 34 short button() const override { return rawButton(); } |
33 bool isMouseEvent() const override; | 35 bool isMouseEvent() const override; |
34 bool isPointerEvent() const override; | 36 bool isPointerEvent() const override; |
35 | 37 |
36 EventDispatchMediator* createMediator() override; | 38 EventDispatchMediator* createMediator() override; |
37 | 39 |
38 HeapVector<Member<PointerEvent>> getCoalescedEvents() const; | 40 HeapVector<Member<PointerEvent>> getCoalescedEvents() const; |
39 | 41 |
40 DECLARE_VIRTUAL_TRACE(); | 42 DECLARE_VIRTUAL_TRACE(); |
41 | 43 |
42 private: | 44 private: |
43 PointerEvent(const AtomicString&, const PointerEventInit&); | 45 PointerEvent(const AtomicString&, const PointerEventInit&); |
44 | 46 |
45 int m_pointerId; | 47 int m_pointerId; |
46 double m_width; | 48 double m_width; |
47 double m_height; | 49 double m_height; |
48 float m_pressure; | 50 float m_pressure; |
49 long m_tiltX; | 51 long m_tiltX; |
50 long m_tiltY; | 52 long m_tiltY; |
53 float m_tangentialPressure; | |
dtapuska
2017/01/03 18:32:48
should this be a double to preserve data from java
mustaq
2017/01/03 19:09:24
I think this is fine because the spec specifies "f
lanwei
2017/01/05 16:13:41
Acknowledged.
| |
54 long m_twist; | |
51 String m_pointerType; | 55 String m_pointerType; |
52 bool m_isPrimary; | 56 bool m_isPrimary; |
53 | 57 |
54 HeapVector<Member<PointerEvent>> m_coalescedEvents; | 58 HeapVector<Member<PointerEvent>> m_coalescedEvents; |
55 }; | 59 }; |
56 | 60 |
57 class PointerEventDispatchMediator final : public EventDispatchMediator { | 61 class PointerEventDispatchMediator final : public EventDispatchMediator { |
58 public: | 62 public: |
59 static PointerEventDispatchMediator* create(PointerEvent*); | 63 static PointerEventDispatchMediator* create(PointerEvent*); |
60 | 64 |
61 private: | 65 private: |
62 explicit PointerEventDispatchMediator(PointerEvent*); | 66 explicit PointerEventDispatchMediator(PointerEvent*); |
63 PointerEvent& event() const; | 67 PointerEvent& event() const; |
64 DispatchEventResult dispatchEvent(EventDispatcher&) const override; | 68 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
65 }; | 69 }; |
66 | 70 |
67 DEFINE_EVENT_TYPE_CASTS(PointerEvent); | 71 DEFINE_EVENT_TYPE_CASTS(PointerEvent); |
68 | 72 |
69 } // namespace blink | 73 } // namespace blink |
70 | 74 |
71 #endif // PointerEvent_h | 75 #endif // PointerEvent_h |
OLD | NEW |