|
@@ -4443,21 +4443,21 @@ RefPtr<StyleValue> Parser::parse_list_style_value(TokenStream<ComponentValue>& t
|
|
|
{ list_position.release_nonnull(), list_image.release_nonnull(), list_type.release_nonnull() });
|
|
|
}
|
|
|
|
|
|
-RefPtr<StyleValue> Parser::parse_math_depth_value(Vector<ComponentValue> const& component_values)
|
|
|
+RefPtr<StyleValue> Parser::parse_math_depth_value(TokenStream<ComponentValue>& tokens)
|
|
|
{
|
|
|
// https://w3c.github.io/mathml-core/#propdef-math-depth
|
|
|
// auto-add | add(<integer>) | <integer>
|
|
|
- auto tokens = TokenStream { component_values };
|
|
|
+ auto transaction = tokens.begin_transaction();
|
|
|
|
|
|
- tokens.skip_whitespace();
|
|
|
auto token = tokens.next_token();
|
|
|
- tokens.skip_whitespace();
|
|
|
if (tokens.has_next_token())
|
|
|
return nullptr;
|
|
|
|
|
|
// auto-add
|
|
|
- if (token.is_ident("auto-add"sv))
|
|
|
+ if (token.is_ident("auto-add"sv)) {
|
|
|
+ transaction.commit();
|
|
|
return MathDepthStyleValue::create_auto_add();
|
|
|
+ }
|
|
|
|
|
|
// FIXME: Make it easier to parse "thing that might be <bar> or literally anything that resolves to it" and get rid of this
|
|
|
auto parse_something_that_resolves_to_integer = [this](ComponentValue& token) -> RefPtr<StyleValue> {
|
|
@@ -4476,14 +4476,18 @@ RefPtr<StyleValue> Parser::parse_math_depth_value(Vector<ComponentValue> const&
|
|
|
add_tokens.skip_whitespace();
|
|
|
if (add_tokens.has_next_token())
|
|
|
return nullptr;
|
|
|
- if (auto integer_value = parse_something_that_resolves_to_integer(integer_token))
|
|
|
+ if (auto integer_value = parse_something_that_resolves_to_integer(integer_token)) {
|
|
|
+ transaction.commit();
|
|
|
return MathDepthStyleValue::create_add(integer_value.release_nonnull());
|
|
|
+ }
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
// <integer>
|
|
|
- if (auto integer_value = parse_something_that_resolves_to_integer(token))
|
|
|
+ if (auto integer_value = parse_something_that_resolves_to_integer(token)) {
|
|
|
+ transaction.commit();
|
|
|
return MathDepthStyleValue::create_integer(integer_value.release_nonnull());
|
|
|
+ }
|
|
|
|
|
|
return nullptr;
|
|
|
}
|
|
@@ -5907,7 +5911,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
|
|
return parsed_value.release_nonnull();
|
|
|
return ParseError::SyntaxError;
|
|
|
case PropertyID::MathDepth:
|
|
|
- if (auto parsed_value = parse_math_depth_value(component_values))
|
|
|
+ if (auto parsed_value = parse_math_depth_value(tokens); parsed_value && !tokens.has_next_token())
|
|
|
return parsed_value.release_nonnull();
|
|
|
return ParseError::SyntaxError;
|
|
|
case PropertyID::Overflow:
|