[webkit-changes] [WebKit/WebKit] c5a722: Entering a To: address moves the viewpoint to the ...

Richard Robinson noreply at github.com
Mon Sep 19 13:34:54 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c5a7221120cea780897f84fff076b7d98b818b5a
      https://github.com/WebKit/WebKit/commit/c5a7221120cea780897f84fff076b7d98b818b5a
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2022-09-19 (Mon, 19 Sep 2022)

  Changed paths:
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreScrollPosition.mm

  Log Message:
  -----------
  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




More information about the webkit-changes mailing list