Bug 1474766 - Merge the three-argument form of KeyframeEffect::Constructor and ConstructKeyframeEffect; r=hiro
There doesn't appear to be any need to separate these anymore. MozReview-Commit-ID: GHR259JJHJV
This commit is contained in:
@@ -679,40 +679,6 @@ KeyframeEffect::ConstructKeyframeEffect(
|
||||
return effect.forget();
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<KeyframeEffect>
|
||||
KeyframeEffect::ConstructKeyframeEffect(const GlobalObject& aGlobal,
|
||||
KeyframeEffect& aSource,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsIDocument* doc = AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
|
||||
if (!doc) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Create a new KeyframeEffect object with aSource's target,
|
||||
// iteration composite operation, composite operation, and spacing mode.
|
||||
// The constructor creates a new AnimationEffect object by
|
||||
// aSource's TimingParams.
|
||||
// Note: we don't need to re-throw exceptions since the value specified on
|
||||
// aSource's timing object can be assumed valid.
|
||||
RefPtr<KeyframeEffect> effect =
|
||||
new KeyframeEffect(doc,
|
||||
aSource.mTarget,
|
||||
aSource.SpecifiedTiming(),
|
||||
aSource.mEffectOptions);
|
||||
// Copy cumulative change hint. mCumulativeChangeHint should be the same as
|
||||
// the source one because both of targets are the same.
|
||||
effect->mCumulativeChangeHint = aSource.mCumulativeChangeHint;
|
||||
|
||||
// Copy aSource's keyframes and animation properties.
|
||||
// Note: We don't call SetKeyframes directly, which might revise the
|
||||
// computed offsets and rebuild the animation properties.
|
||||
effect->mKeyframes = aSource.mKeyframes;
|
||||
effect->mProperties = aSource.mProperties;
|
||||
return effect.forget();
|
||||
}
|
||||
|
||||
nsTArray<AnimationProperty>
|
||||
KeyframeEffect::BuildProperties(const ComputedStyle* aStyle)
|
||||
{
|
||||
@@ -884,14 +850,6 @@ KeyframeEffect::Constructor(
|
||||
return ConstructKeyframeEffect(aGlobal, aTarget, aKeyframes, aOptions, aRv);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<KeyframeEffect>
|
||||
KeyframeEffect::Constructor(const GlobalObject& aGlobal,
|
||||
KeyframeEffect& aSource,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
return ConstructKeyframeEffect(aGlobal, aSource, aRv);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<KeyframeEffect>
|
||||
KeyframeEffect::Constructor(
|
||||
const GlobalObject& aGlobal,
|
||||
@@ -903,6 +861,40 @@ KeyframeEffect::Constructor(
|
||||
return ConstructKeyframeEffect(aGlobal, aTarget, aKeyframes, aOptions, aRv);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<KeyframeEffect>
|
||||
KeyframeEffect::Constructor(const GlobalObject& aGlobal,
|
||||
KeyframeEffect& aSource,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsIDocument* doc = AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
|
||||
if (!doc) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Create a new KeyframeEffect object with aSource's target,
|
||||
// iteration composite operation, composite operation, and spacing mode.
|
||||
// The constructor creates a new AnimationEffect object by
|
||||
// aSource's TimingParams.
|
||||
// Note: we don't need to re-throw exceptions since the value specified on
|
||||
// aSource's timing object can be assumed valid.
|
||||
RefPtr<KeyframeEffect> effect =
|
||||
new KeyframeEffect(doc,
|
||||
aSource.mTarget,
|
||||
aSource.SpecifiedTiming(),
|
||||
aSource.mEffectOptions);
|
||||
// Copy cumulative change hint. mCumulativeChangeHint should be the same as
|
||||
// the source one because both of targets are the same.
|
||||
effect->mCumulativeChangeHint = aSource.mCumulativeChangeHint;
|
||||
|
||||
// Copy aSource's keyframes and animation properties.
|
||||
// Note: We don't call SetKeyframes directly, which might revise the
|
||||
// computed offsets and rebuild the animation properties.
|
||||
effect->mKeyframes = aSource.mKeyframes;
|
||||
effect->mProperties = aSource.mProperties;
|
||||
return effect.forget();
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffect::GetTarget(Nullable<OwningElementOrCSSPseudoElement>& aRv) const
|
||||
{
|
||||
|
||||
@@ -313,11 +313,6 @@ protected:
|
||||
const OptionsType& aOptions,
|
||||
ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<KeyframeEffect>
|
||||
ConstructKeyframeEffect(const GlobalObject& aGlobal,
|
||||
KeyframeEffect& aSource,
|
||||
ErrorResult& aRv);
|
||||
|
||||
// Build properties by recalculating from |mKeyframes| using |aComputedStyle|
|
||||
// to resolve specified values. This function also applies paced spacing if
|
||||
// needed.
|
||||
|
||||
Reference in New Issue
Block a user