Bug 1242872 - Part 5: Change CopyPropertiesFrom to UpdateProperties. r?birtles draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Tue, 16 Feb 2016 06:35:58 +0900
changeset 331106 d0f045a6d730623cea127abbb39ccc4a91a62174
parent 331105 063d18e93a9d2467648b391b49aee07995e3c4b2
child 331107 726b5d36c5b6436eceaf0cd5b6fb6a8bc3dd067c
push id10897
push userbmo:hiikezoe@mozilla-japan.org
push dateMon, 15 Feb 2016 21:52:09 +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: Ec2vNpdEn2U
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
@@ -335,17 +335,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.