Title: [171685] trunk/Source/WebCore
Revision
171685
Author
commit-qu...@webkit.org
Date
2014-07-28 12:35:48 -0700 (Mon, 28 Jul 2014)

Log Message

Let WheelEvent wrap a PlatformWheelEvent
https://bugs.webkit.org/show_bug.cgi?id=135244

WheelEvent now wraps a PlatformWheelEvent. m_directionInvertedFromDevice, as well as m_phase and m_momentumPhase
have been removed, since the information is redundant in PlatformWheelEvent. Note that deltaX and deltaY have
NOT been replaced, since we need double precision instead of float precision.

Patch by Wenson Hsieh <wenson_hs...@apple.com> on 2014-07-28
Reviewed by Beth Dakin.

No new tests, since behavior should not have changed.

* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):
(WebCore::WheelEvent::initWheelEvent):
* dom/WheelEvent.h:
(WebCore::WheelEvent::wheelEvent): Returns a non-null pointer to the PlatformWheelEvent iff WheelEvent was initialized by PlatformWheelEvent.
(WebCore::WheelEvent::webkitDirectionInvertedFromDevice): Updated to use PlatformWheelEvent.
(WebCore::WheelEvent::phase): Updated to use PlatformWheelEvent.
(WebCore::WheelEvent::momentumPhase): Updated to use PlatformWheelEvent.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (171684 => 171685)


--- trunk/Source/WebCore/ChangeLog	2014-07-28 19:31:03 UTC (rev 171684)
+++ trunk/Source/WebCore/ChangeLog	2014-07-28 19:35:48 UTC (rev 171685)
@@ -1,3 +1,25 @@
+2014-07-28  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Let WheelEvent wrap a PlatformWheelEvent
+        https://bugs.webkit.org/show_bug.cgi?id=135244
+
+        WheelEvent now wraps a PlatformWheelEvent. m_directionInvertedFromDevice, as well as m_phase and m_momentumPhase
+        have been removed, since the information is redundant in PlatformWheelEvent. Note that deltaX and deltaY have
+        NOT been replaced, since we need double precision instead of float precision.
+
+        Reviewed by Beth Dakin.
+
+        No new tests, since behavior should not have changed.
+
+        * dom/WheelEvent.cpp:
+        (WebCore::WheelEvent::WheelEvent):
+        (WebCore::WheelEvent::initWheelEvent):
+        * dom/WheelEvent.h:
+        (WebCore::WheelEvent::wheelEvent): Returns a non-null pointer to the PlatformWheelEvent iff WheelEvent was initialized by PlatformWheelEvent.
+        (WebCore::WheelEvent::webkitDirectionInvertedFromDevice): Updated to use PlatformWheelEvent.
+        (WebCore::WheelEvent::phase): Updated to use PlatformWheelEvent.
+        (WebCore::WheelEvent::momentumPhase): Updated to use PlatformWheelEvent.
+
 2014-07-28  Brent Fulgham  <bfulg...@apple.com>
 
         Unreviewed 'merge' fix.

Modified: trunk/Source/WebCore/dom/WheelEvent.cpp (171684 => 171685)


--- trunk/Source/WebCore/dom/WheelEvent.cpp	2014-07-28 19:31:03 UTC (rev 171684)
+++ trunk/Source/WebCore/dom/WheelEvent.cpp	2014-07-28 19:35:48 UTC (rev 171685)
@@ -50,7 +50,7 @@
     , m_deltaY(0)
     , m_deltaZ(0)
     , m_deltaMode(DOM_DELTA_PIXEL)
-    , m_directionInvertedFromDevice(false)
+    , m_initializedWithPlatformWheelEvent(false)
 {
 }
 
@@ -61,6 +61,7 @@
     , m_deltaY(initializer.deltaY ? initializer.deltaY : -initializer.wheelDeltaY)
     , m_deltaZ(initializer.deltaZ)
     , m_deltaMode(initializer.deltaMode)
+    , m_initializedWithPlatformWheelEvent(false)
 {
 }
 
@@ -75,12 +76,8 @@
     , m_deltaY(-event.deltaY())
     , m_deltaZ(0)
     , m_deltaMode(determineDeltaMode(event))
-    , m_directionInvertedFromDevice(event.directionInvertedFromDevice())
-    , m_wheelEvent(std::make_unique<PlatformWheelEvent>(event))
-#if PLATFORM(MAC)
-    , m_phase(event.phase())
-    , m_momentumPhase(event.momentumPhase())
-#endif
+    , m_wheelEvent(event)
+    , m_initializedWithPlatformWheelEvent(true)
 {
 }
 
@@ -103,7 +100,6 @@
     m_deltaY = -rawDeltaY;
 
     m_deltaMode = DOM_DELTA_PIXEL;
-    m_directionInvertedFromDevice = false;
 
     initCoordinates(IntPoint(pageX, pageY));
 }

Modified: trunk/Source/WebCore/dom/WheelEvent.h (171684 => 171685)


--- trunk/Source/WebCore/dom/WheelEvent.h	2014-07-28 19:31:03 UTC (rev 171684)
+++ trunk/Source/WebCore/dom/WheelEvent.h	2014-07-28 19:35:48 UTC (rev 171685)
@@ -77,7 +77,7 @@
         int screenX, int screenY, int pageX, int pageY,
         bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
 
-    const PlatformWheelEvent* wheelEvent() const { return m_wheelEvent.get(); }
+    const PlatformWheelEvent* wheelEvent() const { return m_initializedWithPlatformWheelEvent ? &m_wheelEvent : nullptr; }
     double deltaX() const { return m_deltaX; } // Positive when scrolling right.
     double deltaY() const { return m_deltaY; } // Positive when scrolling down.
     double deltaZ() const { return m_deltaZ; }
@@ -86,7 +86,7 @@
     int wheelDeltaY() const { return m_wheelDelta.y(); } // Deprecated, negative when scrolling down.
     unsigned deltaMode() const { return m_deltaMode; }
 
-    bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedFromDevice; }
+    bool webkitDirectionInvertedFromDevice() const { return m_wheelEvent.directionInvertedFromDevice(); }
     // Needed for Objective-C legacy support
     bool isHorizontal() const { return m_wheelDelta.x(); }
 
@@ -94,8 +94,8 @@
     virtual bool isMouseEvent() const override;
 
 #if PLATFORM(MAC)
-    PlatformWheelEventPhase phase() const { return m_phase; }
-    PlatformWheelEventPhase momentumPhase() const { return m_momentumPhase; }
+    PlatformWheelEventPhase phase() const { return m_wheelEvent.phase(); }
+    PlatformWheelEventPhase momentumPhase() const { return m_wheelEvent.momentumPhase(); }
 #endif
 
 private:
@@ -110,13 +110,8 @@
     double m_deltaY;
     double m_deltaZ;
     unsigned m_deltaMode;
-    bool m_directionInvertedFromDevice;
-    std::unique_ptr<PlatformWheelEvent> m_wheelEvent;
-
-#if PLATFORM(MAC)
-    PlatformWheelEventPhase m_phase;
-    PlatformWheelEventPhase m_momentumPhase;
-#endif
+    PlatformWheelEvent m_wheelEvent;
+    bool m_initializedWithPlatformWheelEvent;
 };
 
 EVENT_TYPE_CASTS(WheelEvent)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to