Keep transforms in the 2d subset instead of dropping all 3d functions - #760
Draft
ruifigueira wants to merge 2 commits into
Draft
Keep transforms in the 2d subset instead of dropping all 3d functions#760ruifigueira wants to merge 2 commits into
ruifigueira wants to merge 2 commits into
Conversation
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
force-pushed
the
ks/transform-2d-subset
branch
from
August 20, 2026 15:09
e656bad to
ac7c531
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
has_3dtells you a 3d function appeared in the transform list, not that the resulting matrix needs 3d. The filter treats it as the latter, sotranslate3d(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 theTODO: support 3D transformsabove 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.htmlin 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)
Generated by the WPT workflow.