Title: [104366] trunk/Source/WebCore
Revision
104366
Author
ander...@apple.com
Date
2012-01-06 17:56:54 -0800 (Fri, 06 Jan 2012)

Log Message

Move more rubberbanding code into ScrollAnimatorMac::smoothScrollWithEvent
https://bugs.webkit.org/show_bug.cgi?id=75750

Reviewed by Sam Weinig.

* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::handleWheelEvent):
Move rubberbanding related code into smoothScrollWithEvent.

(WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
Move code here from handleWheelEvent and made the function return a boolean.

(WebCore::ScrollAnimatorMac::snapRubberBand):
Call the client.

(WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104365 => 104366)


--- trunk/Source/WebCore/ChangeLog	2012-01-07 01:55:18 UTC (rev 104365)
+++ trunk/Source/WebCore/ChangeLog	2012-01-07 01:56:54 UTC (rev 104366)
@@ -1,3 +1,24 @@
+2012-01-06  Anders Carlsson  <ander...@apple.com>
+
+        Move more rubberbanding code into ScrollAnimatorMac::smoothScrollWithEvent
+        https://bugs.webkit.org/show_bug.cgi?id=75750
+
+        Reviewed by Sam Weinig.
+
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::handleWheelEvent):
+        Move rubberbanding related code into smoothScrollWithEvent.
+
+        (WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
+        Move code here from handleWheelEvent and made the function return a boolean.
+
+        (WebCore::ScrollAnimatorMac::snapRubberBand):
+        Call the client.
+
+        (WebCore::ScrollAnimatorMac::snapRubberBandTimerFired):
+        Ditto.
+
 2012-01-06  Caio Marcelo de Oliveira Filho  <caio.olive...@openbossa.org>
 
         Use HashMap<OwnPtr> in SVGAttributeToPropertyMap

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (104365 => 104366)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2012-01-07 01:55:18 UTC (rev 104365)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2012-01-07 01:56:54 UTC (rev 104366)
@@ -141,7 +141,7 @@
     bool pinnedInDirection(float deltaX, float deltaY);
     void snapRubberBand();
     void snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*);
-    void smoothScrollWithEvent(const PlatformWheelEvent&);
+    bool smoothScrollWithEvent(const PlatformWheelEvent&);
     void beginScrollGesture();
     void endScrollGesture();
 

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (104365 => 104366)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-07 01:55:18 UTC (rev 104365)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-01-07 01:56:54 UTC (rev 104366)
@@ -995,17 +995,7 @@
         }
     }
 
-    bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
-    if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_scrollElasticityController.m_snapRubberbandTimerIsActive)) {
-        if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) {
-            m_scrollElasticityController.m_ignoreMomentumScrolls = false;
-            return true;
-        }
-        return false;
-    }
-
-    smoothScrollWithEvent(wheelEvent);
-    return true;
+    return smoothScrollWithEvent(wheelEvent);
 }
 
 void ScrollAnimatorMac::handleGestureEvent(const PlatformGestureEvent& gestureEvent)
@@ -1139,8 +1129,17 @@
     return false;
 }
 
-void ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEvent)
+bool ScrollAnimatorMac::smoothScrollWithEvent(const PlatformWheelEvent& wheelEvent)
 {
+    bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
+    if (m_scrollElasticityController.m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_scrollElasticityController.m_snapRubberbandTimerIsActive)) {
+        if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded) {
+            m_scrollElasticityController.m_ignoreMomentumScrolls = false;
+            return true;
+        }
+        return false;
+    }
+
     m_haveScrolledSincePageLoad = true;
 
     float deltaX = m_scrollElasticityController.m_overflowScrollDelta.width();
@@ -1279,6 +1278,8 @@
         m_scrollElasticityController.m_ignoreMomentumScrolls = false;
         m_scrollElasticityController.m_lastMomentumScrollTimestamp = 0;
     }
+
+    return true;
 }
 
 void ScrollAnimatorMac::beginScrollGesture()
@@ -1317,7 +1318,7 @@
     m_scrollElasticityController.m_origOrigin = FloatPoint();
     m_scrollElasticityController.m_origVelocity = FloatSize();
 
-    m_snapRubberBandTimer.startRepeating(1.0/60.0);
+    m_scrollElasticityController.m_client->startSnapRubberbandTimer();
     m_scrollElasticityController.m_snapRubberbandTimerIsActive = true;
 }
 
@@ -1377,7 +1378,7 @@
         if (fabs(delta.x()) >= 1 || fabs(delta.y()) >= 1) {
             FloatPoint newOrigin = m_scrollElasticityController.m_origOrigin + delta;
 
-            immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollElasticityController.m_client->stretchAmount());
+            m_scrollElasticityController.m_client->immediateScrollByWithoutContentEdgeConstraints(FloatSize(delta.x(), delta.y()) - m_scrollElasticityController.m_client->stretchAmount());
 
             FloatSize newStretch = m_scrollElasticityController.m_client->stretchAmount();
             
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to