Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3c2e8b44b99b51d40ac1e4921897bba8daaa5ed5
https://github.com/WebKit/WebKit/commit/3c2e8b44b99b51d40ac1e4921897bba8daaa5ed5
Author: Aditya Keerthi <[email protected]>
Date: 2025-07-11 (Fri, 11 Jul 2025)
Changed paths:
M Source/WebCore/page/LocalFrameView.cpp
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKScrollGeometryTests.mm
Log Message:
-----------
[SwiftUI] The content size reported by webViewOnScrollGeometryChange can be
incorrect
https://bugs.webkit.org/show_bug.cgi?id=295528
rdar://146576790
Reviewed by Alan Baradlay and Richard Robinson.
Currently, `webViewOnScrollGeometryChange` reports the content size using
`LocalFrameView::contentsSize`. However, this is semantically different from
the content size reported by SwiftUI ScrollView. ScrollView's content size
represents the minimum width and height needed to avoid making the content
scrollable. `LocalFrameView::contentsSize` does not do this – the contents size
can be viewport sized in cases where the content itself is actually smaller.
Additionally, standards/quirks mode can affect the used content size.
`webViewOnScrollGeometryChange` should be agnostic of standards/quirks mode.
Fix by implementing a new algorithm to determine the maximum x and y position
of an element that can be reached by scrolling the body.
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::updateScrollGeometryContentSize):
Traverse the render tree to obtain the maximum x and y position of objects in
the tree.
The body/document renderer's width/height is not used when it is `auto`. This
is because it may be expanded beyond the actual size needed for scrolling.
If the box is positioned skip its descendants, since it will already have the
full geometry information.
Finally, account for overflow that clips to the viewport, and apply the used
margin from the body when necessary.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKScrollGeometryTests.mm:
Canonical link: https://commits.webkit.org/297282@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