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

LibWeb: Resolve type of calc() expressions at parse-time

See https://www.w3.org/TR/css-values-3/#calc-type-checking

If the sub-expressions' types are incompatible, we discard the calc() as
invalid.

Had to do some minor rearranging/renaming of the Calc structs to make
the `resolve_foo_type()` templates work too.
This commit is contained in:
Sam Atkins 2022-01-25 14:45:08 +00:00 committed by Andreas Kling
parent b818d952d1
commit b69f6097de
4 changed files with 265 additions and 25 deletions

View file

@ -213,6 +213,7 @@ private:
RefPtr<StyleValue> parse_css_value(StyleComponentValueRule const&);
RefPtr<StyleValue> parse_builtin_value(StyleComponentValueRule const&);
RefPtr<StyleValue> parse_dynamic_value(StyleComponentValueRule const&);
RefPtr<StyleValue> parse_calculated_value(Vector<StyleComponentValueRule> const&);
RefPtr<StyleValue> parse_dimension_value(StyleComponentValueRule const&);
RefPtr<StyleValue> parse_numeric_value(StyleComponentValueRule const&);
RefPtr<StyleValue> parse_identifier_value(StyleComponentValueRule const&);