Changeset 96652 in webkit


Ignore:
Timestamp:
Oct 4, 2011 3:14:49 PM (13 years ago)
Author:
andersca@apple.com
Message:

ScrollElasticityController should keep track of the rubberband timer state
https://bugs.webkit.org/show_bug.cgi?id=69381

Reviewed by Sam Weinig.

Add a m_snapRubberbandTimerIsActive member variable to ScrollElasticityController
and use it instead of checking whether the m_snapRubberbandTimer is active.

Eventually, ScrollElasticityControllerClient will have two member functions for starting
and stopping the timer, and the ScrollElasticityController will call them at the appropriate times.

  • platform/mac/ScrollAnimatorMac.mm:

(WebCore::ScrollAnimatorMac::handleWheelEvent):
(WebCore::ScrollAnimatorMac::beginScrollGesture):
It's OK to stop the timer unconditionally.

(WebCore::ScrollAnimatorMac::snapRubberBand):
(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):

  • platform/mac/ScrollElasticityController.h:
  • platform/mac/ScrollElasticityController.mm:

(WebCore::ScrollElasticityController::ScrollElasticityController):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96651 r96652  
     12011-10-04  Anders Carlsson  <andersca@apple.com>
     2
     3        ScrollElasticityController should keep track of the rubberband timer state
     4        https://bugs.webkit.org/show_bug.cgi?id=69381
     5
     6        Reviewed by Sam Weinig.
     7
     8        Add a m_snapRubberbandTimerIsActive member variable to ScrollElasticityController
     9        and use it instead of checking whether the m_snapRubberbandTimer is active.
     10
     11        Eventually, ScrollElasticityControllerClient will have two member functions for starting
     12        and stopping the timer, and the ScrollElasticityController will call them at the appropriate times.
     13
     14        * platform/mac/ScrollAnimatorMac.mm:
     15        (WebCore::ScrollAnimatorMac::handleWheelEvent):
     16        (WebCore::ScrollAnimatorMac::beginScrollGesture):
     17        It's OK to stop the timer unconditionally.
     18
     19        (WebCore::ScrollAnimatorMac::snapRubberBand):
     20        (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
     21        * platform/mac/ScrollElasticityController.h:
     22        * platform/mac/ScrollElasticityController.mm:
     23        (WebCore::ScrollElasticityController::ScrollElasticityController):
     24
    1252011-10-04  Anders Carlsson  <andersca@apple.com>
    226
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r96651 r96652  
    837837
    838838    bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
    839     if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_snapRubberBandTimer.isActive())) {
     839    if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_scrollElasticityController.m_snapRubberbandTimerIsActive)) {
    840840        if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) {
    841841            m_scrollElasticityController.m_ignoreMomentumScrolls = false;
     
    10941094    m_scrollElasticityController.m_overflowScrollDelta = FloatSize();
    10951095   
    1096     if (m_snapRubberBandTimer.isActive())
    1097         m_snapRubberBandTimer.stop();
     1096    m_snapRubberBandTimer.stop();
     1097    m_scrollElasticityController.m_snapRubberbandTimerIsActive = false;
    10981098}
    10991099
     
    11131113    m_scrollElasticityController.m_inScrollGesture = false;
    11141114
    1115     if (m_snapRubberBandTimer.isActive())
     1115    if (m_scrollElasticityController.m_snapRubberbandTimerIsActive)
    11161116        return;
    11171117
     
    11221122
    11231123    m_snapRubberBandTimer.startRepeating(1.0/60.0);
     1124    m_scrollElasticityController.m_snapRubberbandTimerIsActive = true;
    11241125}
    11251126
     
    11471148            if (m_scrollElasticityController.m_startStretch == FloatSize()) {   
    11481149                m_snapRubberBandTimer.stop();
     1150
    11491151                m_scrollElasticityController.m_stretchScrollForce = FloatSize();
    11501152                m_scrollElasticityController.m_startTime = 0;
     
    11521154                m_scrollElasticityController.m_origOrigin = FloatPoint();
    11531155                m_scrollElasticityController.m_origVelocity = FloatSize();
     1156                m_scrollElasticityController.m_snapRubberbandTimerIsActive = false;
    11541157
    11551158                return;
     
    11961199
    11971200            m_snapRubberBandTimer.stop();
     1201
    11981202            m_scrollElasticityController.m_stretchScrollForce = FloatSize();
    1199            
    12001203            m_scrollElasticityController.m_startTime = 0;
    12011204            m_scrollElasticityController.m_startStretch = FloatSize();
    12021205            m_scrollElasticityController.m_origOrigin = FloatPoint();
    12031206            m_scrollElasticityController.m_origVelocity = FloatSize();
     1207            m_scrollElasticityController.m_snapRubberbandTimerIsActive = false;
    12041208        }
    12051209    } else {
  • trunk/Source/WebCore/platform/mac/ScrollElasticityController.h

    r96651 r96652  
    7171    FloatPoint m_origOrigin;
    7272    FloatSize m_origVelocity;
     73
     74    bool m_snapRubberbandTimerIsActive;
    7375};
    7476
  • trunk/Source/WebCore/platform/mac/ScrollElasticityController.mm

    r96651 r96652  
    4242    , m_lastMomentumScrollTimestamp(0)
    4343    , m_startTime(0)
     44    , m_snapRubberbandTimerIsActive(false)
    4445{
    4546}
Note: See TracChangeset for help on using the changeset viewer.