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
commit 13ae2a4dab
Notes: sideshowbarker 2024-07-17 07:16:27 +09:00
5 changed files with 31 additions and 0 deletions

View file

@ -404,6 +404,9 @@ void Document::visit_edges(Cell::Visitor& visitor)
for (auto& observer : m_intersection_observers)
visitor.visit(observer);
for (auto& timeline : m_associated_animation_timelines)
visitor.visit(timeline);
}
// https://w3c.github.io/selection-api/#dom-document-getselection
@ -3572,4 +3575,14 @@ JS::NonnullGCPtr<Animations::DocumentTimeline> Document::timeline()
return *m_default_timeline;
}
void Document::associate_with_timeline(JS::NonnullGCPtr<Animations::AnimationTimeline> timeline)
{
m_associated_animation_timelines.set(timeline);
}
void Document::disassociate_with_timeline(JS::NonnullGCPtr<Animations::AnimationTimeline> timeline)
{
m_associated_animation_timelines.remove(timeline);
}
}