diff --git a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp index 950e41d641f..4186625bb54 100644 --- a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -551,8 +551,8 @@ void KeyframeEffect::generate_initial_and_final_frames(RefPtr keyfr // 0% or one that would be positioned earlier in the used keyframe order, add the computed value of that // property on element to initial keyframe’s keyframe values. for (auto property : animated_properties) { - if (!initial_keyframe->resolved_properties.contains(property)) - initial_keyframe->resolved_properties.set(property, KeyFrameSet::UseInitial {}); + if (!initial_keyframe->properties.contains(property)) + initial_keyframe->properties.set(property, KeyFrameSet::UseInitial {}); } // 3. If initial keyframe’s keyframe values is not empty, prepend initial keyframe to keyframes. @@ -568,8 +568,8 @@ void KeyframeEffect::generate_initial_and_final_frames(RefPtr keyfr } for (auto property : animated_properties) { - if (!final_keyframe->resolved_properties.contains(property)) - final_keyframe->resolved_properties.set(property, KeyFrameSet::UseInitial {}); + if (!final_keyframe->properties.contains(property)) + final_keyframe->properties.set(property, KeyFrameSet::UseInitial {}); } } @@ -839,7 +839,7 @@ WebIDL::ExceptionOr KeyframeEffect::set_keyframes(Optional { shorthand_value }); + resolved_keyframe.properties.set(shorthand_id, NonnullRefPtr { shorthand_value }); }); } diff --git a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.h b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.h index 5ce0e59e647..4feb5fae296 100644 --- a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.h +++ b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.h @@ -64,7 +64,9 @@ public: struct KeyFrameSet : public RefCounted { struct UseInitial { }; struct ResolvedKeyFrame { - HashMap>> resolved_properties {}; + // These StyleValue properties can be unresolved, as they may be generated from a @keyframes rule, well + // before they are applied to an element + HashMap>> properties {}; }; RedBlackTree keyframes_by_key; }; diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 0fab61e542c..a4974692d94 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -1337,11 +1337,11 @@ void StyleComputer::collect_animation_into(JS::NonnullGCPtrid(), valid_properties, progress_in_keyframe * 100); } - for (auto const& it : keyframe_values.resolved_properties) { + for (auto const& it : keyframe_values.properties) { auto resolve_property = [&](auto& property) { return property.visit( [&](Animations::KeyframeEffect::KeyFrameSet::UseInitial) -> RefPtr { @@ -1354,7 +1354,7 @@ void StyleComputer::collect_animation_into(JS::NonnullGCPtr StyleComputer::make_rule_cache_for_casca for (auto const& it : keyframe_style.properties()) { for_each_property_expanding_shorthands(it.property_id, it.value, [&](PropertyID shorthand_id, StyleValue const& shorthand_value) { animated_properties.set(shorthand_id); - resolved_keyframe.resolved_properties.set(shorthand_id, NonnullRefPtr { shorthand_value }); + resolved_keyframe.properties.set(shorthand_id, NonnullRefPtr { shorthand_value }); }); } @@ -2435,7 +2435,7 @@ NonnullOwnPtr StyleComputer::make_rule_cache_for_casca if constexpr (LIBWEB_CSS_DEBUG) { dbgln("Resolved keyframe set '{}' into {} keyframes:", rule.name(), keyframe_set->keyframes_by_key.size()); for (auto it = keyframe_set->keyframes_by_key.begin(); it != keyframe_set->keyframes_by_key.end(); ++it) - dbgln(" - keyframe {}: {} properties", it.key(), it->resolved_properties.size()); + dbgln(" - keyframe {}: {} properties", it.key(), it->properties.size()); } rule_cache->rules_by_animation_keyframes.set(rule.name(), move(keyframe_set));