Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Entering a To: address moves the viewpoint to the bottom right corner…
… of the email https://bugs.webkit.org/show_bug.cgi?id=245297 rdar://96703879 Reviewed by Tim Horton. On iPad in the Mail app, when composing a message whose contents are taller than the viewport size, and when the compose window is narrow enough such that the contact picker appears as a modal when entering a contact in the `To:` field, dismissing the contact picker causes the message to erroneously scroll to the bottom right of the message. This is because in this case, there is a large top inset on the web view's scroll view. This causes the UIProcess to erroneously create a `CGRectNull` and sends it to the web process in a visible content rect update. Because a `CGRectNull` has an origin of `(INT_MAX, INT_MAX)`, the web view attempts to scroll to that position. This PR fixes this by using `FloatRect`s intersection behavior instead of using `CGRectIntersection`, so that the resulting rect's origin stays the same instead of becoming `CGRectNull` in the case the two rects don't intersect. A change also had to be made to `-[WKWebView _scrollToContentScrollPosition:scrollOrigin:animated:]` so that the view scrolls to its original position with the inset, instead of `0`. * Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm: (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:animated:]): (-[WKWebView _updateVisibleContentRects]): * Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreScrollPosition.mm: (-[RestoreScrollPositionWithLargeContentInsetWebView safeAreaInsets]): (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/254640@main
- Loading branch information