<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[283019] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/283019">283019</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2021-09-23 16:54:41 -0700 (Thu, 23 Sep 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move the ScrollAnimationSmooth from ScrollAnimator into ScrollingEffectsController
https://bugs.webkit.org/show_bug.cgi?id=230720

Reviewed by Tim Horton.

ScrollingEffectsController is where all the ScrollAnimations will live. The first
step is to move ScrollAnimator's m_scrollAnimation there; this is used for
keyboard scrolling, and CSS smooth scrolling.

ScrollingEffectsController becomes a ScrollAnimationClient (and ScrollAnimator stops
being one), so needs a little bit more glue code.

Add type traits for ScrollAnimator subclasses because we need to downcast<> them
here and in future patches.

Move some code from ScrollAnimatorMac into ScrollAnimator since it's not platform
specific.

ScrollAnimatorGeneric is almost entirely gutted, and code pushed into ScrollingEffectsController.
Make a ScrollAnimationKinetic in ScrollingEffectsController for this code path.

* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
(WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis): Deleted.
* platform/ScrollAnimation.h:
(WebCore::ScrollAnimation::ScrollAnimation):
(WebCore::ScrollAnimation::type const):
* platform/ScrollAnimationKinetic.cpp:
(WebCore::ScrollAnimationKinetic::ScrollAnimationKinetic):
* platform/ScrollAnimationKinetic.h:
* platform/ScrollAnimationMomentum.cpp:
(WebCore::ScrollAnimationMomentum::ScrollAnimationMomentum):
* platform/ScrollAnimationMomentum.h:
* platform/ScrollAnimationSmooth.cpp:
(WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
* platform/ScrollAnimationSmooth.h:
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::ScrollAnimator):
(WebCore::ScrollAnimator::scroll):
(WebCore::ScrollAnimator::scrollToPositionWithoutAnimation):
(WebCore::ScrollAnimator::scrollToPositionWithAnimation):
(WebCore::ScrollAnimator::retargetRunningAnimation):
(WebCore::ScrollAnimator::setScrollBehaviorStatus):
(WebCore::ScrollAnimator::scrollBehaviorStatus const):
(WebCore::ScrollAnimator::adjustScrollPositionToBoundsIfNecessary):
(WebCore::ScrollAnimator::adjustScrollPositionIfNecessary const):
(WebCore::ScrollAnimator::immediateScrollByWithoutContentEdgeConstraints):
(WebCore::ScrollAnimator::immediateScrollBy):
(WebCore::ScrollAnimator::cancelAnimations):
(WebCore::ScrollAnimator::contentsSizeChanged):
(WebCore::ScrollAnimator::immediateScrollOnAxis): Deleted.
(WebCore::ScrollAnimator::contentsSizeChanged const): Deleted.
(WebCore::ScrollAnimator::scrollAnimationDidUpdate): Deleted.
(WebCore::ScrollAnimator::scrollAnimationDidEnd): Deleted.
(WebCore::ScrollAnimator::scrollExtentsForAnimation): Deleted.
* platform/ScrollAnimator.h:
* platform/ScrollingEffectsController.cpp:
(WebCore::ScrollingEffectsController::startAnimatedScrollToDestination):
(WebCore::ScrollingEffectsController::regargetAnimatedScroll):
(WebCore::ScrollingEffectsController::stopAnimatedScroll):
(WebCore::ScrollingEffectsController::processWheelEventForKineticScrolling):
(WebCore::ScrollingEffectsController::contentsSizeChanged):
(WebCore::ScrollingEffectsController::activeScrollSnapIndexForAxis const):
(WebCore::ScrollingEffectsController::scrollToOffsetForAnimation):
(WebCore::ScrollingEffectsController::scrollAnimationDidUpdate):
(WebCore::ScrollingEffectsController::scrollAnimationDidEnd):
(WebCore::ScrollingEffectsController::scrollExtentsForAnimation):
* platform/ScrollingEffectsController.h:
(WebCore::ScrollingEffectsControllerClient::rubberBandingStateChanged):
* platform/generic/ScrollAnimatorGeneric.cpp:
(WebCore::ScrollAnimatorGeneric::ScrollAnimatorGeneric):
(WebCore::ScrollAnimatorGeneric::handleWheelEvent):
(WebCore::ScrollAnimatorGeneric::scrollToPositionWithoutAnimation): Deleted.
(WebCore::ScrollAnimatorGeneric::scrollAnimationDidUpdate): Deleted.
* platform/generic/ScrollAnimatorGeneric.h:
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::adjustScrollPositionIfNecessary const): Deleted.
(WebCore::ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary): Deleted.
(WebCore::ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints): Deleted.
(WebCore::ScrollAnimatorMac::immediateScrollBy): Deleted.
* platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::updateScrollSnapAnimatingState):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeScrollingNodeDelegateMach">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeScrollingNodeDelegateMacmm">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimationh">trunk/Source/WebCore/platform/ScrollAnimation.h</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimationKineticcpp">trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimationKinetich">trunk/Source/WebCore/platform/ScrollAnimationKinetic.h</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimationMomentumcpp">trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimationMomentumh">trunk/Source/WebCore/platform/ScrollAnimationMomentum.h</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimationSmoothcpp">trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimationSmoothh">trunk/Source/WebCore/platform/ScrollAnimationSmooth.h</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimatorcpp">trunk/Source/WebCore/platform/ScrollAnimator.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollAnimatorh">trunk/Source/WebCore/platform/ScrollAnimator.h</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollingEffectsControllercpp">trunk/Source/WebCore/platform/ScrollingEffectsController.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollingEffectsControllerh">trunk/Source/WebCore/platform/ScrollingEffectsController.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgenericScrollAnimatorGenericcpp">trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgenericScrollAnimatorGenerich">trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacScrollAnimatorMach">trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacScrollAnimatorMacmm">trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacScrollingEffectsControllermm">trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/ChangeLog      2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -1,3 +1,89 @@
</span><ins>+2021-09-23  Simon Fraser  <simon.fraser@apple.com>
+
+        Move the ScrollAnimationSmooth from ScrollAnimator into ScrollingEffectsController
+        https://bugs.webkit.org/show_bug.cgi?id=230720
+
+        Reviewed by Tim Horton.
+
+        ScrollingEffectsController is where all the ScrollAnimations will live. The first
+        step is to move ScrollAnimator's m_scrollAnimation there; this is used for
+        keyboard scrolling, and CSS smooth scrolling.
+
+        ScrollingEffectsController becomes a ScrollAnimationClient (and ScrollAnimator stops
+        being one), so needs a little bit more glue code.
+
+        Add type traits for ScrollAnimator subclasses because we need to downcast<> them
+        here and in future patches.
+
+        Move some code from ScrollAnimatorMac into ScrollAnimator since it's not platform
+        specific.
+
+        ScrollAnimatorGeneric is almost entirely gutted, and code pushed into ScrollingEffectsController.
+        Make a ScrollAnimationKinetic in ScrollingEffectsController for this code path.
+
+        * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
+        * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+        (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis): Deleted.
+        * platform/ScrollAnimation.h:
+        (WebCore::ScrollAnimation::ScrollAnimation):
+        (WebCore::ScrollAnimation::type const):
+        * platform/ScrollAnimationKinetic.cpp:
+        (WebCore::ScrollAnimationKinetic::ScrollAnimationKinetic):
+        * platform/ScrollAnimationKinetic.h:
+        * platform/ScrollAnimationMomentum.cpp:
+        (WebCore::ScrollAnimationMomentum::ScrollAnimationMomentum):
+        * platform/ScrollAnimationMomentum.h:
+        * platform/ScrollAnimationSmooth.cpp:
+        (WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
+        * platform/ScrollAnimationSmooth.h:
+        * platform/ScrollAnimator.cpp:
+        (WebCore::ScrollAnimator::ScrollAnimator):
+        (WebCore::ScrollAnimator::scroll):
+        (WebCore::ScrollAnimator::scrollToPositionWithoutAnimation):
+        (WebCore::ScrollAnimator::scrollToPositionWithAnimation):
+        (WebCore::ScrollAnimator::retargetRunningAnimation):
+        (WebCore::ScrollAnimator::setScrollBehaviorStatus):
+        (WebCore::ScrollAnimator::scrollBehaviorStatus const):
+        (WebCore::ScrollAnimator::adjustScrollPositionToBoundsIfNecessary):
+        (WebCore::ScrollAnimator::adjustScrollPositionIfNecessary const):
+        (WebCore::ScrollAnimator::immediateScrollByWithoutContentEdgeConstraints):
+        (WebCore::ScrollAnimator::immediateScrollBy):
+        (WebCore::ScrollAnimator::cancelAnimations):
+        (WebCore::ScrollAnimator::contentsSizeChanged):
+        (WebCore::ScrollAnimator::immediateScrollOnAxis): Deleted.
+        (WebCore::ScrollAnimator::contentsSizeChanged const): Deleted.
+        (WebCore::ScrollAnimator::scrollAnimationDidUpdate): Deleted.
+        (WebCore::ScrollAnimator::scrollAnimationDidEnd): Deleted.
+        (WebCore::ScrollAnimator::scrollExtentsForAnimation): Deleted.
+        * platform/ScrollAnimator.h:
+        * platform/ScrollingEffectsController.cpp:
+        (WebCore::ScrollingEffectsController::startAnimatedScrollToDestination):
+        (WebCore::ScrollingEffectsController::regargetAnimatedScroll):
+        (WebCore::ScrollingEffectsController::stopAnimatedScroll):
+        (WebCore::ScrollingEffectsController::processWheelEventForKineticScrolling):
+        (WebCore::ScrollingEffectsController::contentsSizeChanged):
+        (WebCore::ScrollingEffectsController::activeScrollSnapIndexForAxis const):
+        (WebCore::ScrollingEffectsController::scrollToOffsetForAnimation):
+        (WebCore::ScrollingEffectsController::scrollAnimationDidUpdate):
+        (WebCore::ScrollingEffectsController::scrollAnimationDidEnd):
+        (WebCore::ScrollingEffectsController::scrollExtentsForAnimation):
+        * platform/ScrollingEffectsController.h:
+        (WebCore::ScrollingEffectsControllerClient::rubberBandingStateChanged):
+        * platform/generic/ScrollAnimatorGeneric.cpp:
+        (WebCore::ScrollAnimatorGeneric::ScrollAnimatorGeneric):
+        (WebCore::ScrollAnimatorGeneric::handleWheelEvent):
+        (WebCore::ScrollAnimatorGeneric::scrollToPositionWithoutAnimation): Deleted.
+        (WebCore::ScrollAnimatorGeneric::scrollAnimationDidUpdate): Deleted.
+        * platform/generic/ScrollAnimatorGeneric.h:
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::adjustScrollPositionIfNecessary const): Deleted.
+        (WebCore::ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary): Deleted.
+        (WebCore::ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints): Deleted.
+        (WebCore::ScrollAnimatorMac::immediateScrollBy): Deleted.
+        * platform/mac/ScrollingEffectsController.mm:
+        (WebCore::ScrollingEffectsController::updateScrollSnapAnimatingState):
+
</ins><span class="cx"> 2021-09-23  Nikos Mouchtaris  <nmouchtaris@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Implement atan, acos, asin, atan2 calc functions
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeScrollingNodeDelegateMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h  2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h     2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -82,6 +82,9 @@
</span><span class="cx">     RectEdges<bool> edgePinnedState() const final;
</span><span class="cx">     bool allowsHorizontalScrolling() const final;
</span><span class="cx">     bool allowsVerticalScrolling() const final;
</span><ins>+    void setScrollBehaviorStatus(ScrollBehaviorStatus status) final { m_scrollBehaviorStatus = status; }
+    ScrollBehaviorStatus scrollBehaviorStatus() const final { return m_scrollBehaviorStatus; }
+
</ins><span class="cx">     bool shouldRubberBandInDirection(ScrollDirection) const final;
</span><span class="cx">     void immediateScrollBy(const FloatSize&) final;
</span><span class="cx">     void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) final;
</span><span class="lines">@@ -93,7 +96,6 @@
</span><span class="cx">     void scrollControllerAnimationTimerFired();
</span><span class="cx"> 
</span><span class="cx">     FloatPoint scrollOffset() const final;
</span><del>-    void immediateScrollOnAxis(ScrollEventAxis, float delta) final;
</del><span class="cx">     float pageScaleFactor() const final;
</span><span class="cx">     void willStartScrollSnapAnimation() final;
</span><span class="cx">     void didStopScrollSnapAnimation() final;
</span><span class="lines">@@ -108,6 +110,7 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<RunLoop::Timer<ScrollingTreeScrollingNodeDelegateMac>> m_scrollControllerAnimationTimer;
</span><span class="cx"> 
</span><ins>+    ScrollBehaviorStatus m_scrollBehaviorStatus { ScrollBehaviorStatus::NotInAnimation };
</ins><span class="cx">     bool m_inMomentumPhase { false };
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeScrollingNodeDelegateMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm    2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -379,18 +379,6 @@
</span><span class="cx">     return ScrollableArea::scrollOffsetFromPosition(currentScrollPosition(), scrollOrigin());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis(ScrollEventAxis axis, float delta)
-{
-    const FloatPoint& scrollPosition = currentScrollPosition();
-    FloatPoint change;
-    if (axis == ScrollEventAxis::Horizontal)
-        change = FloatPoint(scrollPosition.x() + delta, scrollPosition.y());
-    else
-        change = FloatPoint(scrollPosition.x(), scrollPosition.y() + delta);
-
-    immediateScrollBy(change - scrollPosition);
-}
-
</del><span class="cx"> float ScrollingTreeScrollingNodeDelegateMac::pageScaleFactor() const
</span><span class="cx"> {
</span><span class="cx">     // FIXME: What should this return for non-root frames, and overflow?
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimation.h (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimation.h  2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollAnimation.h     2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -47,10 +47,19 @@
</span><span class="cx"> class ScrollAnimation {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    ScrollAnimation(ScrollAnimationClient& client)
</del><ins>+    enum class Type {
+        Smooth,
+        Kinetic,
+        Momentum,
+    };
+
+    ScrollAnimation(Type animationType, ScrollAnimationClient& client)
</ins><span class="cx">         : m_client(client)
</span><ins>+        , m_animationType(animationType)
</ins><span class="cx">     { }
</span><span class="cx">     virtual ~ScrollAnimation() = default;
</span><ins>+    
+    Type type() const { return m_animationType; }
</ins><span class="cx"> 
</span><span class="cx">     virtual bool retargetActiveAnimation(const FloatPoint& newDestinationOffset) = 0;
</span><span class="cx">     virtual void stop() = 0;
</span><span class="lines">@@ -62,6 +71,12 @@
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     ScrollAnimationClient& m_client;
</span><ins>+    const Type m_animationType;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><ins>+
+#define SPECIALIZE_TYPE_TRAITS_SCROLL_ANIMATION(ToValueTypeName, predicate) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(ToValueTypeName) \
+    static bool isType(const WebCore::ScrollAnimation& scrollAnimation) { return scrollAnimation.predicate; } \
+SPECIALIZE_TYPE_TRAITS_END()
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimationKineticcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp 2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollAnimationKinetic.cpp    2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -114,7 +114,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ScrollAnimationKinetic::ScrollAnimationKinetic(ScrollAnimationClient& client)
</span><del>-    : ScrollAnimation(client)
</del><ins>+    : ScrollAnimation(Type::Kinetic, client)
</ins><span class="cx">     , m_animationTimer(RunLoop::current(), this, &ScrollAnimationKinetic::animationTimerFired)
</span><span class="cx"> {
</span><span class="cx"> #if USE(GLIB_EVENT_LOOP)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimationKinetich"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimationKinetic.h (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimationKinetic.h   2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollAnimationKinetic.h      2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx">     ScrollAnimationKinetic(ScrollAnimationClient&);
</span><span class="cx">     virtual ~ScrollAnimationKinetic();
</span><span class="cx"> 
</span><ins>+    // FIXME: Velocity should be a FloatSize.
</ins><span class="cx">     bool startAnimatedScrollWithInitialVelocity(const FloatPoint& initialOffset, const FloatPoint& velocity, bool mayHScroll, bool mayVScroll);
</span><span class="cx"> 
</span><span class="cx">     bool retargetActiveAnimation(const FloatPoint& newOffset) final;
</span><span class="lines">@@ -86,3 +87,5 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><ins>+
+SPECIALIZE_TYPE_TRAITS_SCROLL_ANIMATION(WebCore::ScrollAnimationKinetic, type() == WebCore::ScrollAnimation::Type::Kinetic)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimationMomentumcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp        2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollAnimationMomentum.cpp   2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> ScrollAnimationMomentum::ScrollAnimationMomentum(ScrollAnimationClient& client)
</span><del>-    : ScrollAnimation(client)
</del><ins>+    : ScrollAnimation(Type::Momentum, client)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimationMomentumh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimationMomentum.h (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimationMomentum.h  2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollAnimationMomentum.h     2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -51,3 +51,5 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><ins>+
+SPECIALIZE_TYPE_TRAITS_SCROLL_ANIMATION(WebCore::ScrollAnimationMomentum, type() == WebCore::ScrollAnimation::Type::Momentum)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimationSmoothcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp  2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp     2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> static const Seconds maxAnimationDuration { 200_ms };
</span><span class="cx"> 
</span><span class="cx"> ScrollAnimationSmooth::ScrollAnimationSmooth(ScrollAnimationClient& client)
</span><del>-    : ScrollAnimation(client)
</del><ins>+    : ScrollAnimation(Type::Smooth, client)
</ins><span class="cx">     , m_animationTimer(RunLoop::current(), this, &ScrollAnimationSmooth::animationTimerFired)
</span><span class="cx">     , m_easeInOutTimingFunction(CubicBezierTimingFunction::create(CubicBezierTimingFunction::TimingFunctionPreset::EaseInOut))
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimationSmoothh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.h (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.h    2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.h       2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -73,3 +73,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><ins>+SPECIALIZE_TYPE_TRAITS_SCROLL_ANIMATION(WebCore::ScrollAnimationSmooth, type() == WebCore::ScrollAnimation::Type::Smooth)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimator.cpp 2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp    2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx"> #include "KeyboardScrollingAnimator.h"
</span><span class="cx"> #include "LayoutSize.h"
</span><span class="cx"> #include "PlatformWheelEvent.h"
</span><del>-#include "ScrollAnimationSmooth.h"
</del><span class="cx"> #include "ScrollableArea.h"
</span><span class="cx"> #include "ScrollbarsController.h"
</span><span class="cx"> #include "ScrollingEffectsController.h"
</span><span class="lines">@@ -55,7 +54,6 @@
</span><span class="cx">     : m_scrollableArea(scrollableArea)
</span><span class="cx">     , m_scrollController(*this)
</span><span class="cx">     , m_scrollControllerAnimationTimer(*this, &ScrollAnimator::scrollControllerAnimationTimerFired)
</span><del>-    , m_scrollAnimation(makeUnique<ScrollAnimationSmooth>(*this))
</del><span class="cx">     , m_keyboardScrollingAnimator(makeUnique<KeyboardScrollingAnimator>(*this, m_scrollController))
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -93,7 +91,7 @@
</span><span class="cx">         auto startOffset = offsetFromPosition(m_currentPosition);
</span><span class="cx">         auto extents = scrollExtents();
</span><span class="cx">         auto destinationOffset = (startOffset + delta).constrainedBetween(extents.minimumScrollOffset(), extents.maximumScrollOffset());
</span><del>-        return m_scrollAnimation->startAnimatedScrollToDestination(startOffset, destinationOffset);
</del><ins>+        return m_scrollController.startAnimatedScrollToDestination(startOffset, destinationOffset);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return scrollToPositionWithoutAnimation(currentPosition() + delta);
</span><span class="lines">@@ -109,7 +107,7 @@
</span><span class="cx">     if (adjustedPosition == currentPosition && adjustedPosition == scrollableArea().scrollPosition() && !scrollableArea().scrollOriginChanged())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    m_scrollAnimation->stop();
</del><ins>+    m_scrollController.stopAnimatedScroll();
</ins><span class="cx"> 
</span><span class="cx">     setCurrentPosition(adjustedPosition, NotifyScrollableArea::Yes);
</span><span class="cx">     return true;
</span><span class="lines">@@ -121,8 +119,8 @@
</span><span class="cx">     if (!positionChanged && !scrollableArea().scrollOriginChanged())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    m_scrollAnimation->startAnimatedScrollToDestination(offsetFromPosition(m_currentPosition), offsetFromPosition(newPosition));
-    scrollableArea().setScrollBehaviorStatus(ScrollBehaviorStatus::InNonNativeAnimation);
</del><ins>+    m_scrollController.startAnimatedScrollToDestination(offsetFromPosition(m_currentPosition), offsetFromPosition(newPosition));
+    setScrollBehaviorStatus(ScrollBehaviorStatus::InNonNativeAnimation);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -129,8 +127,7 @@
</span><span class="cx"> void ScrollAnimator::retargetRunningAnimation(const FloatPoint& newPosition)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(scrollableArea().currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation);
</span><del>-    ASSERT(m_scrollAnimation->isActive());
-    m_scrollAnimation->retargetActiveAnimation(newPosition);
</del><ins>+    m_scrollController.regargetAnimatedScroll(offsetFromPosition(newPosition));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatPoint ScrollAnimator::offsetFromPosition(const FloatPoint& position) const
</span><span class="lines">@@ -290,6 +287,16 @@
</span><span class="cx">     return m_scrollableArea.allowsVerticalScrolling();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollAnimator::setScrollBehaviorStatus(ScrollBehaviorStatus status)
+{
+    m_scrollableArea.setScrollBehaviorStatus(status);
+}
+
+ScrollBehaviorStatus ScrollAnimator::scrollBehaviorStatus() const
+{
+    return m_scrollableArea.currentScrollBehaviorStatus();
+}
+
</ins><span class="cx"> #if HAVE(RUBBER_BANDING)
</span><span class="cx"> IntSize ScrollAnimator::stretchAmount() const
</span><span class="cx"> {
</span><span class="lines">@@ -313,18 +320,43 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-// FIXME: Unused.
-void ScrollAnimator::immediateScrollOnAxis(ScrollEventAxis axis, float delta)
</del><ins>+void ScrollAnimator::adjustScrollPositionToBoundsIfNecessary()
</ins><span class="cx"> {
</span><del>-    FloatSize deltaSize;
-    if (axis == ScrollEventAxis::Horizontal)
-        deltaSize.setWidth(delta);
-    else
-        deltaSize.setHeight(delta);
</del><ins>+    bool currentlyConstrainsToContentEdge = m_scrollableArea.constrainsScrollingToContentEdge();
+    m_scrollableArea.setConstrainsScrollingToContentEdge(true);
</ins><span class="cx"> 
</span><del>-    scrollToPositionWithoutAnimation(currentPosition() + deltaSize);
</del><ins>+    auto currentScrollPosition = m_scrollableArea.scrollPosition();
+    auto constrainedPosition = m_scrollableArea.constrainScrollPosition(currentScrollPosition);
+    immediateScrollBy(constrainedPosition - currentScrollPosition);
+
+    m_scrollableArea.setConstrainsScrollingToContentEdge(currentlyConstrainsToContentEdge);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+FloatPoint ScrollAnimator::adjustScrollPositionIfNecessary(const FloatPoint& position) const
+{
+    if (!m_scrollableArea.constrainsScrollingToContentEdge())
+        return position;
+
+    return m_scrollableArea.constrainScrollPosition(ScrollPosition(position));
+}
+
+void ScrollAnimator::immediateScrollByWithoutContentEdgeConstraints(const FloatSize& delta)
+{
+    m_scrollableArea.setConstrainsScrollingToContentEdge(false);
+    immediateScrollBy(delta);
+    m_scrollableArea.setConstrainsScrollingToContentEdge(true);
+}
+
+void ScrollAnimator::immediateScrollBy(const FloatSize& delta)
+{
+    FloatPoint currentPosition = this->currentPosition();
+    FloatPoint newPosition = adjustScrollPositionIfNecessary(currentPosition + delta);
+    if (newPosition == currentPosition)
+        return;
+
+    setCurrentPosition(newPosition, NotifyScrollableArea::Yes);
+}
+
</ins><span class="cx"> ScrollExtents ScrollAnimator::scrollExtents() const
</span><span class="cx"> {
</span><span class="cx">     return {
</span><span class="lines">@@ -385,13 +417,13 @@
</span><span class="cx"> 
</span><span class="cx"> void ScrollAnimator::cancelAnimations()
</span><span class="cx"> {
</span><del>-    m_scrollAnimation->stop();
</del><ins>+    m_scrollController.stopAnimatedScroll();
</ins><span class="cx">     m_scrollableArea.scrollbarsController().cancelAnimations();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollAnimator::contentsSizeChanged() const
</del><ins>+void ScrollAnimator::contentsSizeChanged()
</ins><span class="cx"> {
</span><del>-    m_scrollAnimation->updateScrollExtents();
</del><ins>+    m_scrollController.contentsSizeChanged();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatPoint ScrollAnimator::scrollOffsetAdjustedForSnapping(const FloatPoint& offset, ScrollSnapPointSelectionMethod method) const
</span><span class="lines">@@ -423,20 +455,4 @@
</span><span class="cx">     return m_scrollController.adjustedScrollDestination(axis, newOffset, velocityInScrollAxis, originalOffset);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollAnimator::scrollAnimationDidUpdate(ScrollAnimation&, const FloatPoint& currentOffset)
-{
-    setCurrentPosition(positionFromOffset(currentOffset), NotifyScrollableArea::Yes);
-}
-
-void ScrollAnimator::scrollAnimationDidEnd(ScrollAnimation&)
-{
-    m_scrollableArea.setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation);
-}
-
-ScrollExtents ScrollAnimator::scrollExtentsForAnimation(ScrollAnimation&)
-{
-    return scrollExtents();
-}
-
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollAnimatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollAnimator.h   2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h      2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include "FloatPoint.h"
</span><span class="cx"> #include "PlatformWheelEvent.h"
</span><del>-#include "ScrollAnimation.h"
</del><span class="cx"> #include "ScrollingEffectsController.h"
</span><span class="cx"> #include "Timer.h"
</span><span class="cx"> #include "WheelEventTestMonitor.h"
</span><span class="lines">@@ -52,7 +51,7 @@
</span><span class="cx"> 
</span><span class="cx"> class ScrollingEffectsControllerTimer;
</span><span class="cx"> 
</span><del>-class ScrollAnimator : private ScrollingEffectsControllerClient, public ScrollAnimationClient {
</del><ins>+class ScrollAnimator : private ScrollingEffectsControllerClient {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     static std::unique_ptr<ScrollAnimator> create(ScrollableArea&);
</span><span class="lines">@@ -78,7 +77,7 @@
</span><span class="cx">     virtual bool scrollToPositionWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped);
</span><span class="cx">     bool scrollToPositionWithAnimation(const FloatPoint&);
</span><span class="cx"> 
</span><del>-    void retargetRunningAnimation(const FloatPoint&);
</del><ins>+    void retargetRunningAnimation(const FloatPoint& newPosition);
</ins><span class="cx"> 
</span><span class="cx">     virtual bool handleWheelEvent(const PlatformWheelEvent&);
</span><span class="cx"> 
</span><span class="lines">@@ -98,7 +97,7 @@
</span><span class="cx">     virtual bool isRubberBandInProgress() const { return false; }
</span><span class="cx">     virtual bool isScrollSnapInProgress() const { return false; }
</span><span class="cx"> 
</span><del>-    void contentsSizeChanged() const;
</del><ins>+    void contentsSizeChanged();
</ins><span class="cx"> 
</span><span class="cx">     enum NotifyScrollableArea : bool {
</span><span class="cx">         No, Yes
</span><span class="lines">@@ -122,9 +121,6 @@
</span><span class="cx"> protected:
</span><span class="cx">     virtual bool platformAllowsScrollAnimation() const { return true; }
</span><span class="cx"> 
</span><del>-    // ScrollAnimationClient
-    void scrollAnimationDidUpdate(ScrollAnimation&, const FloatPoint& currentOffset) override;
-
</del><span class="cx"> private:
</span><span class="cx">     void notifyPositionChanged(const FloatSize& delta);
</span><span class="cx"> 
</span><span class="lines">@@ -134,6 +130,7 @@
</span><span class="cx">     FloatPoint offsetFromPosition(const FloatPoint& position) const;
</span><span class="cx">     FloatPoint positionFromOffset(const FloatPoint& offset) const;
</span><span class="cx"> 
</span><ins>+    FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const;
</ins><span class="cx"> 
</span><span class="cx">     // ScrollingEffectsControllerClient.
</span><span class="cx">     std::unique_ptr<ScrollingEffectsControllerTimer> createTimer(Function<void()>&&) final;
</span><span class="lines">@@ -141,7 +138,6 @@
</span><span class="cx">     void stopAnimationCallback(ScrollingEffectsController&) final;
</span><span class="cx"> 
</span><span class="cx">     FloatPoint scrollOffset() const final;
</span><del>-    void immediateScrollOnAxis(ScrollEventAxis, float delta) final;
</del><span class="cx">     float pageScaleFactor() const final;
</span><span class="cx">     ScrollExtents scrollExtents() const final;
</span><span class="cx"> 
</span><span class="lines">@@ -148,6 +144,13 @@
</span><span class="cx">     bool allowsHorizontalScrolling() const final;
</span><span class="cx">     bool allowsVerticalScrolling() const final;
</span><span class="cx"> 
</span><ins>+    void setScrollBehaviorStatus(ScrollBehaviorStatus) final;
+    ScrollBehaviorStatus scrollBehaviorStatus() const final;
+
+    void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) final;
+    void immediateScrollBy(const FloatSize&) final;
+    void adjustScrollPositionToBoundsIfNecessary() final;
+
</ins><span class="cx"> #if HAVE(RUBBER_BANDING)
</span><span class="cx">     IntSize stretchAmount() const final;
</span><span class="cx">     RectEdges<bool> edgePinnedState() const final;
</span><span class="lines">@@ -159,10 +162,6 @@
</span><span class="cx">     void removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) const final;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    // ScrollAnimationClient
-    void scrollAnimationDidEnd(ScrollAnimation&) final;
-    ScrollExtents scrollExtentsForAnimation(ScrollAnimation&) final;
-
</del><span class="cx">     static FloatSize deltaFromStep(ScrollbarOrientation, float step, float multiplier);
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="lines">@@ -172,7 +171,6 @@
</span><span class="cx">     Timer m_scrollControllerAnimationTimer;
</span><span class="cx">     FloatPoint m_currentPosition;
</span><span class="cx"> 
</span><del>-    std::unique_ptr<ScrollAnimationSmooth> m_scrollAnimation;
</del><span class="cx">     std::unique_ptr<KeyboardScrollingAnimator> m_keyboardScrollingAnimator;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollingEffectsControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollingEffectsController.cpp (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollingEffectsController.cpp     2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollingEffectsController.cpp        2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -30,6 +30,8 @@
</span><span class="cx"> #include "LayoutSize.h"
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "PlatformWheelEvent.h"
</span><ins>+#include "ScrollAnimationKinetic.h"
+#include "ScrollAnimationSmooth.h"
</ins><span class="cx"> #include "ScrollableArea.h"
</span><span class="cx"> #include "WheelEventTestMonitor.h"
</span><span class="cx"> #include <wtf/text/TextStream.h>
</span><span class="lines">@@ -76,6 +78,59 @@
</span><span class="cx">     setIsAnimatingKeyboardScrolling(false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ScrollingEffectsController::startAnimatedScrollToDestination(FloatPoint startOffset, FloatPoint destinationOffset)
+{
+    if (m_currentAnimation)
+        m_currentAnimation->stop();
+
+    m_currentAnimation = makeUnique<ScrollAnimationSmooth>(*this);
+    return downcast<ScrollAnimationSmooth>(*m_currentAnimation).startAnimatedScrollToDestination(startOffset, destinationOffset);
+}
+
+bool ScrollingEffectsController::regargetAnimatedScroll(FloatPoint newDestinationOffset)
+{
+    if (!is<ScrollAnimationSmooth>(m_currentAnimation.get()))
+        return false;
+    
+    ASSERT(m_currentAnimation->isActive());
+    return downcast<ScrollAnimationSmooth>(*m_currentAnimation).retargetActiveAnimation(newDestinationOffset);
+}
+
+void ScrollingEffectsController::stopAnimatedScroll()
+{
+    if (m_currentAnimation)
+        m_currentAnimation->stop();
+}
+
+bool ScrollingEffectsController::processWheelEventForKineticScrolling(const PlatformWheelEvent& event)
+{
+#if ENABLE(KINETIC_SCROLLING)
+    if (m_currentAnimation && !is<ScrollAnimationKinetic>(m_currentAnimation.get())) {
+        m_currentAnimation->stop();
+        m_currentAnimation = nullptr;
+    }
+
+    if (!m_currentAnimation)
+        m_currentAnimation = WTF::makeUnique<ScrollAnimationKinetic>(*this);
+
+    auto& kineticAnimation = downcast<ScrollAnimationKinetic>(*m_currentAnimation);
+    kineticAnimation.appendToScrollHistory(event);
+
+    if (event.isEndOfNonMomentumScroll()) {
+        kineticAnimation.startAnimatedScrollWithInitialVelocity(m_client.scrollOffset(), kineticAnimation.computeVelocity(), m_client.allowsHorizontalScrolling(), m_client.allowsVerticalScrolling());
+        return true;
+    }
+    if (event.isTransitioningToMomentumScroll()) {
+        kineticAnimation.clearScrollHistory();
+        kineticAnimation.startAnimatedScrollWithInitialVelocity(m_client.scrollOffset(), event.swipeVelocity(), m_client.allowsHorizontalScrolling(), m_client.allowsVerticalScrolling());
+        return true;
+    }
+#else
+    UNUSED_PARAM(event);
+#endif
+    return false;
+}
+
</ins><span class="cx"> void ScrollingEffectsController::setIsAnimatingRubberBand(bool isAnimatingRubberBand)
</span><span class="cx"> {
</span><span class="cx">     if (isAnimatingRubberBand == m_isAnimatingRubberBand)
</span><span class="lines">@@ -103,6 +158,12 @@
</span><span class="cx">     startOrStopAnimationCallbacks();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollingEffectsController::contentsSizeChanged()
+{
+    if (m_currentAnimation)
+        m_currentAnimation->updateScrollExtents();
+}
+
</ins><span class="cx"> bool ScrollingEffectsController::usesScrollSnap() const
</span><span class="cx"> {
</span><span class="cx">     return !!m_scrollSnapState;
</span><span class="lines">@@ -136,6 +197,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!usesScrollSnap())
</span><span class="cx">         return std::nullopt;
</span><ins>+
</ins><span class="cx">     return m_scrollSnapState->activeSnapIndexForAxis(axis);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -184,6 +246,28 @@
</span><span class="cx">     m_client.keyboardScrollingAnimator()->updateKeyboardScrollPosition(currentTime);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollingEffectsController::scrollToOffsetForAnimation(const FloatPoint& scrollOffset)
+{
+    auto currentOffset = m_client.scrollOffset();
+    auto scrollDelta = scrollOffset - currentOffset;
+    m_client.immediateScrollBy(scrollDelta);
+}
+
+void ScrollingEffectsController::scrollAnimationDidUpdate(ScrollAnimation&, const FloatPoint& currentOffset)
+{
+    scrollToOffsetForAnimation(currentOffset);
+}
+
+void ScrollingEffectsController::scrollAnimationDidEnd(ScrollAnimation&)
+{
+    m_client.setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation);
+}
+
+ScrollExtents ScrollingEffectsController::scrollExtentsForAnimation(ScrollAnimation&)
+{
+    return m_client.scrollExtents();
+}
+
</ins><span class="cx"> // Currently, only Mac supports momentum srolling-based scrollsnapping and rubber banding
</span><span class="cx"> // so all of these methods are a noop on non-Mac platforms.
</span><span class="cx"> #if !PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollingEffectsControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollingEffectsController.h (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollingEffectsController.h       2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/ScrollingEffectsController.h  2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include "FloatSize.h"
</span><span class="cx"> 
</span><span class="cx"> #include "RectEdges.h"
</span><ins>+#include "ScrollAnimation.h"
</ins><span class="cx"> #include "ScrollSnapAnimatorState.h"
</span><span class="cx"> #include "ScrollSnapOffsetsInfo.h"
</span><span class="cx"> #include "ScrollTypes.h"
</span><span class="lines">@@ -80,6 +81,17 @@
</span><span class="cx">     virtual bool allowsHorizontalScrolling() const = 0;
</span><span class="cx">     virtual bool allowsVerticalScrolling() const = 0;
</span><span class="cx"> 
</span><ins>+    // FIXME: Maybe ScrollBehaviorStatus should be stored on ScrollingEffectsController.
+    virtual void setScrollBehaviorStatus(ScrollBehaviorStatus) = 0;
+    virtual ScrollBehaviorStatus scrollBehaviorStatus() const = 0;
+
+    virtual void immediateScrollBy(const FloatSize&) = 0;
+    virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0;
+
+    // If the current scroll position is within the overhang area, this function will cause
+    // the page to scroll to the nearest boundary point.
+    virtual void adjustScrollPositionToBoundsIfNecessary() = 0;
+
</ins><span class="cx"> #if HAVE(RUBBER_BANDING)
</span><span class="cx">     virtual bool allowsHorizontalStretching(const PlatformWheelEvent&) const = 0;
</span><span class="cx">     virtual bool allowsVerticalStretching(const PlatformWheelEvent&) const = 0;
</span><span class="lines">@@ -92,17 +104,10 @@
</span><span class="cx">     virtual bool shouldRubberBandInDirection(ScrollDirection) const = 0;
</span><span class="cx"> 
</span><span class="cx">     // FIXME: use ScrollClamping to collapse these to one.
</span><del>-    virtual void immediateScrollBy(const FloatSize&) = 0;
-    virtual void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) = 0;
-
</del><span class="cx">     virtual void willStartRubberBandSnapAnimation() { }
</span><span class="cx">     virtual void didStopRubberbandSnapAnimation() { }
</span><span class="cx"> 
</span><span class="cx">     virtual void rubberBandingStateChanged(bool) { }
</span><del>-
-    // If the current scroll position is within the overhang area, this function will cause
-    // the page to scroll to the nearest boundary point.
-    virtual void adjustScrollPositionToBoundsIfNecessary() = 0;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     virtual void deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) const { /* Do nothing */ }
</span><span class="lines">@@ -109,7 +114,6 @@
</span><span class="cx">     virtual void removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) const { /* Do nothing */ }
</span><span class="cx"> 
</span><span class="cx">     virtual FloatPoint scrollOffset() const = 0;
</span><del>-    virtual void immediateScrollOnAxis(ScrollEventAxis, float delta) = 0;
</del><span class="cx">     virtual void willStartScrollSnapAnimation() { }
</span><span class="cx">     virtual void didStopScrollSnapAnimation() { }
</span><span class="cx">     virtual float pageScaleFactor() const = 0;
</span><span class="lines">@@ -116,17 +120,24 @@
</span><span class="cx">     virtual ScrollExtents scrollExtents() const = 0;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class ScrollingEffectsController {
</del><ins>+class ScrollingEffectsController : public ScrollAnimationClient {
</ins><span class="cx">     WTF_MAKE_NONCOPYABLE(ScrollingEffectsController);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><span class="cx">     explicit ScrollingEffectsController(ScrollingEffectsControllerClient&);
</span><del>-    ~ScrollingEffectsController();
</del><ins>+    virtual ~ScrollingEffectsController();
</ins><span class="cx"> 
</span><span class="cx">     bool usesScrollSnap() const;
</span><span class="cx">     void stopAllTimers();
</span><span class="cx">     void scrollPositionChanged();
</span><span class="cx"> 
</span><ins>+    bool startAnimatedScrollToDestination(FloatPoint startOffset, FloatPoint destinationOffset);
+    bool regargetAnimatedScroll(FloatPoint newDestinationOffset);
+    void stopAnimatedScroll();
+
+    // FIXME: Hack for ScrollAnimatorGeneric. Needs cleanup.
+    bool processWheelEventForKineticScrolling(const PlatformWheelEvent&);
+
</ins><span class="cx">     void beginKeyboardScrolling();
</span><span class="cx">     void stopKeyboardScrolling();
</span><span class="cx">     
</span><span class="lines">@@ -134,6 +145,8 @@
</span><span class="cx">     void animationCallback(MonotonicTime);
</span><span class="cx"> 
</span><span class="cx">     void updateGestureInProgressState(const PlatformWheelEvent&);
</span><ins>+    
+    void contentsSizeChanged();
</ins><span class="cx"> 
</span><span class="cx">     void setSnapOffsetsInfo(const LayoutScrollSnapOffsetsInfo&);
</span><span class="cx">     const LayoutScrollSnapOffsetsInfo* snapOffsetsInfo() const;
</span><span class="lines">@@ -162,12 +175,10 @@
</span><span class="cx">     // Returns true if handled.
</span><span class="cx">     bool processWheelEventForScrollSnap(const PlatformWheelEvent&);
</span><span class="cx"> 
</span><del>-#if HAVE(RUBBER_BANDING)
</del><span class="cx">     void stopRubberbanding();
</span><span class="cx">     bool isRubberBandInProgress() const;
</span><span class="cx">     RectEdges<bool> rubberBandingEdges() const { return m_rubberBandingEdges; }
</span><span class="cx"> #endif
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void updateScrollSnapAnimatingState(MonotonicTime);
</span><span class="lines">@@ -188,7 +199,6 @@
</span><span class="cx">     void startDeferringWheelEventTestCompletionDueToScrollSnapping();
</span><span class="cx">     void stopDeferringWheelEventTestCompletionDueToScrollSnapping();
</span><span class="cx"> 
</span><del>-#if HAVE(RUBBER_BANDING)
</del><span class="cx">     void startRubberbandAnimation();
</span><span class="cx">     void stopSnapRubberbandAnimation();
</span><span class="cx"> 
</span><span class="lines">@@ -199,11 +209,19 @@
</span><span class="cx">     void updateRubberBandingState();
</span><span class="cx">     void updateRubberBandingEdges(IntSize clientStretch);
</span><span class="cx"> #endif
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx">     void startOrStopAnimationCallbacks();
</span><ins>+    void scrollToOffsetForAnimation(const FloatPoint& scrollOffset);
</ins><span class="cx"> 
</span><ins>+    // ScrollAnimationClient
+    void scrollAnimationDidUpdate(ScrollAnimation&, const FloatPoint& /* currentOffset */) final;
+    void scrollAnimationDidEnd(ScrollAnimation&) final;
+    ScrollExtents scrollExtentsForAnimation(ScrollAnimation&)  final;
+
</ins><span class="cx">     ScrollingEffectsControllerClient& m_client;
</span><ins>+
+    std::unique_ptr<ScrollAnimation> m_currentAnimation;
+
</ins><span class="cx">     std::unique_ptr<ScrollSnapAnimatorState> m_scrollSnapState;
</span><span class="cx">     bool m_activeScrollSnapIndexDidChange { false };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgenericScrollAnimatorGenericcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp  2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp     2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -31,10 +31,7 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "ScrollAnimatorGeneric.h"
</span><span class="cx"> 
</span><del>-#include "ScrollAnimationKinetic.h"
-#include "ScrollAnimationSmooth.h"
</del><span class="cx"> #include "ScrollableArea.h"
</span><del>-#include "ScrollbarTheme.h"
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -45,50 +42,18 @@
</span><span class="cx"> 
</span><span class="cx"> ScrollAnimatorGeneric::ScrollAnimatorGeneric(ScrollableArea& scrollableArea)
</span><span class="cx">     : ScrollAnimator(scrollableArea)
</span><del>-    , m_kineticAnimation(makeUnique<ScrollAnimationKinetic>(*this))
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ScrollAnimatorGeneric::~ScrollAnimatorGeneric() = default;
</span><span class="cx"> 
</span><del>-bool ScrollAnimatorGeneric::scrollToPositionWithoutAnimation(const FloatPoint& position, ScrollClamping clamping)
-{
-    m_kineticAnimation->stop();
-    return ScrollAnimator::scrollToPositionWithoutAnimation(position, clamping);
-}
-
</del><ins>+// FIXME: Push this into the base class so that ScrollAnimatorGeneric can be removed.
</ins><span class="cx"> bool ScrollAnimatorGeneric::handleWheelEvent(const PlatformWheelEvent& event)
</span><span class="cx"> {
</span><del>-    m_kineticAnimation->stop();
-
-#if ENABLE(KINETIC_SCROLLING)
-    m_kineticAnimation->appendToScrollHistory(event);
-
-    if (event.isEndOfNonMomentumScroll()) {
-        m_kineticAnimation->startAnimatedScrollWithInitialVelocity(m_currentPosition, m_kineticAnimation->computeVelocity(), m_scrollableArea.horizontalScrollbar(), m_scrollableArea.verticalScrollbar());
</del><ins>+    if (m_scrollController.processWheelEventForKineticScrolling(event))
</ins><span class="cx">         return true;
</span><del>-    }
-    if (event.isTransitioningToMomentumScroll()) {
-        m_kineticAnimation->clearScrollHistory();
-        m_kineticAnimation->startAnimatedScrollWithInitialVelocity(m_currentPosition, event.swipeVelocity(), m_scrollableArea.horizontalScrollbar(), m_scrollableArea.verticalScrollbar());
-        return true;
-    }
-#endif
</del><span class="cx"> 
</span><span class="cx">     return ScrollAnimator::handleWheelEvent(event);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: Can we just use the base class implementation?
-void ScrollAnimatorGeneric::scrollAnimationDidUpdate(ScrollAnimation& animation, const FloatPoint& position)
-{
-    if (&animation == m_kineticAnimation.get()) {
-        // FIXME: Clarify how animations interact. There should never be more than one active at a time.
-        m_scrollAnimation->stop();
-        setCurrentPosition(position, NotifyScrollableArea::Yes);
-        return;
-    }
-
-    ScrollAnimator::scrollAnimationDidUpdate(animation, position);
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgenericScrollAnimatorGenerich"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h    2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h       2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -31,12 +31,10 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "ScrollAnimator.h"
</span><del>-#include "Timer.h"
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class ScrollAnimation;
</span><del>-class ScrollAnimationKinetic;
</del><span class="cx"> 
</span><span class="cx"> class ScrollAnimatorGeneric final : public ScrollAnimator {
</span><span class="cx"> public:
</span><span class="lines">@@ -43,14 +41,7 @@
</span><span class="cx">     explicit ScrollAnimatorGeneric(ScrollableArea&);
</span><span class="cx">     virtual ~ScrollAnimatorGeneric();
</span><span class="cx"> 
</span><del>-private:
-    bool scrollToPositionWithoutAnimation(const FloatPoint&, ScrollClamping) final;
</del><span class="cx">     bool handleWheelEvent(const PlatformWheelEvent&) final;
</span><del>-
-    // ScrollAnimationClient
-    void scrollAnimationDidUpdate(ScrollAnimation&, const FloatPoint& currentPosition) final;
-
-    std::unique_ptr<ScrollAnimationKinetic> m_kineticAnimation;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollAnimatorMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h    2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h       2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -50,8 +50,6 @@
</span><span class="cx"> 
</span><span class="cx">     void handleWheelEventPhase(PlatformWheelEventPhase) final;
</span><span class="cx">     
</span><del>-    FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const;
-
</del><span class="cx">     bool isUserScrollInProgress() const final;
</span><span class="cx">     bool isRubberBandInProgress() const final;
</span><span class="cx">     bool isScrollSnapInProgress() const final;
</span><span class="lines">@@ -62,9 +60,6 @@
</span><span class="cx">     bool allowsHorizontalStretching(const PlatformWheelEvent&) const final;
</span><span class="cx">     bool allowsVerticalStretching(const PlatformWheelEvent&) const final;
</span><span class="cx">     bool shouldRubberBandInDirection(ScrollDirection) const final;
</span><del>-    void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) final;
-    void immediateScrollBy(const FloatSize&) final;
-    void adjustScrollPositionToBoundsIfNecessary() final;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollAnimatorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm   2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm      2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -73,26 +73,6 @@
</span><span class="cx">     return enabled;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FloatPoint ScrollAnimatorMac::adjustScrollPositionIfNecessary(const FloatPoint& position) const
-{
-    if (!m_scrollableArea.constrainsScrollingToContentEdge())
-        return position;
-
-    return m_scrollableArea.constrainScrollPosition(ScrollPosition(position));
-}
-
-void ScrollAnimatorMac::adjustScrollPositionToBoundsIfNecessary()
-{
-    bool currentlyConstrainsToContentEdge = m_scrollableArea.constrainsScrollingToContentEdge();
-    m_scrollableArea.setConstrainsScrollingToContentEdge(true);
-
-    ScrollPosition currentScrollPosition = m_scrollableArea.scrollPosition();
-    ScrollPosition constrainedPosition = m_scrollableArea.constrainScrollPosition(currentScrollPosition);
-    immediateScrollBy(constrainedPosition - currentScrollPosition);
-
-    m_scrollableArea.setConstrainsScrollingToContentEdge(currentlyConstrainsToContentEdge);
-}
-
</del><span class="cx"> bool ScrollAnimatorMac::isUserScrollInProgress() const
</span><span class="cx"> {
</span><span class="cx">     return m_scrollController.isUserScrollInProgress();
</span><span class="lines">@@ -220,23 +200,6 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollAnimatorMac::immediateScrollByWithoutContentEdgeConstraints(const FloatSize& delta)
-{
-    m_scrollableArea.setConstrainsScrollingToContentEdge(false);
-    immediateScrollBy(delta);
-    m_scrollableArea.setConstrainsScrollingToContentEdge(true);
-}
-
-void ScrollAnimatorMac::immediateScrollBy(const FloatSize& delta)
-{
-    FloatPoint currentPosition = this->currentPosition();
-    FloatPoint newPosition = adjustScrollPositionIfNecessary(currentPosition + delta);
-    if (newPosition == currentPosition)
-        return;
-
-    setCurrentPosition(newPosition, NotifyScrollableArea::Yes);
-}
-
</del><span class="cx"> bool ScrollAnimatorMac::processWheelEventForScrollSnap(const PlatformWheelEvent& wheelEvent)
</span><span class="cx"> {
</span><span class="cx">     return m_scrollController.processWheelEventForScrollSnap(wheelEvent);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollingEffectsControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (283018 => 283019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm  2021-09-23 23:08:19 UTC (rev 283018)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm     2021-09-23 23:54:41 UTC (rev 283019)
</span><span class="lines">@@ -757,11 +757,10 @@
</span><span class="cx"> 
</span><span class="cx">     bool isAnimationComplete;
</span><span class="cx">     auto animationOffset = m_scrollSnapState->currentAnimatedScrollOffset(currentTime, isAnimationComplete);
</span><del>-    auto currentOffset = m_client.scrollOffset();
</del><ins>+    LOG_WITH_STREAM(ScrollSnap, stream << "ScrollingEffectsController " << this << " updateScrollSnapAnimatingState - isAnimationComplete " << isAnimationComplete << " animationOffset " << animationOffset << " (main thread " << isMainThread() << ")");
</ins><span class="cx"> 
</span><del>-    LOG_WITH_STREAM(ScrollSnap, stream << "ScrollingEffectsController " << this << " updateScrollSnapAnimatingState - isAnimationComplete " << isAnimationComplete << " currentOffset " << currentOffset << " (main thread " << isMainThread() << ")");
</del><ins>+    scrollToOffsetForAnimation(animationOffset);
</ins><span class="cx"> 
</span><del>-    m_client.immediateScrollByWithoutContentEdgeConstraints(FloatSize(animationOffset.x() - currentOffset.x(), animationOffset.y() - currentOffset.y()));
</del><span class="cx">     if (isAnimationComplete) {
</span><span class="cx">         m_scrollSnapState->transitionToDestinationReachedState();
</span><span class="cx">         stopScrollSnapAnimation();
</span></span></pre>
</div>
</div>

</body>
</html>