| 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 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 const String& pointerType() const { return m_pointerType; } | 29 const String& pointerType() const { return m_pointerType; } |
| 30 bool isPrimary() const { return m_isPrimary; } | 30 bool isPrimary() const { return m_isPrimary; } |
| 31 | 31 |
| 32 short button() const override { return rawButton(); } | 32 short button() const override { return rawButton(); } |
| 33 bool isMouseEvent() const override; | 33 bool isMouseEvent() const override; |
| 34 bool isPointerEvent() const override; | 34 bool isPointerEvent() const override; |
| 35 | 35 |
| 36 EventDispatchMediator* createMediator() override; | 36 EventDispatchMediator* createMediator() override; |
| 37 | 37 |
| 38 HeapVector<Member<PointerEvent>> getCoalescedEvents() const; |
| 39 |
| 38 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
| 39 | 41 |
| 40 private: | 42 private: |
| 41 PointerEvent(const AtomicString&, const PointerEventInit&); | 43 PointerEvent(const AtomicString&, const PointerEventInit&); |
| 42 | 44 |
| 43 int m_pointerId; | 45 int m_pointerId; |
| 44 double m_width; | 46 double m_width; |
| 45 double m_height; | 47 double m_height; |
| 46 float m_pressure; | 48 float m_pressure; |
| 47 long m_tiltX; | 49 long m_tiltX; |
| 48 long m_tiltY; | 50 long m_tiltY; |
| 49 String m_pointerType; | 51 String m_pointerType; |
| 50 bool m_isPrimary; | 52 bool m_isPrimary; |
| 53 |
| 54 HeapVector<Member<PointerEvent>> m_coalescedEvents; |
| 51 }; | 55 }; |
| 52 | 56 |
| 53 class PointerEventDispatchMediator final : public EventDispatchMediator { | 57 class PointerEventDispatchMediator final : public EventDispatchMediator { |
| 54 public: | 58 public: |
| 55 static PointerEventDispatchMediator* create(PointerEvent*); | 59 static PointerEventDispatchMediator* create(PointerEvent*); |
| 56 | 60 |
| 57 private: | 61 private: |
| 58 explicit PointerEventDispatchMediator(PointerEvent*); | 62 explicit PointerEventDispatchMediator(PointerEvent*); |
| 59 PointerEvent& event() const; | 63 PointerEvent& event() const; |
| 60 DispatchEventResult dispatchEvent(EventDispatcher&) const override; | 64 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
| 61 }; | 65 }; |
| 62 | 66 |
| 63 DEFINE_EVENT_TYPE_CASTS(PointerEvent); | 67 DEFINE_EVENT_TYPE_CASTS(PointerEvent); |
| 64 | 68 |
| 65 } // namespace blink | 69 } // namespace blink |
| 66 | 70 |
| 67 #endif // PointerEvent_h | 71 #endif // PointerEvent_h |
| OLD | NEW |