Diff
Modified: trunk/LayoutTests/ChangeLog (292811 => 292812)
--- trunk/LayoutTests/ChangeLog 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/LayoutTests/ChangeLog 2022-04-13 16:41:00 UTC (rev 292812)
@@ -1,3 +1,20 @@
+2022-04-13 Simon Fraser <[email protected]>
+
+ [css-scroll-snap] scrollIntoView fails with scroll-snap-type on :root
+ https://bugs.webkit.org/show_bug.cgi?id=239063
+ <rdar://problem/91603363>
+
+ Reviewed by Dean Jackson.
+
+ Make UIHelper.waitForScrollCompletion() work on iOS.
+
+ * fast/scrolling/ios/constrain-scrollintoview-position-expected.txt: Added.
+ * fast/scrolling/ios/constrain-scrollintoview-position.html: Added.
+ * resources/ui-helper.js:
+ (window.UIHelper.async waitForScrollCompletion.await.new.Promise.):
+ (window.UIHelper.async waitForScrollCompletion.await.new.Promise):
+ (window.UIHelper.async waitForScrollCompletion):
+
2022-04-12 Wenson Hsieh <[email protected]>
Remove support for drawing cropped image overlays when hovering over "Copy Cropped Image"
Added: trunk/LayoutTests/fast/scrolling/ios/constrain-scrollintoview-position-expected.txt (0 => 292812)
--- trunk/LayoutTests/fast/scrolling/ios/constrain-scrollintoview-position-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/constrain-scrollintoview-position-expected.txt 2022-04-13 16:41:00 UTC (rev 292812)
@@ -0,0 +1,7 @@
+
+PASS contentWindow.pageYOffset is 0
+PASS contentWindow.pageYOffset is 1120
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/scrolling/ios/constrain-scrollintoview-position.html (0 => 292812)
--- trunk/LayoutTests/fast/scrolling/ios/constrain-scrollintoview-position.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/constrain-scrollintoview-position.html 2022-04-13 16:41:00 UTC (rev 292812)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <script src=""
+ <script src=""
+ <script>
+ jsTestIsAsync = true;
+
+ if (window.internals)
+ internals.settings.setAsyncFrameScrollingEnabled(true);
+
+ async function runTest()
+ {
+ let iframe = document.getElementsByTagName('iframe')[0];
+ contentWindow = iframe.contentWindow;
+ let target = iframe.contentDocument.getElementById('target');
+
+ shouldBe('contentWindow.pageYOffset', '0');
+ target.scrollIntoView({ behavior: "smooth" });
+
+ await UIHelper.waitForScrollCompletion();
+
+ shouldBe('contentWindow.pageYOffset', '1120');
+ finishJSTest();
+ }
+ </script>
+ <style>
+ iframe {
+ border: 1px solid black;
+ height: 400px;
+ width: 320px;
+ }
+ </style>
+ </head>
+ <body>
+ <iframe srcdoc="
+ <style>
+ body { margin: 0; }
+ #target { margin-top: 1500px; height: 20px; }
+ </style>
+ <body>
+ <div id=target>target</div>
+ </body>" _onload_="runTest()">
+ </iframe>
+ <div id=console></div>
+ <script src=""
+ </body>
+</html>
Modified: trunk/LayoutTests/resources/ui-helper.js (292811 => 292812)
--- trunk/LayoutTests/resources/ui-helper.js 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/LayoutTests/resources/ui-helper.js 2022-04-13 16:41:00 UTC (rev 292812)
@@ -141,6 +141,19 @@
static async waitForScrollCompletion()
{
+ if (this.isIOSFamily()) {
+ await new Promise(resolve => {
+ testRunner.runUIScript(`
+ (function() {
+ uiController.didEndScrollingCallback = function() {
+ uiController.uiScriptComplete();
+ }
+ })()`, resolve);
+ });
+ // Wait for the new scroll position to get back to the web process.
+ return UIHelper.renderingUpdate();
+ }
+
return new Promise(resolve => {
eventSender.callAfterScrollingCompletes(() => {
requestAnimationFrame(resolve);
Modified: trunk/Source/WebCore/ChangeLog (292811 => 292812)
--- trunk/Source/WebCore/ChangeLog 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebCore/ChangeLog 2022-04-13 16:41:00 UTC (rev 292812)
@@ -1,3 +1,33 @@
+2022-04-13 Simon Fraser <[email protected]>
+
+ [css-scroll-snap] scrollIntoView fails with scroll-snap-type on :root
+ https://bugs.webkit.org/show_bug.cgi?id=239063
+ <rdar://problem/91603363>
+
+ Reviewed by Dean Jackson.
+
+ Programmatic smooth scrolls on iframe documents were broken because
+ ScrollingTreeFrameScrollingNodeRemoteIOS was overlooked when adding support (easily done
+ since the main frame's scrolling is controlled via the WKWebView; some unification here
+ would be beneficial). Implementing startAnimatedScrollToPosition() and stopAnimatedScroll()
+ on ScrollingTreeFrameScrollingNodeRemoteIOS fixes this.
+
+ However, this revealed an additional bug; RenderLayer::scrollRectToVisible() failed to clamp
+ the target scroll position correctly, and nothing in the iOS-smooth scrolling code path
+ clamped, so the scroll would go too far.
+
+ Testing required getting UIHelper.waitForScrollCompletion() to work. This is based on the
+ uiController.didEndScrollingCallback, but that was only hooked up for the main scroller. So
+ make it work for all scrollers by plumbing ScrollingNodeIDs through
+ scrollingNodeScrollViewDidScroll() and friends so that everything ends up in -[WKWebViewIOS
+ _didFinishScrolling:] with a UIScrollView argument; to avoid any behavior change, this bails
+ for non-main scroll views, but TestRunnerWKWebView overrides it to make testing work.
+
+ Test: fast/scrolling/ios/constrain-scrollintoview-position.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::scrollRectToVisible):
+
2022-04-13 Chris Dumez <[email protected]>
Replace AtomString(const char*) with AtomString::fromLatin1(const char*)
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (292811 => 292812)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-04-13 16:41:00 UTC (rev 292812)
@@ -2549,10 +2549,9 @@
expandScrollRectToVisibleTargetRectToIncludeScrollPadding(renderer, viewRect, newRect);
LayoutRect exposeRect = getRectToExpose(viewRect, newRect, insideFixed, options.alignX, options.alignY);
- IntPoint scrollPosition(roundedIntPoint(exposeRect.location()));
+ auto scrollPosition = roundedIntPoint(exposeRect.location());
- // Adjust offsets if they're outside of the allowable range.
- scrollPosition = scrollPosition.constrainedBetween(IntPoint(), IntPoint(frameView.contentsSize()));
+ scrollPosition = frameView.constrainedScrollPosition(scrollPosition);
// FIXME: Should we use contentDocument()->scrollingElement()?
// See https://bugs.webkit.org/show_bug.cgi?id=205059
Modified: trunk/Source/WebKit/ChangeLog (292811 => 292812)
--- trunk/Source/WebKit/ChangeLog 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/ChangeLog 2022-04-13 16:41:00 UTC (rev 292812)
@@ -1,3 +1,76 @@
+2022-04-13 Simon Fraser <[email protected]>
+
+ [css-scroll-snap] scrollIntoView fails with scroll-snap-type on :root
+ https://bugs.webkit.org/show_bug.cgi?id=239063
+ <rdar://problem/91603363>
+
+ Reviewed by Dean Jackson.
+
+ Programmatic smooth scrolls on iframe documents were broken because
+ ScrollingTreeFrameScrollingNodeRemoteIOS was overlooked when adding support (easily done
+ since the main frame's scrolling is controlled via the WKWebView; some unification here
+ would be beneficial). Implementing startAnimatedScrollToPosition() and stopAnimatedScroll()
+ on ScrollingTreeFrameScrollingNodeRemoteIOS fixes this.
+
+ However, this revealed an additional bug; RenderLayer::scrollRectToVisible() failed to clamp
+ the target scroll position correctly, and nothing in the iOS-smooth scrolling code path
+ clamped, so the scroll would go too far.
+
+ Testing required getting UIHelper.waitForScrollCompletion() to work. This is based on the
+ uiController.didEndScrollingCallback, but that was only hooked up for the main scroller. So
+ make it work for all scrollers by plumbing ScrollingNodeIDs through
+ scrollingNodeScrollViewDidScroll() and friends so that everything ends up in -[WKWebViewIOS
+ _didFinishScrolling:] with a UIScrollView argument; to avoid any behavior change, this bails
+ for non-main scroll views, but TestRunnerWKWebView overrides it to make testing work.
+
+ Test: fast/scrolling/ios/constrain-scrollintoview-position.html
+
+ * UIProcess/API/ios/WKWebViewIOS.h:
+ * UIProcess/API/ios/WKWebViewIOS.mm:
+ (-[WKWebView _didFinishScrolling:]):
+ (-[WKWebView scrollViewDidEndDragging:willDecelerate:]):
+ (-[WKWebView scrollViewDidEndDecelerating:]):
+ (-[WKWebView scrollViewDidScrollToTop:]):
+ (-[WKWebView scrollViewDidEndScrollingAnimation:]):
+ (-[WKWebView _didFinishScrolling]): Deleted.
+ * UIProcess/PageClient.h:
+ * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
+ * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture):
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll):
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll):
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
+ (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::startAnimatedScrollToPosition):
+ (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::stopAnimatedScroll):
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+ (-[WKScrollingNodeScrollViewDelegate scrollViewDidEndScrollingAnimation:]):
+ (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::scrollingNodeScrollViewWillStartPanGesture):
+ (WebKit::PageClientImpl::scrollingNodeScrollViewDidScroll):
+ (WebKit::PageClientImpl::scrollingNodeScrollWillStartScroll):
+ (WebKit::PageClientImpl::scrollingNodeScrollDidEndScroll):
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _scrollingNodeScrollingWillBegin:]):
+ (-[WKContentView _scrollingNodeScrollingDidEnd:]):
+ (-[WKContentView keyboardScrollViewAnimatorDidFinishScrolling:]):
+ (-[WKContentView _scrollingNodeScrollingWillBegin]): Deleted.
+ (-[WKContentView _scrollingNodeScrollingDidEnd]): Deleted.
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::scrollingNodeScrollViewWillStartPanGesture):
+ (WebKit::WebPageProxy::scrollingNodeScrollViewDidScroll):
+ (WebKit::WebPageProxy::scrollingNodeScrollWillStartScroll):
+ (WebKit::WebPageProxy::scrollingNodeScrollDidEndScroll):
+ * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+ (WebKit::WebChromeClient::didStartOverflowScroll):
+ (WebKit::WebChromeClient::didEndOverflowScroll):
+
2022-04-13 Chris Dumez <[email protected]>
Replace AtomString(const char*) with AtomString::fromLatin1(const char*)
Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h 2022-04-13 16:41:00 UTC (rev 292812)
@@ -85,7 +85,7 @@
- (BOOL)_zoomToRect:(WebCore::FloatRect)targetRect withOrigin:(WebCore::FloatPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(float)minimumScrollDistance;
- (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated;
- (void)_zoomToInitialScaleWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated;
-- (void)_didFinishScrolling;
+- (void)_didFinishScrolling:(UIScrollView *)scrollView;
- (void)_setHasCustomContentView:(BOOL)hasCustomContentView loadedMIMEType:(const WTF::String&)mimeType;
- (void)_didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:(const WTF::String&)suggestedFilename data:(NSData *)data;
Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm 2022-04-13 16:41:00 UTC (rev 292812)
@@ -1676,8 +1676,11 @@
#endif
}
-- (void)_didFinishScrolling
+- (void)_didFinishScrolling:(UIScrollView *)scrollView
{
+ if (scrollView != _scrollView.get())
+ return;
+
if (![self usesStandardContentView])
return;
@@ -1725,17 +1728,17 @@
{
// If we're decelerating, scroll offset will be updated when scrollViewDidFinishDecelerating: is called.
if (!decelerate)
- [self _didFinishScrolling];
+ [self _didFinishScrolling:scrollView];
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
- [self _didFinishScrolling];
+ [self _didFinishScrolling:scrollView];
}
- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView
{
- [self _didFinishScrolling];
+ [self _didFinishScrolling:scrollView];
}
- (CGPoint)_scrollView:(UIScrollView *)scrollView adjustedOffsetForOffset:(CGPoint)offset translation:(CGPoint)translation startPoint:(CGPoint)start locationInView:(CGPoint)locationInView horizontalVelocity:(inout double *)hv verticalVelocity:(inout double *)vv
@@ -1858,7 +1861,7 @@
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
- [self _didFinishScrolling];
+ [self _didFinishScrolling:scrollView];
}
- (void)_scrollViewDidInterruptDecelerating:(UIScrollView *)scrollView
Modified: trunk/Source/WebKit/UIProcess/PageClient.h (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/PageClient.h 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/PageClient.h 2022-04-13 16:41:00 UTC (rev 292812)
@@ -480,10 +480,10 @@
virtual void handleSmartMagnificationInformationForPotentialTap(WebKit::TapIdentifier, const WebCore::FloatRect& renderRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale, bool nodeIsRootLevel) = 0;
virtual double minimumZoomScale() const = 0;
virtual WebCore::FloatRect documentRect() const = 0;
- virtual void scrollingNodeScrollViewWillStartPanGesture() = 0;
- virtual void scrollingNodeScrollViewDidScroll() = 0;
- virtual void scrollingNodeScrollWillStartScroll() = 0;
- virtual void scrollingNodeScrollDidEndScroll() = 0;
+ virtual void scrollingNodeScrollViewWillStartPanGesture(WebCore::ScrollingNodeID) = 0;
+ virtual void scrollingNodeScrollViewDidScroll(WebCore::ScrollingNodeID) = 0;
+ virtual void scrollingNodeScrollWillStartScroll(WebCore::ScrollingNodeID) = 0;
+ virtual void scrollingNodeScrollDidEndScroll(WebCore::ScrollingNodeID) = 0;
virtual Vector<String> mimeTypesWithCustomContentProviders() = 0;
virtual void showInspectorHighlight(const WebCore::InspectorOverlay::Highlight&) = 0;
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp 2022-04-13 16:41:00 UTC (rev 292812)
@@ -227,7 +227,7 @@
return;
#if PLATFORM(IOS_FAMILY)
- m_webPageProxy.scrollingNodeScrollViewDidScroll();
+ m_webPageProxy.scrollingNodeScrollViewDidScroll(scrolledNodeID);
#endif
if (m_scrollingTree->isHandlingProgrammaticScroll())
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm 2022-04-13 16:41:00 UTC (rev 292812)
@@ -129,15 +129,15 @@
m_webPageProxy.displayedContentScale(), FrameView::LayoutViewportConstraint::Unconstrained);
}
-void RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture(ScrollingNodeID)
+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture(ScrollingNodeID nodeID)
{
- m_webPageProxy.scrollingNodeScrollViewWillStartPanGesture();
+ m_webPageProxy.scrollingNodeScrollViewWillStartPanGesture(nodeID);
}
// This is not called for the main scroll view.
void RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartScroll(ScrollingNodeID nodeID)
{
- m_webPageProxy.scrollingNodeScrollWillStartScroll();
+ m_webPageProxy.scrollingNodeScrollWillStartScroll(nodeID);
m_uiState.addNodeWithActiveUserScroll(nodeID);
sendUIStateChangedIfNecessary();
@@ -146,7 +146,7 @@
// This is not called for the main scroll view.
void RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidEndScroll(ScrollingNodeID nodeID)
{
- m_webPageProxy.scrollingNodeScrollDidEndScroll();
+ m_webPageProxy.scrollingNodeScrollDidEndScroll(nodeID);
m_uiState.removeNodeWithActiveUserScroll(nodeID);
sendUIStateChangedIfNecessary();
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h 2022-04-13 16:41:00 UTC (rev 292812)
@@ -54,6 +54,9 @@
void repositionScrollingLayers() override;
void repositionRelatedLayers() override;
+ bool startAnimatedScrollToPosition(WebCore::FloatPoint) final;
+ void stopAnimatedScroll() final;
+
std::unique_ptr<ScrollingTreeScrollingNodeDelegateIOS> m_scrollingNodeDelegate;
RetainPtr<CALayer> m_counterScrollingLayer;
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm 2022-04-13 16:41:00 UTC (rev 292812)
@@ -143,5 +143,26 @@
END_BLOCK_OBJC_EXCEPTIONS
}
+bool ScrollingTreeFrameScrollingNodeRemoteIOS::startAnimatedScrollToPosition(FloatPoint destinationPosition)
+{
+ // Main frame animated scrolls are handled via PageClientImpl::requestScroll().
+ if (!m_scrollingNodeDelegate)
+ return false;
+
+ bool started = m_scrollingNodeDelegate->startAnimatedScrollToPosition(destinationPosition);
+ if (started)
+ willStartAnimatedScroll();
+ return started;
}
+
+void ScrollingTreeFrameScrollingNodeRemoteIOS::stopAnimatedScroll()
+{
+ // Main frame animated scrolls are handled via PageClientImpl::requestScroll().
+ if (!m_scrollingNodeDelegate)
+ return;
+
+ m_scrollingNodeDelegate->stopAnimatedScroll();
+}
+
+}
#endif
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm 2022-04-13 16:41:00 UTC (rev 292812)
@@ -132,6 +132,11 @@
}
}
+- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
+{
+ _scrollingTreeNodeDelegate->scrollDidEnd();
+}
+
- (CGPoint)_scrollView:(UIScrollView *)scrollView adjustedOffsetForOffset:(CGPoint)offset translation:(CGPoint)translation startPoint:(CGPoint)start locationInView:(CGPoint)locationInView horizontalVelocity:(inout double *)hv verticalVelocity:(inout double *)vv
{
auto* panGestureRecognizer = scrollView.panGestureRecognizer;
@@ -331,6 +336,10 @@
void ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers()
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
+
+ if ([scrollView() _isAnimatingScroll])
+ return;
+
[scrollView() setContentOffset:scrollingNode().currentScrollOffset()];
END_BLOCK_OBJC_EXCEPTIONS
}
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2022-04-13 16:41:00 UTC (rev 292812)
@@ -844,10 +844,10 @@
WebCore::FloatRect unconstrainedLayoutViewportRect() const;
void adjustLayersForLayoutViewport(const WebCore::FloatRect& layoutViewport);
- void scrollingNodeScrollViewWillStartPanGesture();
- void scrollingNodeScrollViewDidScroll();
- void scrollingNodeScrollWillStartScroll();
- void scrollingNodeScrollDidEndScroll();
+ void scrollingNodeScrollViewWillStartPanGesture(WebCore::ScrollingNodeID);
+ void scrollingNodeScrollViewDidScroll(WebCore::ScrollingNodeID);
+ void scrollingNodeScrollWillStartScroll(WebCore::ScrollingNodeID);
+ void scrollingNodeScrollDidEndScroll(WebCore::ScrollingNodeID);
void dynamicViewportSizeUpdate(const WebCore::FloatSize& viewLayoutSize, const WebCore::FloatSize& minimumUnobscuredSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double targetScale, int32_t deviceOrientation, double minimumEffectiveDeviceWidth, DynamicViewportSizeUpdateID);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2022-04-13 16:41:00 UTC (rev 292812)
@@ -391,8 +391,8 @@
ElementDidBlur()
UpdateInputContextAfterBlurringAndRefocusingElement()
FocusedElementDidChangeInputMode(enum:uint8_t WebCore::InputMode mode)
- ScrollingNodeScrollWillStartScroll()
- ScrollingNodeScrollDidEndScroll()
+ ScrollingNodeScrollWillStartScroll(uint64_t nodeID)
+ ScrollingNodeScrollDidEndScroll(uint64_t nodeID)
ShowInspectorHighlight(struct WebCore::InspectorOverlay::Highlight highlight)
HideInspectorHighlight()
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2022-04-13 16:41:00 UTC (rev 292812)
@@ -211,10 +211,10 @@
void enableInspectorNodeSearch() override;
void disableInspectorNodeSearch() override;
- void scrollingNodeScrollViewWillStartPanGesture() override;
- void scrollingNodeScrollViewDidScroll() override;
- void scrollingNodeScrollWillStartScroll() override;
- void scrollingNodeScrollDidEndScroll() override;
+ void scrollingNodeScrollViewWillStartPanGesture(WebCore::ScrollingNodeID) override;
+ void scrollingNodeScrollViewDidScroll(WebCore::ScrollingNodeID) override;
+ void scrollingNodeScrollWillStartScroll(WebCore::ScrollingNodeID) override;
+ void scrollingNodeScrollDidEndScroll(WebCore::ScrollingNodeID) override;
void requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin) override;
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2022-04-13 16:41:00 UTC (rev 292812)
@@ -760,24 +760,24 @@
[m_webView _didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:suggestedFilename data:data.get()];
}
-void PageClientImpl::scrollingNodeScrollViewWillStartPanGesture()
+void PageClientImpl::scrollingNodeScrollViewWillStartPanGesture(ScrollingNodeID)
{
[m_contentView scrollViewWillStartPanOrPinchGesture];
}
-void PageClientImpl::scrollingNodeScrollViewDidScroll()
+void PageClientImpl::scrollingNodeScrollViewDidScroll(ScrollingNodeID)
{
[m_contentView _didScroll];
}
-void PageClientImpl::scrollingNodeScrollWillStartScroll()
+void PageClientImpl::scrollingNodeScrollWillStartScroll(ScrollingNodeID nodeID)
{
- [m_contentView _scrollingNodeScrollingWillBegin];
+ [m_contentView _scrollingNodeScrollingWillBegin:nodeID];
}
-void PageClientImpl::scrollingNodeScrollDidEndScroll()
+void PageClientImpl::scrollingNodeScrollDidEndScroll(ScrollingNodeID nodeID)
{
- [m_contentView _scrollingNodeScrollingDidEnd];
+ [m_contentView _scrollingNodeScrollingDidEnd:nodeID];
}
Vector<String> PageClientImpl::mimeTypesWithCustomContentProviders()
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2022-04-13 16:41:00 UTC (rev 292812)
@@ -661,8 +661,8 @@
- (void)_willStartScrollingOrZooming;
- (void)_didScroll;
- (void)_didEndScrollingOrZooming;
-- (void)_scrollingNodeScrollingWillBegin;
-- (void)_scrollingNodeScrollingDidEnd;
+- (void)_scrollingNodeScrollingWillBegin:(WebCore::ScrollingNodeID)nodeID;
+- (void)_scrollingNodeScrollingDidEnd:(WebCore::ScrollingNodeID)nodeID;
- (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect routeSharingPolicy:(WebCore::RouteSharingPolicy)policy routingContextUID:(NSString *)contextUID;
- (void)_showRunOpenPanel:(API::OpenPanelParameters*)parameters frameInfo:(const WebKit::FrameInfoData&)frameInfo resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener;
- (void)_showShareSheet:(const WebCore::ShareDataWithParsedURL&)shareData inRect:(std::optional<WebCore::FloatRect>)rect completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2022-04-13 16:41:00 UTC (rev 292812)
@@ -2286,12 +2286,12 @@
[self _cancelInteraction];
}
-- (void)_scrollingNodeScrollingWillBegin
+- (void)_scrollingNodeScrollingWillBegin:(WebCore::ScrollingNodeID)scrollingNodeID
{
[_textInteractionAssistant willStartScrollingOverflow];
}
-- (void)_scrollingNodeScrollingDidEnd
+- (void)_scrollingNodeScrollingDidEnd:(WebCore::ScrollingNodeID)scrollingNodeID
{
// If scrolling ends before we've received a selection update,
// we postpone showing the selection until the update is received.
@@ -2301,6 +2301,12 @@
}
[self _updateChangedSelection];
[_textInteractionAssistant didEndScrollingOverflow];
+
+ UIScrollView *targetScrollView = nil;
+ if (auto* scrollingCoordinator = _page->scrollingCoordinatorProxy())
+ targetScrollView = scrollingCoordinator->scrollViewForScrollingNodeID(scrollingNodeID);
+
+ [_webView _didFinishScrolling:targetScrollView];
}
- (BOOL)shouldShowAutomaticKeyboardUI
@@ -6340,7 +6346,7 @@
- (void)keyboardScrollViewAnimatorDidFinishScrolling:(WKKeyboardScrollViewAnimator *)animator
{
- [_webView _didFinishScrolling];
+ [_webView _didFinishScrolling:self.webView.scrollView];
}
- (void)executeEditCommandWithCallback:(NSString *)commandName
Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (292811 => 292812)
--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2022-04-13 16:41:00 UTC (rev 292812)
@@ -245,24 +245,24 @@
m_scrollingCoordinatorProxy->viewportChangedViaDelegatedScrolling(unobscuredContentRect().location(), layoutViewport, displayedContentScale());
}
-void WebPageProxy::scrollingNodeScrollViewWillStartPanGesture()
+void WebPageProxy::scrollingNodeScrollViewWillStartPanGesture(ScrollingNodeID nodeID)
{
- pageClient().scrollingNodeScrollViewWillStartPanGesture();
+ pageClient().scrollingNodeScrollViewWillStartPanGesture(nodeID);
}
-void WebPageProxy::scrollingNodeScrollViewDidScroll()
+void WebPageProxy::scrollingNodeScrollViewDidScroll(ScrollingNodeID nodeID)
{
- pageClient().scrollingNodeScrollViewDidScroll();
+ pageClient().scrollingNodeScrollViewDidScroll(nodeID);
}
-void WebPageProxy::scrollingNodeScrollWillStartScroll()
+void WebPageProxy::scrollingNodeScrollWillStartScroll(ScrollingNodeID nodeID)
{
- pageClient().scrollingNodeScrollWillStartScroll();
+ pageClient().scrollingNodeScrollWillStartScroll(nodeID);
}
-void WebPageProxy::scrollingNodeScrollDidEndScroll()
+void WebPageProxy::scrollingNodeScrollDidEndScroll(ScrollingNodeID nodeID)
{
- pageClient().scrollingNodeScrollDidEndScroll();
+ pageClient().scrollingNodeScrollDidEndScroll(nodeID);
}
void WebPageProxy::dynamicViewportSizeUpdate(const FloatSize& viewLayoutSize, const WebCore::FloatSize& minimumUnobscuredSize, const WebCore::FloatSize& maximumUnobscuredSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, const FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double targetScale, int32_t deviceOrientation, double minimumEffectiveDeviceWidth, DynamicViewportSizeUpdateID dynamicViewportSizeUpdateID)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm (292811 => 292812)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm 2022-04-13 16:41:00 UTC (rev 292812)
@@ -93,12 +93,14 @@
void WebChromeClient::didStartOverflowScroll()
{
- m_page.send(Messages::WebPageProxy::ScrollingNodeScrollWillStartScroll());
+ // FIXME: This is only relevant for legacy touch-driven overflow in the web process (see ScrollAnimatorIOS::handleTouchEvent), and should be removed.
+ m_page.send(Messages::WebPageProxy::ScrollingNodeScrollWillStartScroll(0));
}
void WebChromeClient::didEndOverflowScroll()
{
- m_page.send(Messages::WebPageProxy::ScrollingNodeScrollDidEndScroll());
+ // FIXME: This is only relevant for legacy touch-driven overflow in the web process (see ScrollAnimatorIOS::handleTouchEvent), and should be removed.
+ m_page.send(Messages::WebPageProxy::ScrollingNodeScrollDidEndScroll(0));
}
bool WebChromeClient::hasStablePageScaleFactor() const
Modified: trunk/Tools/ChangeLog (292811 => 292812)
--- trunk/Tools/ChangeLog 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Tools/ChangeLog 2022-04-13 16:41:00 UTC (rev 292812)
@@ -1,3 +1,17 @@
+2022-04-13 Simon Fraser <[email protected]>
+
+ [css-scroll-snap] scrollIntoView fails with scroll-snap-type on :root
+ https://bugs.webkit.org/show_bug.cgi?id=239063
+ <rdar://problem/91603363>
+
+ Reviewed by Dean Jackson.
+
+ _didFinishScrolling: now works for subscrollers too.
+
+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+ (-[TestRunnerWKWebView _didFinishScrolling:]):
+ (-[TestRunnerWKWebView _didFinishScrolling]): Deleted.
+
2022-04-13 Chris Dumez <[email protected]>
Replace AtomString(const char*) with AtomString::fromLatin1(const char*)
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm (292811 => 292812)
--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm 2022-04-13 16:12:24 UTC (rev 292811)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm 2022-04-13 16:41:00 UTC (rev 292812)
@@ -44,7 +44,7 @@
// FIXME: move these to WKWebView_Private.h
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view;
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale;
-- (void)_didFinishScrolling;
+- (void)_didFinishScrolling:(UIScrollView *)scrollView;
- (void)_scheduleVisibleContentRectUpdate;
@end
@@ -426,9 +426,9 @@
}
}
-- (void)_didFinishScrolling
+- (void)_didFinishScrolling:(UIScrollView *)scrollView
{
- [super _didFinishScrolling];
+ [super _didFinishScrolling:scrollView];
if (self.didEndScrollingCallback)
self.didEndScrollingCallback();