Use PlatformWheelEvent::phase() to determine if a scroll gesture begins or ends
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2012 20:13:39 +0000 (20:13 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2012 20:13:39 +0000 (20:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77127

Reviewed by Beth Dakin.

* platform/mac/ScrollAnimatorMac.h:
(ScrollAnimatorMac):
Remove handleGestureEvent.

* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::handleWheelEvent):
Look at the event phase to determine when to call didBeginGesture and didEndGesture.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106026 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/mac/ScrollAnimatorMac.h
Source/WebCore/platform/mac/ScrollAnimatorMac.mm

index 15a36a7..ce41389 100644 (file)
@@ -1,3 +1,18 @@
+2012-01-26  Anders Carlsson  <andersca@apple.com>
+
+        Use PlatformWheelEvent::phase() to determine if a scroll gesture begins or ends
+        https://bugs.webkit.org/show_bug.cgi?id=77127
+
+        Reviewed by Beth Dakin.
+
+        * platform/mac/ScrollAnimatorMac.h:
+        (ScrollAnimatorMac):
+        Remove handleGestureEvent.
+
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::handleWheelEvent):
+        Look at the event phase to determine when to call didBeginGesture and didEndGesture.
+
 2012-01-26  Benjamin Poulain  <benjamin@webkit.org>
 
         Using strncmp() for comparing scheme and port numbers is inefficient
index 48ddf7d..5c28ca9 100644 (file)
@@ -84,9 +84,6 @@ private:
 
 #if ENABLE(RUBBER_BANDING)
     virtual bool handleWheelEvent(const PlatformWheelEvent&) OVERRIDE;
-#if ENABLE(GESTURE_EVENTS)
-    virtual void handleGestureEvent(const PlatformGestureEvent&);
-#endif
 #endif
 
     virtual void cancelAnimations();
index f66160d..2042585 100644 (file)
@@ -950,15 +950,15 @@ bool ScrollAnimatorMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
         }
     }
 
-    return m_scrollElasticityController.handleWheelEvent(wheelEvent);
-}
-
-void ScrollAnimatorMac::handleGestureEvent(const PlatformGestureEvent& gestureEvent)
-{
-    if (gestureEvent.type() == PlatformEvent::GestureScrollBegin)
+    if (wheelEvent.phase() == PlatformWheelEventPhaseBegan) {
+        // We don't return after this because we still want the scroll elasticity controller to handle the wheel event.
         beginScrollGesture();
-    else if (gestureEvent.type() == PlatformEvent::GestureScrollEnd)
+    } else if (wheelEvent.phase() == PlatformWheelEventPhaseEnded) {
         endScrollGesture();
+        return true;
+    }
+
+    return m_scrollElasticityController.handleWheelEvent(wheelEvent);
 }
 
 bool ScrollAnimatorMac::pinnedInDirection(float deltaX, float deltaY)