1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:47:45 +00:00

LibWeb: Expose StyleValue parsing method in CSS Parser

Now that StyleResolver is going to deal with StyleComponentValueRules,
it will need to be able to parse those into StyleValues, using
`parse_css_value()`.

Also added StyleValue::is_builtin_or_dynamic(), which returns true for
values that are valid anywhere - things like `initial` and `inherit`,
along with `var()`, `attr()` and `calc()` - which we want to test for
easily.
This commit is contained in:
Sam Atkins 2021-07-18 17:12:23 +01:00 committed by Andreas Kling
parent 57d34f1966
commit 6e0376361a
3 changed files with 116 additions and 55 deletions

View file

@ -239,6 +239,11 @@ public:
bool is_numeric() const { return type() == Type::Numeric; }
bool is_value_list() const { return type() == Type::ValueList; }
bool is_builtin_or_dynamic() const
{
return is_inherit() || is_initial() || is_custom_property();
}
virtual String to_string() const = 0;
virtual Length to_length() const { return Length::make_auto(); }
virtual Color to_color(const DOM::Document&) const { return {}; }