summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2022-06-25 16:54:57 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-26 22:04:20 +0100
commitb652546a16a3561f61d8e527a0b89b60fc0e2c05 (patch)
tree2ea1a9581dda3e4f68fde9cb0efec0cc1550f764
parent93b4c3bb820838fbefbc79b4fbb3fff6b008f6b8 (diff)
downloadserenity-b652546a16a3561f61d8e527a0b89b60fc0e2c05.zip
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.
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp4
1 files changed, 3 insertions, 1 deletions
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<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)) {