diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index 36db3ea5c84e..60b88c50c5a7 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -6,6 +6,7 @@ #include "mozilla/dom/KeyframeEffect.h" +#include "mozilla/dom/AnimatableBinding.h" #include "mozilla/dom/KeyframeEffectBinding.h" #include "mozilla/dom/PropertyIndexedKeyframesBinding.h" #include "mozilla/AnimationUtils.h" @@ -673,19 +674,6 @@ KeyframeEffectReadOnly::ConstructKeyframeEffect( return nullptr; } - return ConstructKeyframeEffect( - aGlobal, aTarget, aFrames, timingParams, aRv); -} - -template -/* static */ already_AddRefed -KeyframeEffectReadOnly::ConstructKeyframeEffect( - const GlobalObject& aGlobal, - const Nullable& aTarget, - JS::Handle aFrames, - const TimingParams& aTiming, - ErrorResult& aRv) -{ if (aTarget.IsNull()) { // We don't support null targets yet. aRv.Throw(NS_ERROR_DOM_ANIM_NO_TARGET_ERR); @@ -720,7 +708,7 @@ KeyframeEffectReadOnly::ConstructKeyframeEffect( RefPtr effect = new KeyframeEffectType(targetElement->OwnerDoc(), targetElement, - pseudoType, aTiming); + pseudoType, timingParams); effect->mProperties = Move(animationProperties); return effect.forget(); } @@ -2250,11 +2238,11 @@ KeyframeEffect::Constructor( const GlobalObject& aGlobal, const Nullable& aTarget, JS::Handle aFrames, - const TimingParams& aTiming, + const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions, ErrorResult& aRv) { return ConstructKeyframeEffect(aGlobal, aTarget, aFrames, - aTiming, aRv); + aOptions, aRv); } void KeyframeEffect::NotifySpecifiedTimingUpdated() diff --git a/dom/animation/KeyframeEffect.h b/dom/animation/KeyframeEffect.h index a5b963f2dfc8..6b64e85a6a50 100644 --- a/dom/animation/KeyframeEffect.h +++ b/dom/animation/KeyframeEffect.h @@ -42,6 +42,7 @@ enum class CSSPseudoElementType : uint8_t; namespace dom { class ElementOrCSSPseudoElement; class OwningElementOrCSSPseudoElement; +class UnrestrictedDoubleOrKeyframeAnimationOptions; class UnrestrictedDoubleOrKeyframeEffectOptions; enum class IterationCompositeOperation : uint32_t; enum class CompositeOperation : uint32_t; @@ -352,13 +353,6 @@ protected: JS::Handle aFrames, const OptionsType& aOptions, ErrorResult& aRv); - template - static already_AddRefed - ConstructKeyframeEffect(const GlobalObject& aGlobal, - const Nullable& aTarget, - JS::Handle aFrames, - const TimingParams& aTiming, - ErrorResult& aRv); void ResetIsRunningOnCompositor(); @@ -433,13 +427,14 @@ public: const UnrestrictedDoubleOrKeyframeEffectOptions& aOptions, ErrorResult& aRv); - // More generalized version of Constructor for Animatable.animate. + // Variant of Constructor that accepts a KeyframeAnimationOptions object + // for use with for Animatable.animate. // Not exposed to content. static already_AddRefed Constructor(const GlobalObject& aGlobal, const Nullable& aTarget, JS::Handle aFrames, - const TimingParams& aTiming, + const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions, ErrorResult& aRv); void NotifySpecifiedTimingUpdated(); diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 9d96545a35a5..d60cef5a9311 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -3353,15 +3353,8 @@ Element::Animate(const Nullable& aTarget, } } - TimingParams timingParams = - TimingParams::FromOptionsUnion(aOptions, referenceElement->OwnerDoc(), - aError); - if (aError.Failed()) { - return nullptr; - } - RefPtr effect = - KeyframeEffect::Constructor(global, aTarget, frames, timingParams, aError); + KeyframeEffect::Constructor(global, aTarget, frames, aOptions, aError); if (aError.Failed()) { return nullptr; }