Bug 1242872 - Part 5: Change CopyPropertiesFrom to UpdateProperties. r=birtles
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Fri, 19 Feb 2016 09:16:15 +0900
changeset 321842 d2459a786eef36c202b12635040e761eef1eebe1
parent 321841 b257d647614093c646e718b679dfe6b282c5b33c
child 321843 564a81e686f005d113a78b322d105a88b69754a9
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1242872
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
@@ -448,31 +448,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
@@ -282,20 +282,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.