Skip to content

Keep transforms in the 2d subset instead of dropping all 3d functions - #760

Draft
ruifigueira wants to merge 2 commits into
DioxusLabs:mainfrom
ruifigueira:ks/transform-2d-subset
Draft

Keep transforms in the 2d subset instead of dropping all 3d functions#760
ruifigueira wants to merge 2 commits into
DioxusLabs:mainfrom
ruifigueira:ks/transform-2d-subset

Conversation

@ruifigueira

@ruifigueira ruifigueira commented Aug 20, 2026

Copy link
Copy Markdown

has_3d tells you a 3d function appeared in the transform list, not that the resulting matrix needs 3d. The filter treats it as the latter, so translate3d(x, y, 0) gets dropped and the element paints with no transform. That one hurts, it's the standard centring trick.

t.is_2d() is the actual question, and it's the two-dimensional subset that the spec link on the next line down already points at. rotateX and perspective still get dropped, so the TODO: support 3D transforms above still stands.

Tests in tests/blitz-tests/tests/transform_2d_subset.rs. The two translate3d ones fail without the fix. The rotateX one passes either way, it's there so nobody later "fixes" 3d by flattening it.

No existing test caught this, by the way. subpixel-transform-changes-004.html in css-transforms looks like it should, but it uses translate3d on the reference side too, so dropping them all leaves both sides matching. Can send a reftest to WPT if you want one.

WPT results

5 newly passing, 2 newly failing (net +3).

Full diff (7 changed tests)
+ Fail => Pass css/css-transforms/css-transform-3d-rotate3d-Z-negative.html
+ Fail => Pass css/css-transforms/css-transform-3d-rotate3d-Z-positive.html
+ Fail => Pass css/css-transforms/css-transform-3d-rotateZ-negative.html
+ Fail => Pass css/css-transforms/css-transform-3d-rotateZ-positive.html
- Pass => Fail css/css-transforms/subpixel-transform-changes-004.html
+ Fail => Pass css/css-transforms/transform3d-matrix3d-001.html
- Pass => Fail css/css-viewport/zoom/transform-matrix-3d.html

Generated by the WPT workflow.

LuisDuarte1 and others added 2 commits August 20, 2026 16:09
has_3d means a 3d function showed up in the list, not that the matrix
needs 3d. So translate3d(0, -50%, 0) — a plain 2d translation, and a
very common one — was thrown away and the element painted untransformed.

Filter on the matrix instead, which is what the two-dimensional subset
linked just below actually says. rotateX and friends are still dropped.
translate3d resolves to the 2d translation and reaches hit testing;
rotateX under a perspective stays dropped. The first two fail without
the fix, the rotateX one is there to mark the boundary.

Nothing covered this before. The closest WPT reftest,
subpixel-transform-changes-004, uses translate3d on both the test and
the reference side, so dropping it everywhere renders them identically
and passes.
@ruifigueira
ruifigueira force-pushed the ks/transform-2d-subset branch from e656bad to ac7c531 Compare August 20, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants