LibWeb: Adapt parse_position() into parse_position_value()

Having two ways that `<position>` is represented is awkward and
unnecessary. So, let's combine the two paths together. This first step
copies and modifies the `parse_position()` code to produce a
`PositionStyleValue`.

Apart from returning a StyleValue, this also makes use of automatic enum
parsing instead of manually comparing identifier strings.
This commit is contained in:
Sam Atkins
2023-11-07 11:50:44 +00:00
committed by Sam Atkins
parent 4ad58f0204
commit 8917378aa7
4 changed files with 206 additions and 0 deletions

View File

@@ -217,6 +217,7 @@ private:
RefPtr<StyleValue> parse_string_value(ComponentValue const&);
RefPtr<StyleValue> parse_image_value(ComponentValue const&);
RefPtr<StyleValue> parse_paint_value(TokenStream<ComponentValue>&);
RefPtr<PositionStyleValue> parse_position_value(TokenStream<ComponentValue>&);
template<typename ParseFunction>
RefPtr<StyleValue> parse_comma_separated_value_list(Vector<ComponentValue> const&, ParseFunction);
RefPtr<StyleValue> parse_simple_comma_separated_value_list(PropertyID, Vector<ComponentValue> const&);