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

LibWeb: Store all timelines associated with a document on the document

This will be required for propagating the current animation time to all
relevant timelines, which each propagate that time to all of their
relevant animations.
This commit is contained in:
Matthew Olsson 2023-11-04 08:43:10 -07:00 committed by Andreas Kling
parent 2fbb9649e3
commit 13ae2a4dab
5 changed files with 31 additions and 0 deletions

View file

@ -26,6 +26,10 @@ WebIDL::ExceptionOr<void> AnimationTimeline::set_current_time(Optional<double> v
void AnimationTimeline::set_associated_document(JS::GCPtr<DOM::Document> document)
{
if (document)
document->associate_with_timeline(*this);
if (m_associated_document)
m_associated_document->disassociate_with_timeline(*this);
m_associated_document = document;
}
@ -41,6 +45,12 @@ AnimationTimeline::AnimationTimeline(JS::Realm& realm)
{
}
AnimationTimeline::~AnimationTimeline()
{
if (m_associated_document)
m_associated_document->disassociate_with_timeline(*this);
}
void AnimationTimeline::initialize(JS::Realm& realm)
{
Base::initialize(realm);