From 5cd01bd644ad899cd20eac94421291b69619a78e Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Fri, 26 May 2023 03:54:05 +0330 Subject: 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. --- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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> 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); -- cgit v1.2.3