Reject a single-axis position followed by a length in transform-origin#217
Open
jhaygood86 wants to merge 1 commit into
Open
Reject a single-axis position followed by a length in transform-origin#217jhaygood86 wants to merge 1 commit into
jhaygood86 wants to merge 1 commit into
Conversation
transform-origin accepted `top 2px` (resolved to center/top with 2px as the z-offset) and `2px left` (a length in the horizontal slot paired with a horizontal keyword in the vertical slot), both invalid per CSS Transforms 1 (https://www.w3.org/TR/css-transforms-1/#transform-origin-property). The two-value form is ordered (horizontal then vertical) and only the keyword-only form may be reordered; the trailing <length> z-offset exists only in the two-value production. Restructure the converter around explicit Horizontal/Vertical axis converters and a TwoValuePosition that requires both axes, and gate the z-offset behind it so it can only follow a genuine two-value position. Fixes the two tests that asserted the non-conformant `2px left` forms.
jhaygood86
marked this pull request as ready for review
July 24, 2026 19:59
jhaygood86
marked this pull request as draft
July 24, 2026 20:35
jhaygood86
marked this pull request as ready for review
July 24, 2026 20:35
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.
Summary
transform-originaccepted two forms that are invalid per CSS Transforms 1:transform-origin: top 2px— a single-axis position followed by a length. It was accepted and resolved to center/top with2pxswallowed as the z-offset, but the trailing<length>z-offset only exists in the two-value production.transform-origin: 2px left(and2px left 10px) — a<length>in the horizontal slot paired with a horizontal keywordleftin the vertical slot. The two-value form is ordered (horizontal then vertical), and only the keyword-only form may be reordered, so this pair is invalid.Fix
The converter is restructured around explicit
Horizontal/Verticalaxis converters and aTwoValuePositionthat requires both axes to be present. The<length>z-offset is gated behindTwoValuePosition, so it can only follow a genuine two-value position; a one-or-two-value<position>with no z-offset is the fallback.Grammar
Tests
CssTransformOriginVerticalKeywordThenLengthIllegal/...WithZIllegal(top 2px,top 2px 10px).2px left/2px left 10pxforms to assert rejection.left 2px,2px 30%,right top,2px 30% 10px,left 5px -3px, …) continue to pass. Full suite green.Ported from a fix made in PeachPDF, which vendors ExCSS.