From 5647d37d4286e35a507e390edc8311673e5554ba Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 17 Apr 2023 20:03:12 +0100 Subject: [PATCH] LibWeb: Stop parsing `auto` as a Length Previously, whether trying to parse a `` or ``, we would accept `auto` and produce a `LengthStyleValue` from it. This would fool the `property_accepts_value()` into allowing `auto` where it does not belong, if the property did accept lengths. Of the few places in the parser that called `parse_dimension_value()` or `parse_length()`, none of them were expecting it to accept `auto`, so this fixes those too. :^) --- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 1daa720a9a..d47553b0ab 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -3382,10 +3382,6 @@ Optional Parser::parse_length(ComponentValue const& component_value) if (dimension->is_length()) return dimension->length(); - // FIXME: auto isn't a length! - if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_ascii_case("auto"sv)) - return Length::make_auto(); - return {}; } @@ -3678,9 +3674,6 @@ RefPtr Parser::parse_dimension_value(ComponentValue const& component if (component_value.is(Token::Type::Number) && !(m_context.in_quirks_mode() && property_has_quirk(m_context.current_property_id(), Quirk::UnitlessLength))) return {}; - if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_ascii_case("auto"sv)) - return LengthStyleValue::create(Length::make_auto()); - auto dimension = parse_dimension(component_value); if (!dimension.has_value()) return {};