LibWeb: Add DocumentOrShadowRoot::get_animations()

This commit is contained in:
Matthew Olsson 2024-06-02 07:26:36 -07:00 committed by Andreas Kling
commit 5b84bd6e45
Notes: sideshowbarker 2024-07-17 07:48:42 +09:00
5 changed files with 27 additions and 0 deletions

View file

@ -130,4 +130,14 @@ void ShadowRoot::for_each_css_style_sheet(Function<void(CSS::CSSStyleSheet&)>&&
}
}
Vector<JS::NonnullGCPtr<Animations::Animation>> ShadowRoot::get_animations()
{
Vector<JS::NonnullGCPtr<Animations::Animation>> relevant_animations;
for_each_child_of_type<Element>([&](auto& child) {
relevant_animations.extend(child.get_animations({ .subtree = true }));
return IterationDecision::Continue;
});
return relevant_animations;
}
}