From 6bbf163499d5e6d9ceb88ac5c7158de2f60302b0 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Sat, 27 May 2023 12:22:14 +0100 Subject: [PATCH] LibWeb: Create a LengthStyleValue for flex-basis of `0` We're about to stop letting 0 NumericStyleValues pretend to be Lengths, so this will break. As noted, the flex-basis property accepts `` not `` so this is actually correct. --- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index d4517c0615..f05fc4b841 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -5392,9 +5392,10 @@ ErrorOr> Parser::parse_flex_value(Vector cons case PropertyID::FlexGrow: { // NOTE: The spec says that flex-basis should be 0 here, but other engines currently use 0%. // https://github.com/w3c/csswg-drafts/issues/5742 - auto zero_percent = TRY(NumericStyleValue::create_integer(0)); + // (flex-basis takes ``, not ``, so the 0 is a Length.) + auto flex_basis = TRY(LengthStyleValue::create(Length::make_px(0))); auto one = TRY(NumericStyleValue::create_integer(1)); - return FlexStyleValue::create(*value, one, zero_percent); + return FlexStyleValue::create(*value, one, flex_basis); } case PropertyID::FlexBasis: { auto one = TRY(NumericStyleValue::create_integer(1));