Bug 1456394 - Moving timing updates to KeyframeEffectReadOnly; r=hiro
This might seem a bit odd but later in this patch series we will rename KeyframeEffectReadOnly to KeyframeEffect. MozReview-Commit-ID: H9b8brtA36W
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "mozilla/dom/AnimatableBinding.h"
|
||||
#include "mozilla/dom/AnimationEffectTimingBinding.h"
|
||||
#include "mozilla/dom/KeyframeEffect.h"
|
||||
#include "mozilla/dom/KeyframeEffectReadOnly.h"
|
||||
#include "mozilla/TimingParams.h"
|
||||
#include "nsAString.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ AnimationEffectTiming::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenPr
|
||||
}
|
||||
|
||||
static inline void
|
||||
PostSpecifiedTimingUpdated(KeyframeEffect* aEffect)
|
||||
PostSpecifiedTimingUpdated(KeyframeEffectReadOnly* aEffect)
|
||||
{
|
||||
if (aEffect) {
|
||||
aEffect->NotifySpecifiedTimingUpdated();
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class KeyframeEffect;
|
||||
class KeyframeEffectReadOnly;
|
||||
|
||||
class AnimationEffectTiming : public AnimationEffectTimingReadOnly
|
||||
{
|
||||
public:
|
||||
AnimationEffectTiming(nsIDocument* aDocument,
|
||||
const TimingParams& aTiming,
|
||||
KeyframeEffect* aEffect)
|
||||
KeyframeEffectReadOnly* aEffect)
|
||||
: AnimationEffectTimingReadOnly(aDocument, aTiming)
|
||||
, mEffect(aEffect) { }
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
void SetEasing(const nsAString& aEasing, ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
KeyframeEffect* MOZ_NON_OWNING_REF mEffect;
|
||||
KeyframeEffectReadOnly* MOZ_NON_OWNING_REF mEffect;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -66,24 +66,5 @@ KeyframeEffect::Constructor(
|
||||
aOptions, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffect::NotifySpecifiedTimingUpdated()
|
||||
{
|
||||
// Use the same document for a pseudo element and its parent element.
|
||||
// Use nullptr if we don't have mTarget, so disable the mutation batch.
|
||||
nsAutoAnimationMutationBatch mb(mTarget ? mTarget->mElement->OwnerDoc()
|
||||
: nullptr);
|
||||
|
||||
if (mAnimation) {
|
||||
mAnimation->NotifyEffectTimingUpdated();
|
||||
|
||||
if (mAnimation->IsRelevant()) {
|
||||
nsNodeUtils::AnimationChanged(mAnimation);
|
||||
}
|
||||
|
||||
RequestRestyle(EffectCompositor::RestyleType::Layer);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -62,8 +62,6 @@ public:
|
||||
JS::Handle<JSObject*> aKeyframes,
|
||||
const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void NotifySpecifiedTimingUpdated();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -156,6 +156,25 @@ KeyframeEffectReadOnly::SetComposite(const CompositeOperation& aComposite)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::NotifySpecifiedTimingUpdated()
|
||||
{
|
||||
// Use the same document for a pseudo element and its parent element.
|
||||
// Use nullptr if we don't have mTarget, so disable the mutation batch.
|
||||
nsAutoAnimationMutationBatch mb(mTarget ? mTarget->mElement->OwnerDoc()
|
||||
: nullptr);
|
||||
|
||||
if (mAnimation) {
|
||||
mAnimation->NotifyEffectTimingUpdated();
|
||||
|
||||
if (mAnimation->IsRelevant()) {
|
||||
nsNodeUtils::AnimationChanged(mAnimation);
|
||||
}
|
||||
|
||||
RequestRestyle(EffectCompositor::RestyleType::Layer);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::NotifyAnimationTimingUpdated()
|
||||
{
|
||||
|
||||
@@ -175,6 +175,7 @@ public:
|
||||
CompositeOperation Composite() const;
|
||||
void SetComposite(const CompositeOperation& aComposite);
|
||||
|
||||
void NotifySpecifiedTimingUpdated();
|
||||
void NotifyAnimationTimingUpdated();
|
||||
void RequestRestyle(EffectCompositor::RestyleType aRestyleType);
|
||||
void SetAnimation(Animation* aAnimation) override;
|
||||
|
||||
Reference in New Issue
Block a user