@@ -2682,13 +2682,13 @@ static void remove_property(Vector<PropertyID>& properties, PropertyID property_
2682
2682
}
2683
2683
2684
2684
// https://www.w3.org/TR/css-sizing-4/#aspect-ratio
2685
- RefPtr<StyleValue> Parser::parse_aspect_ratio_value (Vector <ComponentValue> const & component_values )
2685
+ RefPtr<StyleValue> Parser::parse_aspect_ratio_value (TokenStream <ComponentValue>& tokens )
2686
2686
{
2687
2687
// `auto || <ratio>`
2688
2688
RefPtr<StyleValue> auto_value;
2689
2689
RefPtr<StyleValue> ratio_value;
2690
2690
2691
- auto tokens = TokenStream { component_values } ;
2691
+ auto transaction = tokens. begin_transaction () ;
2692
2692
while (tokens.has_next_token ()) {
2693
2693
auto maybe_value = parse_css_value_for_property (PropertyID::AspectRatio, tokens);
2694
2694
if (!maybe_value)
@@ -2712,16 +2712,21 @@ RefPtr<StyleValue> Parser::parse_aspect_ratio_value(Vector<ComponentValue> const
2712
2712
}
2713
2713
2714
2714
if (auto_value && ratio_value) {
2715
+ transaction.commit ();
2715
2716
return StyleValueList::create (
2716
2717
StyleValueVector { auto_value.release_nonnull (), ratio_value.release_nonnull () },
2717
2718
StyleValueList::Separator::Space);
2718
2719
}
2719
2720
2720
- if (ratio_value)
2721
+ if (ratio_value) {
2722
+ transaction.commit ();
2721
2723
return ratio_value.release_nonnull ();
2724
+ }
2722
2725
2723
- if (auto_value)
2726
+ if (auto_value) {
2727
+ transaction.commit ();
2724
2728
return auto_value.release_nonnull ();
2729
+ }
2725
2730
2726
2731
return nullptr ;
2727
2732
}
@@ -5728,7 +5733,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
5728
5733
auto tokens = TokenStream { component_values };
5729
5734
switch (property_id) {
5730
5735
case PropertyID::AspectRatio:
5731
- if (auto parsed_value = parse_aspect_ratio_value (component_values ))
5736
+ if (auto parsed_value = parse_aspect_ratio_value (tokens); parsed_value && !tokens. has_next_token ( ))
5732
5737
return parsed_value.release_nonnull ();
5733
5738
return ParseError::SyntaxError;
5734
5739
case PropertyID::BackdropFilter:
0 commit comments