Truly independent web browser
LibWeb: Preserve `initial` in JavaScript keyframes
Callum Lawd2416e17e2b1
diff --git a/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Libraries/LibWeb/Animations/KeyframeEffect.cppindex c570a537830..5ac6edca3b3 100644--- a/Libraries/LibWeb/Animations/KeyframeEffect.cpp+++ b/Libraries/LibWeb/Animations/KeyframeEffect.cpp@@ -571,12 +571,8 @@ static WebIDL::ExceptionOr<Vector<BaseKeyframe>> process_a_keyframes_argument(JSif (!property.has_value())continue;- if (auto style_value = parse_css_value(CSS::Parser::ParsingParams(), value_string, property->id())) {- // 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() && !property->is_custom_property())- style_value = CSS::property_initial_value(property->id());+ if (auto style_value = parse_css_value(CSS::Parser::ParsingParams(), value_string, property->id()))parsed_properties.set(*property, CSS::RustStyleValueHandle::retained(style_value->rust_style_value_data()));- }}keyframe.properties.set(move(parsed_properties));diff --git a/Tests/LibWeb/Text/expected/css/animation-initial-keyframe-reflection.txt b/Tests/LibWeb/Text/expected/css/animation-initial-keyframe-reflection.txtnew file mode 100644index 00000000000..e79c5e8f964--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/animation-initial-keyframe-reflection.txt@@ -0,0 +1 @@+initialdiff --git a/Tests/LibWeb/Text/input/css/animation-initial-keyframe-reflection.html b/Tests/LibWeb/Text/input/css/animation-initial-keyframe-reflection.htmlnew file mode 100644index 00000000000..3edbbc93373--- /dev/null+++ b/Tests/LibWeb/Text/input/css/animation-initial-keyframe-reflection.html@@ -0,0 +1,8 @@+<!doctype html>+<script src="../include.js"></script>+<script>+ test(() => {+ const effect = new KeyframeEffect(null, [{ opacity: "initial" }]);+ println(effect.getKeyframes()[0].opacity);+ });+</script>