#include "config.h"
#if ENABLE(TOUCH_EVENTS)
#include "TouchEvent.h"
#include "EventDispatcher.h"
#include <wtf/CurrentTime.h>
namespace WebCore {
TouchEvent::TouchEvent()
{
}
TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
TouchList* changedTouches, const AtomicString& type,
AbstractView* view, int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
: MouseRelatedEvent(type, true, true, currentTime(), view, 0, IntPoint(screenX, screenY),
IntPoint(pageX, pageY),
#if ENABLE(POINTER_LOCK)
IntPoint(0, 0),
#endif
ctrlKey, altKey, shiftKey, metaKey)
, m_touches(touches)
, m_targetTouches(targetTouches)
, m_changedTouches(changedTouches)
{
}
TouchEvent::TouchEvent(const AtomicString& type, const TouchEventInit& initializer)
: MouseRelatedEvent(type, initializer)
, m_touches(initializer.touches ? initializer.touches : TouchList::create())
, m_targetTouches(initializer.targetTouches ? initializer.targetTouches : TouchList::create())
, m_changedTouches(initializer.changedTouches ? initializer.changedTouches : TouchList::create())
{
}
TouchEvent::~TouchEvent()
{
}
void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
TouchList* changedTouches, const AtomicString& type,
AbstractView* view, int screenX, int screenY, int clientX, int clientY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
if (dispatched())
return;
initUIEvent(type, true, true, view, 0);
m_touches = touches;
m_targetTouches = targetTouches;
m_changedTouches = changedTouches;
m_screenLocation = IntPoint(screenX, screenY);
m_ctrlKey = ctrlKey;
m_altKey = altKey;
m_shiftKey = shiftKey;
m_metaKey = metaKey;
initCoordinates(IntPoint(clientX, clientY));
}
EventInterface TouchEvent::eventInterface() const
{
return TouchEventInterfaceType;
}
bool TouchEvent::isTouchEvent() const
{
return true;
}
}
#endif // ENABLE(TOUCH_EVENTS)