Changeset 104321 in webkit


Ignore:
Timestamp:
Jan 6, 2012 12:25:40 PM (12 years ago)
Author:
andersca@apple.com
Message:

Make ScrollAnimatorMac::snapRubberBandTimerFired use m_scrollElasticityController in more places
https://bugs.webkit.org/show_bug.cgi?id=75726

Reviewed by Sam Weinig.

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

(WebCore::ScrollAnimatorMac::canScrollHorizontally):
(WebCore::ScrollAnimatorMac::canScrollVertically):
(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):

  • platform/mac/ScrollElasticityController.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r104320 r104321  
     12012-01-06  Anders Carlsson  <andersca@apple.com>
     2
     3        Make ScrollAnimatorMac::snapRubberBandTimerFired use m_scrollElasticityController in more places
     4        https://bugs.webkit.org/show_bug.cgi?id=75726
     5
     6        Reviewed by Sam Weinig.
     7
     8        * platform/mac/ScrollAnimatorMac.h:
     9        * platform/mac/ScrollAnimatorMac.mm:
     10        (WebCore::ScrollAnimatorMac::canScrollHorizontally):
     11        (WebCore::ScrollAnimatorMac::canScrollVertically):
     12        (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
     13        * platform/mac/ScrollElasticityController.h:
     14
    1152012-01-06  Pratik Solanki  <psolanki@apple.com>
    216
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h

    r104312 r104321  
    129129    virtual IntSize stretchAmount() OVERRIDE;
    130130    virtual bool pinnedInDirection(const FloatSize&) OVERRIDE;
     131    virtual bool canScrollHorizontally() OVERRIDE;
     132    virtual bool canScrollVertically() OVERRIDE;
    131133    virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) OVERRIDE;
    132134    virtual void immediateScrollBy(const FloatSize&) OVERRIDE;
  • trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm

    r104312 r104321  
    10641064{
    10651065    return pinnedInDirection(direction.width(), direction.height());
     1066}
     1067
     1068bool ScrollAnimatorMac::canScrollHorizontally()
     1069{
     1070    Scrollbar* scrollbar = m_scrollableArea->horizontalScrollbar();
     1071    if (!scrollbar)
     1072        return false;
     1073    return scrollbar->enabled();
     1074}
     1075
     1076bool ScrollAnimatorMac::canScrollVertically()
     1077{
     1078    Scrollbar* scrollbar = m_scrollableArea->verticalScrollbar();
     1079    if (!scrollbar)
     1080        return false;
     1081    return scrollbar->enabled();
    10661082}
    10671083
     
    13211337
    13221338        if (m_scrollElasticityController.m_startStretch == FloatSize()) {
    1323             m_scrollElasticityController.m_startStretch = m_scrollableArea->overhangAmount();
    1324             if (m_scrollElasticityController.m_startStretch == FloatSize()) {   
    1325                 m_snapRubberBandTimer.stop();
     1339            m_scrollElasticityController.m_startStretch = m_scrollElasticityController.m_client->stretchAmount();
     1340            if (m_scrollElasticityController.m_startStretch == FloatSize()) {
     1341                m_scrollElasticityController.m_client->stopSnapRubberbandTimer();
    13261342
    13271343                m_scrollElasticityController.m_stretchScrollForce = FloatSize();
     
    13431359           
    13441360            // Don't rubber-band horizontally if it's not possible to scroll horizontally
    1345             Scrollbar* hScroller = m_scrollableArea->horizontalScrollbar();
    1346             if (!hScroller || !hScroller->enabled())
     1361            if (!m_scrollElasticityController.m_client->canScrollHorizontally())
    13471362                m_scrollElasticityController.m_origVelocity.setWidth(0);
    13481363           
    1349             // Don't rubber-band vertically if it's not possible to scroll horizontally
    1350             Scrollbar* vScroller = m_scrollableArea->verticalScrollbar();
    1351             if (!vScroller || !vScroller->enabled())
     1364            // Don't rubber-band vertically if it's not possible to scroll vertically
     1365            if (!m_scrollElasticityController.m_client->canScrollVertically())
    13521366                m_scrollElasticityController.m_origVelocity.setHeight(0);
    13531367        }
     
    13591373            FloatPoint newOrigin = m_scrollElasticityController.m_origOrigin + delta;
    13601374
    1361             immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollableArea->overhangAmount());
    1362 
    1363             FloatSize newStretch = m_scrollableArea->overhangAmount();
     1375            immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollElasticityController.m_client->stretchAmount());
     1376
     1377            FloatSize newStretch = m_scrollElasticityController.m_client->stretchAmount();
    13641378           
    13651379            m_scrollElasticityController.m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(newStretch.width()));
     
    13681382            immediateScrollTo(m_scrollElasticityController.m_origOrigin);
    13691383
    1370             m_snapRubberBandTimer.stop();
     1384            m_scrollElasticityController.m_client->stopSnapRubberbandTimer();
    13711385
    13721386            m_scrollElasticityController.m_stretchScrollForce = FloatSize();
  • trunk/Source/WebCore/platform/mac/ScrollElasticityController.h

    r104312 r104321  
    4242    virtual IntSize stretchAmount() = 0;
    4343    virtual bool pinnedInDirection(const FloatSize&) = 0;
     44    virtual bool canScrollHorizontally() = 0;
     45    virtual bool canScrollVertically() = 0;
    4446    virtual void immediateScrollBy(const FloatSize&) = 0;
    4547    virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0;
Note: See TracChangeset for help on using the changeset viewer.