1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

LibWeb: Parse the linear-gradient() CSS function

This should parse linear-gradient()s as defined in the W3 spec
https://drafts.csswg.org/css-images/#linear-gradients.

Note: This currently cannot parse multi-position color stops,
these are shown on MDN and work in Firefox and Chrome, though do
not seem to be defined in the spec.

See: https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#gradient_with_multi-position_color_stops

P.s. This also allows -webkit-linear-gradient for compatibility.
This commit is contained in:
MacDue 2022-07-12 00:15:05 +01:00 committed by Sam Atkins
parent 259bb30c35
commit ae6c0258a4
3 changed files with 187 additions and 3 deletions

View file

@ -317,6 +317,8 @@ private:
};
Optional<AK::URL> parse_url_function(ComponentValue const&, AllowedDataUrlType = AllowedDataUrlType::None);
RefPtr<StyleValue> parse_linear_gradient_function(ComponentValue const&);
ParseErrorOr<NonnullRefPtr<StyleValue>> parse_css_value(PropertyID, TokenStream<ComponentValue>&);
RefPtr<StyleValue> parse_css_value(ComponentValue const&);
RefPtr<StyleValue> parse_builtin_value(ComponentValue const&);