Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 26daa5456ac48a643162f426bb1ebebe6e46a5e5
      
https://github.com/WebKit/WebKit/commit/26daa5456ac48a643162f426bb1ebebe6e46a5e5
  Author: Wenson Hsieh <[email protected]>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm

  Log Message:
  -----------
  [iOS 18] Web view lays out at the wrong dimensions after rotating in element 
fullscreen
https://bugs.webkit.org/show_bug.cgi?id=276661
rdar://131329311

Reviewed by Richard Robinson.

After the changes in 279030@main to enable live resize on iPad along with the 
rest of the
`BrowserEngineKit` integration when `UIKit/async_text_input_ipad` is enabled, 
rotating the device
on YouTube.com while watching a video in element fullscreen mode causes the 
webpage to lay out at
the wrong dimensions after rotation for about 500 ms, before adjusting to the 
new size.

This happens because the codepaths to engage live resize in response to frame 
or bounds changes
activates now, when it didn't before the change. This codepath was previously 
guarded by a check for
`-[UIWindowScene _isInLiveResize]`, which was only set when adjusting the 
dimensions of the window
in Stage Manager. However, since 279030@main stopped using that SPI in favor of 
matching the
automatic live resize behavior on visionOS, we no longer have that constraint, 
and will enter this
live resize codepath in more cases (e.g. when changing the interface 
orientation).

To mitigate this, we reintroduce some more constraints, to avoid automatic live 
resize in a couple
of cases:

1.  Only the window height is changing (there's typically no need to keep the 
web view stable in
    this case, since we'd just reveal more content underneath the previous 
viewport which could be
    scrolled to anyways).

2.  The window is changing interface orientation (to address the immediate 
cause of this issue).

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:

Keep track of the last known interface orientation, in addition to the last 
known window size.

* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _updateLastKnownWindowSizeAndOrientation]):
(-[WKWebView didMoveToWindow]):
(-[WKWebView _beginAutomaticLiveResizeIfNeeded]):
(-[WKWebView _frameOrBoundsWillChange]):

See above for more details.

(-[WKWebView _updateLastKnownWindowSize]): Deleted.

Canonical link: https://commits.webkit.org/281008@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

Reply via email to