Bug 1242872 - Part 5: Change CopyPropertiesFrom to UpdateProperties. r?birtles
Once we don't create any temporary effect, we do not need to pass
the effect to CopyPropertiesFrom.
MozReview-Commit-ID: HczU5IU6Ggp
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -445,31 +445,32 @@ KeyframeEffectReadOnly::HasAnimationOfPr
if (HasAnimationOfProperty(aProperties[i])) {
return true;
}
}
return false;
}
void
-KeyframeEffectReadOnly::CopyPropertiesFrom(const KeyframeEffectReadOnly& aOther)
+KeyframeEffectReadOnly::UpdateProperties(
+ const InfallibleTArray<AnimationProperty>& aProperties)
{
nsCSSPropertySet winningInCascadeProperties;
nsCSSPropertySet runningOnCompositorProperties;
for (const AnimationProperty& property : mProperties) {
if (property.mWinsInCascade) {
winningInCascadeProperties.AddProperty(property.mProperty);
}
if (property.mIsRunningOnCompositor) {
runningOnCompositorProperties.AddProperty(property.mProperty);
}
}
- mProperties = aOther.mProperties;
+ mProperties = aProperties;
for (AnimationProperty& property : mProperties) {
property.mWinsInCascade =
winningInCascadeProperties.HasProperty(property.mProperty);
property.mIsRunningOnCompositor =
runningOnCompositorProperties.HasProperty(property.mProperty);
}
}
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -278,20 +278,21 @@ public:
bool HasAnimationOfProperties(const nsCSSProperty* aProperties,
size_t aPropertyCount) const;
const InfallibleTArray<AnimationProperty>& Properties() const {
return mProperties;
}
InfallibleTArray<AnimationProperty>& Properties() {
return mProperties;
}
- // Copies the properties from another keyframe effect whilst preserving
- // the mWinsInCascade and mIsRunningOnCompositor state of matching
- // properties.
- void CopyPropertiesFrom(const KeyframeEffectReadOnly& aOther);
+ // Updates the set of properties using the supplied list whilst preserving
+ // the mWinsInCascade and mIsRunningOnCompositor state of any matching
+ // properties
+ void UpdateProperties(
+ const InfallibleTArray<AnimationProperty>& aProperties);
// Updates |aStyleRule| with the animation values produced by this
// AnimationEffect for the current time except any properties already
// contained in |aSetProperties|.
// Any updated properties are added to |aSetProperties|.
void ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
nsCSSPropertySet& aSetProperties);
// Returns true if at least one property is being animated on compositor.
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -336,17 +336,17 @@ UpdateOldAnimationPropertiesWithNew(CSSA
// identity (and any expando properties attached to it).
if (aOld.GetEffect() && aNew.GetEffect()) {
KeyframeEffectReadOnly* oldEffect = aOld.GetEffect();
KeyframeEffectReadOnly* newEffect = aNew.GetEffect();
animationChanged =
oldEffect->SpecifiedTiming() != newEffect->SpecifiedTiming() ||
oldEffect->Properties() != newEffect->Properties();
oldEffect->SetSpecifiedTiming(newEffect->SpecifiedTiming());
- oldEffect->CopyPropertiesFrom(*newEffect);
+ oldEffect->UpdateProperties(newEffect->Properties());
}
// Handle changes in play state. If the animation is idle, however,
// changes to animation-play-state should *not* restart it.
if (aOld.PlayState() != AnimationPlayState::Idle) {
// CSSAnimation takes care of override behavior so that,
// for example, if the author has called pause(), that will
// override the animation-play-state.