From 64ec66e209f876dfc19a79221858bdeef7ee5bf6 Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Fri, 31 May 2024 09:01:14 -0700 Subject: [PATCH] LibWeb: Handle animating 'initial' property values --- Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp index 447cc272f4..ac109aa20f 100644 --- a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -504,8 +504,12 @@ static WebIDL::ExceptionOr> process_a_keyframes_argument(JS if (maybe_parser.is_error()) continue; - if (auto style_value = maybe_parser.release_value().parse_as_css_value(*property)) + if (auto style_value = maybe_parser.release_value().parse_as_css_value(*property)) { + // Handle 'initial' here so we don't have to get the default value of the property every frame in StyleComputer + if (style_value->is_initial()) + style_value = CSS::property_initial_value(realm, *property); parsed_properties.set(*property, *style_value); + } } } keyframe.properties.set(move(parsed_properties));