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

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

Issue 23034006: WheelEvent's deltaX/deltaY should report real amount of pixels scrolled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No Change 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
« no previous file with comments | « Source/core/dom/WheelEvent.h ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/WheelEvent.cpp
diff --git a/Source/core/dom/WheelEvent.cpp b/Source/core/dom/WheelEvent.cpp
index bcb3d69d1169a71cc6a9463c752cebf1e3c38cb9..f2b71f6c8488607a0c80b71b87564b45f5b3019b 100644
--- a/Source/core/dom/WheelEvent.cpp
+++ b/Source/core/dom/WheelEvent.cpp
@@ -30,14 +30,6 @@
namespace WebCore {
-static inline double wheelTicksToPixels(double ticks)
-{
- // Make sure we use +0 for all zeros.
- if (!ticks)
- return 0;
- return -ticks * WheelEvent::TickMultiplier;
-}
-
WheelEventInit::WheelEventInit()
: deltaX(0)
, deltaY(0)
@@ -60,6 +52,7 @@ WheelEvent::WheelEvent()
WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializer)
: MouseEvent(type, initializer)
+ , m_wheelDelta(initializer.wheelDeltaX ? initializer.wheelDeltaX : -initializer.deltaX, initializer.wheelDeltaY ? initializer.wheelDeltaY : -initializer.deltaY)
, m_deltaX(initializer.deltaX ? initializer.deltaX : -initializer.wheelDeltaX)
, m_deltaY(initializer.deltaY ? initializer.deltaY : -initializer.wheelDeltaY)
, m_deltaZ(initializer.deltaZ)
@@ -76,10 +69,10 @@ WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
pageLocation.x(), pageLocation.y(),
0, 0,
ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false)
- , m_deltaX(wheelTicksToPixels(wheelTicks.x()))
- , m_deltaY(wheelTicksToPixels(wheelTicks.y()))
- , m_deltaZ(0) // FIXME: Not supported.
- , m_rawDelta(roundedIntPoint(rawDelta))
+ , m_wheelDelta(wheelTicks.x() * TickMultiplier, wheelTicks.y() * TickMultiplier)
+ , m_deltaX(-rawDelta.x())
+ , m_deltaY(-rawDelta.y())
+ , m_deltaZ(0)
, m_deltaMode(deltaMode)
, m_directionInvertedFromDevice(directionInvertedFromDevice)
{
@@ -101,9 +94,9 @@ void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<Abstrac
m_shiftKey = shiftKey;
m_metaKey = metaKey;
- m_deltaX = wheelTicksToPixels(rawDeltaX);
- m_deltaY = wheelTicksToPixels(rawDeltaY);
- m_rawDelta = IntPoint(rawDeltaX, rawDeltaY);
+ m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultiplier);
+ m_deltaX = -rawDeltaX;
+ m_deltaY = -rawDeltaY;
m_deltaMode = DOM_DELTA_PIXEL;
m_directionInvertedFromDevice = false;
« no previous file with comments | « Source/core/dom/WheelEvent.h ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698