[webkit-changes] [WebKit/WebKit] ea884a: [iOS] Enable automatic live resize on iPadOS at ru...

Wenson Hsieh noreply at github.com
Mon May 20 19:10:01 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ea884a9b50d637b50ca72d62c0813d555f94bc19
      https://github.com/WebKit/WebKit/commit/ea884a9b50d637b50ca72d62c0813d555f94bc19
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-05-20 (Mon, 20 May 2024)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/Shared/WebPreferencesDefaultValues.h
    M Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm

  Log Message:
  -----------
  [iOS] Enable automatic live resize on iPadOS at runtime
https://bugs.webkit.org/show_bug.cgi?id=274410

Reviewed by Abrar Rahman Protyasha.

Enable automatic live resize on iPad, with runtime enablement guarded by a system feature flag.
Additionally, remove usage of two SPIs that currently support automatic live resize behaviors:

• `_UIWindowSceneDidEndLiveResizeNotification`
• `-[UIWindowScene _isInLiveResize]`

...by instead changing how automatic live resize works:

(a) Don't wait for the live resize gesture to end before allowing geometry updates to commence;
    instead, use an arbitrary hysteresis of 500 ms to determine when the viewport dimensions have
    stabilized, before ending live resize.

(b) Use automatic live resize whenever the window itself is changing size; to detect this, keep
    track of the last known size of the window containing the web view, and only trigger live resize
    when this size is changing.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/Shared/WebPreferencesDefaultValues.h:
* Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm:
(WebKit::defaultAutomaticLiveResizeEnabled):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView didMoveToWindow]):
(-[WKWebView _beginAutomaticLiveResizeIfNeeded]):

Refactor this so that we debounce the new "end live resize" timer instead of just early returning
when the size changes.

(-[WKWebView _rescheduleEndLiveResizeTimer]):
(-[WKWebView _acquireResizeAssertionForReason:]):

Remove unnecessary runtime staging, since support for this SPI has long shipped.

(-[WKWebView _endLiveResize]):
(-[WKWebView _destroyEndLiveResizeObserver]): Deleted.

Replace this notification observer with an `NSTimer` instead, which is debounced whenever the web
view size changes, and otherwise fires after a fixed delay of half a second.

Canonical link: https://commits.webkit.org/279030@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list