Files
ladybird/Tests/LibWeb/Text/input/css/transform-non-invertible-discrete-fallback.html
Andreas Kling fa0a7d4a4a Tests: Add test for non-invertible transform animation fallback
When a transform animation involves a non-invertible matrix (e.g. a
matrix3d with zero Z-scale), the spec requires falling back to discrete
interpolation. Currently we drop the transform entirely, producing
"none" at all progress values. A following commit will fix this.
2026-03-21 23:16:32 -05:00

26 lines
1001 B
HTML

<!DOCTYPE html>
<div id="target" style="width: 100px; height: 100px;"></div>
<script src="../include.js"></script>
<script>
test(() => {
// matrix3d with a zero Z-scale produces a non-invertible (singular) matrix.
// Per spec, when one of the matrices for interpolation is non-invertible,
// the animation must fall back to discrete interpolation.
const anim = target.animate([
{ transform: "matrix3d(2,0,0,0, 0,2,0,0, 0,0,0,0, 0,0,0,1)" },
{ transform: "scale(1)" },
], 1000);
anim.pause();
// At progress < 0.5, discrete interpolation should use the "from" value.
anim.currentTime = 200;
const at02 = getComputedStyle(target).transform;
println("at 0.2: " + at02);
// At progress >= 0.5, discrete interpolation should use the "to" value.
anim.currentTime = 800;
const at08 = getComputedStyle(target).transform;
println("at 0.8: " + at08);
});
</script>