From b652546a16a3561f61d8e527a0b89b60fc0e2c05 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 25 Jun 2022 16:54:57 +0100 Subject: [PATCH] LibWeb: Fix parsing of background-size: contain/cover The lack of the commit() before returning the x_value here meant, that in parse_background_value() the token stream would be one token behind after parsing the background-size. This led to it to returning null, after it sees the unexpected 'second' contain / cover token. With this change all of backgrounds.html is working again. --- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 7e1d648011..615ffd43b4 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -3741,8 +3741,10 @@ RefPtr Parser::parse_single_background_size_value(TokenStreamto_identifier() == ValueID::Cover || x_value->to_identifier() == ValueID::Contain) + if (x_value->to_identifier() == ValueID::Cover || x_value->to_identifier() == ValueID::Contain) { + transaction.commit(); return x_value; + } auto maybe_y_value = parse_css_value(tokens.peek_token()); if (!maybe_y_value || !property_accepts_value(PropertyID::BackgroundSize, *maybe_y_value)) {