Diff
Modified: trunk/Source/WebCore/ChangeLog (283910 => 283911)
--- trunk/Source/WebCore/ChangeLog 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebCore/ChangeLog 2021-10-11 17:52:56 UTC (rev 283911)
@@ -1,3 +1,17 @@
+2021-10-11 Simon Fraser <simon.fra...@apple.com>
+
+ Smooth-scroll animations should run in the UI process on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=204936
+
+ Reviewed by Tim Horton.
+
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::handleScrollPositionRequest): On iOS scrollingTreeNodeRequestsScroll()
+ doesn't handle the animated scroll, so we need to call startAnimatedScrollToPosition() from here.
+ * rendering/RenderLayerScrollableArea.cpp:
+ (WebCore::RenderLayerScrollableArea::scrollToOffset): call stopAsyncAnimatedScroll()
+ for overflow scrolls as we do in FrameView.
+
2021-10-11 Alex Christensen <achristen...@webkit.org>
Prepare to switch from WTF::Variant to std::variant
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (283910 => 283911)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -243,6 +243,11 @@
if (scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), requestedScrollData))
return;
+ if (requestedScrollData.animated == ScrollIsAnimated::Yes) {
+ startAnimatedScrollToPosition(requestedScrollData.scrollPosition);
+ return;
+ }
+
scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
}
Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (283910 => 283911)
--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -277,8 +277,10 @@
ScrollOffset RenderLayerScrollableArea::scrollToOffset(const ScrollOffset& scrollOffset, const ScrollPositionChangeOptions& options)
{
- if (scrollAnimationStatus() == ScrollAnimationStatus::Animating)
+ if (scrollAnimationStatus() == ScrollAnimationStatus::Animating) {
scrollAnimator().cancelAnimations();
+ stopAsyncAnimatedScroll();
+ }
ScrollOffset clampedScrollOffset = options.clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset;
if (clampedScrollOffset == this->scrollOffset())
Modified: trunk/Source/WebKit/ChangeLog (283910 => 283911)
--- trunk/Source/WebKit/ChangeLog 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/ChangeLog 2021-10-11 17:52:56 UTC (rev 283911)
@@ -1,3 +1,81 @@
+2021-10-11 Simon Fraser <simon.fra...@apple.com>
+
+ Smooth-scroll animations should run in the UI process on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=204936
+
+ Reviewed by Tim Horton.
+
+ Implement animated scrolls in the UI process for UI-side compositing. The scrolling tree
+ decoded in the UI process has a RequestedScrollData with the 'animated' flag. This is
+ processed by handleScrollPositionRequest() as normal.
+
+ ScrollingTreeOverflowScrollingNodeIOS::startAnimatedScrollToPosition() responds by calling
+ through to the delegate, which simply calls -[setContentOffset:animated:YES] on the
+ UIScrollView.
+
+ Main frame scrolls are a little different because the programmatic scroll needs to be
+ handled after layer tree commits; leverage the existing
+ RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll() code, but clean it up to
+ share the RequestedScrollData type, and have commitScrollingTreeState() return
+ std::optional<RequestedScrollData> instead of storing a pointer to a struct on the stack as
+ it did before. The various requestScroll() functions take a ScrollIsAnimated flag which
+ turns into -[setContentOffset:animated:YES] in WKWebView.
+
+ * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
+ (WebKit::dump):
+ * UIProcess/API/gtk/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::requestScroll):
+ * UIProcess/API/gtk/PageClientImpl.h:
+ * UIProcess/API/ios/WKWebViewIOS.h:
+ * UIProcess/API/ios/WKWebViewIOS.mm:
+ (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:animated:]):
+ (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]): Deleted.
+ * UIProcess/API/wpe/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::requestScroll):
+ * UIProcess/API/wpe/PageClientImpl.h:
+ * UIProcess/PageClient.h:
+ * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
+ (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
+ * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
+ (WebKit::RemoteScrollingCoordinatorProxy::commitScrollingTreeState):
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
+ * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+ * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
+ (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
+ (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): The delegate's
+ commitStateAfterChildren() has to run first to update UIScrollView state before the programmatic scroll
+ is handled in the base class.
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren): The delegate's
+ commitStateAfterChildren() has to run first to update UIScrollView state before the programmatic scroll
+ is handled in the base class.
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::startAnimatedScrollToPosition):
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::stopAnimatedScroll):
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollLayer const): Deleted.
+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActions const): Deleted.
+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::clearActiveTouchActions): Deleted.
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::startAnimatedScrollToPosition):
+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::stopAnimatedScroll):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::requestScroll):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::requestScroll):
+ * UIProcess/mac/PageClientImplMac.h:
+ * UIProcess/mac/PageClientImplMac.mm:
+ (WebKit::PageClientImpl::requestScroll):
+ * UIProcess/playstation/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::requestScroll):
+ * UIProcess/playstation/PageClientImpl.h:
+ * UIProcess/win/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::requestScroll):
+ * UIProcess/win/PageClientImpl.h:
+
2021-10-11 Alex Christensen <achristen...@webkit.org>
Prepare to switch from WTF::Variant to std::variant
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp (283910 => 283911)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -738,6 +738,7 @@
ts.dumpProperty("requested-scroll-position", requestedScrollData.scrollPosition);
ts.dumpProperty("requested-scroll-position-is-programatic", requestedScrollData.scrollType);
ts.dumpProperty("requested-scroll-position-clamping", requestedScrollData.clamping);
+ ts.dumpProperty("requested-scroll-position-animated", requestedScrollData.animated == ScrollIsAnimated::Yes);
}
}
Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -92,7 +92,7 @@
#endif
}
-void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&)
+void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, WebCore::ScrollIsAnimated)
{
notImplemented();
}
Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -62,7 +62,7 @@
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
void setViewNeedsDisplay(const WebCore::Region&) override;
- void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) override;
+ void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated) override;
void requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin) override;
WebCore::FloatPoint viewScrollPosition() override;
WebCore::IntSize viewSize() override;
Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -67,7 +67,7 @@
- (RefPtr<WebKit::ViewSnapshot>)_takeViewSnapshot;
-- (void)_scrollToContentScrollPosition:(WebCore::FloatPoint)scrollPosition scrollOrigin:(WebCore::IntPoint)scrollOrigin;
+- (void)_scrollToContentScrollPosition:(WebCore::FloatPoint)scrollPosition scrollOrigin:(WebCore::IntPoint)scrollOrigin animated:(BOOL)animated;
- (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance;
- (double)_initialScaleFactor;
Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2021-10-11 17:52:56 UTC (rev 283911)
@@ -1133,7 +1133,7 @@
return contentOffset.constrainedBetween(WebCore::FloatPoint(), WebCore::FloatPoint(maximumContentOffset));
}
-- (void)_scrollToContentScrollPosition:(WebCore::FloatPoint)scrollPosition scrollOrigin:(WebCore::IntPoint)scrollOrigin
+- (void)_scrollToContentScrollPosition:(WebCore::FloatPoint)scrollPosition scrollOrigin:(WebCore::IntPoint)scrollOrigin animated:(BOOL)animated
{
if (_commitDidRestoreScrollPosition || _dynamicViewportUpdateMode != WebKit::DynamicViewportUpdateMode::NotResizing)
return;
@@ -1156,7 +1156,7 @@
[_scrollView _stopScrollingAndZoomingAnimations];
if (!CGPointEqualToPoint(contentOffsetInScrollViewCoordinates, [_scrollView contentOffset]))
- [_scrollView setContentOffset:contentOffsetInScrollViewCoordinates];
+ [_scrollView setContentOffset:contentOffsetInScrollViewCoordinates animated:animated];
else {
// If we haven't changed anything, there would not be any VisibleContentRect update sent to the content.
// The WebProcess would keep the invalid contentOffset as its scroll position.
Modified: trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -71,7 +71,7 @@
{
}
-void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&)
+void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, WebCore::ScrollIsAnimated)
{
}
Modified: trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -68,7 +68,7 @@
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
void setViewNeedsDisplay(const WebCore::Region&) override;
- void requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&) override;
+ void requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, WebCore::ScrollIsAnimated) override;
WebCore::FloatPoint viewScrollPosition() override;
WebCore::IntSize viewSize() override;
bool isViewWindowActive() override;
Modified: trunk/Source/WebKit/UIProcess/PageClient.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/PageClient.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/PageClient.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -112,6 +112,7 @@
enum class TextIndicatorLifetime : uint8_t;
enum class TextIndicatorDismissalAnimation : uint8_t;
enum class DOMPasteAccessResponse : uint8_t;
+enum class ScrollIsAnimated : uint8_t;
struct AppHighlight;
struct DataDetectorElementInfo;
@@ -213,7 +214,7 @@
virtual void setViewNeedsDisplay(const WebCore::Region&) = 0;
// Tell the view to scroll to the given position, and whether this was a programmatic scroll.
- virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) = 0;
+ virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated) = 0;
// Return the current scroll position (not necessarily the same as the WebCore scroll position, because of scaling, insets etc.)
virtual WebCore::FloatPoint viewScrollPosition() = 0;
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm 2021-10-11 17:52:56 UTC (rev 283911)
@@ -222,8 +222,7 @@
}
#if ENABLE(ASYNC_SCROLLING)
- RemoteScrollingCoordinatorProxy::RequestedScrollInfo requestedScrollInfo;
- m_webPageProxy.scrollingCoordinatorProxy()->commitScrollingTreeState(scrollingTreeTransaction, requestedScrollInfo);
+ auto requestedScroll = m_webPageProxy.scrollingCoordinatorProxy()->commitScrollingTreeState(scrollingTreeTransaction);
#endif
m_webPageProxy.didCommitLayerTree(layerTreeTransaction);
@@ -236,8 +235,8 @@
// Handle requested scroll position updates from the scrolling tree transaction after didCommitLayerTree()
// has updated the view size based on the content size.
- if (requestedScrollInfo.requestsScrollPositionUpdate)
- m_webPageProxy.requestScroll(requestedScrollInfo.requestedScrollPosition, layerTreeTransaction.scrollOrigin());
+ if (requestedScroll)
+ m_webPageProxy.requestScroll(requestedScroll->scrollPosition, layerTreeTransaction.scrollOrigin(), requestedScroll->animated);
#endif // ENABLE(ASYNC_SCROLLING)
if (m_debugIndicatorLayerTreeHost) {
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -76,9 +76,9 @@
return &remoteDrawingArea.remoteLayerTreeHost();
}
-void RemoteScrollingCoordinatorProxy::commitScrollingTreeState(const RemoteScrollingCoordinatorTransaction& transaction, RequestedScrollInfo& requestedScrollInfo)
+std::optional<RequestedScrollData> RemoteScrollingCoordinatorProxy::commitScrollingTreeState(const RemoteScrollingCoordinatorTransaction& transaction)
{
- m_requestedScrollInfo = &requestedScrollInfo;
+ m_requestedScroll = { };
auto stateTree = WTFMove(const_cast<RemoteScrollingCoordinatorTransaction&>(transaction).scrollingStateTree());
@@ -85,7 +85,7 @@
auto* layerTreeHost = this->layerTreeHost();
if (!layerTreeHost) {
ASSERT_NOT_REACHED();
- return;
+ return { };
}
connectStateNodeLayers(*stateTree, *layerTreeHost);
@@ -93,7 +93,7 @@
establishLayerTreeScrollingRelations(*layerTreeHost);
- m_requestedScrollInfo = nullptr;
+ return std::exchange(m_requestedScroll, { });
}
#if !PLATFORM(IOS_FAMILY)
@@ -241,16 +241,13 @@
m_webPageProxy.send(Messages::RemoteScrollingCoordinator::AnimatedScrollDidEndForNode(scrolledNodeID));
}
-bool RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& scrollPosition, ScrollType scrollType, ScrollClamping)
+bool RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll(ScrollingNodeID scrolledNodeID, const RequestedScrollData& request)
{
- if (scrolledNodeID == rootScrollingNodeID() && m_requestedScrollInfo) {
- // FIXME: Handle animated scrolls.
- m_requestedScrollInfo->requestsScrollPositionUpdate = true;
- m_requestedScrollInfo->requestIsProgrammaticScroll = scrollType == ScrollType::Programmatic;
- m_requestedScrollInfo->requestedScrollPosition = scrollPosition;
+ if (scrolledNodeID == rootScrollingNodeID()) {
+ m_requestedScroll = request;
return true;
}
-
+
return false;
}
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -59,7 +59,7 @@
// Inform the web process that the scroll position changed (called from the scrolling tree)
void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition, const std::optional<WebCore::FloatPoint>& layoutViewportOrigin, WebCore::ScrollingLayerPositionAction);
- bool scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::ScrollType, WebCore::ScrollClamping);
+ bool scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::RequestedScrollData&);
void scrollingTreeNodeDidStopAnimatedScroll(WebCore::ScrollingNodeID);
WebCore::TrackingType eventTrackingTypeForPoint(const AtomString& eventName, WebCore::IntPoint) const;
@@ -80,12 +80,7 @@
const RemoteLayerTreeHost* layerTreeHost() const;
WebPageProxy& webPageProxy() const { return m_webPageProxy; }
- struct RequestedScrollInfo {
- bool requestsScrollPositionUpdate { };
- bool requestIsProgrammaticScroll { };
- WebCore::FloatPoint requestedScrollPosition;
- };
- void commitScrollingTreeState(const RemoteScrollingCoordinatorTransaction&, RequestedScrollInfo&);
+ std::optional<WebCore::RequestedScrollData> commitScrollingTreeState(const RemoteScrollingCoordinatorTransaction&);
void setPropagatesMainFrameScrolls(bool propagatesMainFrameScrolls) { m_propagatesMainFrameScrolls = propagatesMainFrameScrolls; }
bool propagatesMainFrameScrolls() const { return m_propagatesMainFrameScrolls; }
@@ -126,7 +121,7 @@
WebPageProxy& m_webPageProxy;
RefPtr<RemoteScrollingTree> m_scrollingTree;
HashMap<unsigned, OptionSet<WebCore::TouchAction>> m_touchActionsByTouchIdentifier;
- RequestedScrollInfo* m_requestedScrollInfo { nullptr };
+ std::optional<WebCore::RequestedScrollData> m_requestedScroll;
RemoteScrollingUIState m_uiState;
std::optional<unsigned> m_currentHorizontalSnapPointIndex;
std::optional<unsigned> m_currentVerticalSnapPointIndex;
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -101,7 +101,7 @@
bool RemoteScrollingTree::scrollingTreeNodeRequestsScroll(ScrollingNodeID nodeID, const RequestedScrollData& request)
{
- return m_scrollingCoordinatorProxy.scrollingTreeNodeRequestsScroll(nodeID, request.scrollPosition, request.scrollType, request.clamping);
+ return m_scrollingCoordinatorProxy.scrollingTreeNodeRequestsScroll(nodeID, request);
}
Ref<ScrollingTreeNode> RemoteScrollingTree::createScrollingTreeNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm 2021-10-11 17:52:56 UTC (rev 283911)
@@ -84,11 +84,11 @@
void ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren(const ScrollingStateNode& stateNode)
{
- ScrollingTreeFrameScrollingNode::commitStateAfterChildren(stateNode);
-
const auto& scrollingStateNode = downcast<ScrollingStateFrameScrollingNode>(stateNode);
if (m_scrollingNodeDelegate)
m_scrollingNodeDelegate->commitStateAfterChildren(scrollingStateNode);
+
+ ScrollingTreeFrameScrollingNode::commitStateAfterChildren(stateNode);
}
FloatPoint ScrollingTreeFrameScrollingNodeRemoteIOS::minimumScrollPosition() const
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -35,7 +35,7 @@
class ScrollingTreeScrollingNodeDelegateIOS;
-class ScrollingTreeOverflowScrollingNodeIOS : public WebCore::ScrollingTreeOverflowScrollingNode {
+class ScrollingTreeOverflowScrollingNodeIOS final : public WebCore::ScrollingTreeOverflowScrollingNode {
public:
static Ref<ScrollingTreeOverflowScrollingNodeIOS> create(WebCore::ScrollingTree&, WebCore::ScrollingNodeID);
virtual ~ScrollingTreeOverflowScrollingNodeIOS();
@@ -45,11 +45,14 @@
private:
ScrollingTreeOverflowScrollingNodeIOS(WebCore::ScrollingTree&, WebCore::ScrollingNodeID);
- void commitStateBeforeChildren(const WebCore::ScrollingStateNode&) override;
- void commitStateAfterChildren(const WebCore::ScrollingStateNode&) override;
+ void commitStateBeforeChildren(const WebCore::ScrollingStateNode&) final;
+ void commitStateAfterChildren(const WebCore::ScrollingStateNode&) final;
- void repositionScrollingLayers() override;
+ void repositionScrollingLayers() final;
+ bool startAnimatedScrollToPosition(WebCore::FloatPoint) final;
+ void stopAnimatedScroll() final;
+
// The delegate is non-null for subframes.
std::unique_ptr<ScrollingTreeScrollingNodeDelegateIOS> m_scrollingNodeDelegate;
};
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm 2021-10-11 17:52:56 UTC (rev 283911)
@@ -67,10 +67,10 @@
void ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren(const ScrollingStateNode& stateNode)
{
- ScrollingTreeOverflowScrollingNode::commitStateAfterChildren(stateNode);
-
const auto& scrollingStateNode = downcast<ScrollingStateScrollingNode>(stateNode);
m_scrollingNodeDelegate->commitStateAfterChildren(scrollingStateNode);
+
+ ScrollingTreeOverflowScrollingNode::commitStateAfterChildren(stateNode);
}
void ScrollingTreeOverflowScrollingNodeIOS::repositionScrollingLayers()
@@ -78,6 +78,16 @@
m_scrollingNodeDelegate->repositionScrollingLayers();
}
+bool ScrollingTreeOverflowScrollingNodeIOS::startAnimatedScrollToPosition(FloatPoint destinationPosition)
+{
+ return m_scrollingNodeDelegate->startAnimatedScrollToPosition(destinationPosition);
+}
+
+void ScrollingTreeOverflowScrollingNodeIOS::stopAnimatedScroll()
+{
+ m_scrollingNodeDelegate->stopAnimatedScroll();
+}
+
} // namespace WebKit
#endif // ENABLE(ASYNC_SCROLLING)
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -46,7 +46,7 @@
namespace WebKit {
-class ScrollingTreeScrollingNodeDelegateIOS : public WebCore::ScrollingTreeScrollingNodeDelegate {
+class ScrollingTreeScrollingNodeDelegateIOS final : public WebCore::ScrollingTreeScrollingNodeDelegate {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit ScrollingTreeScrollingNodeDelegateIOS(WebCore::ScrollingTreeScrollingNode&);
@@ -78,10 +78,10 @@
UIScrollView *findActingScrollParent(UIScrollView *);
UIScrollView *scrollView() const;
-private:
- bool startAnimatedScrollToPosition(FloatPoint) final;
+ bool startAnimatedScrollToPosition(WebCore::FloatPoint) final;
void stopAnimatedScroll() final;
+private:
RetainPtr<CALayer> m_scrollLayer;
RetainPtr<CALayer> m_scrolledContentsLayer;
RetainPtr<WKScrollingNodeScrollViewDelegate> m_scrollViewDelegate;
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm 2021-10-11 17:52:56 UTC (rev 283911)
@@ -45,7 +45,6 @@
#import <wtf/BlockObjCExceptions.h>
#import <wtf/SetForScope.h>
-
@implementation WKScrollingNodeScrollViewDelegate
- (instancetype)initWithScrollingTreeNodeDelegate:(WebKit::ScrollingTreeScrollingNodeDelegateIOS*)delegate
@@ -294,15 +293,21 @@
}
}
-bool ScrollingTreeScrollingNodeDelegateIOS::startAnimatedScrollToPosition(FloatPoint)
+bool ScrollingTreeScrollingNodeDelegateIOS::startAnimatedScrollToPosition(FloatPoint scrollPosition)
{
- // FIXME: Implement.
- return false;
+ auto scrollOffset = ScrollableArea::scrollOffsetFromPosition(scrollPosition, toFloatSize(scrollOrigin()));
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ [scrollView() setContentOffset:scrollOffset animated:YES];
+ END_BLOCK_OBJC_EXCEPTIONS
+ return true;
}
void ScrollingTreeScrollingNodeDelegateIOS::stopAnimatedScroll()
{
- // FIXME: Implement.
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ [scrollView() _stopScrollingAndZoomingAnimations];
+ END_BLOCK_OBJC_EXCEPTIONS
}
#if HAVE(UISCROLLVIEW_ASYNCHRONOUS_SCROLL_EVENT_HANDLING)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -2067,9 +2067,9 @@
pageClient().setViewNeedsDisplay(region);
}
-void WebPageProxy::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin)
+void WebPageProxy::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, ScrollIsAnimated animated)
{
- pageClient().requestScroll(scrollPosition, scrollOrigin);
+ pageClient().requestScroll(scrollPosition, scrollOrigin, animated);
}
WebCore::FloatPoint WebPageProxy::viewScrollPosition() const
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -712,7 +712,7 @@
PageClient& pageClient() const;
void setViewNeedsDisplay(const WebCore::Region&);
- void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin);
+ void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated);
WebCore::FloatPoint viewScrollPosition() const;
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -59,7 +59,7 @@
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
void setViewNeedsDisplay(const WebCore::Region&) override;
- void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) override;
+ void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated) override;
WebCore::FloatPoint viewScrollPosition() override;
WebCore::IntSize viewSize() override;
bool isViewWindowActive() override;
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2021-10-11 17:52:56 UTC (rev 283911)
@@ -104,9 +104,9 @@
ASSERT_NOT_REACHED();
}
-void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin)
+void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, ScrollIsAnimated animated)
{
- [m_webView _scrollToContentScrollPosition:scrollPosition scrollOrigin:scrollOrigin];
+ [m_webView _scrollToContentScrollPosition:scrollPosition scrollOrigin:scrollOrigin animated:animated == ScrollIsAnimated::Yes];
}
WebCore::FloatPoint PageClientImpl::viewScrollPosition()
Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -65,7 +65,7 @@
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
void setViewNeedsDisplay(const WebCore::Region&) override;
- void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) override;
+ void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated) override;
WebCore::FloatPoint viewScrollPosition() override;
WebCore::IntSize viewSize() override;
Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm 2021-10-11 17:52:56 UTC (rev 283911)
@@ -130,7 +130,7 @@
ASSERT_NOT_REACHED();
}
-void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin)
+void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, ScrollIsAnimated)
{
}
Modified: trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.cpp (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -48,7 +48,7 @@
m_view.setViewNeedsDisplay(region);
}
-void PageClientImpl::requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin)
+void PageClientImpl::requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated)
{
}
Modified: trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -52,7 +52,7 @@
void setViewNeedsDisplay(const WebCore::Region&) override;
// Tell the view to scroll to the given position, and whether this was a programmatic scroll.
- void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) override;
+ void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated) override;
// Return the current scroll position (not necessarily the same as the WebCore scroll position, because of scaling, insets etc.)
WebCore::FloatPoint viewScrollPosition() override;
Modified: trunk/Source/WebKit/UIProcess/win/PageClientImpl.cpp (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/win/PageClientImpl.cpp 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/win/PageClientImpl.cpp 2021-10-11 17:52:56 UTC (rev 283911)
@@ -55,7 +55,7 @@
m_view.setViewNeedsDisplay(region);
}
-void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&)
+void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, WebCore::ScrollIsAnimated)
{
notImplemented();
}
Modified: trunk/Source/WebKit/UIProcess/win/PageClientImpl.h (283910 => 283911)
--- trunk/Source/WebKit/UIProcess/win/PageClientImpl.h 2021-10-11 17:49:51 UTC (rev 283910)
+++ trunk/Source/WebKit/UIProcess/win/PageClientImpl.h 2021-10-11 17:52:56 UTC (rev 283911)
@@ -59,7 +59,7 @@
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
void setViewNeedsDisplay(const WebCore::Region&) override;
- void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) override;
+ void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated) override;
WebCore::FloatPoint viewScrollPosition() override;
WebCore::IntSize viewSize() override;
bool isViewWindowActive() override;