diff --git a/Userland/Libraries/LibWeb/Animations/AnimationEffect.h b/Userland/Libraries/LibWeb/Animations/AnimationEffect.h index 2dec4af9d0..56204443aa 100644 --- a/Userland/Libraries/LibWeb/Animations/AnimationEffect.h +++ b/Userland/Libraries/LibWeb/Animations/AnimationEffect.h @@ -141,6 +141,8 @@ public: Optional current_iteration() const; Optional transformed_progress() const; + HashTable const& target_properties() const { return m_target_properties; } + virtual DOM::Element* target() const { return {}; } virtual bool is_keyframe_effect() const { return false; } @@ -183,6 +185,10 @@ protected: // Used for calculating transitions in StyleComputer Phase m_previous_phase { Phase::Idle }; double m_previous_current_iteration { 0.0 }; + + // https://www.w3.org/TR/web-animations-1/#target-property + // Note: Only modified by child classes + HashTable m_target_properties; }; } diff --git a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp index 3a776a857d..d18a0ffc97 100644 --- a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -817,7 +817,7 @@ WebIDL::ExceptionOr KeyframeEffect::set_keyframes(Optional animated_properties; + m_target_properties.clear(); for (auto& keyframe : m_keyframes) { Animations::KeyframeEffect::KeyFrameSet::ResolvedKeyFrame resolved_keyframe; @@ -825,14 +825,14 @@ WebIDL::ExceptionOr KeyframeEffect::set_keyframes(Optional(keyframe.computed_offset.value() * 100 * AnimationKeyFrameKeyScaleFactor); for (auto const& [property_id, property_value] : keyframe.parsed_properties()) { - animated_properties.set(property_id); + m_target_properties.set(property_id); resolved_keyframe.resolved_properties.set(property_id, property_value); } keyframe_set->keyframes_by_key.insert(key, resolved_keyframe); } - generate_initial_and_final_frames(keyframe_set, animated_properties); + generate_initial_and_final_frames(keyframe_set, m_target_properties); m_key_frame_set = keyframe_set; return {};