Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7cfc79c2b3d82989bd001597f61053ecb65ff19c
https://github.com/WebKit/WebKit/commit/7cfc79c2b3d82989bd001597f61053ecb65ff19c
Author: Aditya Keerthi <[email protected]>
Date: 2025-06-23 (Mon, 23 Jun 2025)
Changed paths:
M Source/WebCore/page/ChromeClient.h
M Source/WebCore/page/LocalFrameView.cpp
M Source/WebCore/page/LocalFrameView.h
M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in
M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h
M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm
M Source/WebKit/Shared/WebPageCreationParameters.h
M Source/WebKit/Shared/WebPageCreationParameters.serialization.in
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm
M Source/WebKit/UIProcess/Cocoa/WebPageWebView.swift
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
M Source/WebKit/_WebKit_SwiftUI/Implementation/CocoaWebViewAdapter.swift
M Tools/TestWebKitAPI/SourcesCocoa.txt
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/WebKitCocoa/WKScrollGeometryTests.mm
Log Message:
-----------
[SwiftUI] Add plumbing and test infrastructure to support more accurate
scroll geometry reporting
https://bugs.webkit.org/show_bug.cgi?id=294694
rdar://153764316
Reviewed by Richard Robinson, Wenson Hsieh, and Megan Gardner.
`webViewOnScrollGeometryChange` currently does not always report an accurate
content size. The reported size should be a "fitting size" given the current
web view size. However, at this time the reported size is always the
`FrameView`'s
content size, which is often larger.
This patch works towards fixing the reported size by introducing plumbing to
only compute a content size for scroll geometry if needed, and reporting that
size back to SwiftUI. Additionally, testing capability for scroll geometry is
added.
A subsequent patch will fill out the implementation of
`LocalFrameView::updateScrollGeometryContentSize` to fix the described issue.
That patch will also introduce even more test cases, including ones that are
currently broken.
No behavior change.
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::needsScrollGeometryUpdates const):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::didLayout):
(WebCore::LocalFrameView::updateScrollGeometryContentSize):
Recompute the content size for SwiftUI after every layout, but only if
scroll geometry updates are needed. This ensures expensive (to be added)
work is avoided when unnecessary.
For now, simply return `contentsSize()`, preserving the currently
implemented behavior.
* Source/WebCore/page/LocalFrameView.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
Add a new field to `RemoteLayerTreeTransaction` so that content size changes
are reported in-sync with scroll position changes.
(WebKit::RemoteLayerTreeTransaction::scrollGeometryContentSize const):
(WebKit::RemoteLayerTreeTransaction::setScrollGeometryContentSize):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::description const):
* Source/WebKit/Shared/WebPageCreationParameters.h:
* Source/WebKit/Shared/WebPageCreationParameters.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setNeedsScrollGeometryUpdates:]):
Add a hook for SwiftUI to let WebKit know scroll geometry updates are needed.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::didCommitLayerTree):
* Source/WebKit/UIProcess/Cocoa/WebPageWebView.swift:
(WebPageWebView.setNeedsScrollGeometryUpdates(_:)):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setNeedsScrollGeometryUpdates):
(WebKit::WebPageProxy::creationParameters):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::needsScrollGeometryUpdates const):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::m_textAnimationController):
(WebKit::WebPage::willCommitLayerTree):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/_WebKit_SwiftUI/Implementation/CocoaWebViewAdapter.swift:
(CocoaWebViewAdapter.onScrollGeometryChange):
Only perform scroll geometry content size computation if the view modifier is
in use.
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKScrollGeometryTests.mm: Added.
(-[TestScrollGeometryDelegate _webView:geometryDidChange:]):
(-[TestScrollGeometryDelegate currentContentSize]):
(runContentSizeTest):
Test both quirks and standards mode.
(TEST(WKScrollGeometry, ContentSizeTallerThanWebView)):
(TEST(WKScrollGeometry, NoScrollGeometryUpdates)):
Canonical link: https://commits.webkit.org/296531@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes