Skip to content

Three minification folds: gradient stops, gradient angle, alpha properties - #214

Merged
samoht merged 4 commits into
mainfrom
gradient-stop-folding
Jul 29, 2026
Merged

Three minification folds: gradient stops, gradient angle, alpha properties#214
samoht merged 4 commits into
mainfrom
gradient-stop-folding

Conversation

@samoht

@samoht samoht commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Three independent gaps, one commit each.

Adjacent gradient stops of one colour now fold into the double-position stop that CSS Images 4 defines as their exact equivalent. A 0deg linear-gradient angle is dropped and the stops reversed, since the default direction is that angle turned 180 degrees; this is gated on stops carrying no position, which the reversal would otherwise have to mirror to 100% - p, and never applies to the legacy prefixed gradients, which measure their angle from a different zero. fill-opacity and its three siblings are now modelled as the <alpha-value> they are, instead of parsing as unknown properties whose text survives untouched.

The to top case in the gradient-direction test changed meaning as a direct consequence of the second commit, so its oracle moved from 0deg to the reversed form.

samoht added 4 commits July 29, 2026 18:25
CSS Images 4 sec. 3.4.1 defines the two-position stop as exactly the pair it
abbreviates, so the pair was being emitted where the shorter equivalent is
always available.
The default direction is that angle turned 180 degrees, so the angle buys
nothing once the stops are reversed. Gated on unpositioned stops, whose
positions would otherwise each need mirroring, and on the unprefixed
gradients, since the legacy ones measure their angle from a different zero.
They parsed as unknown properties, so their values survived as opaque text
and missed even leading-zero stripping. Each is an <alpha-value>, so they
reuse the opacity reader, printer and normaliser wholesale.
@samoht
samoht force-pushed the gradient-stop-folding branch from 786c304 to 78be5a6 Compare July 29, 2026 18:45
@samoht
samoht merged commit b66d330 into main Jul 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant