From 3b8c2a97c06b2dec19bc5dac8ff5706a3b61e9b9 Mon Sep 17 00:00:00 2001 From: Callum Law Date: Thu, 28 Aug 2025 01:56:47 +1200 Subject: [PATCH] LibWeb: Don't resolve `UnresolvedStyleValue`s in `set_keyframes` If the custom property related to this UnresolvedStyleValue changed we would not reflect the up to date value in the animation. --- Libraries/LibWeb/Animations/KeyframeEffect.cpp | 4 ---- .../css/animation-changing-custom-property.txt | 1 + .../css/animation-changing-custom-property.html | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/css/animation-changing-custom-property.txt create mode 100644 Tests/LibWeb/Text/input/css/animation-changing-custom-property.html diff --git a/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Libraries/LibWeb/Animations/KeyframeEffect.cpp index 846518eb4fc..91c06be2488 100644 --- a/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -869,7 +869,6 @@ WebIDL::ExceptionOr KeyframeEffect::set_keyframes(Optionaltarget(); for (auto& keyframe : m_keyframes) { Animations::KeyframeEffect::KeyFrameSet::ResolvedKeyFrame resolved_keyframe; @@ -877,9 +876,6 @@ WebIDL::ExceptionOr KeyframeEffect::set_keyframes(Optional(keyframe.computed_offset.value() * 100 * AnimationKeyFrameKeyScaleFactor); for (auto [property_id, property_value] : keyframe.parsed_properties()) { - if (property_value->is_unresolved() && target) - property_value = CSS::Parser::Parser::resolve_unresolved_style_value(CSS::Parser::ParsingParams { target->document() }, *target, pseudo_element_type(), property_id, property_value->as_unresolved()); - resolved_keyframe.properties.set(property_id, property_value); CSS::StyleComputer::for_each_property_expanding_shorthands(property_id, property_value, [&](CSS::PropertyID longhand_id, CSS::StyleValue const&) { m_target_properties.set(longhand_id); diff --git a/Tests/LibWeb/Text/expected/css/animation-changing-custom-property.txt b/Tests/LibWeb/Text/expected/css/animation-changing-custom-property.txt new file mode 100644 index 00000000000..f2b5e94d8ea --- /dev/null +++ b/Tests/LibWeb/Text/expected/css/animation-changing-custom-property.txt @@ -0,0 +1 @@ +rgb(0, 64, 0) diff --git a/Tests/LibWeb/Text/input/css/animation-changing-custom-property.html b/Tests/LibWeb/Text/input/css/animation-changing-custom-property.html new file mode 100644 index 00000000000..85bce155d2c --- /dev/null +++ b/Tests/LibWeb/Text/input/css/animation-changing-custom-property.html @@ -0,0 +1,17 @@ + + +
+ + +