зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1626133
- Separate the portion of Element::GetAnimation which needs script from the part that doesn't. r=birtles
Also update the existing caller which doesn't need the flush that was causing the script requirement. Differential Revision: https://phabricator.services.mozilla.com/D68944 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8b5461f86a
Коммит
c4d84d5ca5
|
@ -591,7 +591,7 @@ void DocumentOrShadowRoot::GetAnimations(
|
|||
child = child->GetNextSibling()) {
|
||||
if (RefPtr<Element> element = Element::FromNode(child)) {
|
||||
nsTArray<RefPtr<Animation>> result;
|
||||
element->GetAnimations(options, result, Element::Flush::No);
|
||||
element->GetAnimationsWithoutFlush(options, result);
|
||||
aAnimations.AppendElements(std::move(result));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3287,23 +3287,26 @@ already_AddRefed<Animation> Element::Animate(
|
|||
}
|
||||
|
||||
void Element::GetAnimations(const GetAnimationsOptions& aOptions,
|
||||
nsTArray<RefPtr<Animation>>& 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<RefPtr<Animation>>& 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<RefPtr<Animation>>& aAnimations) {
|
||||
Element* elem = this;
|
||||
PseudoStyleType pseudoType = PseudoStyleType::NotPseudo;
|
||||
// For animations on generated-content elements, the animations are stored
|
||||
|
|
|
@ -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<RefPtr<Animation>>& aAnimations,
|
||||
Flush aFlush = Flush::Yes);
|
||||
nsTArray<RefPtr<Animation>>& aAnimations);
|
||||
|
||||
void GetAnimationsWithoutFlush(const GetAnimationsOptions& aOptions,
|
||||
nsTArray<RefPtr<Animation>>& aAnimations);
|
||||
|
||||
static void GetAnimationsUnsorted(Element* aElement,
|
||||
PseudoStyleType aPseudoType,
|
||||
|
|
Загрузка…
Ссылка в новой задаче