Bug 227733 - Animation from scale(0) has missing backing store
Summary: Animation from scale(0) has missing backing store
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2021-07-06 20:49 PDT by Simon Fraser (smfr)
Modified: 2022-02-02 08:58 PST (History)
7 users (show)

See Also:


Attachments
Test case (352 bytes, text/html)
2021-07-06 20:49 PDT, Simon Fraser (smfr)
no flags Details
Patch (2.45 KB, patch)
2022-02-01 02:13 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (6.32 KB, patch)
2022-02-01 04:12 PST, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2021-07-06 20:49:01 PDT
Created attachment 433003 [details]
Test case

Attached test shows that animation from scale(0) has missing backing store.
Comment 1 Simon Fraser (smfr) 2021-07-06 20:50:18 PDT
Workaround is to animate from scale(0.001)
Comment 2 Radar WebKit Bug Importer 2021-07-06 20:51:28 PDT
<rdar://problem/80246192>
Comment 3 Simon Fraser (smfr) 2021-07-06 20:59:19 PDT
Similar to bug 218371.
Comment 4 Simon Fraser (smfr) 2021-07-06 21:19:19 PDT
We've synthesized a 100% keyframe, but it doesn't have a transform property, so we never call addStyleToCumulativeBounds() for the scale(1) state.
Comment 5 Simon Fraser (smfr) 2021-07-06 21:34:10 PDT
When we call KeyframeEffect::computeExtentOfTransformAnimation() box.style() already reflects the first keyframe, so falling back to box.style() for the 100% keyframe doesn't work (it has scale(0) in it). We need to be able to get to the style which is not affected by keyframes.
Comment 6 Antoine Quint 2022-02-01 01:51:45 PST
(In reply to Simon Fraser (smfr) from comment #5)
> When we call KeyframeEffect::computeExtentOfTransformAnimation() box.style()
> already reflects the first keyframe, so falling back to box.style() for the
> 100% keyframe doesn't work (it has scale(0) in it). We need to be able to
> get to the style which is not affected by keyframes.

The style not accounting for animations is stored on ElementAnimationRareData, and you may access it from KeyframeEffect with targetStyleable()->lastStyleChangeEventStyle().
Comment 7 Antoine Quint 2022-02-01 02:13:30 PST
Created attachment 450510 [details]
Patch
Comment 8 Antoine Quint 2022-02-01 04:12:21 PST
Created attachment 450513 [details]
Patch
Comment 9 EWS 2022-02-01 08:52:55 PST
Committed r288881 (246633@main): <https://commits.webkit.org/246633@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450513 [details].
Comment 10 Antoine Quint 2022-02-01 23:55:33 PST
Interestingly, modifying `transform: scale(0)` to `scale: 0` in the keyframe in the test case doesn't reproduce the issue.
Comment 11 Simon Fraser (smfr) 2022-02-02 08:58:57 PST
Filed bug 236019 on that.