From 1ee83b8364dec3fcca1193a4cf06e8dbd1dd461a Mon Sep 17 00:00:00 2001 From: "andersca@apple.com" Date: Thu, 26 Jan 2012 20:13:39 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106026 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 15 +++++++++++++++ Source/WebCore/platform/mac/ScrollAnimatorMac.h | 3 --- Source/WebCore/platform/mac/ScrollAnimatorMac.mm | 14 +++++++------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 15a36a7..ce41389 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,18 @@ +2012-01-26 Anders Carlsson + + 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 Using strncmp() for comparing scheme and port numbers is inefficient diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.h b/Source/WebCore/platform/mac/ScrollAnimatorMac.h index 48ddf7d..5c28ca9 100644 --- a/Source/WebCore/platform/mac/ScrollAnimatorMac.h +++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.h @@ -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(); diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm index f66160d..2042585 100644 --- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm +++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm @@ -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) -- 2.7.4