Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5aa322f6a3dd1e38efa13dfcc2d367b6a3f26e3a
https://github.com/WebKit/WebKit/commit/5aa322f6a3dd1e38efa13dfcc2d367b6a3f26e3a
Author: Aditya Keerthi <[email protected]>
Date: 2023-09-21 (Thu, 21 Sep 2023)
Changed paths:
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm
Log Message:
-----------
REGRESSION (267539@main): [iOS] Webpage unexpectedly scrolls down while
typing in the find bar
https://bugs.webkit.org/show_bug.cgi?id=261913
rdar://115796405
Reviewed by Wenson Hsieh.
267539@main adjusted WKWebView's "scroll to target rect" logic to account for
content insets, to ensure that content in the inset area does not hide the
target rect. However, it did not account for `-[WKWebView _obscuredInsets]`
Specifically, the targeted scrolling logic works by computing the scroll
delta between the current unobscured offset, and a new offset which reveals
the target. Following, 267539@main found matches at the top of the page, could
have a negative target offset for content with insets, which was necessary to
fix the issue described in that change. However, the unobscured offset is
effectively clamped to (0, 0), as it comes from
`-[WKWebView _contentRectForUserInteraction]`, which adds obscured insets prior
to converting to content view coordinates. Consequently, a constant scroll delta
of `-_obscuredInsets.top` is computed when the page is scrolled to the top, and
there are obscured insets. This results in repeating scrolling as matches are
found at the top of the page.
Fix by accounting for the `_obscuredInsets` when determining the minimum
scroll position.
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _scrollToRect:origin:minimumScrollDistance:]):
Add the obscured insets to the minimum content offset to determine a more
accurate minimum scrolling position. The logic additionally enforces a
maximum minimum content offset of (0, 0), as was the case before 267539@main.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm:
(TEST):
Canonical link: https://commits.webkit.org/268295@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes