зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1246320 part 5 - Simplify KeyframeEffect(ReadOnly) Constructor overloads further; r=hiro
As well as generally simplifying the different KeyframeEffect(ReadOnly) constructor methods, this patch also means we will use the realm document for parsing timing functions in all cases. Although this currently doesn't have any impact (the current set of timing functions are expected to be parsed identically regardless of the document used) it may become significant if, in future, it becomes possible to register hooks with certain documents for parsing CSS properties as part of the houdini efforts. MozReview-Commit-ID: 4gAZi1G1uAD --HG-- extra : rebase_source : f619592a02ddcbe56835344ec1fb3023219cd2d3
This commit is contained in:
Родитель
6846d9e23b
Коммит
107642839f
|
@ -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<KeyframeEffectType>(
|
||||
aGlobal, aTarget, aFrames, timingParams, aRv);
|
||||
}
|
||||
|
||||
template <class KeyframeEffectType>
|
||||
/* static */ already_AddRefed<KeyframeEffectType>
|
||||
KeyframeEffectReadOnly::ConstructKeyframeEffect(
|
||||
const GlobalObject& aGlobal,
|
||||
const Nullable<ElementOrCSSPseudoElement>& aTarget,
|
||||
JS::Handle<JSObject*> 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<KeyframeEffectType> 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<ElementOrCSSPseudoElement>& aTarget,
|
||||
JS::Handle<JSObject*> aFrames,
|
||||
const TimingParams& aTiming,
|
||||
const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
return ConstructKeyframeEffect<KeyframeEffect>(aGlobal, aTarget, aFrames,
|
||||
aTiming, aRv);
|
||||
aOptions, aRv);
|
||||
}
|
||||
|
||||
void KeyframeEffect::NotifySpecifiedTimingUpdated()
|
||||
|
|
|
@ -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<JSObject*> aFrames,
|
||||
const OptionsType& aOptions,
|
||||
ErrorResult& aRv);
|
||||
template<class KeyframeEffectType>
|
||||
static already_AddRefed<KeyframeEffectType>
|
||||
ConstructKeyframeEffect(const GlobalObject& aGlobal,
|
||||
const Nullable<ElementOrCSSPseudoElement>& aTarget,
|
||||
JS::Handle<JSObject*> 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<KeyframeEffect>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
const Nullable<ElementOrCSSPseudoElement>& aTarget,
|
||||
JS::Handle<JSObject*> aFrames,
|
||||
const TimingParams& aTiming,
|
||||
const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void NotifySpecifiedTimingUpdated();
|
||||
|
|
|
@ -3353,15 +3353,8 @@ Element::Animate(const Nullable<ElementOrCSSPseudoElement>& aTarget,
|
|||
}
|
||||
}
|
||||
|
||||
TimingParams timingParams =
|
||||
TimingParams::FromOptionsUnion(aOptions, referenceElement->OwnerDoc(),
|
||||
aError);
|
||||
if (aError.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<KeyframeEffect> effect =
|
||||
KeyframeEffect::Constructor(global, aTarget, frames, timingParams, aError);
|
||||
KeyframeEffect::Constructor(global, aTarget, frames, aOptions, aError);
|
||||
if (aError.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче