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

LibWeb: Keep track of associated Animations in AnimationTimeline

This allows the timeline to propagate changes in time to any relevant
animation objects.
This commit is contained in:
Matthew Olsson 2023-11-04 11:58:09 -07:00 committed by Andreas Kling
parent 0d3c8a1cd9
commit 4efbb10a36
2 changed files with 12 additions and 0 deletions

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Animations/Animation.h>
#include <LibWeb/Animations/AnimationTimeline.h>
#include <LibWeb/DOM/Document.h>
@ -21,6 +22,9 @@ WebIDL::ExceptionOr<void> AnimationTimeline::set_current_time(Optional<double> v
m_current_time = value;
for (auto& animation : m_associated_animations)
TRY(animation->set_current_time(value));
return {};
}
@ -61,6 +65,8 @@ void AnimationTimeline::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_associated_document);
for (auto const& animation : m_associated_animations)
visitor.visit(animation);
}
}