1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 00:27:43 +00:00

LibWeb: Disassociate animations from Animatables when setting effects

This commit is contained in:
Matthew Olsson 2024-03-07 11:15:16 -07:00 committed by Alexander Kalenik
parent 90290eb985
commit e11b9658ed

View file

@ -74,6 +74,14 @@ void Animation::set_effect(JS::GCPtr<AnimationEffect> new_effect)
}
// 6. Let the associated effect of animation be new effect.
auto old_target = m_effect ? m_effect->target() : nullptr;
auto new_target = new_effect ? new_effect->target() : nullptr;
if (old_target != new_target) {
if (old_target)
old_target->disassociate_with_animation(*this);
if (new_target)
new_target->associate_with_animation(*this);
}
if (new_effect)
new_effect->set_associated_animation(this);
if (m_effect)