Bug 1339675 - Move TimingParams in call to SetSpecifiedTiming r=boris
authorDiego Pino Garcia <dpino@igalia.com>
Fri, 12 Oct 2018 11:28:00 +0300
changeset 496931 b56ff378a56d47a954ad6a892b2d258d2eaccbda
parent 496930 b8601c0c061473d7c81844816d6efdbfbc1eb53b
child 496932 bbae2c874b4460a5ef7c8a3b3e35ee99cd5c4e78
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersboris
bugs1339675
milestone64.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 1339675 - Move TimingParams in call to SetSpecifiedTiming r=boris
dom/animation/AnimationEffect.cpp
dom/animation/AnimationEffect.h
layout/style/nsAnimationManager.cpp
--- a/dom/animation/AnimationEffect.cpp
+++ b/dom/animation/AnimationEffect.cpp
@@ -61,17 +61,17 @@ AnimationEffect::IsCurrent() const
 bool
 AnimationEffect::IsInEffect() const
 {
   ComputedTiming computedTiming = GetComputedTiming();
   return !computedTiming.mProgress.IsNull();
 }
 
 void
-AnimationEffect::SetSpecifiedTiming(const TimingParams& aTiming)
+AnimationEffect::SetSpecifiedTiming(TimingParams&& aTiming)
 {
   if (mTiming == aTiming) {
     return;
   }
 
   mTiming = aTiming;
 
   if (mAnimation) {
@@ -337,17 +337,17 @@ AnimationEffect::UpdateTiming(const Opti
                               ErrorResult& aRv)
 {
   TimingParams timing =
     TimingParams::MergeOptionalEffectTiming(mTiming, aTiming, mDocument, aRv);
   if (aRv.Failed()) {
     return;
   }
 
-  SetSpecifiedTiming(timing);
+  SetSpecifiedTiming(std::move(timing));
 }
 
 Nullable<TimeDuration>
 AnimationEffect::GetLocalTime() const
 {
   // Since the *animation* start time is currently always zero, the local
   // time is equal to the parent time.
   Nullable<TimeDuration> result;
--- a/dom/animation/AnimationEffect.h
+++ b/dom/animation/AnimationEffect.h
@@ -54,17 +54,17 @@ public:
   }
 
   // AnimationEffect interface
   void GetTiming(EffectTiming& aRetVal) const;
   void GetComputedTimingAsDict(ComputedEffectTiming& aRetVal) const;
   void UpdateTiming(const OptionalEffectTiming& aTiming, ErrorResult& aRv);
 
   const TimingParams& SpecifiedTiming() const { return mTiming; }
-  void SetSpecifiedTiming(const TimingParams& aTiming);
+  void SetSpecifiedTiming(TimingParams&& aTiming);
 
   // This function takes as input the timing parameters of an animation and
   // returns the computed timing at the specified local time.
   //
   // The local time may be null in which case only static parameters such as the
   // active duration are calculated. All other members of the returned object
   // are given a null/initial value.
   //
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -416,29 +416,29 @@ public:
 private:
   const ComputedStyle* mComputedStyle;
 };
 
 
 static void
 UpdateOldAnimationPropertiesWithNew(
     CSSAnimation& aOld,
-    TimingParams& aNewTiming,
+    TimingParams&& aNewTiming,
     nsTArray<Keyframe>&& aNewKeyframes,
     bool aNewIsStylePaused,
     ServoCSSAnimationBuilder& aBuilder)
 {
   bool animationChanged = false;
 
   // Update the old from the new so we can keep the original object
   // identity (and any expando properties attached to it).
   if (aOld.GetEffect()) {
     dom::AnimationEffect* oldEffect = aOld.GetEffect();
     animationChanged = oldEffect->SpecifiedTiming() != aNewTiming;
-    oldEffect->SetSpecifiedTiming(aNewTiming);
+    oldEffect->SetSpecifiedTiming(std::move(aNewTiming));
 
     KeyframeEffect* oldKeyframeEffect = oldEffect->AsKeyframeEffect();
     if (oldKeyframeEffect) {
       aBuilder.SetKeyframes(*oldKeyframeEffect, std::move(aNewKeyframes));
     }
   }
 
   // Handle changes in play state. If the animation is idle, however,
@@ -512,17 +512,17 @@ BuildAnimation(nsPresContext* aPresConte
     // for each animation (matching on name only) that was also in the
     // old list of animations.
     // This means that we honor dynamic changes, which isn't what the
     // spec says to do, but WebKit seems to honor at least some of
     // them.  See
     // http://lists.w3.org/Archives/Public/www-style/2011Apr/0079.html
     // In order to honor what the spec said, we'd copy more data over.
     UpdateOldAnimationPropertiesWithNew(*oldAnim,
-                                        timing,
+                                        std::move(timing),
                                         std::move(keyframes),
                                         isStylePaused,
                                         aBuilder);
     return oldAnim.forget();
   }
 
   // mTarget is non-null here, so we emplace it directly.
   Maybe<OwningAnimationTarget> target;