1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

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.
This commit is contained in:
MacDue 2022-06-25 16:54:57 +01:00 committed by Linus Groh
parent 93b4c3bb82
commit b652546a16

View file

@ -3741,8 +3741,10 @@ RefPtr<StyleValue> Parser::parse_single_background_size_value(TokenStream<Compon
return nullptr;
auto x_value = maybe_x_value.release_nonnull();
if (x_value->to_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)) {