#include "config.h"
#include "WheelEvent.h"
#include "EventNames.h"
#include <wtf/MathExtras.h>
namespace WebCore {
using namespace EventNames;
WheelEvent::WheelEvent()
: m_wheelDeltaX(0)
, m_wheelDeltaY(0)
{
}
WheelEvent::WheelEvent(float wheelDeltaX, float wheelDeltaY, AbstractView* view,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
: MouseRelatedEvent(mousewheelEvent,
true, true, view, 0, screenX, screenY, pageX, pageY,
ctrlKey, altKey, shiftKey, metaKey)
, m_wheelDeltaX(lroundf(wheelDeltaX) * 120)
, m_wheelDeltaY(lroundf(wheelDeltaY) * 120) {
}
void WheelEvent::initWheelEvent(int wheelDeltaX, int wheelDeltaY, AbstractView* view,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
if (dispatched())
return;
initUIEvent(mousewheelEvent, true, true, view, 0);
m_screenX = screenX;
m_screenY = screenY;
m_ctrlKey = ctrlKey;
m_altKey = altKey;
m_shiftKey = shiftKey;
m_metaKey = metaKey;
m_wheelDeltaX = wheelDeltaX;
m_wheelDeltaY = wheelDeltaY;
initCoordinates(pageX, pageY);
}
bool WheelEvent::isWheelEvent() const
{
return true;
}
}