Diff
Modified: trunk/Source/WebCore/ChangeLog (283791 => 283792)
--- trunk/Source/WebCore/ChangeLog 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/ChangeLog 2021-10-08 04:30:33 UTC (rev 283792)
@@ -1,3 +1,98 @@
+2021-10-07 Simon Fraser <[email protected]>
+
+ Add some plumbing for running smooth scroll animations in the scrolling thread/UI process
+ https://bugs.webkit.org/show_bug.cgi?id=231402
+
+ Reviewed by Tim Horton.
+
+ These change prepare the scrolling tree to handle the starting and cancelation of
+ programmatic smooth scroll animations.
+
+ ScrollableArea subclasses implement requestAnimatedScrollToPosition() and
+ stopAsyncAnimatedScroll(), akin to the existing requestScrollPositionUpdate(). FrameView and
+ RenderLayerScrollableArea call through to AsyncScrollingCoordinator, which will soon respond
+ to these requests by setting state on scrolling state nodes. Currently,
+ AsyncScrollingCoordinator does `return false` to avoid a behavior change.
+
+ ScrollingTreeScrollingNode gains startAnimatedScrollToPosition() and stopAnimatedScroll(),
+ and concrete subclasses use their ScrollingTreeScrollingNodeDelegate (and its
+ ScrollingEffectsController) to actually trigger the scroll animation, or stop an existing
+ one.
+
+ RequestedScrollData will be used a bit more widely, so move it to
+ ScrollingCoordinatorTypes.h, and give it a ScrollIsAnimated field.
+
+ * dom/Element.cpp:
+ (WebCore::Element::scrollTo):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::setScrollPosition):
+ (WebCore::FrameView::requestAnimatedScrollToPosition):
+ (WebCore::FrameView::stopAsyncAnimatedScroll):
+ * page/FrameView.h:
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
+ (WebCore::AsyncScrollingCoordinator::requestAnimatedScrollToPosition):
+ (WebCore::AsyncScrollingCoordinator::stopAnimatedScroll):
+ * page/scrolling/AsyncScrollingCoordinator.h:
+ * page/scrolling/ScrollingCoordinator.h:
+ (WebCore::ScrollingCoordinator::requestScrollPositionUpdate):
+ (WebCore::ScrollingCoordinator::requestAnimatedScrollToPosition):
+ (WebCore::ScrollingCoordinator::stopAnimatedScroll):
+ * page/scrolling/ScrollingCoordinatorTypes.h:
+ (WebCore::RequestedScrollData::operator== const):
+ * page/scrolling/ScrollingStateScrollingNode.cpp:
+ (WebCore::ScrollingStateScrollingNode::dumpProperties const):
+ * page/scrolling/ScrollingStateScrollingNode.h:
+ (WebCore::RequestedScrollData::operator== const): Deleted.
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::didStopAnimatedScroll):
+ (WebCore::ScrollingTreeScrollingNode::handleScrollPositionRequest):
+ * page/scrolling/ScrollingTreeScrollingNode.h:
+ * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
+ * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
+ * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::startAnimatedScrollToPosition):
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::stopAnimatedScroll):
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren):
+ (WebCore::ScrollingTreeOverflowScrollingNodeMac::startAnimatedScrollToPosition):
+ (WebCore::ScrollingTreeOverflowScrollingNodeMac::stopAnimatedScroll):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::startAnimatedScrollToPosition):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopAnimatedScroll):
+ * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
+ (WebCore::ScrollingTreeFrameScrollingNodeNicosia::commitStateAfterChildren):
+ (WebCore::ScrollingTreeFrameScrollingNodeNicosia::startAnimatedScrollToPosition):
+ (WebCore::ScrollingTreeFrameScrollingNodeNicosia::stopAnimatedScroll):
+ (WebCore::ScrollingTreeFrameScrollingNodeNicosia::stopScrollAnimations): Deleted.
+ * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h:
+ * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp:
+ (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::commitStateAfterChildren):
+ (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::startAnimatedScrollToPosition):
+ (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::stopAnimatedScroll):
+ (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::stopScrollAnimations): Deleted.
+ * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h:
+ * page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp:
+ (WebCore::ScrollingTreeScrollingNodeDelegateNicosia::startAnimatedScrollToPosition):
+ (WebCore::ScrollingTreeScrollingNodeDelegateNicosia::stopAnimatedScroll):
+ (WebCore::ScrollingTreeScrollingNodeDelegateNicosia::stopScrollAnimations): Deleted.
+ * page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.h:
+ * platform/ScrollTypes.h:
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::setScrollPosition):
+ * platform/ScrollableArea.cpp:
+ (WebCore::ScrollableArea::scrollToPositionWithAnimation):
+ * platform/ScrollableArea.h:
+ (WebCore::ScrollableArea::requestAnimatedScrollToPosition):
+ (WebCore::ScrollableArea::stopAsyncAnimatedScroll):
+ * rendering/RenderLayerScrollableArea.cpp:
+ (WebCore::RenderLayerScrollableArea::requestAnimatedScrollToPosition):
+ (WebCore::RenderLayerScrollableArea::stopAsyncAnimatedScroll):
+ * rendering/RenderLayerScrollableArea.h:
+
2021-10-07 Alexey Shvayka <[email protected]>
`highWaterMark` should be a readonly WebIDL attribute of queuing strategies
Modified: trunk/Source/WebCore/dom/Element.cpp (283791 => 283792)
--- trunk/Source/WebCore/dom/Element.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/dom/Element.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -1000,6 +1000,8 @@
void Element::scrollTo(const ScrollToOptions& options, ScrollClamping clamping, ScrollSnapPointSelectionMethod snapPointSelectionMethod)
{
+ LOG_WITH_STREAM(Scrolling, stream << "Element " << *this << " scrollTo " << options.left << ", " << options.top);
+
if (!document().settings().CSSOMViewScrollingAPIEnabled()) {
// If the element is the root element and document is in quirks mode, terminate these steps.
// Note that WebKit always uses quirks mode document scrolling behavior. See Document::scrollingElement().
Modified: trunk/Source/WebCore/page/FrameView.cpp (283791 => 283792)
--- trunk/Source/WebCore/page/FrameView.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/FrameView.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -2306,7 +2306,7 @@
void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, const ScrollPositionChangeOptions& options)
{
- LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " , clearing anchor");
+ LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " animated " << (options.animated == ScrollIsAnimated::Yes) << ", clearing anchor");
auto oldScrollType = currentScrollType();
setCurrentScrollType(options.type);
@@ -2687,6 +2687,30 @@
return false;
}
+bool FrameView::requestAnimatedScrollToPosition(const ScrollPosition& destinationPosition, ScrollClamping clamping)
+{
+ LOG_WITH_STREAM(Scrolling, stream << "FrameView::requestAnimatedScrollToPosition " << destinationPosition);
+
+#if ENABLE(ASYNC_SCROLLING)
+ if (auto scrollingCoordinator = this->scrollingCoordinator())
+ return scrollingCoordinator->requestAnimatedScrollToPosition(*this, destinationPosition, clamping);
+#else
+ UNUSED_PARAM(destinationPosition);
+#endif
+
+ return false;
+}
+
+void FrameView::stopAsyncAnimatedScroll()
+{
+#if ENABLE(ASYNC_SCROLLING)
+ LOG_WITH_STREAM(Scrolling, stream << "FrameView::stopAsyncAnimatedScroll");
+
+ if (auto scrollingCoordinator = this->scrollingCoordinator())
+ return scrollingCoordinator->stopAnimatedScroll(*this);
+#endif
+}
+
HostWindow* FrameView::hostWindow() const
{
auto* page = frame().page();
Modified: trunk/Source/WebCore/page/FrameView.h (283791 => 283792)
--- trunk/Source/WebCore/page/FrameView.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/FrameView.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -246,7 +246,11 @@
void scrollToFocusedElementImmediatelyIfNeeded();
void updateLayerPositionsAfterScrolling() final;
void updateCompositingLayersAfterScrolling() final;
+
bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) final;
+ bool requestAnimatedScrollToPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped) final;
+ void stopAsyncAnimatedScroll() final;
+
bool isUserScrollInProgress() const final;
bool isRubberBandInProgress() const final;
WEBCORE_EXPORT ScrollPosition minimumScrollPosition() const final;
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -239,7 +239,7 @@
node->setHorizontalScrollbarLayer(frameView.layerForHorizontalScrollbar());
}
-bool AsyncScrollingCoordinator::requestScrollPositionUpdate(ScrollableArea& scrollableArea, const IntPoint& scrollPosition, ScrollType scrollType, ScrollClamping clamping)
+bool AsyncScrollingCoordinator::requestScrollPositionUpdate(ScrollableArea& scrollableArea, const ScrollPosition& scrollPosition, ScrollType scrollType, ScrollClamping clamping)
{
ASSERT(isMainThread());
ASSERT(m_page);
@@ -275,11 +275,23 @@
if (!stateNode)
return false;
- stateNode->setRequestedScrollData({ scrollPosition, scrollType, clamping });
+ stateNode->setRequestedScrollData({ scrollPosition, scrollType, clamping, ScrollIsAnimated::No });
+ // FIXME: This should schedule a rendering update
commitTreeStateIfNeeded();
return true;
}
+bool AsyncScrollingCoordinator::requestAnimatedScrollToPosition(ScrollableArea&, const ScrollPosition&, ScrollClamping)
+{
+ // FIXME: Implement.
+ return false;
+}
+
+void AsyncScrollingCoordinator::stopAnimatedScroll(ScrollableArea&)
+{
+ // FIXME: Implement.
+}
+
void AsyncScrollingCoordinator::applyScrollingTreeLayerPositions()
{
m_scrollingTree->applyLayerPositions();
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -100,7 +100,9 @@
WEBCORE_EXPORT void frameViewVisualViewportChanged(FrameView&) override;
WEBCORE_EXPORT void frameViewEventTrackingRegionsChanged(FrameView&) override;
- WEBCORE_EXPORT bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint&, ScrollType, ScrollClamping) override;
+ WEBCORE_EXPORT bool requestScrollPositionUpdate(ScrollableArea&, const ScrollPosition&, ScrollType, ScrollClamping) final;
+ WEBCORE_EXPORT bool requestAnimatedScrollToPosition(ScrollableArea&, const ScrollPosition&, ScrollClamping) final;
+ WEBCORE_EXPORT void stopAnimatedScroll(ScrollableArea&) final;
WEBCORE_EXPORT void applyScrollingTreeLayerPositions() override;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -112,7 +112,11 @@
// These virtual functions are currently unique to the threaded scrolling architecture.
virtual void commitTreeStateIfNeeded() { }
- virtual bool requestScrollPositionUpdate(ScrollableArea&, const IntPoint&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped) { return false; }
+
+ virtual bool requestScrollPositionUpdate(ScrollableArea&, const ScrollPosition&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped) { return false; }
+ virtual bool requestAnimatedScrollToPosition(ScrollableArea&, const ScrollPosition&, ScrollClamping) { return false; }
+ virtual void stopAnimatedScroll(ScrollableArea&) { }
+
virtual bool handleWheelEventForScrolling(const PlatformWheelEvent&, ScrollingNodeID, std::optional<WheelScrollGestureState>) { return false; }
virtual void wheelEventWasProcessedByMainThread(const PlatformWheelEvent&, std::optional<WheelScrollGestureState>) { }
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -102,6 +102,20 @@
ChangingObscuredInsetsInteractively // This implies Unstable.
};
+struct RequestedScrollData {
+ FloatPoint scrollPosition;
+ ScrollType scrollType { ScrollType::User };
+ ScrollClamping clamping { ScrollClamping::Clamped };
+ ScrollIsAnimated animated { ScrollIsAnimated::No };
+
+ bool operator==(const RequestedScrollData& other) const
+ {
+ return scrollPosition == other.scrollPosition
+ && scrollType == other.scrollType
+ && clamping == other.clamping;
+ }
+};
+
struct ScrollUpdate {
ScrollingNodeID nodeID { 0 };
FloatPoint scrollPosition;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -297,6 +297,9 @@
if (m_requestedScrollData.clamping == ScrollClamping::Unclamped)
ts.dumpProperty("requested scroll position clamping", m_requestedScrollData.clamping);
+ if (m_requestedScrollData.animated == ScrollIsAnimated::Yes)
+ ts.dumpProperty("requested scroll position is animated", true);
+
if (m_scrollOrigin != IntPoint())
ts.dumpProperty("scroll origin", m_scrollOrigin);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -38,19 +38,6 @@
namespace WebCore {
-struct RequestedScrollData {
- FloatPoint scrollPosition;
- ScrollType scrollType { ScrollType::User };
- ScrollClamping clamping { ScrollClamping::Clamped };
-
- bool operator==(const RequestedScrollData& other) const
- {
- return scrollPosition == other.scrollPosition
- && scrollType == other.scrollType
- && clamping == other.clamping;
- }
-};
-
class ScrollingStateScrollingNode : public ScrollingStateNode {
public:
virtual ~ScrollingStateScrollingNode();
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -227,6 +227,26 @@
scrollingTree().setNodeScrollSnapInProgress(scrollingNodeID(), isSnapping);
}
+void ScrollingTreeScrollingNode::didStopAnimatedScroll()
+{
+ LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeScrollingNode " << scrollingNodeID() << " didStopAnimatedScroll");
+ // FIXME: Propagate state back to the main thread.
+}
+
+void ScrollingTreeScrollingNode::handleScrollPositionRequest(const RequestedScrollData& requestedScrollData)
+{
+ LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeScrollingNode " << scrollingNodeID() << " handleScrollPositionRequest() - position " << requestedScrollData.scrollPosition << " animated " << (requestedScrollData.animated == ScrollIsAnimated::Yes));
+
+ stopAnimatedScroll();
+
+ if (requestedScrollData.animated == ScrollIsAnimated::Yes) {
+ if (startAnimatedScrollToPosition(requestedScrollData.scrollPosition))
+ return;
+ }
+
+ scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
+}
+
FloatPoint ScrollingTreeScrollingNode::adjustedScrollPosition(const FloatPoint& scrollPosition, ScrollClamping clamping) const
{
if (clamping == ScrollClamping::Clamped)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -78,7 +78,7 @@
void scrollTo(const FloatPoint&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped);
void scrollBy(const FloatSize&, ScrollClamping = ScrollClamping::Clamped);
- virtual void stopScrollAnimations() { };
+ void handleScrollPositionRequest(const RequestedScrollData&);
void wasScrolledByDelegatedScrolling(const FloatPoint& position, std::optional<FloatRect> overrideLayoutViewport = { }, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync);
@@ -123,6 +123,9 @@
virtual void willDoProgrammaticScroll(const FloatPoint&) { }
virtual FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped) const;
+
+ virtual bool startAnimatedScrollToPosition(FloatPoint) { return false; }
+ virtual void stopAnimatedScroll() { }
virtual void currentScrollPositionChanged(ScrollType, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync);
virtual void updateViewportForCurrentScrollPosition(std::optional<FloatRect> = { }) { }
@@ -133,6 +136,8 @@
void applyLayerPositions() override;
+ void didStopAnimatedScroll();
+
const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; }
bool isLatchedNode() const;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -38,6 +38,9 @@
ScrollingTreeScrollingNode& scrollingNode() { return m_scrollingNode; }
const ScrollingTreeScrollingNode& scrollingNode() const { return m_scrollingNode; }
+
+ virtual bool startAnimatedScrollToPosition(FloatPoint) = 0;
+ virtual void stopAnimatedScroll() = 0;
protected:
WEBCORE_EXPORT ScrollingTree& scrollingTree() const;
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -66,6 +66,9 @@
void willBeDestroyed() final;
void willDoProgrammaticScroll(const FloatPoint&) final;
+ bool startAnimatedScrollToPosition(FloatPoint) final;
+ void stopAnimatedScroll() final;
+
FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const final;
void currentScrollPositionChanged(ScrollType, ScrollingLayerPositionAction) final;
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm 2021-10-08 04:30:33 UTC (rev 283792)
@@ -105,10 +105,8 @@
const auto& scrollingStateNode = downcast<ScrollingStateScrollingNode>(stateNode);
// Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
- if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition)) {
- const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
- scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
- }
+ if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition))
+ handleScrollPositionRequest(scrollingStateNode.requestedScrollData());
if (isRootNode()
&& (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::ScrolledContentsLayer)
@@ -132,6 +130,16 @@
return WheelEventHandlingResult::result(handled);
}
+bool ScrollingTreeFrameScrollingNodeMac::startAnimatedScrollToPosition(FloatPoint destinationPosition)
+{
+ return m_delegate.startAnimatedScrollToPosition(destinationPosition);
+}
+
+void ScrollingTreeFrameScrollingNodeMac::stopAnimatedScroll()
+{
+ m_delegate.stopAnimatedScroll();
+}
+
void ScrollingTreeFrameScrollingNodeMac::willDoProgrammaticScroll(const FloatPoint& targetScrollPosition)
{
m_delegate.willDoProgrammaticScroll(targetScrollPosition);
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -47,6 +47,9 @@
FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override;
+ bool startAnimatedScrollToPosition(FloatPoint destinationPosition) override;
+ void stopAnimatedScroll() override;
+
void currentScrollPositionChanged(ScrollType, ScrollingLayerPositionAction) final;
void willDoProgrammaticScroll(const FloatPoint&) final;
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm 2021-10-08 04:30:33 UTC (rev 283792)
@@ -67,10 +67,8 @@
const auto& overflowStateNode = downcast<ScrollingStateOverflowScrollingNode>(stateNode);
- if (overflowStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition)) {
- const auto& requestedScrollData = overflowStateNode.requestedScrollData();
- scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
- }
+ if (overflowStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition))
+ handleScrollPositionRequest(overflowStateNode.requestedScrollData());
}
WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
@@ -86,6 +84,16 @@
return WheelEventHandlingResult::result(m_delegate.handleWheelEvent(wheelEvent));
}
+bool ScrollingTreeOverflowScrollingNodeMac::startAnimatedScrollToPosition(FloatPoint destinationPosition)
+{
+ return m_delegate.startAnimatedScrollToPosition(destinationPosition);
+}
+
+void ScrollingTreeOverflowScrollingNodeMac::stopAnimatedScroll()
+{
+ m_delegate.stopAnimatedScroll();
+}
+
void ScrollingTreeOverflowScrollingNodeMac::willDoProgrammaticScroll(const FloatPoint& targetScrollPosition)
{
m_delegate.willDoProgrammaticScroll(targetScrollPosition);
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -51,7 +51,10 @@
void nodeWillBeDestroyed();
bool handleWheelEvent(const PlatformWheelEvent&);
-
+
+ bool startAnimatedScrollToPosition(FloatPoint) final;
+ void stopAnimatedScroll() final;
+
void willDoProgrammaticScroll(const FloatPoint&);
void currentScrollPositionChanged();
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-10-08 04:30:33 UTC (rev 283792)
@@ -113,6 +113,19 @@
return m_scrollController.handleWheelEvent(wheelEvent);
}
+bool ScrollingTreeScrollingNodeDelegateMac::startAnimatedScrollToPosition(FloatPoint destinationPosition)
+{
+ auto currentOffset = ScrollableArea::scrollOffsetFromPosition(currentScrollPosition(), scrollOrigin());
+ auto destinationOffset = ScrollableArea::scrollOffsetFromPosition(destinationPosition, scrollOrigin());
+
+ return m_scrollController.startAnimatedScrollToDestination(currentOffset, destinationOffset);
+}
+
+void ScrollingTreeScrollingNodeDelegateMac::stopAnimatedScroll()
+{
+ m_scrollController.stopAnimatedScroll();
+}
+
void ScrollingTreeScrollingNodeDelegateMac::willDoProgrammaticScroll(const FloatPoint& targetPosition)
{
if (scrollPositionIsNotRubberbandingEdge(targetPosition)) {
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -93,11 +93,8 @@
const auto& scrollingStateNode = downcast<ScrollingStateScrollingNode>(stateNode);
// Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
- if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition)) {
- stopScrollAnimations();
- const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
- scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
- }
+ if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition))
+ handleScrollPositionRequest(scrollingStateNode.requestedScrollData());
}
WheelEventHandlingResult ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
@@ -105,11 +102,16 @@
return m_delegate.handleWheelEvent(wheelEvent, eventTargeting);
}
-void ScrollingTreeFrameScrollingNodeNicosia::stopScrollAnimations()
+bool ScrollingTreeFrameScrollingNodeNicosia::startAnimatedScrollToPosition(FloatPoint destinationPosition)
{
- m_delegate.stopScrollAnimations();
+ return m_delegate.startAnimatedScrollToPosition(destinationPosition);
}
+void ScrollingTreeFrameScrollingNodeNicosia::stopAnimatedScroll()
+{
+ m_delegate.stopAnimatedScroll();
+}
+
FloatPoint ScrollingTreeFrameScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamping) const
{
FloatPoint scrollPosition(roundf(position.x()), roundf(position.y()));
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -55,11 +55,12 @@
void commitStateBeforeChildren(const ScrollingStateNode&) override;
void commitStateAfterChildren(const ScrollingStateNode&) override;
+ bool startAnimatedScrollToPosition(FloatPoint) override;
+ void stopAnimatedScroll() override;
WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, EventTargeting) override;
FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override;
void currentScrollPositionChanged(ScrollType, ScrollingLayerPositionAction) override;
- void stopScrollAnimations() override;
void repositionScrollingLayers() override;
void repositionRelatedLayers() override;
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -52,11 +52,8 @@
ScrollingTreeOverflowScrollingNode::commitStateAfterChildren(stateNode);
const auto& overflowStateNode = downcast<ScrollingStateOverflowScrollingNode>(stateNode);
- if (overflowStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition)) {
- stopScrollAnimations();
- const auto& requestedScrollData = overflowStateNode.requestedScrollData();
- scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
- }
+ if (overflowStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition))
+ handleScrollPositionRequest(overflowStateNode.requestedScrollData());
}
FloatPoint ScrollingTreeOverflowScrollingNodeNicosia::adjustedScrollPosition(const FloatPoint& position, ScrollClamping clamping) const
@@ -88,11 +85,16 @@
return m_delegate.handleWheelEvent(wheelEvent, eventTargeting);
}
-void ScrollingTreeOverflowScrollingNodeNicosia::stopScrollAnimations()
+bool ScrollingTreeOverflowScrollingNodeNicosia::startAnimatedScrollToPosition(FloatPoint destinationPosition)
{
- m_delegate.stopScrollAnimations();
+ return m_delegate.startAnimatedScrollToPosition(destinationPosition);
}
+void ScrollingTreeOverflowScrollingNodeNicosia::stopAnimatedScroll()
+{
+ m_delegate.stopAnimatedScroll();
+}
+
} // namespace WebCore
#endif // ENABLE(ASYNC_SCROLLING) && USE(NICOSIA)
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -49,8 +49,10 @@
FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override;
void repositionScrollingLayers() override;
WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, EventTargeting) override;
- void stopScrollAnimations() override;
+ bool startAnimatedScrollToPosition(FloatPoint) override;
+ void stopAnimatedScroll() override;
+
ScrollingTreeScrollingNodeDelegateNicosia m_delegate;
};
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -86,11 +86,6 @@
return WheelEventHandlingResult::handled();
}
-void ScrollingTreeScrollingNodeDelegateNicosia::stopScrollAnimations()
-{
- m_scrollController.stopAnimatedScroll();
-}
-
void ScrollingTreeScrollingNodeDelegateNicosia::animationTimerFired()
{
m_scrollController.animationCallback(MonotonicTime::now());
@@ -182,6 +177,19 @@
};
}
+bool ScrollingTreeScrollingNodeDelegateNicosia::startAnimatedScrollToPosition(FloatPoint destinationPosition)
+{
+ auto currentOffset = ScrollableArea::scrollOffsetFromPosition(currentScrollPosition(), scrollOrigin());
+ auto destinationOffset = ScrollableArea::scrollOffsetFromPosition(destinationPosition, scrollOrigin());
+
+ return m_scrollController.startAnimatedScrollToDestination(currentOffset, destinationOffset);
+}
+
+void ScrollingTreeScrollingNodeDelegateNicosia::stopAnimatedScroll()
+{
+ m_scrollController.stopAnimatedScroll();
+}
+
} // namespace WebCore
#endif // ENABLE(ASYNC_SCROLLING) && USE(NICOSIA)
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.h (283791 => 283792)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -31,7 +31,6 @@
#if ENABLE(ASYNC_SCROLLING) && USE(NICOSIA)
#include "NicosiaPlatformLayer.h"
-#include "ScrollAnimation.h"
#include "ScrollingEffectsController.h"
#include "ScrollingStateOverflowScrollingNode.h"
#include "ThreadedScrollingTree.h"
@@ -39,7 +38,6 @@
namespace WebCore {
-// FIXME: This should not be a ScrollAnimationClient.
class ScrollingTreeScrollingNodeDelegateNicosia : public ScrollingTreeScrollingNodeDelegate, public ScrollingEffectsControllerClient {
public:
explicit ScrollingTreeScrollingNodeDelegateNicosia(ScrollingTreeScrollingNode&, bool scrollAnimatorEnabled);
@@ -49,8 +47,11 @@
std::unique_ptr<Nicosia::SceneIntegration::UpdateScope> createUpdateScope();
void updateVisibleLengths();
WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&, EventTargeting);
- void stopScrollAnimations();
+ // ScrollingTreeScrollingNodeDelegate
+ bool startAnimatedScrollToPosition(FloatPoint) final;
+ void stopAnimatedScroll() final;
+
private:
void animationTimerFired();
Modified: trunk/Source/WebCore/platform/ScrollTypes.h (283791 => 283792)
--- trunk/Source/WebCore/platform/ScrollTypes.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/platform/ScrollTypes.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -305,6 +305,14 @@
namespace WTF {
+template<> struct EnumTraits<WebCore::ScrollIsAnimated> {
+ using values = EnumValues<
+ WebCore::ScrollIsAnimated,
+ WebCore::ScrollIsAnimated::No,
+ WebCore::ScrollIsAnimated::Yes
+ >;
+};
+
template<> struct EnumTraits<WebCore::ScrollbarMode> {
using values = EnumValues<
WebCore::ScrollbarMode,
Modified: trunk/Source/WebCore/platform/ScrollView.cpp (283791 => 283792)
--- trunk/Source/WebCore/platform/ScrollView.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/platform/ScrollView.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -523,12 +523,16 @@
return;
}
- if (scrollAnimationStatus() == ScrollAnimationStatus::Animating)
+ if (scrollAnimationStatus() == ScrollAnimationStatus::Animating) {
scrollAnimator().cancelAnimations();
+ stopAsyncAnimatedScroll();
+ }
ScrollPosition newScrollPosition = (!delegatesScrolling() && options.clamping == ScrollClamping::Clamped) ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition;
- if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && newScrollPosition == this->scrollPosition())
+ if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && newScrollPosition == this->scrollPosition()) {
+ LOG_WITH_STREAM(Scrolling, stream << "ScrollView::setScrollPosition " << scrollPosition << " return for no change");
return;
+ }
if (!requestScrollPositionUpdate(newScrollPosition, currentScrollType(), options.clamping))
updateScrollbars(newScrollPosition);
Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (283791 => 283792)
--- trunk/Source/WebCore/platform/ScrollableArea.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -140,10 +140,15 @@
scrollAnimator().scrollToPositionWithoutAnimation(position, clamping);
}
-void ScrollableArea::scrollToPositionWithAnimation(const FloatPoint& position, ScrollClamping)
+void ScrollableArea::scrollToPositionWithAnimation(const FloatPoint& position, ScrollClamping clamping)
{
LOG_WITH_STREAM(Scrolling, stream << "ScrollableArea " << this << " scrollToPositionWithAnimation " << position);
- if (scrollAnimator().scrollToPositionWithAnimation(position))
+
+ bool startedAnimation = requestAnimatedScrollToPosition(roundedIntPoint(position), clamping);
+ if (!startedAnimation)
+ startedAnimation = scrollAnimator().scrollToPositionWithAnimation(position);
+
+ if (startedAnimation)
setScrollAnimationStatus(ScrollAnimationStatus::Animating);
}
Modified: trunk/Source/WebCore/platform/ScrollableArea.h (283791 => 283792)
--- trunk/Source/WebCore/platform/ScrollableArea.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/platform/ScrollableArea.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -83,6 +83,8 @@
// returns true, the scrollable area won't actually update the scroll position and instead
// expect it to happen sometime in the future.
virtual bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) { return false; }
+ virtual bool requestAnimatedScrollToPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped) { return false; }
+ virtual void stopAsyncAnimatedScroll() { }
WEBCORE_EXPORT virtual bool handleWheelEventForScrolling(const PlatformWheelEvent&, std::optional<WheelScrollGestureState>);
Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (283791 => 283792)
--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -254,6 +254,27 @@
return false;
}
+bool RenderLayerScrollableArea::requestAnimatedScrollToPosition(const ScrollPosition& destinationPosition, ScrollClamping clamping)
+{
+#if ENABLE(ASYNC_SCROLLING)
+ LOG_WITH_STREAM(Scrolling, stream << m_layer << " requestAnimatedScrollToPosition " << destinationPosition);
+
+ if (auto* scrollingCoordinator = m_layer.page().scrollingCoordinator())
+ return scrollingCoordinator->requestAnimatedScrollToPosition(*this, destinationPosition, clamping);
+#endif
+ return false;
+}
+
+void RenderLayerScrollableArea::stopAsyncAnimatedScroll()
+{
+#if ENABLE(ASYNC_SCROLLING)
+ LOG_WITH_STREAM(Scrolling, stream << m_layer << " stopAsyncAnimatedScroll");
+
+ if (auto* scrollingCoordinator = m_layer.page().scrollingCoordinator())
+ return scrollingCoordinator->stopAnimatedScroll(*this);
+#endif
+}
+
ScrollOffset RenderLayerScrollableArea::scrollToOffset(const ScrollOffset& scrollOffset, const ScrollPositionChangeOptions& options)
{
if (scrollAnimationStatus() == ScrollAnimationStatus::Animating)
Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.h (283791 => 283792)
--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -200,6 +200,8 @@
IntSize reachableTotalContentsSize() const final;
bool requestScrollPositionUpdate(const ScrollPosition&, ScrollType = ScrollType::User, ScrollClamping = ScrollClamping::Clamped) final;
+ bool requestAnimatedScrollToPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped) final;
+ void stopAsyncAnimatedScroll() final;
bool containsDirtyOverlayScrollbars() const { return m_containsDirtyOverlayScrollbars; }
void setContainsDirtyOverlayScrollbars(bool dirtyScrollbars) { m_containsDirtyOverlayScrollbars = dirtyScrollbars; }
Modified: trunk/Source/WebKit/ChangeLog (283791 => 283792)
--- trunk/Source/WebKit/ChangeLog 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebKit/ChangeLog 2021-10-08 04:30:33 UTC (rev 283792)
@@ -1,3 +1,21 @@
+2021-10-07 Simon Fraser <[email protected]>
+
+ Add some plumbing for running smooth scroll animations in the scrolling thread/UI process
+ https://bugs.webkit.org/show_bug.cgi?id=231402
+
+ Reviewed by Tim Horton.
+
+ * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
+ (ArgumentCoder<RequestedScrollData>::encode):
+ (ArgumentCoder<RequestedScrollData>::decode):
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
+ (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::startAnimatedScrollToPosition):
+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::stopAnimatedScroll):
+
2021-10-07 Myles C. Maxfield <[email protected]>
[GPU Process] Unique RenderingResourceIdentifiers Part 2: Unroll PendingWakeupInformation::arguments
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp (283791 => 283792)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp 2021-10-08 04:30:33 UTC (rev 283792)
@@ -507,6 +507,7 @@
encoder << scrollData.scrollPosition;
encoder << scrollData.scrollType;
encoder << scrollData.clamping;
+ encoder << scrollData.animated;
}
bool ArgumentCoder<RequestedScrollData>::decode(Decoder& decoder, RequestedScrollData& scrollData)
@@ -520,6 +521,9 @@
if (!decoder.decode(scrollData.clamping))
return false;
+ if (!decoder.decode(scrollData.animated))
+ return false;
+
return true;
}
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm (283791 => 283792)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm 2021-10-08 04:30:33 UTC (rev 283792)
@@ -94,10 +94,8 @@
}
// Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
- if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition)) {
- const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
- scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
- }
+ if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition))
+ handleScrollPositionRequest(scrollingStateNode.requestedScrollData());
}
FloatPoint ScrollingTreeFrameScrollingNodeRemoteIOS::minimumScrollPosition() const
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h (283791 => 283792)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h 2021-10-08 04:30:33 UTC (rev 283792)
@@ -79,6 +79,9 @@
UIScrollView *scrollView() const;
private:
+ bool startAnimatedScrollToPosition(FloatPoint) final;
+ void stopAnimatedScroll() final;
+
RetainPtr<CALayer> m_scrollLayer;
RetainPtr<CALayer> m_scrolledContentsLayer;
RetainPtr<WKScrollingNodeScrollViewDelegate> m_scrollViewDelegate;
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (283791 => 283792)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm 2021-10-08 02:03:00 UTC (rev 283791)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm 2021-10-08 04:30:33 UTC (rev 283792)
@@ -289,12 +289,22 @@
}
if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition)) {
- const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
- scrollingNode().scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
+ scrollingNode().handleScrollPositionRequest(scrollingStateNode.requestedScrollData());
scrollingTree().setNeedsApplyLayerPositionsAfterCommit();
}
}
+bool ScrollingTreeScrollingNodeDelegateIOS::startAnimatedScrollToPosition(FloatPoint)
+{
+ // FIXME: Implement.
+ return false;
+}
+
+void ScrollingTreeScrollingNodeDelegateIOS::stopAnimatedScroll()
+{
+ // FIXME: Implement.
+}
+
#if HAVE(UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_HANDLING)
void ScrollingTreeScrollingNodeDelegateIOS::handleAsynchronousCancelableScrollEvent(UIScrollView *scrollView, UIScrollEvent *scrollEvent, void (^completion)(BOOL handled))
{