| 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 PointerEvent final : public MouseEvent { |
| 15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
| 16 | 16 |
| 17 public: | 17 public: |
| 18 static PointerEvent* create() | |
| 19 { | |
| 20 return new PointerEvent; | |
| 21 } | |
| 22 | |
| 23 static PointerEvent* create(const AtomicString& type, const PointerEventInit
& initializer) | 18 static PointerEvent* create(const AtomicString& type, const PointerEventInit
& initializer) |
| 24 { | 19 { |
| 25 return new PointerEvent(type, initializer); | 20 return new PointerEvent(type, initializer); |
| 26 } | 21 } |
| 27 | 22 |
| 28 int pointerId() const { return m_pointerId; } | 23 int pointerId() const { return m_pointerId; } |
| 29 double width() const { return m_width; } | 24 double width() const { return m_width; } |
| 30 double height() const { return m_height; } | 25 double height() const { return m_height; } |
| 31 float pressure() const { return m_pressure; } | 26 float pressure() const { return m_pressure; } |
| 32 long tiltX() const { return m_tiltX; } | 27 long tiltX() const { return m_tiltX; } |
| 33 long tiltY() const { return m_tiltY; } | 28 long tiltY() const { return m_tiltY; } |
| 34 const String& pointerType() const { return m_pointerType; } | 29 const String& pointerType() const { return m_pointerType; } |
| 35 bool isPrimary() const { return m_isPrimary; } | 30 bool isPrimary() const { return m_isPrimary; } |
| 36 | 31 |
| 37 short button() const override { return rawButton(); } | 32 short button() const override { return rawButton(); } |
| 38 bool isMouseEvent() const override; | 33 bool isMouseEvent() const override; |
| 39 bool isPointerEvent() const override; | 34 bool isPointerEvent() const override; |
| 40 | 35 |
| 41 EventDispatchMediator* createMediator() override; | 36 EventDispatchMediator* createMediator() override; |
| 42 | 37 |
| 43 DECLARE_VIRTUAL_TRACE(); | 38 DECLARE_VIRTUAL_TRACE(); |
| 44 | 39 |
| 45 private: | 40 private: |
| 46 PointerEvent(); | |
| 47 PointerEvent(const AtomicString&, const PointerEventInit&); | 41 PointerEvent(const AtomicString&, const PointerEventInit&); |
| 48 | 42 |
| 49 int m_pointerId; | 43 int m_pointerId; |
| 50 double m_width; | 44 double m_width; |
| 51 double m_height; | 45 double m_height; |
| 52 float m_pressure; | 46 float m_pressure; |
| 53 long m_tiltX; | 47 long m_tiltX; |
| 54 long m_tiltY; | 48 long m_tiltY; |
| 55 String m_pointerType; | 49 String m_pointerType; |
| 56 bool m_isPrimary; | 50 bool m_isPrimary; |
| 57 }; | 51 }; |
| 58 | 52 |
| 59 | 53 |
| 60 class PointerEventDispatchMediator final : public EventDispatchMediator { | 54 class PointerEventDispatchMediator final : public EventDispatchMediator { |
| 61 public: | 55 public: |
| 62 static PointerEventDispatchMediator* create(PointerEvent*); | 56 static PointerEventDispatchMediator* create(PointerEvent*); |
| 63 | 57 |
| 64 private: | 58 private: |
| 65 explicit PointerEventDispatchMediator(PointerEvent*); | 59 explicit PointerEventDispatchMediator(PointerEvent*); |
| 66 PointerEvent& event() const; | 60 PointerEvent& event() const; |
| 67 DispatchEventResult dispatchEvent(EventDispatcher&) const override; | 61 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
| 68 }; | 62 }; |
| 69 | 63 |
| 70 DEFINE_EVENT_TYPE_CASTS(PointerEvent); | 64 DEFINE_EVENT_TYPE_CASTS(PointerEvent); |
| 71 | 65 |
| 72 } // namespace blink | 66 } // namespace blink |
| 73 | 67 |
| 74 #endif // PointerEvent_h | 68 #endif // PointerEvent_h |
| OLD | NEW |