LibWeb: Parse "none" value for box-shadow property

Previously, `box-shadow: none` would fail to parse, meaning that in this
example:

```css
p {
  box-shadow: 20px 10px 5px magenta;
}

p.foo {
  box-shadow: none;
}
```

... a `<p class="foo">` would still have a box-shadow, when it should
not have one. Now, we handle the `none` value. :^)
This commit is contained in:
Sam Atkins 2021-10-15 19:25:27 +01:00 committed by Linus Groh
parent 7879b98f60
commit 8b57e56d66
Notes: sideshowbarker 2024-07-18 02:20:08 +09:00
2 changed files with 11 additions and 1 deletions

View file

@ -2571,6 +2571,13 @@ RefPtr<StyleValue> Parser::parse_border_radius_shorthand_value(ParsingContext co
RefPtr<StyleValue> Parser::parse_box_shadow_value(ParsingContext const& context, Vector<StyleComponentValueRule> const& component_values)
{
// "none"
if (component_values.size() == 1 && component_values.first().is(Token::Type::Ident)) {
auto ident = parse_identifier_value(context, component_values.first());
if (ident && ident->to_identifier() == ValueID::None)
return ident;
}
// FIXME: Also support inset, spread-radius and multiple comma-separated box-shadows
Length offset_x {};
Length offset_y {};

View file

@ -415,7 +415,10 @@
},
"box-shadow": {
"inherited": false,
"initial": "none"
"initial": "none",
"valid-identifiers": [
"none"
]
},
"box-sizing": {
"inherited": false,