#pragma once
#include "MouseEvent.h"
#include <wtf/text/WTFString.h>
#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
#include "PlatformTouchEventIOS.h"
#endif
namespace WebCore {
class PointerEvent final : public MouseEvent {
public:
struct Init : MouseEventInit {
long pointerId { 0 };
double width { 1 };
double height { 1 };
float pressure { 0 };
float tangentialPressure { 0 };
long tiltX { 0 };
long tiltY { 0 };
long twist { 0 };
String pointerType;
bool isPrimary { false };
};
static Ref<PointerEvent> create(const AtomicString& type, Init&& initializer)
{
return adoptRef(*new PointerEvent(type, WTFMove(initializer)));
}
static Ref<PointerEvent> createForBindings()
{
return adoptRef(*new PointerEvent);
}
#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
static Ref<PointerEvent> create(const PlatformTouchEvent&, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
#endif
virtual ~PointerEvent();
long pointerId() const { return m_pointerId; }
double width() const { return m_width; }
double height() const { return m_height; }
float pressure() const { return m_pressure; }
float tangentialPressure() const { return m_tangentialPressure; }
long tiltX() const { return m_tiltX; }
long tiltY() const { return m_tiltY; }
long twist() const { return m_twist; }
String pointerType() const { return m_pointerType; }
bool isPrimary() const { return m_isPrimary; }
bool isPointerEvent() const final { return true; }
EventInterface eventInterface() const override;
private:
PointerEvent();
PointerEvent(const AtomicString&, Init&&);
#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
PointerEvent(const AtomicString& type, const PlatformTouchEvent&, IsCancelable isCancelable, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
#endif
long m_pointerId { 0 };
double m_width { 1 };
double m_height { 1 };
float m_pressure { 0 };
float m_tangentialPressure { 0 };
long m_tiltX { 0 };
long m_tiltY { 0 };
long m_twist { 0 };
String m_pointerType;
bool m_isPrimary { false };
};
}
SPECIALIZE_TYPE_TRAITS_EVENT(PointerEvent)