Index: Source/core/dom/WheelEvent.cpp |
diff --git a/Source/core/dom/WheelEvent.cpp b/Source/core/dom/WheelEvent.cpp |
index 1c000eecec2146a66df376ccae29af9f69281012..9bbc95fa51e36607a431e8bfadd0d3ec7e1687b8 100644 |
--- a/Source/core/dom/WheelEvent.cpp |
+++ b/Source/core/dom/WheelEvent.cpp |
@@ -30,6 +30,13 @@ |
namespace WebCore { |
+static inline double wheelTicksToPixels(double ticks) |
+{ |
+ if (!ticks) |
+ return 0; |
arv (Not doing code reviews)
2013/08/21 14:19:23
Is it worth special casing 0? Are you concerned ab
do-not-use
2013/08/21 14:31:10
I had an issue with a test failing because a shoul
arv (Not doing code reviews)
2013/08/21 14:52:30
Makes sense. I think we should normalize -0 here.
do-not-use
2013/08/21 15:00:36
Done.
arv (Not doing code reviews)
2013/08/21 15:02:53
That comment is not very nice. How about:
// Make
|
+ return -ticks * WheelEvent::TickMultiplier; |
+} |
+ |
WheelEventInit::WheelEventInit() |
: deltaX(0) |
, deltaY(0) |
@@ -49,8 +56,8 @@ WheelEvent::WheelEvent() |
WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializer) |
: MouseEvent(type, initializer) |
- , m_deltaX(initializer.deltaX ? initializer.deltaX : initializer.wheelDeltaX) |
- , m_deltaY(initializer.deltaY ? initializer.deltaY : initializer.wheelDeltaY) |
+ , m_deltaX(initializer.deltaX ? initializer.deltaX : -initializer.wheelDeltaX) |
+ , m_deltaY(initializer.deltaY ? initializer.deltaY : -initializer.wheelDeltaY) |
, m_deltaZ(initializer.deltaZ) |
, m_deltaMode(initializer.deltaMode) |
{ |
@@ -65,8 +72,8 @@ WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, |
pageLocation.x(), pageLocation.y(), |
0, 0, |
ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false) |
- , m_deltaX(wheelTicks.x() * TickMultiplier) |
- , m_deltaY(wheelTicks.y() * TickMultiplier) |
+ , m_deltaX(wheelTicksToPixels(wheelTicks.x())) |
+ , m_deltaY(wheelTicksToPixels(wheelTicks.y())) |
, m_deltaZ(0) // FIXME: Not supported. |
, m_rawDelta(roundedIntPoint(rawDelta)) |
, m_deltaMode(deltaMode) |
@@ -90,8 +97,8 @@ void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<Abstrac |
m_shiftKey = shiftKey; |
m_metaKey = metaKey; |
- m_deltaX = rawDeltaX * TickMultiplier; |
- m_deltaY = rawDeltaY * TickMultiplier; |
+ m_deltaX = wheelTicksToPixels(rawDeltaX); |
+ m_deltaY = wheelTicksToPixels(rawDeltaY); |
m_rawDelta = IntPoint(rawDeltaX, rawDeltaY); |
m_deltaMode = DOM_DELTA_PIXEL; |
m_directionInvertedFromDevice = false; |