summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2021-10-15 19:25:27 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-15 21:18:50 +0100
commit8b57e56d6627a6e8c82629617ec4181c4b6aa1c9 (patch)
tree4b1263ec6b9b966dd337b54f3c37f7eed6e3d470 /Userland/Libraries/LibWeb
parent7879b98f6063a40509c2ad96ff9056f06f62dc1c (diff)
downloadserenity-8b57e56d6627a6e8c82629617ec4181c4b6aa1c9.zip
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. :^)
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp7
-rw-r--r--Userland/Libraries/LibWeb/CSS/Properties.json5
2 files changed, 11 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index fe6162559e..2f3326d21e 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -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 {};
diff --git a/Userland/Libraries/LibWeb/CSS/Properties.json b/Userland/Libraries/LibWeb/CSS/Properties.json
index d53dcfcd21..c35022d31c 100644
--- a/Userland/Libraries/LibWeb/CSS/Properties.json
+++ b/Userland/Libraries/LibWeb/CSS/Properties.json
@@ -415,7 +415,10 @@
},
"box-shadow": {
"inherited": false,
- "initial": "none"
+ "initial": "none",
+ "valid-identifiers": [
+ "none"
+ ]
},
"box-sizing": {
"inherited": false,