зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1593222: part 2) Move `nsNodeUtils::GetTargetForAnimation` to `Animation` class. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D51607 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b845b4e662
Коммит
f7921bb4e3
|
@ -61,8 +61,7 @@ class MOZ_RAII AutoMutationBatchForAnimation {
|
|||
explicit AutoMutationBatchForAnimation(
|
||||
const Animation& aAnimation MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
Maybe<NonOwningAnimationTarget> target =
|
||||
nsNodeUtils::GetTargetForAnimation(&aAnimation);
|
||||
Maybe<NonOwningAnimationTarget> target = aAnimation.GetTargetForAnimation();
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
|
@ -82,6 +81,15 @@ class MOZ_RAII AutoMutationBatchForAnimation {
|
|||
// Animation interface:
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Maybe<NonOwningAnimationTarget> Animation::GetTargetForAnimation() const {
|
||||
AnimationEffect* effect = GetEffect();
|
||||
if (!effect || !effect->AsKeyframeEffect()) {
|
||||
return Nothing();
|
||||
}
|
||||
return effect->AsKeyframeEffect()->GetTarget();
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<Animation> Animation::Constructor(
|
||||
const GlobalObject& aGlobal, AnimationEffect* aEffect,
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/EffectCompositor.h" // For EffectCompositor::CascadeLevel
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/PostRestyleMode.h"
|
||||
#include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration
|
||||
#include "mozilla/dom/AnimationBinding.h" // for AnimationPlayState
|
||||
|
@ -57,6 +58,13 @@ class Animation : public DOMEventTargetHelper,
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Animation, DOMEventTargetHelper)
|
||||
|
||||
nsIGlobalObject* GetParentObject() const { return GetOwnerGlobal(); }
|
||||
|
||||
/**
|
||||
* Utility function to get the target (pseudo-)element associated with an
|
||||
* animation.
|
||||
*/
|
||||
Maybe<NonOwningAnimationTarget> GetTargetForAnimation() const;
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
|
|
|
@ -221,18 +221,11 @@ void nsNodeUtils::ContentRemoved(nsINode* aContainer, nsIContent* aChild,
|
|||
IsRemoveNotification::Yes);
|
||||
}
|
||||
|
||||
Maybe<NonOwningAnimationTarget> nsNodeUtils::GetTargetForAnimation(
|
||||
const dom::Animation* aAnimation) {
|
||||
AnimationEffect* effect = aAnimation->GetEffect();
|
||||
if (!effect || !effect->AsKeyframeEffect()) {
|
||||
return Nothing();
|
||||
}
|
||||
return effect->AsKeyframeEffect()->GetTarget();
|
||||
}
|
||||
void nsNodeUtils::AnimationMutated(
|
||||
dom::Animation* aAnimation, AnimationMutationType aMutatedType) {
|
||||
MOZ_ASSERT(aAnimation);
|
||||
|
||||
void nsNodeUtils::AnimationMutated(dom::Animation* aAnimation,
|
||||
AnimationMutationType aMutatedType) {
|
||||
Maybe<NonOwningAnimationTarget> target = GetTargetForAnimation(aAnimation);
|
||||
Maybe<NonOwningAnimationTarget> target = aAnimation->GetTargetForAnimation();
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef nsNodeUtils_h___
|
||||
#define nsNodeUtils_h___
|
||||
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "nsIContent.h" // for use in inline function (ParentChainChanged)
|
||||
#include "nsIMutationObserver.h" // for use in inline function (ParentChainChanged)
|
||||
#include "mozilla/dom/Document.h"
|
||||
|
@ -134,14 +133,6 @@ class nsNodeUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function to get the target (pseudo-)element associated with an
|
||||
* animation.
|
||||
* @param aAnimation The animation whose target is what we want.
|
||||
*/
|
||||
static mozilla::Maybe<mozilla::NonOwningAnimationTarget>
|
||||
GetTargetForAnimation(const mozilla::dom::Animation* aAnimation);
|
||||
|
||||
/**
|
||||
* Notify that an animation is added/changed/removed.
|
||||
* @param aAnimation The animation we added/changed/removed.
|
||||
|
|
Загрузка…
Ссылка в новой задаче