You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A gradient's first colour stop written at a unitless 0 is dropped, so repeating-radial-gradient(red 0, blue 10px) draws solid blue #584
The audit recorded this as "repeating-radial-gradient() draws one solid colour". It does not: repeating radial gradients draw their rings. What fails is the audit's input, red 0. A first colour stop written with a unitless 0 position is taken for the gradient's angle and dropped, in linear and radial gradients alike.
Measured on gravitypdf at 60b82630, PHP 8.5.4, on a 60 × 30 mm block, rasterised.
background
Browser
mPDF
repeating-radial-gradient(red 0, blue 10px)
red and blue rings every 10px
solid blue
radial-gradient(red 0, blue)
red centre fading to blue
solid blue
linear-gradient(red 0, blue)
red at the top fading to blue
solid blue
repeating-radial-gradient(red 0%, blue 10%)
rings
rings
repeating-radial-gradient(circle, red 0, blue 10px)
rings
rings
Cause. Both parsers decide whether the first comma-separated part is a direction or a colour stop. A part whose last word is 0 counts as a direction, whatever comes before it (src/Gradient.php:651 and :676 in parseMozLinearGradient(), :804 in parseMozRadialGradient()). A bare 0 is a valid angle, and linear-gradient(0, red, blue) has to keep working. But red 0 is a colour stop, and its colour is lost. The one remaining stop is then drawn on its own.
#577 rewrites the angle handling in parseMozLinearGradient() but keeps this check.
Fix. Treat the first part as a direction only when its first word is not a colour. 0 alone stays an angle; red 0 is a stop at 0. Apply the same test in both parsers.
Tests. Each row above, reading the stops given to the shading function: red 0 in first place, a bare 0 angle before the stops, rgb(…) 0, and a repeating radial gradient with stops in px and in %.
Activity
Keep a gradient's first colour stop when its position is a unitless 0 (…