LibWeb: Maintain easing keywords as KeywordStyleValue until use-time

This excludes `step-end` and `step-start` which are expected to be
converted to the equivalent function at parse time.

We are expected to serialize these as the explicit keywords - previously
we would parse as `EasingStyleValue` and serialize equivalent functions
as the keywords. This caused issues as we would incorrectly serialize
even explicit functions as the keyword.

This also allows us to move the magic easing functions to
`EasingFunction` rather than `EasingStyleValue` which is a bit tidier
This commit is contained in:
Callum Law 2025-10-11 23:34:35 +13:00 committed by Sam Atkins
commit 03be70087d
Notes: github-actions[bot] 2025-10-20 10:29:02 +00:00
15 changed files with 210 additions and 125 deletions

View file

@ -13,7 +13,9 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/ComputedProperties.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleInvalidation.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
@ -606,9 +608,11 @@ Optional<double> AnimationEffect::transformed_progress() const
Optional<CSS::EasingFunction> AnimationEffect::parse_easing_string(StringView value)
{
if (auto style_value = parse_css_value(CSS::Parser::ParsingParams(), value, CSS::PropertyID::AnimationTimingFunction)) {
if (style_value->is_easing())
// FIXME: We should absolutize style_value to resolve relative lengths within calcs
return CSS::EasingFunction::from_style_value(*style_value);
if (style_value->is_unresolved() || style_value->is_value_list() || style_value->is_css_wide_keyword())
return {};
// FIXME: We should absolutize style_value to resolve relative lengths within calcs
return CSS::EasingFunction::from_style_value(style_value.release_nonnull());
}
return {};