summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2023-05-26 03:54:05 +0330
committerAndreas Kling <kling@serenityos.org>2023-05-29 05:35:41 +0200
commit5cd01bd644ad899cd20eac94421291b69619a78e (patch)
tree01ebadb08a5b1f94759687cde1ab34ce80d050cc
parente47f81d954a0a77d9aa8e763935466e1160fbfc5 (diff)
downloadserenity-5cd01bd644ad899cd20eac94421291b69619a78e.zip
LibWeb: Allow '0' as a CSS dimension value
The comment mentions that zero is let through, but then immediately errors out if it sees any number outside quirks mode. This commit makes that check let zeros through.
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index e400ecdb79..1e697a6dde 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -3683,7 +3683,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_dimension_value(ComponentValue const&
// 2) It's a 0.
// We handle case 1 here. Case 2 is handled by NumericStyleValue pretending to be a LengthStyleValue if it is 0.
- if (component_value.is(Token::Type::Number) && !(m_context.in_quirks_mode() && property_has_quirk(m_context.current_property_id(), Quirk::UnitlessLength)))
+ if (component_value.is(Token::Type::Number) && component_value.token().number_value() != 0 && !(m_context.in_quirks_mode() && property_has_quirk(m_context.current_property_id(), Quirk::UnitlessLength)))
return nullptr;
auto dimension = parse_dimension(component_value);