Bug 228333 - [iOS] CSS transform transitions become janky after snapshotting other UIViews
Summary: [iOS] CSS transform transitions become janky after snapshotting other UIViews
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-07-27 10:38 PDT by Ali Juma
Modified: 2023-02-24 03:44 PST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ali Juma 2021-07-27 10:38:49 PDT
Snapshotting UIViews with a forced screen update (i.e., calling -[UIView snapshotAfterScreenUpdates:YES]) sufficiently many times somehow breaks all CSS transform transitions in all WKWebViews embedded in the same app, until the app is-relaunched. In the broken state, transitions are either very janky (low frame rate) or just jump directly to their end state with no intermediate frames.

In an app with a complex view hierarchy (e.g., Chrome for iOS), even a couple calls to -[UIView snapshotAfterScreenUpdates:YES] are enough to get into this broken state. In a simple test app, a few hundred calls are needed to make the jankiness obvious. The UIView being snapshotted is independent of WKWebView (neither contained in WKWebView nor an ancestor). The same bug happens when using -[UIView resizableSnapshotViewFromRect:rect afterScreenUpdates:YES withCapInsets:UIEdgeInsetsZero]. In both cases, changing the 'afterScreenUpdates' argument to NO prevents the bug from happening.

This doesn't seem to affect CSS keyframe animations, just CSS transitions.

I've attached a test app to FB9409883.
Comment 1 Simon Fraser (smfr) 2021-07-27 10:41:57 PDT
<rdar://81165761>
Comment 2 Simon Fraser (smfr) 2021-07-29 10:18:48 PDT
This appears to be a bug in UIKit. Tracked by the above radar.
Comment 3 Jeroen Kroese 2022-12-17 03:19:39 PST
Hi there, as of today the issue still persists. See the following bug reports on the Chromium project for examples of manifestations of this issue:

https://bugs.chromium.org/p/chromium/issues/detail?id=1231712
https://bugs.chromium.org/p/chromium/issues/detail?id=899130
https://bugs.chromium.org/p/chromium/issues/detail?id=1249723

Any updates on the UIKit bug logged in Radar?
Comment 4 Brent Fulgham 2022-12-20 09:45:17 PST
Note: This is actually tracked by this:
<rdar://81165591>
Comment 5 Antoine Quint 2023-01-08 13:13:47 PST
This might be as easy as setting `-[CALayer inheritsTiming]` to `NO` for the CALayer managed by PlatformCALayerCocoa.
Comment 6 Antoine Quint 2023-01-08 13:14:12 PST
Steps to reproduce:

1. Install Google Chrome
2. Open a second tab
3. Go to getbrentobox.com
4. Tap on the hamburger menu icon in the top right
5. Tap on the icon again to dismiss the sliding menu in the Web page
6. Go to the first tab
7. Go back to the second tab
8. Tap on the hamburger menu icon in the top right again

At this stage there is no animation, this is the bug.
Comment 7 Antoine Quint 2023-01-09 04:35:46 PST
(In reply to Antoine Quint from comment #5)
> This might be as easy as setting `-[CALayer inheritsTiming]` to `NO` for the
> CALayer managed by PlatformCALayerCocoa.

That indeed seems to work, need to find the best place to include this call for all remote layers.
Comment 8 Antoine Quint 2023-01-09 05:01:36 PST
Pull request: https://github.com/WebKit/WebKit/pull/8394
Comment 9 EWS 2023-01-11 03:34:46 PST
Committed 258781@main (46c1b789ed08): <https://commits.webkit.org/258781@main>

Reviewed commits have been landed. Closing PR #8394 and removing active labels.
Comment 10 Antoine Quint 2023-02-24 03:44:11 PST
This should be fixed in iOS 16.4 Seed 1.