Commit Graph

3 Commits

Author SHA1 Message Date
Andreas Kling
593fd69cdb Tests: Make rotation interpolation test use stable boolean checks
Avoid comparing exact matrix3d values which contain floating point
noise that could differ across platforms. Instead, check whether the
transform is or isn't the identity matrix.
2026-03-21 23:16:32 -05:00
Andreas Kling
3cda08b6bf LibWeb: Numerically interpolate rotation angles for same-axis rotations
Per the CSS Transforms spec, when interpolating rotate3d() functions
with equal normalized direction vectors (or when one angle is zero),
the rotation angle should be interpolated numerically rather than
using quaternion slerp.

Previously we always used quaternion slerp, which cannot represent
rotations beyond 360 degrees. This meant that animating from
rotateY(0deg) to rotateY(3600deg) produced no visual animation, since
both quaternions are identical (3600 mod 360 = 0).

Now we detect when axes match and interpolate the angle directly,
correctly preserving multi-turn rotations. This fixes 168 WPT tests.
2026-03-21 23:16:32 -05:00
Andreas Kling
ed4b5d7b72 Tests: Add test for rotation interpolation with same-axis transforms
When interpolating between rotateY(0deg) and rotateY(3600deg), the
angle should be interpolated numerically. Currently we use quaternion
slerp which sees these as identical rotations (3600 mod 360 = 0),
producing no visual animation. A following commit will fix this.
2026-03-21 23:16:32 -05:00