summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-05-18 15:43:52 +0100
committerAndreas Kling <kling@serenityos.org>2023-05-25 06:36:10 +0200
commit8e34bdc123bec958c5e315ade5417c7107fb1c2d (patch)
tree0553dbc05c548ac40d7e54eace953c9efb8d03f7 /Userland/Libraries
parenta0ec05ef81bab6caaeeb281b071ddaf0b0960464 (diff)
downloadserenity-8e34bdc123bec958c5e315ade5417c7107fb1c2d.zip
LibWeb: Use new StyleValue parsing for background-repeat
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index 2c227ef95d..412d321cea 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -4628,9 +4628,8 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_single_background_repeat_value(TokenSt
}
};
- auto const& token = tokens.next_token();
- auto maybe_x_value = TRY(parse_css_value(token));
- if (!maybe_x_value || !property_accepts_value(PropertyID::BackgroundRepeat, *maybe_x_value))
+ auto maybe_x_value = TRY(parse_css_value_for_property(PropertyID::BackgroundRepeat, tokens));
+ if (!maybe_x_value)
return nullptr;
auto x_value = maybe_x_value.release_nonnull();
@@ -4647,14 +4646,12 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_single_background_repeat_value(TokenSt
return nullptr;
// See if we have a second value for Y
- auto const& second_token = tokens.peek_token();
- auto maybe_y_value = TRY(parse_css_value(second_token));
- if (!maybe_y_value || !property_accepts_value(PropertyID::BackgroundRepeat, *maybe_y_value)) {
+ auto maybe_y_value = TRY(parse_css_value_for_property(PropertyID::BackgroundRepeat, tokens));
+ if (!maybe_y_value) {
// We don't have a second value, so use x for both
transaction.commit();
return BackgroundRepeatStyleValue::create(x_repeat.value(), x_repeat.value());
}
- tokens.next_token();
auto y_value = maybe_y_value.release_nonnull();
if (is_directional_repeat(*y_value))
return nullptr;