|
@@ -93,7 +93,7 @@ static void log_parse_error(SourceLocation const& location = SourceLocation::cur
|
|
|
|
|
|
namespace Web::CSS::Parser {
|
|
|
|
|
|
-ErrorOr<Parser> Parser::create(ParsingContext const& context, StringView input, StringView encoding)
|
|
|
+Parser Parser::create(ParsingContext const& context, StringView input, StringView encoding)
|
|
|
{
|
|
|
auto tokens = Tokenizer::tokenize(input, encoding);
|
|
|
return Parser { context, move(tokens) };
|
|
@@ -7788,7 +7788,7 @@ NonnullRefPtr<StyleValue> Parser::resolve_unresolved_style_value(ParsingContext
|
|
|
|
|
|
// If the value is invalid, we fall back to `unset`: https://www.w3.org/TR/css-variables-1/#invalid-at-computed-value-time
|
|
|
|
|
|
- auto parser = MUST(Parser::create(context, ""sv));
|
|
|
+ auto parser = Parser::create(context, ""sv);
|
|
|
return parser.resolve_unresolved_style_value(element, pseudo_element, property_id, unresolved);
|
|
|
}
|
|
|
|
|
@@ -8072,7 +8072,7 @@ bool Parser::substitute_attr_function(DOM::Element& element, FlyString const& pr
|
|
|
auto attribute_value = element.get_attribute_value(attribute_name);
|
|
|
if (attribute_type.equals_ignoring_ascii_case("angle"_fly_string)) {
|
|
|
// Parse a component value from the attribute’s value.
|
|
|
- auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
|
|
+ auto component_value = Parser::Parser::create(m_context, attribute_value).parse_as_component_value();
|
|
|
// If the result is a <dimension-token> whose unit matches the given type, the result is the substitution value.
|
|
|
// Otherwise, there is no substitution value.
|
|
|
if (component_value.has_value() && component_value->is(Token::Type::Dimension)) {
|
|
@@ -8085,7 +8085,7 @@ bool Parser::substitute_attr_function(DOM::Element& element, FlyString const& pr
|
|
|
// Parse a component value from the attribute’s value.
|
|
|
// If the result is a <hex-color> or a named color ident, the substitution value is that result as a <color>.
|
|
|
// Otherwise there is no substitution value.
|
|
|
- auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
|
|
+ auto component_value = Parser::Parser::create(m_context, attribute_value).parse_as_component_value();
|
|
|
if (component_value.has_value()) {
|
|
|
if ((component_value->is(Token::Type::Hash)
|
|
|
&& Color::from_string(MUST(String::formatted("#{}", component_value->token().hash_value()))).has_value())
|
|
@@ -8097,7 +8097,7 @@ bool Parser::substitute_attr_function(DOM::Element& element, FlyString const& pr
|
|
|
}
|
|
|
} else if (attribute_type.equals_ignoring_ascii_case("flex"_fly_string)) {
|
|
|
// Parse a component value from the attribute’s value.
|
|
|
- auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
|
|
+ auto component_value = Parser::Parser::create(m_context, attribute_value).parse_as_component_value();
|
|
|
// If the result is a <dimension-token> whose unit matches the given type, the result is the substitution value.
|
|
|
// Otherwise, there is no substitution value.
|
|
|
if (component_value.has_value() && component_value->is(Token::Type::Dimension)) {
|
|
@@ -8108,7 +8108,7 @@ bool Parser::substitute_attr_function(DOM::Element& element, FlyString const& pr
|
|
|
}
|
|
|
} else if (attribute_type.equals_ignoring_ascii_case("frequency"_fly_string)) {
|
|
|
// Parse a component value from the attribute’s value.
|
|
|
- auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
|
|
+ auto component_value = Parser::Parser::create(m_context, attribute_value).parse_as_component_value();
|
|
|
// If the result is a <dimension-token> whose unit matches the given type, the result is the substitution value.
|
|
|
// Otherwise, there is no substitution value.
|
|
|
if (component_value.has_value() && component_value->is(Token::Type::Dimension)) {
|
|
@@ -8131,7 +8131,7 @@ bool Parser::substitute_attr_function(DOM::Element& element, FlyString const& pr
|
|
|
}
|
|
|
} else if (attribute_type.equals_ignoring_ascii_case("length"_fly_string)) {
|
|
|
// Parse a component value from the attribute’s value.
|
|
|
- auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
|
|
+ auto component_value = Parser::Parser::create(m_context, attribute_value).parse_as_component_value();
|
|
|
// If the result is a <dimension-token> whose unit matches the given type, the result is the substitution value.
|
|
|
// Otherwise, there is no substitution value.
|
|
|
if (component_value.has_value() && component_value->is(Token::Type::Dimension)) {
|
|
@@ -8144,14 +8144,14 @@ bool Parser::substitute_attr_function(DOM::Element& element, FlyString const& pr
|
|
|
// Parse a component value from the attribute’s value.
|
|
|
// If the result is a <number-token>, the result is the substitution value.
|
|
|
// Otherwise, there is no substitution value.
|
|
|
- auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
|
|
+ auto component_value = Parser::Parser::create(m_context, attribute_value).parse_as_component_value();
|
|
|
if (component_value.has_value() && component_value->is(Token::Type::Number)) {
|
|
|
dest.append(component_value.release_value());
|
|
|
return true;
|
|
|
}
|
|
|
} else if (attribute_type.equals_ignoring_ascii_case("percentage"_fly_string)) {
|
|
|
// Parse a component value from the attribute’s value.
|
|
|
- auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
|
|
+ auto component_value = Parser::Parser::create(m_context, attribute_value).parse_as_component_value();
|
|
|
// If the result is a <percentage-token>, the result is the substitution value.
|
|
|
// Otherwise, there is no substitution value.
|
|
|
if (component_value.has_value() && component_value->is(Token::Type::Percentage)) {
|
|
@@ -8166,7 +8166,7 @@ bool Parser::substitute_attr_function(DOM::Element& element, FlyString const& pr
|
|
|
return true;
|
|
|
} else if (attribute_type.equals_ignoring_ascii_case("time"_fly_string)) {
|
|
|
// Parse a component value from the attribute’s value.
|
|
|
- auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
|
|
+ auto component_value = Parser::Parser::create(m_context, attribute_value).parse_as_component_value();
|
|
|
// If the result is a <dimension-token> whose unit matches the given type, the result is the substitution value.
|
|
|
// Otherwise, there is no substitution value.
|
|
|
if (component_value.has_value() && component_value->is(Token::Type::Dimension)) {
|
|
@@ -8186,7 +8186,7 @@ bool Parser::substitute_attr_function(DOM::Element& element, FlyString const& pr
|
|
|
// Parse a component value from the attribute’s value.
|
|
|
// If the result is a <number-token>, the substitution value is a dimension with the result’s value, and the given unit.
|
|
|
// Otherwise, there is no substitution value.
|
|
|
- auto component_value = MUST(Parser::Parser::create(m_context, attribute_value)).parse_as_component_value();
|
|
|
+ auto component_value = Parser::Parser::create(m_context, attribute_value).parse_as_component_value();
|
|
|
if (component_value.has_value() && component_value->is(Token::Type::Number)) {
|
|
|
if (attribute_value == "%"sv) {
|
|
|
dest.empend(Token::create_dimension(component_value->token().number_value(), attribute_type));
|