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
commit 019e3a342d
Notes: sideshowbarker 2024-07-17 11:34:34 +09:00
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>&);