1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibWeb: Parse rgb and hsl functions according to CSS Module Level 4

Implement parsing of rgb(..) and hsl(..) in both the modern level 4
syntax without commas, and the legacy syntax with commas.

The parser accepts non-integer numbers but rounds to integer values
for now.
This commit is contained in:
Thomas Fach-Pedersen 2022-06-09 19:08:57 +02:00 committed by Sam Atkins
parent 83c79fec1c
commit 019e3a342d
2 changed files with 136 additions and 125 deletions

View file

@ -304,6 +304,7 @@ private:
Variant<Angle, Frequency, Length, Percentage, Resolution, Time> m_value;
};
Optional<Dimension> parse_dimension(ComponentValue const&);
Optional<Color> parse_rgb_or_hsl_color(StringView function_name, Vector<ComponentValue> const&);
Optional<Color> parse_color(ComponentValue const&);
Optional<Length> parse_length(ComponentValue const&);
Optional<Ratio> parse_ratio(TokenStream<ComponentValue>&);