diff --git a/dom/base/DocumentOrShadowRoot.cpp b/dom/base/DocumentOrShadowRoot.cpp index 062fd9efc2b4..0779d09326ab 100644 --- a/dom/base/DocumentOrShadowRoot.cpp +++ b/dom/base/DocumentOrShadowRoot.cpp @@ -591,7 +591,7 @@ void DocumentOrShadowRoot::GetAnimations( child = child->GetNextSibling()) { if (RefPtr element = Element::FromNode(child)) { nsTArray> result; - element->GetAnimations(options, result, Element::Flush::No); + element->GetAnimationsWithoutFlush(options, result); aAnimations.AppendElements(std::move(result)); } } diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index e1549bbc26c1..e46be8d7fbe5 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -3287,23 +3287,26 @@ already_AddRefed Element::Animate( } void Element::GetAnimations(const GetAnimationsOptions& aOptions, - nsTArray>& aAnimations, - Flush aFlush) { - if (aFlush == Flush::Yes) { - if (Document* doc = GetComposedDoc()) { - // We don't need to explicitly flush throttled animations here, since - // updating the animation style of elements will never affect the set of - // running animations and it's only the set of running animations that is - // important here. - // - // NOTE: Any changes to the flags passed to the following call should - // be reflected in the flags passed in DocumentOrShadowRoot::GetAnimations - // too. - doc->FlushPendingNotifications( - ChangesToFlush(FlushType::Style, false /* flush animations */)); - } + nsTArray>& aAnimations) { + if (Document* doc = GetComposedDoc()) { + // We don't need to explicitly flush throttled animations here, since + // updating the animation style of elements will never affect the set of + // running animations and it's only the set of running animations that is + // important here. + // + // NOTE: Any changes to the flags passed to the following call should + // be reflected in the flags passed in DocumentOrShadowRoot::GetAnimations + // too. + doc->FlushPendingNotifications( + ChangesToFlush(FlushType::Style, false /* flush animations */)); } + GetAnimationsWithoutFlush(aOptions, aAnimations); +} + +void Element::GetAnimationsWithoutFlush( + const GetAnimationsOptions& aOptions, + nsTArray>& aAnimations) { Element* elem = this; PseudoStyleType pseudoType = PseudoStyleType::NotPseudo; // For animations on generated-content elements, the animations are stored diff --git a/dom/base/Element.h b/dom/base/Element.h index 8b0ef28d9fbe..5df6a899262e 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -1310,12 +1310,12 @@ class Element : public FragmentOrElement { const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions, ErrorResult& aError); - enum class Flush { Yes, No }; - MOZ_CAN_RUN_SCRIPT void GetAnimations(const GetAnimationsOptions& aOptions, - nsTArray>& aAnimations, - Flush aFlush = Flush::Yes); + nsTArray>& aAnimations); + + void GetAnimationsWithoutFlush(const GetAnimationsOptions& aOptions, + nsTArray>& aAnimations); static void GetAnimationsUnsorted(Element* aElement, PseudoStyleType aPseudoType,