mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
LibWeb: Add DocumentOrShadowRoot::get_animations()
This commit is contained in:
parent
37322baf54
commit
5b84bd6e45
Notes:
sideshowbarker
2024-07-17 07:48:42 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/5b84bd6e45 Pull-request: https://github.com/SerenityOS/serenity/pull/24530
@ -4406,6 +4406,16 @@ void Document::ensure_animation_timer()
|
||||
m_animation_driver_timer->start();
|
||||
}
|
||||
|
||||
Vector<JS::NonnullGCPtr<Animations::Animation>> Document::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;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem-filter
|
||||
static bool is_potentially_named_element(DOM::Element const& element)
|
||||
{
|
||||
|
@ -612,6 +612,8 @@ public:
|
||||
void remove_replaced_animations();
|
||||
void ensure_animation_timer();
|
||||
|
||||
Vector<JS::NonnullGCPtr<Animations::Animation>> get_animations();
|
||||
|
||||
bool ready_to_run_scripts() const { return m_ready_to_run_scripts; }
|
||||
void set_ready_to_run_scripts() { m_ready_to_run_scripts = true; }
|
||||
|
||||
|
@ -5,4 +5,7 @@ interface mixin DocumentOrShadowRoot {
|
||||
// https://w3c.github.io/csswg-drafts/cssom/#extensions-to-the-document-or-shadow-root-interface
|
||||
[SameObject, ImplementedAs=style_sheets_for_bindings] readonly attribute StyleSheetList styleSheets;
|
||||
attribute any adoptedStyleSheets;
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#extensions-to-the-documentorshadowroot-interface-mixin
|
||||
sequence<Animation> getAnimations();
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ public:
|
||||
|
||||
void for_each_css_style_sheet(Function<void(CSS::CSSStyleSheet&)>&& callback) const;
|
||||
|
||||
Vector<JS::NonnullGCPtr<Animations::Animation>> get_animations();
|
||||
|
||||
virtual void finalize() override;
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user