Repository navigation
Skip the interpolation method in linear gradient stops - #281
Merged
Merged
Conversation
eXpl0it3r
force-pushed
the
fix/gradient-interpolation-method
branch
from
November 10, 2026 19:06
8199555 to
d23302d
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.
A linear gradient with a leading color interpolation method, e.g.
linear-gradient(in srgb, red, blue)orlinear-gradient(in oklab to right, red, blue), got painted with an extra first color stop and the default top to bottom direction. The CSS engine already validates thein <colorspace>part, butCssValueParser.ParseLinearGradient, which builds the gradient for painting, didn't know about it and handedin srgbto the color parser as the first stop. As such onlyto right in oklabhappened to work, since the direction keywords get looked up by name and the rest of the group is ignored.The parser now takes the interpolation method out of the first argument with the existing
ColorInterpolationMethodGrammar, reads whatever is left as the angle orto <side>direction, and treats the group as a prelude, not as a color stop. An invalid method or a leftover that isn't a direction makes the gradient invalid. The gradient still interpolates in sRGB, actually using the given color space is a separate feature. Radial and conic gradients aren't painted yet, so onlylinear-gradient()andrepeating-linear-gradient()are affected.How to test this PR?
CI should succeed.
GradientTests.ParseImageSkipsTheInterpolationMethodcovers the method alone, before and after an angle or a side, with a hue interpolation method and on a repeating gradient, and fails on master.GradientTests.ParseImageRejectsAnInvalidInterpolationMethodchecks that an invalid method drops the gradient.