Bug 1242872 - Part 5: Change CopyPropertiesFrom to UpdateProperties. r?birtles draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Fri, 19 Feb 2016 09:16:15 +0900
changeset 332031 0e72a49d87f3d078a9139b1a021c3bf847638244
parent 332030 b257884a3e179552dbd04cc4d572ca657b34939c
child 332032 742be8ab73eb31c9c9bd44f49ad42ad941b5de85
push id11141
push userbmo:hiikezoe@mozilla-japan.org
push dateFri, 19 Feb 2016 02:33:47 +0000
reviewersbirtles
bugs1242872
milestone47.0a1
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
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeEffect.h
layout/style/nsAnimationManager.cpp
--- 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.