|
@@ -2682,13 +2682,13 @@ static void remove_property(Vector<PropertyID>& properties, PropertyID property_
|
|
|
}
|
|
|
|
|
|
// https://www.w3.org/TR/css-sizing-4/#aspect-ratio
|
|
|
-RefPtr<StyleValue> Parser::parse_aspect_ratio_value(Vector<ComponentValue> const& component_values)
|
|
|
+RefPtr<StyleValue> Parser::parse_aspect_ratio_value(TokenStream<ComponentValue>& tokens)
|
|
|
{
|
|
|
// `auto || <ratio>`
|
|
|
RefPtr<StyleValue> auto_value;
|
|
|
RefPtr<StyleValue> ratio_value;
|
|
|
|
|
|
- auto tokens = TokenStream { component_values };
|
|
|
+ auto transaction = tokens.begin_transaction();
|
|
|
while (tokens.has_next_token()) {
|
|
|
auto maybe_value = parse_css_value_for_property(PropertyID::AspectRatio, tokens);
|
|
|
if (!maybe_value)
|
|
@@ -2712,16 +2712,21 @@ RefPtr<StyleValue> Parser::parse_aspect_ratio_value(Vector<ComponentValue> const
|
|
|
}
|
|
|
|
|
|
if (auto_value && ratio_value) {
|
|
|
+ transaction.commit();
|
|
|
return StyleValueList::create(
|
|
|
StyleValueVector { auto_value.release_nonnull(), ratio_value.release_nonnull() },
|
|
|
StyleValueList::Separator::Space);
|
|
|
}
|
|
|
|
|
|
- if (ratio_value)
|
|
|
+ if (ratio_value) {
|
|
|
+ transaction.commit();
|
|
|
return ratio_value.release_nonnull();
|
|
|
+ }
|
|
|
|
|
|
- if (auto_value)
|
|
|
+ if (auto_value) {
|
|
|
+ transaction.commit();
|
|
|
return auto_value.release_nonnull();
|
|
|
+ }
|
|
|
|
|
|
return nullptr;
|
|
|
}
|
|
@@ -5728,7 +5733,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
|
|
auto tokens = TokenStream { component_values };
|
|
|
switch (property_id) {
|
|
|
case PropertyID::AspectRatio:
|
|
|
- if (auto parsed_value = parse_aspect_ratio_value(component_values))
|
|
|
+ if (auto parsed_value = parse_aspect_ratio_value(tokens); parsed_value && !tokens.has_next_token())
|
|
|
return parsed_value.release_nonnull();
|
|
|
return ParseError::SyntaxError;
|
|
|
case PropertyID::BackdropFilter:
|