Title: [283355] trunk/Source/WebCore
Revision
283355
Author
simon.fra...@apple.com
Date
2021-09-30 18:30:29 -0700 (Thu, 30 Sep 2021)

Log Message

Rename snapRubberBand() to have a clearer name
https://bugs.webkit.org/show_bug.cgi?id=231051

Reviewed by Myles C. Maxfield.

It wasn't clear that snapRubberBand() started the timer, sometimes. Make that
more obvious.

* platform/ScrollingEffectsController.h:
* platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::handleWheelEvent):
(WebCore::ScrollingEffectsController::updateRubberBandAnimatingState):
(WebCore::ScrollingEffectsController::stopRubberbanding):
(WebCore::ScrollingEffectsController::stopRubberbandAnimation):
(WebCore::ScrollingEffectsController::startRubberbandAnimationIfNecessary):
(WebCore::ScrollingEffectsController::stopSnapRubberbandAnimation): Deleted.
(WebCore::ScrollingEffectsController::snapRubberBand): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283354 => 283355)


--- trunk/Source/WebCore/ChangeLog	2021-10-01 01:23:14 UTC (rev 283354)
+++ trunk/Source/WebCore/ChangeLog	2021-10-01 01:30:29 UTC (rev 283355)
@@ -1,3 +1,23 @@
+2021-09-30  Simon Fraser  <simon.fra...@apple.com>
+
+        Rename snapRubberBand() to have a clearer name
+        https://bugs.webkit.org/show_bug.cgi?id=231051
+
+        Reviewed by Myles C. Maxfield.
+
+        It wasn't clear that snapRubberBand() started the timer, sometimes. Make that
+        more obvious.
+
+        * platform/ScrollingEffectsController.h:
+        * platform/mac/ScrollingEffectsController.mm:
+        (WebCore::ScrollingEffectsController::handleWheelEvent):
+        (WebCore::ScrollingEffectsController::updateRubberBandAnimatingState):
+        (WebCore::ScrollingEffectsController::stopRubberbanding):
+        (WebCore::ScrollingEffectsController::stopRubberbandAnimation):
+        (WebCore::ScrollingEffectsController::startRubberbandAnimationIfNecessary):
+        (WebCore::ScrollingEffectsController::stopSnapRubberbandAnimation): Deleted.
+        (WebCore::ScrollingEffectsController::snapRubberBand): Deleted.
+
 2021-09-30  Cathie Chen  <cathiec...@igalia.com>
 
         [Performance] Optimize RenderLayer::clipCrossesPaintingBoundary

Modified: trunk/Source/WebCore/platform/ScrollingEffectsController.h (283354 => 283355)


--- trunk/Source/WebCore/platform/ScrollingEffectsController.h	2021-10-01 01:23:14 UTC (rev 283354)
+++ trunk/Source/WebCore/platform/ScrollingEffectsController.h	2021-10-01 01:30:29 UTC (rev 283355)
@@ -198,10 +198,10 @@
     void startDeferringWheelEventTestCompletionDueToScrollSnapping();
     void stopDeferringWheelEventTestCompletionDueToScrollSnapping();
 
+    void startRubberbandAnimationIfNecessary();
     void startRubberbandAnimation();
-    void stopSnapRubberbandAnimation();
+    void stopRubberbandAnimation();
 
-    void snapRubberBand();
     bool shouldRubberBandOnSide(BoxSide) const;
     bool isRubberBandInProgressInternal() const;
     void updateRubberBandingState();

Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (283354 => 283355)


--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-10-01 01:23:14 UTC (rev 283354)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm	2021-10-01 01:30:29 UTC (rev 283355)
@@ -151,7 +151,7 @@
         m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(stretchAmount.height()));
         m_unappliedOverscrollDelta = { };
 
-        stopSnapRubberbandAnimation();
+        stopRubberbandAnimation();
         updateRubberBandingState();
         return true;
     }
@@ -158,7 +158,7 @@
 
     if (wheelEvent.phase() == PlatformWheelEventPhase::Ended) {
         // FIXME: This triggers the rubberband timer even when we don't start rubberbanding.
-        snapRubberBand();
+        startRubberbandAnimationIfNecessary();
         updateRubberBandingState();
         return true;
     }
@@ -300,7 +300,7 @@
                 if ((!sideAffectedByEventDelta || m_client.isPinnedOnSide(*sideAffectedByEventDelta)) && m_lastMomentumScrollTimestamp) {
                     m_ignoreMomentumScrolls = true;
                     m_momentumScrollInProgress = false;
-                    snapRubberBand();
+                    startRubberbandAnimationIfNecessary();
                 }
             }
 
@@ -358,7 +358,7 @@
 
         if (m_startStretch.isZero()) {
             m_startStretch = m_client.stretchAmount();
-            if (m_startStretch == FloatSize()) {
+            if (m_startStretch.isZero()) {
                 stopRubberbanding();
                 return;
             }
@@ -406,7 +406,7 @@
         m_startTime = currentTime;
         m_startStretch = { };
         if (!isRubberBandInProgressInternal())
-            stopSnapRubberbandAnimation();
+            stopRubberbandAnimation();
     }
 
     updateRubberBandingState();
@@ -440,7 +440,7 @@
 
 void ScrollingEffectsController::stopRubberbanding()
 {
-    stopSnapRubberbandAnimation();
+    stopRubberbandAnimation();
     m_stretchScrollForce = { };
     m_startTime = { };
     m_startStretch = { };
@@ -457,7 +457,7 @@
     m_client.deferWheelEventTestCompletionForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::RubberbandInProgress);
 }
 
-void ScrollingEffectsController::stopSnapRubberbandAnimation()
+void ScrollingEffectsController::stopRubberbandAnimation()
 {
     m_client.didStopRubberbandSnapAnimation();
 
@@ -466,7 +466,7 @@
     m_client.removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::RubberbandInProgress);
 }
 
-void ScrollingEffectsController::snapRubberBand()
+void ScrollingEffectsController::startRubberbandAnimationIfNecessary()
 {
     auto timeDelta = WallTime::now() - m_lastMomentumScrollTimestamp;
     if (m_lastMomentumScrollTimestamp && timeDelta >= scrollVelocityZeroingTimeout)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to