Bug 195790 - transform matrix which cannot be decomposed shouldn't be interpolated with other value
Summary: transform matrix which cannot be decomposed shouldn't be interpolated with ot...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2019-03-14 20:34 PDT by Xidorn Quan
Modified: 2023-10-13 07:54 PDT (History)
6 users (show)

See Also:


Attachments
testcase (424 bytes, text/html)
2019-03-14 20:34 PDT, Xidorn Quan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xidorn Quan 2019-03-14 20:34:17 PDT
Created attachment 364765 [details]
testcase

Steps to reproduce:
1. open the attached testcase
2. click the "toggle" button and observe
3. click it again

Actual result:
The rectangle animates when it shows and hides.

Expected result:
The rectangle should just show and hide without any animation.

Explanation:
Here I use `transform: matrix(0, 0, 0, 0, 0, 0)` to hide the rectangle. This is a matrix which cannot be decomposed. Based on the spec, this value should not be interpolated with other values.


It works as expected on Firefox and Chrome.
Comment 1 Radar WebKit Bug Importer 2019-03-16 12:10:53 PDT
<rdar://problem/48955191>
Comment 2 Ahmad Saleem 2022-10-25 01:21:33 PDT
I am able to reproduce this bug in Safari 16.1 and Safari Technology Preview 156 where the toggling back leads to animations while Chrome Canary 109 and Firefox Nightly 108 does not animate.

I know there are fixes around transform matrix in Webkit ToT but since they are not in STP, I cannot verify whether those fixes would result in fixing this or not. Thanks!
Comment 3 Antoine Quint 2022-10-25 01:50:31 PDT
This persists on ToT as well.
Comment 4 Antoine Quint 2022-10-25 01:56:35 PDT
The relevant spec text here is at the end of https://w3c.github.io/csswg-drafts/css-transforms-1/#matrix-interpolation:

"If one of the matrices for interpolation is non-invertible, the used animation function must fall-back to a discrete animation according to the rules of the respective animation specification."
Comment 5 Antoine Quint 2022-10-25 02:04:45 PDT
We seem to have the necessary logic to handle this in TransformOperations::shouldFallBackToDiscreteAnimation() and TransformOperations::blend(), but I wonder if we're running animations with acceleration here and thus not going through this code path.