Title: [104312] trunk/Source/WebCore
Revision
104312
Author
ander...@apple.com
Date
2012-01-06 12:01:55 -0800 (Fri, 06 Jan 2012)

Log Message

Add ScrollElasticityControllerClient::immediateScrollBy
https://bugs.webkit.org/show_bug.cgi?id=75720

Reviewed by Andreas Kling.

Add a new ScrollElasticityControllerClient::immediateScrollBy client member function.
Also, make ScrollAnimatorMac::smoothScrollWithEvent calls go through the ScrollElasticityController
in preparation for moving that function to ScrollElasticityController.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104311 => 104312)


--- trunk/Source/WebCore/ChangeLog	2012-01-06 20:00:06 UTC (rev 104311)
+++ trunk/Source/WebCore/ChangeLog	2012-01-06 20:01:55 UTC (rev 104312)
@@ -1,3 +1,19 @@
+2012-01-06  Anders Carlsson  <ander...@apple.com>
+
+        Add ScrollElasticityControllerClient::immediateScrollBy
+        https://bugs.webkit.org/show_bug.cgi?id=75720
+
+        Reviewed by Andreas Kling.
+
+        Add a new ScrollElasticityControllerClient::immediateScrollBy client member function.
+        Also, make ScrollAnimatorMac::smoothScrollWithEvent calls go through the ScrollElasticityController
+        in preparation for moving that function to ScrollElasticityController.
+
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
+        * platform/mac/ScrollElasticityController.h:
+
 2012-01-06  Wei James  <james....@intel.com>
 
         Use VectorMath lib when possible to optimize the processing in WebAudio AudioBus

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (104311 => 104312)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2012-01-06 20:00:06 UTC (rev 104311)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2012-01-06 20:01:55 UTC (rev 104312)
@@ -123,13 +123,13 @@
     FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const;
 
     void immediateScrollTo(const FloatPoint&);
-    void immediateScrollBy(const FloatSize&);
 
 #if ENABLE(RUBBER_BANDING)
     /// ScrollElasticityControllerClient member functions.
     virtual IntSize stretchAmount() OVERRIDE;
     virtual bool pinnedInDirection(const FloatSize&) OVERRIDE;
     virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) OVERRIDE;
+    virtual void immediateScrollBy(const FloatSize&) OVERRIDE;
     virtual void startSnapRubberbandTimer() OVERRIDE;
     virtual void stopSnapRubberbandTimer() OVERRIDE;
 

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (104311 => 104312)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-06 20:00:06 UTC (rev 104311)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-06 20:01:55 UTC (rev 104312)
@@ -1144,7 +1144,7 @@
     bool isHorizontallyStretched = false;
     bool shouldStretch = false;
     
-    IntSize stretchAmount = m_scrollableArea->overhangAmount();
+    IntSize stretchAmount = m_scrollElasticityController.m_client->stretchAmount();
 
     isHorizontallyStretched = stretchAmount.width();
     isVerticallyStretched = stretchAmount.height();
@@ -1207,11 +1207,11 @@
         if (!(shouldStretch || isVerticallyStretched || isHorizontallyStretched)) {
             if (deltaY != 0) {
                 deltaY *= scrollWheelMultiplier();
-                immediateScrollBy(FloatSize(0, deltaY));
+                m_scrollElasticityController.m_client->immediateScrollBy(FloatSize(0, deltaY));
             }
             if (deltaX != 0) {
                 deltaX *= scrollWheelMultiplier();
-                immediateScrollBy(FloatSize(deltaX, 0));
+                m_scrollElasticityController.m_client->immediateScrollBy(FloatSize(deltaX, 0));
             }
         } else {
             if (!allowsHorizontalStretching()) {
@@ -1220,7 +1220,7 @@
             } else if ((deltaX != 0) && !isHorizontallyStretched && !pinnedInDirection(deltaX, 0)) {
                 deltaX *= scrollWheelMultiplier();
 
-                immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0));
+                m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(deltaX, 0));
                 deltaX = 0;
             }
             
@@ -1230,11 +1230,11 @@
             } else if ((deltaY != 0) && !isVerticallyStretched && !pinnedInDirection(0, deltaY)) {
                 deltaY *= scrollWheelMultiplier();
 
-                immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY));
+                m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(0, deltaY));
                 deltaY = 0;
             }
             
-            IntSize stretchAmount = m_scrollableArea->overhangAmount();
+            IntSize stretchAmount = m_scrollElasticityController.m_client->stretchAmount();
         
             if (m_scrollElasticityController.m_momentumScrollInProgress) {
                 if ((pinnedInDirection(eventCoalescedDeltaX, eventCoalescedDeltaY) || (fabsf(eventCoalescedDeltaX) + fabsf(eventCoalescedDeltaY) <= 0)) && m_scrollElasticityController.m_lastMomentumScrollTimestamp) {
@@ -1249,7 +1249,7 @@
 
             FloatSize dampedDelta(ceilf(elasticDeltaForReboundDelta(m_scrollElasticityController.m_stretchScrollForce.width())), ceilf(elasticDeltaForReboundDelta(m_scrollElasticityController.m_stretchScrollForce.height())));
 
-            immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);
+            m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(dampedDelta - stretchAmount);
         }
     }
 

Modified: trunk/Source/WebCore/platform/mac/ScrollElasticityController.h (104311 => 104312)


--- trunk/Source/WebCore/platform/mac/ScrollElasticityController.h	2012-01-06 20:00:06 UTC (rev 104311)
+++ trunk/Source/WebCore/platform/mac/ScrollElasticityController.h	2012-01-06 20:01:55 UTC (rev 104312)
@@ -41,6 +41,7 @@
 public:
     virtual IntSize stretchAmount() = 0;
     virtual bool pinnedInDirection(const FloatSize&) = 0;
+    virtual void immediateScrollBy(const FloatSize&) = 0;
     virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0;
     virtual void startSnapRubberbandTimer() = 0;
     virtual void stopSnapRubberbandTimer() = 0;
@@ -55,13 +56,13 @@
     void beginScrollGesture();
 
 private:
-    ScrollElasticityControllerClient* m_client;
-
     void stopSnapRubberbandTimer();
 
     // FIXME: These member variables should be private. They are currently public as a stop-gap measure, while
     // the rubber-band related code from ScrollAnimatorMac is being moved over.
 public:
+    ScrollElasticityControllerClient* m_client;
+
     bool m_inScrollGesture;
     bool m_momentumScrollInProgress;
     bool m_ignoreMomentumScrolls;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to