Bug 227733

Summary: Animation from scale(0) has missing backing store
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: AnimationsAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: ben, dino, graouts, graouts, mattaningram, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=218371
Attachments:
Description Flags
Test case
none
Patch
none
Patch none

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.