Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(890)

Unified Diff: Source/core/dom/WheelEvent.cpp

Issue 22859012: Add support for DOM Level 3 WheelEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take feedback into consideration Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/WheelEvent.cpp
diff --git a/Source/core/dom/WheelEvent.cpp b/Source/core/dom/WheelEvent.cpp
index c7bdf0d638023da48258ed4e3d9b1671e84ecf11..40e9cb0136b5907225731e75ca685dfb4e4959ad 100644
--- a/Source/core/dom/WheelEvent.cpp
+++ b/Source/core/dom/WheelEvent.cpp
@@ -3,6 +3,7 @@
* Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
* Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
* Copyright (C) 2003, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -30,7 +31,10 @@
namespace WebCore {
WheelEventInit::WheelEventInit()
- : wheelDeltaX(0)
+ : deltaX(0)
+ , deltaY(0)
+ , deltaZ(0)
+ , wheelDeltaX(0)
, wheelDeltaY(0)
, deltaMode(WheelEvent::DOM_DELTA_PIXEL)
{
@@ -45,7 +49,9 @@ WheelEvent::WheelEvent()
WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializer)
: MouseEvent(type, initializer)
- , m_wheelDelta(IntPoint(initializer.wheelDeltaX, initializer.wheelDeltaY))
+ , m_ticksX(initializer.deltaX ? initializer.deltaX / TickMultiplier : static_cast<double>(initializer.wheelDeltaX) / LegacyTickMultiplier)
+ , m_ticksY(initializer.deltaY ? initializer.deltaY / TickMultiplier : static_cast<double>(initializer.wheelDeltaY) / LegacyTickMultiplier)
+ , m_ticksZ(initializer.deltaZ / TickMultiplier)
, m_deltaMode(initializer.deltaMode)
{
ScriptWrappable::init(this);
@@ -54,12 +60,14 @@ WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializ
WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, unsigned deltaMode,
PassRefPtr<AbstractView> view, const IntPoint& screenLocation, const IntPoint& pageLocation,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice)
- : MouseEvent(eventNames().mousewheelEvent,
+ : MouseEvent(eventNames().wheelEvent,
true, true, view, 0, screenLocation.x(), screenLocation.y(),
pageLocation.x(), pageLocation.y(),
0, 0,
ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false)
- , m_wheelDelta(IntPoint(static_cast<int>(wheelTicks.x() * TickMultiplier), static_cast<int>(wheelTicks.y() * TickMultiplier)))
+ , m_ticksX(wheelTicks.x())
+ , m_ticksY(wheelTicks.y())
+ , m_ticksZ(0) // FIXME: Not supported.
, m_rawDelta(roundedIntPoint(rawDelta))
, m_deltaMode(deltaMode)
, m_directionInvertedFromDevice(directionInvertedFromDevice)
@@ -74,7 +82,7 @@ void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<Abstrac
if (dispatched())
return;
- initUIEvent(eventNames().mousewheelEvent, true, true, view, 0);
+ initUIEvent(eventNames().wheelEvent, true, true, view, 0);
m_screenLocation = IntPoint(screenX, screenY);
m_ctrlKey = ctrlKey;
@@ -82,9 +90,8 @@ void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<Abstrac
m_shiftKey = shiftKey;
m_metaKey = metaKey;
- // Normalize to the Windows 120 multiple
- m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultiplier);
-
+ m_ticksX = rawDeltaX;
+ m_ticksY = rawDeltaY;
m_rawDelta = IntPoint(rawDeltaX, rawDeltaY);
m_deltaMode = DOM_DELTA_PIXEL;
m_directionInvertedFromDevice = false;

Powered by Google App Engine
This is Rietveld 408576698