Changeset 182334 in webkit


Ignore:
Timestamp:
Apr 3, 2015 2:32:59 PM (9 years ago)
Author:
Brent Fulgham
Message:

Expand test infrastructure to support scrolling tests
https://bugs.webkit.org/show_bug.cgi?id=143383

Reviewed by Darin Adler.

No new tests: No change in behavior.

This is an initial set of changes that clean up a few things I noticed while extending testing support
for scroll animations and wheel event gestures.

  1. Reduce the amount of #ifdef code in EventHandler{Mac}.
  2. Consolidate the idea of an "End Gesture" in the PlatformWheelEvent class.
  3. Remove a number of unneeded null checks in EventHandler.
  4. ScrollController must always have a client, so hold a reference instead of using a pointer.
  • page/EventHandler.cpp:

(WebCore::EventHandler::platformNotifyIfEndGesture): Renamed from 'platformNotifySnapIfNecessary'.
(WebCore::EventHandler::handleWheelEvent): Call 'platformNotifySnapIfNecessary' at method exit points.
(WebCore::EventHandler::platformNotifySnapIfNecessary): Deleted.

  • page/EventHandler.h:
  • page/mac/EventHandlerMac.mm:

(WebCore::EventHandler::platformCompleteWheelEvent): Remove unneeded null checks for 'view'. Remove
CSS_SNAP-specific call to 'platformNotifySnapIfNecessary'. This logic is now handled in the new
'platformNotifyIfEndGesture' method.
(WebCore::EventHandler::platformNotifyIfEndGesture): Renamed from 'platformNotifySnapIfNecessary'.
(WebCore::EventHandler::platformNotifySnapIfNecessary): Deleted.

  • page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:

(WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac): Pass 'this' as
reference to ScrollController constructor.

  • platform/PlatformWheelEvent.h:

(WebCore::PlatformWheelEvent::shouldResetLatching): Call new 'isEndGesture' method.
(WebCore::PlatformWheelEvent::isEndGesture): Added method to encapsulate some code that was duplicated
in a number of places.

  • platform/ScrollAnimator.cpp:

(WebCore::ScrollAnimator::ScrollAnimator): Pass 'this' as reference to ScrollController constructor.

  • platform/cocoa/ScrollController.h:
  • platform/cocoa/ScrollController.mm:

(WebCore::ScrollController::ScrollController): Update to reflect m_client is now a reference.
(WebCore::ScrollController::handleWheelEvent): Ditto.
(WebCore::ScrollController::snapRubberBandTimerFired): Ditto. Also, a drive-by fix for ending rubberband
snapping. This end-state wasn't deactivating the timer (even when the animation finished). This isn't a
huge problem, but I (will) rely on the state of the animation timer in a future patch to decide if
tests should run or continue waiting.
(WebCore::ScrollController::isRubberBandInProgress): Ditto.
(WebCore::ScrollController::startSnapRubberbandTimer): Ditto.
(WebCore::ScrollController::stopSnapRubberbandTimer): Ditto.
(WebCore::ScrollController::shouldRubberBandInHorizontalDirection): Ditto.
(WebCore::ScrollController::processWheelEventForScrollSnapOnAxis): Ditto.
(WebCore::ScrollController::startScrollSnapTimer): Ditto.
(WebCore::ScrollController::stopScrollSnapTimer): Ditto.
(WebCore::ScrollController::scrollSnapAnimationUpdate): Ditto.
(WebCore::ScrollController::beginScrollSnapAnimation): Ditto.
(WebCore::ScrollController::computeSnapDelta): Ditto.
(WebCore::ScrollController::computeGlideDelta): Ditto.

  • platform/mac/ScrollAnimatorMac.mm:

(WebCore::gestureShouldBeginSnap): Use new PlatformWheelEvent::isEndGesture() method.

Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r182333 r182334  
     12015-04-03  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Expand test infrastructure to support scrolling tests
     4        https://bugs.webkit.org/show_bug.cgi?id=143383
     5
     6        Reviewed by Darin Adler.
     7
     8        No new tests: No change in behavior.
     9
     10        This is an initial set of changes that clean up a few things I noticed while extending testing support
     11        for scroll animations and wheel event gestures.
     12        1. Reduce the amount of #ifdef code in EventHandler{Mac}.
     13        2. Consolidate the idea of an "End Gesture" in the PlatformWheelEvent class.
     14        3. Remove a number of unneeded null checks in EventHandler.
     15        4. ScrollController must always have a client, so hold a reference instead of using a pointer.
     16
     17        * page/EventHandler.cpp:
     18        (WebCore::EventHandler::platformNotifyIfEndGesture): Renamed from 'platformNotifySnapIfNecessary'.
     19        (WebCore::EventHandler::handleWheelEvent): Call 'platformNotifySnapIfNecessary' at method exit points.
     20        (WebCore::EventHandler::platformNotifySnapIfNecessary): Deleted.
     21        * page/EventHandler.h:
     22        * page/mac/EventHandlerMac.mm:
     23        (WebCore::EventHandler::platformCompleteWheelEvent):  Remove unneeded null checks for 'view'. Remove
     24        CSS_SNAP-specific call to 'platformNotifySnapIfNecessary'. This logic is now handled in the new
     25        'platformNotifyIfEndGesture' method.
     26        (WebCore::EventHandler::platformNotifyIfEndGesture): Renamed from 'platformNotifySnapIfNecessary'.
     27        (WebCore::EventHandler::platformNotifySnapIfNecessary): Deleted.
     28        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
     29        (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac): Pass 'this' as
     30        reference to ScrollController constructor.
     31        * platform/PlatformWheelEvent.h:
     32        (WebCore::PlatformWheelEvent::shouldResetLatching): Call new 'isEndGesture' method.
     33        (WebCore::PlatformWheelEvent::isEndGesture): Added method to encapsulate some code that was duplicated
     34        in a number of places.
     35        * platform/ScrollAnimator.cpp:
     36        (WebCore::ScrollAnimator::ScrollAnimator): Pass 'this' as reference to ScrollController constructor.
     37        * platform/cocoa/ScrollController.h:
     38        * platform/cocoa/ScrollController.mm:
     39        (WebCore::ScrollController::ScrollController): Update to reflect m_client is now a reference.
     40        (WebCore::ScrollController::handleWheelEvent): Ditto.
     41        (WebCore::ScrollController::snapRubberBandTimerFired): Ditto. Also, a drive-by fix for ending rubberband
     42        snapping. This end-state wasn't deactivating the timer (even when the animation finished). This isn't a
     43        huge problem, but I (will) rely on the state of the animation timer in a future patch to decide if
     44        tests should run or continue waiting.
     45        (WebCore::ScrollController::isRubberBandInProgress): Ditto.
     46        (WebCore::ScrollController::startSnapRubberbandTimer): Ditto.
     47        (WebCore::ScrollController::stopSnapRubberbandTimer): Ditto.
     48        (WebCore::ScrollController::shouldRubberBandInHorizontalDirection): Ditto.
     49        (WebCore::ScrollController::processWheelEventForScrollSnapOnAxis): Ditto.
     50        (WebCore::ScrollController::startScrollSnapTimer): Ditto.
     51        (WebCore::ScrollController::stopScrollSnapTimer): Ditto.
     52        (WebCore::ScrollController::scrollSnapAnimationUpdate): Ditto.
     53        (WebCore::ScrollController::beginScrollSnapAnimation): Ditto.
     54        (WebCore::ScrollController::computeSnapDelta): Ditto.
     55        (WebCore::ScrollController::computeGlideDelta): Ditto.
     56        * platform/mac/ScrollAnimatorMac.mm:
     57        (WebCore::gestureShouldBeginSnap): Use new PlatformWheelEvent::isEndGesture() method.
     58
    1592015-04-03  Chris Fleizach  <cfleizach@apple.com>
    260
  • trunk/Source/WebCore/page/EventHandler.cpp

    r181971 r182334  
    26282628}
    26292629
    2630 #if ENABLE(CSS_SCROLL_SNAP)
    2631 void EventHandler::platformNotifySnapIfNecessary(const PlatformWheelEvent&, ScrollableArea&)
    2632 {
    2633 }
    2634 #endif
     2630void EventHandler::platformNotifyIfEndGesture(const PlatformWheelEvent&, ScrollableArea*)
     2631{
     2632}
    26352633
    26362634#endif
     
    26832681                    if (scrollableArea)
    26842682                        scrollableArea->setScrolledProgrammatically(false);
     2683                    platformNotifyIfEndGesture(adjustedEvent, scrollableArea);
    26852684                    if (!widget->platformWidget())
    26862685                        return true;
     
    26982697            }
    26992698
    2700 #if ENABLE(CSS_SCROLL_SNAP)
    2701             if (scrollableArea)
    2702                 platformNotifySnapIfNecessary(adjustedEvent, *scrollableArea);
    2703 #endif
     2699            platformNotifyIfEndGesture(adjustedEvent, scrollableArea);
    27042700            return true;
    27052701        }
     
    27092705        scrollableArea->setScrolledProgrammatically(false);
    27102706
    2711     return platformCompleteWheelEvent(event, scrollableContainer.get(), scrollableArea);
     2707    bool handledEvent = platformCompleteWheelEvent(event, scrollableContainer.get(), scrollableArea);
     2708    platformNotifyIfEndGesture(adjustedEvent, scrollableArea);
     2709    return handledEvent;
    27122710}
    27132711
  • trunk/Source/WebCore/page/EventHandler.h

    r181971 r182334  
    211211    bool platformCompleteWheelEvent(const PlatformWheelEvent&, ContainerNode* scrollableContainer, ScrollableArea*);
    212212    bool platformCompletePlatformWidgetWheelEvent(const PlatformWheelEvent&, const Widget&, ContainerNode* scrollableContainer);
    213 
    214 #if ENABLE(CSS_SCROLL_SNAP)
    215     void platformNotifySnapIfNecessary(const PlatformWheelEvent&, ScrollableArea&);
    216 #endif
     213    void platformNotifyIfEndGesture(const PlatformWheelEvent&, ScrollableArea*);
    217214
    218215#if ENABLE(IOS_TOUCH_EVENTS) || ENABLE(IOS_GESTURE_EVENTS)
  • trunk/Source/WebCore/page/mac/EventHandlerMac.mm

    r181879 r182334  
    939939{
    940940    // We do another check on the frame view because the event handler can run JS which results in the frame getting destroyed.
     941    ASSERT(m_frame.view());
    941942    FrameView* view = m_frame.view();
    942943
     
    955956            view = frameViewForLatchingState(m_frame, latchingState);
    956957
    957         bool didHandleWheelEvent = view && view->wheelEvent(wheelEvent);
     958        ASSERT(view);
     959
     960        bool didHandleWheelEvent = view->wheelEvent(wheelEvent);
    958961        if (scrollableContainer == latchingState->scrollableContainer()) {
    959962            // If we are just starting a scroll event, and have nowhere left to scroll, allow
     
    963966
    964967        // If the platform widget is handling the event, we always want to return false.
    965         if (view && scrollableArea == view && view->platformWidget())
     968        if (scrollableArea == view && view->platformWidget())
    966969            didHandleWheelEvent = false;
    967970       
     
    969972    }
    970973   
    971     bool didHandleEvent = view ? view->wheelEvent(wheelEvent) : false;
     974    bool didHandleEvent = view->wheelEvent(wheelEvent);
    972975    m_isHandlingWheelEvent = false;
    973 
    974 #if ENABLE(CSS_SCROLL_SNAP)
    975     if (scrollableArea)
    976         platformNotifySnapIfNecessary(wheelEvent, *scrollableArea);
    977 #endif
    978 
    979976    return didHandleEvent;
    980977}
     
    996993}
    997994
    998 #if ENABLE(CSS_SCROLL_SNAP)
    999 void EventHandler::platformNotifySnapIfNecessary(const PlatformWheelEvent& wheelEvent, ScrollableArea& scrollableArea)
    1000 {
     995void EventHandler::platformNotifyIfEndGesture(const PlatformWheelEvent& wheelEvent, ScrollableArea* scrollableArea)
     996{
     997    if (!scrollableArea)
     998        return;
     999
    10011000    // Special case handling for ending wheel gesture to activate snap animation:
    10021001    if (wheelEvent.phase() != PlatformWheelEventPhaseEnded && wheelEvent.momentumPhase() != PlatformWheelEventPhaseEnded)
    10031002        return;
    10041003
    1005     if (ScrollAnimator* scrollAnimator = scrollableArea.existingScrollAnimator())
     1004#if ENABLE(CSS_SCROLL_SNAP)
     1005    if (ScrollAnimator* scrollAnimator = scrollableArea->existingScrollAnimator())
    10061006        scrollAnimator->processWheelEventForScrollSnap(wheelEvent);
    1007 }
    10081007#endif
    1009 
    1010 }
     1008}
     1009
     1010}
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm

    r182242 r182334  
    5656ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
    5757    : ScrollingTreeFrameScrollingNode(scrollingTree, nodeID)
    58     , m_scrollController(this)
     58    , m_scrollController(*this)
    5959    , m_verticalScrollbarPainter(0)
    6060    , m_horizontalScrollbarPainter(0)
  • trunk/Source/WebCore/platform/PlatformWheelEvent.h

    r181879 r182334  
    163163        float unacceleratedScrollingDeltaX() const { return m_unacceleratedScrollingDeltaX; }
    164164        float unacceleratedScrollingDeltaY() const { return m_unacceleratedScrollingDeltaY; }
    165         bool useLatchedEventElement() const
    166         {
    167             return m_phase == PlatformWheelEventPhaseBegan || m_phase == PlatformWheelEventPhaseChanged
    168                 || m_momentumPhase == PlatformWheelEventPhaseBegan || m_momentumPhase == PlatformWheelEventPhaseChanged
    169                 || (m_phase == PlatformWheelEventPhaseEnded && m_momentumPhase == PlatformWheelEventPhaseNone);
    170         }
    171         bool shouldConsiderLatching() const
    172         {
    173             return m_phase == PlatformWheelEventPhaseBegan || m_phase == PlatformWheelEventPhaseMayBegin;
    174         }
    175         bool shouldResetLatching() const
    176         {
    177             if (m_phase == PlatformWheelEventPhaseCancelled || m_phase == PlatformWheelEventPhaseMayBegin)
    178                 return true;
    179            
    180             if (m_phase == PlatformWheelEventPhaseNone && m_momentumPhase == PlatformWheelEventPhaseEnded)
    181                 return true;
    182            
    183             return false;
    184         }
     165        bool useLatchedEventElement() const;
     166        bool shouldConsiderLatching() const;
     167        bool shouldResetLatching() const;
     168        bool isEndGesture() const;
    185169#else
    186170        bool useLatchedEventElement() const { return false; }
     
    211195    };
    212196
     197#if PLATFORM(COCOA)
     198    inline bool PlatformWheelEvent::useLatchedEventElement() const
     199    {
     200        return m_phase == PlatformWheelEventPhaseBegan || m_phase == PlatformWheelEventPhaseChanged
     201        || m_momentumPhase == PlatformWheelEventPhaseBegan || m_momentumPhase == PlatformWheelEventPhaseChanged
     202        || (m_phase == PlatformWheelEventPhaseEnded && m_momentumPhase == PlatformWheelEventPhaseNone);
     203    }
     204   
     205    inline bool PlatformWheelEvent::shouldConsiderLatching() const
     206    {
     207        return m_phase == PlatformWheelEventPhaseBegan || m_phase == PlatformWheelEventPhaseMayBegin;
     208    }
     209   
     210    inline bool PlatformWheelEvent::shouldResetLatching() const
     211    {
     212        return m_phase == PlatformWheelEventPhaseCancelled || m_phase == PlatformWheelEventPhaseMayBegin || isEndGesture();
     213    }
     214   
     215    inline bool PlatformWheelEvent::isEndGesture() const
     216    {
     217        return m_phase == PlatformWheelEventPhaseNone && m_momentumPhase == PlatformWheelEventPhaseEnded;
     218    }
     219
     220#endif
     221
    213222} // namespace WebCore
    214223
  • trunk/Source/WebCore/platform/ScrollAnimator.cpp

    r181087 r182334  
    5151    : m_scrollableArea(scrollableArea)
    5252#if (ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)) && PLATFORM(MAC)
    53     , m_scrollController(this)
     53    , m_scrollController(*this)
    5454#endif
    5555    , m_currentPosX(0)
  • trunk/Source/WebCore/platform/cocoa/ScrollController.h

    r181510 r182334  
    100100
    101101public:
    102     explicit ScrollController(ScrollControllerClient*);
     102    explicit ScrollController(ScrollControllerClient&);
    103103
    104104    bool handleWheelEvent(const PlatformWheelEvent&);
     
    142142#endif
    143143
    144     ScrollControllerClient* m_client;
     144    ScrollControllerClient& m_client;
    145145   
    146146    CFTimeInterval m_lastMomentumScrollTimestamp;
  • trunk/Source/WebCore/platform/cocoa/ScrollController.mm

    r181510 r182334  
    121121}
    122122
    123 ScrollController::ScrollController(ScrollControllerClient* client)
     123ScrollController::ScrollController(ScrollControllerClient& client)
    124124    : m_client(client)
    125125    , m_lastMomentumScrollTimestamp(0)
     
    145145    if (wheelEvent.phase() == PlatformWheelEventPhaseBegan) {
    146146        // First, check if we should rubber-band at all.
    147         if (m_client->pinnedInDirection(FloatSize(-wheelEvent.deltaX(), 0))
     147        if (m_client.pinnedInDirection(FloatSize(-wheelEvent.deltaX(), 0))
    148148            && !shouldRubberBandInHorizontalDirection(wheelEvent))
    149149            return false;
     
    155155        m_momentumVelocity = FloatSize();
    156156
    157         IntSize stretchAmount = m_client->stretchAmount();
     157        IntSize stretchAmount = m_client.stretchAmount();
    158158        m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(stretchAmount.width()));
    159159        m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(stretchAmount.height()));
     
    185185    m_overflowScrollDelta = FloatSize();
    186186
    187     IntSize stretchAmount = m_client->stretchAmount();
     187    IntSize stretchAmount = m_client.stretchAmount();
    188188    bool isVerticallyStretched = stretchAmount.height();
    189189    bool isHorizontallyStretched = stretchAmount.width();
     
    229229
    230230        if (isVerticallyStretched) {
    231             if (!isHorizontallyStretched && m_client->pinnedInDirection(FloatSize(deltaX, 0))) {
     231            if (!isHorizontallyStretched && m_client.pinnedInDirection(FloatSize(deltaX, 0))) {
    232232                // Stretching only in the vertical.
    233233                if (deltaY && (fabsf(deltaX / deltaY) < rubberbandDirectionLockStretchRatio))
     
    241241        } else if (isHorizontallyStretched) {
    242242            // Stretching only in the horizontal.
    243             if (m_client->pinnedInDirection(FloatSize(0, deltaY))) {
     243            if (m_client.pinnedInDirection(FloatSize(0, deltaY))) {
    244244                if (deltaX && (fabsf(deltaY / deltaX) < rubberbandDirectionLockStretchRatio))
    245245                    deltaY = 0;
     
    252252        } else {
    253253            // Not stretching at all yet.
    254             if (m_client->pinnedInDirection(FloatSize(deltaX, deltaY))) {
     254            if (m_client.pinnedInDirection(FloatSize(deltaX, deltaY))) {
    255255                if (fabsf(deltaY) >= fabsf(deltaX)) {
    256256                    if (fabsf(deltaX) < rubberbandMinimumRequiredDeltaBeforeStretch) {
     
    269269            if (deltaY) {
    270270                deltaY *= scrollWheelMultiplier();
    271                 m_client->immediateScrollBy(FloatSize(0, deltaY));
     271                m_client.immediateScrollBy(FloatSize(0, deltaY));
    272272            }
    273273            if (deltaX) {
    274274                deltaX *= scrollWheelMultiplier();
    275                 m_client->immediateScrollBy(FloatSize(deltaX, 0));
     275                m_client.immediateScrollBy(FloatSize(deltaX, 0));
    276276            }
    277277        } else {
    278             if (!m_client->allowsHorizontalStretching(wheelEvent)) {
     278            if (!m_client.allowsHorizontalStretching(wheelEvent)) {
    279279                deltaX = 0;
    280280                eventCoalescedDeltaX = 0;
    281             } else if (deltaX && !isHorizontallyStretched && !m_client->pinnedInDirection(FloatSize(deltaX, 0))) {
     281            } else if (deltaX && !isHorizontallyStretched && !m_client.pinnedInDirection(FloatSize(deltaX, 0))) {
    282282                deltaX *= scrollWheelMultiplier();
    283283
    284                 m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0));
     284                m_client.immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0));
    285285                deltaX = 0;
    286286            }
    287287
    288             if (!m_client->allowsVerticalStretching(wheelEvent)) {
     288            if (!m_client.allowsVerticalStretching(wheelEvent)) {
    289289                deltaY = 0;
    290290                eventCoalescedDeltaY = 0;
    291             } else if (deltaY && !isVerticallyStretched && !m_client->pinnedInDirection(FloatSize(0, deltaY))) {
     291            } else if (deltaY && !isVerticallyStretched && !m_client.pinnedInDirection(FloatSize(0, deltaY))) {
    292292                deltaY *= scrollWheelMultiplier();
    293293
    294                 m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY));
     294                m_client.immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY));
    295295                deltaY = 0;
    296296            }
    297297
    298             IntSize stretchAmount = m_client->stretchAmount();
     298            IntSize stretchAmount = m_client.stretchAmount();
    299299
    300300            if (m_momentumScrollInProgress) {
    301                 if ((m_client->pinnedInDirection(FloatSize(eventCoalescedDeltaX, eventCoalescedDeltaY)) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) <= 0)) && m_lastMomentumScrollTimestamp) {
     301                if ((m_client.pinnedInDirection(FloatSize(eventCoalescedDeltaX, eventCoalescedDeltaY)) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) <= 0)) && m_lastMomentumScrollTimestamp) {
    302302                    m_ignoreMomentumScrolls = true;
    303303                    m_momentumScrollInProgress = false;
     
    311311            FloatSize dampedDelta(ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.width())), ceilf(elasticDeltaForReboundDelta(m_stretchScrollForce.height())));
    312312
    313             m_client->immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);
     313            m_client.immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);
    314314        }
    315315    }
     
    344344
    345345        if (m_startStretch == FloatSize()) {
    346             m_startStretch = m_client->stretchAmount();
     346            m_startStretch = m_client.stretchAmount();
    347347            if (m_startStretch == FloatSize()) {
    348348                stopSnapRubberbandTimer();
     
    356356            }
    357357
    358             m_origOrigin = m_client->absoluteScrollPosition() - m_startStretch;
     358            m_origOrigin = m_client.absoluteScrollPosition() - m_startStretch;
    359359            m_origVelocity = m_momentumVelocity;
    360360
     
    364364
    365365            // Don't rubber-band horizontally if it's not possible to scroll horizontally
    366             if (!m_client->canScrollHorizontally())
     366            if (!m_client.canScrollHorizontally())
    367367                m_origVelocity.setWidth(0);
    368368
    369369            // Don't rubber-band vertically if it's not possible to scroll vertically
    370             if (!m_client->canScrollVertically())
     370            if (!m_client.canScrollVertically())
    371371                m_origVelocity.setHeight(0);
    372372        }
     
    376376
    377377        if (fabs(delta.x()) >= 1 || fabs(delta.y()) >= 1) {
    378             m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_client->stretchAmount());
    379 
    380             FloatSize newStretch = m_client->stretchAmount();
     378            m_client.immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_client.stretchAmount());
     379
     380            FloatSize newStretch = m_client.stretchAmount();
    381381
    382382            m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(newStretch.width()));
    383383            m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(newStretch.height()));
    384384        } else {
    385             m_client->adjustScrollPositionToBoundsIfNecessary();
     385            m_client.adjustScrollPositionToBoundsIfNecessary();
    386386
    387387            stopSnapRubberbandTimer();
     
    395395        m_startTime = [NSDate timeIntervalSinceReferenceDate];
    396396        m_startStretch = FloatSize();
     397        if (!isRubberBandInProgress())
     398            stopSnapRubberbandTimer();
    397399    }
    398400}
     
    403405        return false;
    404406
    405     return !m_client->stretchAmount().isZero();
     407    return !m_client.stretchAmount().isZero();
    406408}
    407409
    408410void ScrollController::startSnapRubberbandTimer()
    409411{
    410     m_client->startSnapRubberbandTimer();
     412    m_client.startSnapRubberbandTimer();
    411413    m_snapRubberbandTimer.startRepeating(1.0 / 60.0);
    412414}
     
    414416void ScrollController::stopSnapRubberbandTimer()
    415417{
    416     m_client->stopSnapRubberbandTimer();
     418    m_client.stopSnapRubberbandTimer();
    417419    m_snapRubberbandTimer.stop();
    418420    m_snapRubberbandTimerIsActive = false;
     
    442444{
    443445    if (wheelEvent.deltaX() > 0)
    444         return m_client->shouldRubberBandInDirection(ScrollLeft);
     446        return m_client.shouldRubberBandInDirection(ScrollLeft);
    445447    if (wheelEvent.deltaX() < 0)
    446         return m_client->shouldRubberBandInDirection(ScrollRight);
     448        return m_client.shouldRubberBandInDirection(ScrollRight);
    447449
    448450    return true;
     
    527529        endScrollSnapAnimation(axis, ScrollSnapState::UserInteraction);
    528530        snapState.pushInitialWheelDelta(wheelDelta);
    529         snapState.m_beginTrackingWheelDeltaOffset = m_client->scrollOffsetOnAxis(axis);
     531        snapState.m_beginTrackingWheelDeltaOffset = m_client.scrollOffsetOnAxis(axis);
    530532        break;
    531533           
     
    609611    RunLoop::Timer<ScrollController>& scrollSnapTimer = axis == ScrollEventAxis::Horizontal ? m_horizontalScrollSnapTimer : m_verticalScrollSnapTimer;
    610612    if (!scrollSnapTimer.isActive()) {
    611         m_client->startScrollSnapTimer(axis);
     613        m_client.startScrollSnapTimer(axis);
    612614        scrollSnapTimer.startRepeating(1.0 / 60.0);
    613615    }
     
    616618void ScrollController::stopScrollSnapTimer(ScrollEventAxis axis)
    617619{
    618     m_client->stopScrollSnapTimer(axis);
     620    m_client.stopScrollSnapTimer(axis);
    619621    RunLoop::Timer<ScrollController>& scrollSnapTimer = axis == ScrollEventAxis::Horizontal ? m_horizontalScrollSnapTimer : m_verticalScrollSnapTimer;
    620622    scrollSnapTimer.stop();
     
    646648    float delta = snapState.m_currentState == ScrollSnapState::Snapping ? computeSnapDelta(axis) : computeGlideDelta(axis);
    647649    if (delta)
    648         m_client->immediateScrollOnAxis(axis, delta);
     650        m_client.immediateScrollOnAxis(axis, delta);
    649651    else
    650652        endScrollSnapAnimation(axis, ScrollSnapState::DestinationReached);
     
    679681    ScrollSnapAnimatorState& snapState = scrollSnapPointState(axis);
    680682
    681     LayoutUnit offset = m_client->scrollOffsetOnAxis(axis);
     683    LayoutUnit offset = m_client.scrollOffsetOnAxis(axis);
    682684    float initialWheelDelta = newState == ScrollSnapState::Gliding ? snapState.averageInitialWheelDelta() : 0;
    683685    LayoutUnit projectedScrollDestination = newState == ScrollSnapState::Gliding ? snapState.m_beginTrackingWheelDeltaOffset + LayoutUnit(projectedInertialScrollDistance(initialWheelDelta)) : offset;
     
    685687        return;
    686688
    687     float scaleFactor = m_client->pageScaleFactor();
     689    float scaleFactor = m_client.pageScaleFactor();
    688690   
    689691    projectedScrollDestination = std::min(std::max(LayoutUnit(projectedScrollDestination / scaleFactor), snapState.m_snapOffsets.first()), snapState.m_snapOffsets.last());
     
    744746    const ScrollSnapAnimatorState& snapState = scrollSnapPointState(axis);
    745747
    746     LayoutUnit offset = m_client->scrollOffsetOnAxis(axis);
     748    LayoutUnit offset = m_client.scrollOffsetOnAxis(axis);
    747749    bool canComputeSnap =  (snapState.m_initialOffset <= offset && offset < snapState.m_targetOffset) || (snapState.m_targetOffset < offset && offset <= snapState.m_initialOffset);
    748750    if (snapState.m_currentState != ScrollSnapState::Snapping || !canComputeSnap)
     
    791793    const ScrollSnapAnimatorState& snapState = scrollSnapPointState(axis);
    792794
    793     LayoutUnit offset = m_client->scrollOffsetOnAxis(axis);
     795    LayoutUnit offset = m_client.scrollOffsetOnAxis(axis);
    794796    bool canComputeGlide = (snapState.m_initialOffset <= offset && offset < snapState.m_targetOffset) || (snapState.m_targetOffset < offset && offset <= snapState.m_initialOffset);
    795797    if (snapState.m_currentState != ScrollSnapState::Gliding || !canComputeGlide)
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r181087 r182334  
    11551155        return false;
    11561156   
    1157     if ((wheelEvent.phase() != PlatformWheelEventPhaseEnded)
    1158         && !(wheelEvent.phase() == PlatformWheelEventPhaseNone && wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded)) {
     1157    if (wheelEvent.phase() != PlatformWheelEventPhaseEnded && !wheelEvent.isEndGesture())
    11591158        return false;
    1160     }
    11611159
    11621160    return true;
Note: See TracChangeset for help on using the changeset viewer.