Add and use ScrollElasticityControllerClient::absoluteScrollPosition
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jan 2012 22:58:50 +0000 (22:58 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jan 2012 22:58:50 +0000 (22:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75744

Reviewed by Dan Bernstein.

* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::absoluteScrollPosition):
(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
* platform/mac/ScrollElasticityController.h:

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

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

index 02f35f5..d641273 100755 (executable)
@@ -1,3 +1,16 @@
+2012-01-06  Anders Carlsson  <andersca@apple.com>
+
+        Add and use ScrollElasticityControllerClient::absoluteScrollPosition
+        https://bugs.webkit.org/show_bug.cgi?id=75744
+
+        Reviewed by Dan Bernstein.
+
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::absoluteScrollPosition):
+        (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
+        * platform/mac/ScrollElasticityController.h:
+
 2012-01-06  Adam Barth  <abarth@webkit.org>
 
         Move FrameDestructionObserver to its own file
index 265f248..a348b8a 100644 (file)
@@ -130,6 +130,7 @@ private:
     virtual bool pinnedInDirection(const FloatSize&) OVERRIDE;
     virtual bool canScrollHorizontally() OVERRIDE;
     virtual bool canScrollVertically() OVERRIDE;
+    virtual WebCore::IntPoint absoluteScrollPosition() OVERRIDE;
     virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) OVERRIDE;
     virtual void immediateScrollBy(const FloatSize&) OVERRIDE;
     virtual void startSnapRubberbandTimer() OVERRIDE;
index 7fec38b..52e20c9 100644 (file)
@@ -1068,6 +1068,11 @@ bool ScrollAnimatorMac::canScrollVertically()
     return scrollbar->enabled();
 }
 
+IntPoint ScrollAnimatorMac::absoluteScrollPosition()
+{
+    return m_scrollableArea->visibleContentRect().location() + m_scrollableArea->scrollOrigin();
+}
+
 void ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints(const FloatSize& delta)
 {
     m_scrollableArea->setConstrainsScrollingToContentEdge(false);
@@ -1350,7 +1355,7 @@ void ScrollAnimatorMac::snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*)
                 return;
             }
 
-            m_scrollElasticityController.m_origOrigin = (m_scrollableArea->visibleContentRect().location() + m_scrollableArea->scrollOrigin()) - m_scrollElasticityController.m_startStretch;
+            m_scrollElasticityController.m_origOrigin = m_scrollElasticityController.m_client->absoluteScrollPosition() - m_scrollElasticityController.m_startStretch;
             m_scrollElasticityController.m_origVelocity = m_scrollElasticityController.m_momentumVelocity;
 
             // Just like normal scrolling, prefer vertical rubberbanding
index faaec2a..0661844 100644 (file)
@@ -43,6 +43,10 @@ public:
     virtual bool pinnedInDirection(const FloatSize&) = 0;
     virtual bool canScrollHorizontally() = 0;
     virtual bool canScrollVertically() = 0;
+
+    // Return the absolute scroll position, not relative to the scroll origin.
+    virtual WebCore::IntPoint absoluteScrollPosition() = 0;
+
     virtual void immediateScrollBy(const FloatSize&) = 0;
     virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0;
     virtual void startSnapRubberbandTimer() = 0;