LibWeb/CSS: Make CSS Parser::create() infallible

Now that `Tokenizer::tokenize()` just returns a String, there are no
errors to propagate, and we can simplify the user code a bit.
This commit is contained in:
Sam Atkins 2024-07-26 15:20:26 +01:00 committed by Andreas Kling
commit 59778d2b36
Notes: github-actions[bot] 2024-07-26 15:30:15 +00:00
8 changed files with 33 additions and 64 deletions

View file

@ -594,11 +594,9 @@ Optional<double> AnimationEffect::transformed_progress() const
RefPtr<CSS::StyleValue const> AnimationEffect::parse_easing_string(JS::Realm& realm, StringView value)
{
auto maybe_parser = CSS::Parser::Parser::create(CSS::Parser::ParsingContext(realm), value);
if (maybe_parser.is_error())
return {};
auto parser = CSS::Parser::Parser::create(CSS::Parser::ParsingContext(realm), value);
if (auto style_value = maybe_parser.release_value().parse_as_css_value(CSS::PropertyID::AnimationTimingFunction)) {
if (auto style_value = parser.parse_as_css_value(CSS::PropertyID::AnimationTimingFunction)) {
if (style_value->is_easing())
return style_value;
}