Skip to content

Stage Manager resize is very jumpy#45877

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
hortont424:eng/Stage-Manager-resize-is-very-jumpy
May 25, 2025
Merged

Stage Manager resize is very jumpy#45877
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
hortont424:eng/Stage-Manager-resize-is-very-jumpy

Conversation

@hortont424
Copy link
Copy Markdown
Contributor

@hortont424 hortont424 commented May 24, 2025

06265c0

Stage Manager resize is very jumpy
https://bugs.webkit.org/show_bug.cgi?id=293530
rdar://151952483

Reviewed by Wenson Hsieh.

Fix two bugs with the "automatic live resize" mechanism:

1) In _beginLiveResize, we record the current scroll position; in _updateLiveResizeTransform
   we pass the scroll position through _contentOffsetAdjustedForObscuredInset before comparing
   it to the current one. But, the originally saved scroll position had the obscured inset
   factored into it. Subtract it out so that the math works out (this didn't cause trouble
   where automatic live resize was originally introduced, on visionOS, because it has no
   obscured insets).

2) Don't start a animated resize if we're about to kick off an automatic live resize.
   The precise timing of `_beginLiveResize` vs. clients calling into `_beginAnimatedResizeWithUpdates`
   is hard to guarantee, so make sure that if `_beginAnimatedResizeWithUpdates` is called first
   in a situation where we *will* start a live resize, we bail from the animated resize.
   We already guard against animated resize happening *during* live resize, we just missed this
   ordering.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _canBeginAutomaticLiveResize]):
(-[WKWebView _beginLiveResize]):
(-[WKWebView _beginAnimatedResizeWithUpdates:]):

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

621b6c0

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
🧪 ios-wk2-wpt ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@hortont424 hortont424 requested a review from cdumez as a code owner May 24, 2025 08:10
@hortont424 hortont424 self-assigned this May 24, 2025
@hortont424 hortont424 added the WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). label May 24, 2025
@hortont424 hortont424 force-pushed the eng/Stage-Manager-resize-is-very-jumpy branch from 64348a4 to 0b404ad Compare May 24, 2025 08:12
@hortont424 hortont424 requested review from pxlcoder and whsieh May 24, 2025 08:14
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 24, 2025
@whsieh
Copy link
Copy Markdown
Member

whsieh commented May 24, 2025

Seems reasonable, if we replace voidbool or BOOL

@hortont424 hortont424 removed the merging-blocked Applied to prevent a change from being merged label May 24, 2025
@hortont424 hortont424 force-pushed the eng/Stage-Manager-resize-is-very-jumpy branch from 0b404ad to bbf8a20 Compare May 24, 2025 18:24
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 24, 2025
@hortont424 hortont424 removed the merging-blocked Applied to prevent a change from being merged label May 24, 2025
@hortont424 hortont424 force-pushed the eng/Stage-Manager-resize-is-very-jumpy branch from bbf8a20 to 621b6c0 Compare May 24, 2025 22:35
@hortont424 hortont424 added the merge-queue Applied to send a pull request to merge-queue label May 25, 2025
https://bugs.webkit.org/show_bug.cgi?id=293530
rdar://151952483

Reviewed by Wenson Hsieh.

Fix two bugs with the "automatic live resize" mechanism:

1) In _beginLiveResize, we record the current scroll position; in _updateLiveResizeTransform
   we pass the scroll position through _contentOffsetAdjustedForObscuredInset before comparing
   it to the current one. But, the originally saved scroll position had the obscured inset
   factored into it. Subtract it out so that the math works out (this didn't cause trouble
   where automatic live resize was originally introduced, on visionOS, because it has no
   obscured insets).

2) Don't start a animated resize if we're about to kick off an automatic live resize.
   The precise timing of `_beginLiveResize` vs. clients calling into `_beginAnimatedResizeWithUpdates`
   is hard to guarantee, so make sure that if `_beginAnimatedResizeWithUpdates` is called first
   in a situation where we *will* start a live resize, we bail from the animated resize.
   We already guard against animated resize happening *during* live resize, we just missed this
   ordering.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _canBeginAutomaticLiveResize]):
(-[WKWebView _beginLiveResize]):
(-[WKWebView _beginAnimatedResizeWithUpdates:]):

Canonical link: https://commits.webkit.org/295400@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Stage-Manager-resize-is-very-jumpy branch from 621b6c0 to 06265c0 Compare May 25, 2025 00:15
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 295400@main (06265c0): https://commits.webkit.org/295400@main

Reviewed commits have been landed. Closing PR #45877 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 06265c0 into WebKit:main May 25, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants