Bug 1260655 - Add an assignment operator to Keyframe that takes an rvalue reference; r?heycam draft
authorBrian Birtles <birtles@gmail.com>
Tue, 29 Mar 2016 11:29:20 +0900
changeset 345761 9714d2a5e256541ea9737a24b4463d66be0df7ae
parent 345760 742e0b97eddb6d3e2c42ce1ef925e4a21b2d7fc2
child 345762 6801a86735e6f46640ce2b1f1a2e238d990c7000
child 346186 fd71ef82cb17bf4a32a15fabadfa32e81e9f5a30
child 346367 93c55010671bd8f3e2a010691793e056fbcd6248
push id14156
push userbbirtles@mozilla.com
push dateWed, 30 Mar 2016 07:49:31 +0000
reviewersheycam
bugs1260655
milestone48.0a1
Bug 1260655 - Add an assignment operator to Keyframe that takes an rvalue reference; r?heycam This is needed in order to use std::stable_sort with this type since some implementations of std::stable_sort require this (as opposed to simply a move constructor). MozReview-Commit-ID: 5QmcIxkC4aB
dom/animation/KeyframeEffect.h
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -84,21 +84,26 @@ struct PropertyValuePair
  * When the target element or style context changes, however, we rebuild these
  * per-property arrays from the original list of keyframes objects. As a result,
  * these objects represent the master definition of the effect's values.
  */
 struct Keyframe
 {
   Keyframe() = default;
   Keyframe(Keyframe&& aOther)
-    : mOffset(aOther.mOffset)
-    , mComputedOffset(aOther.mComputedOffset)
-    , mTimingFunction(Move(aOther.mTimingFunction))
-    , mPropertyValues(Move(aOther.mPropertyValues))
+  {
+    *this = Move(aOther);
+  }
+  Keyframe& operator=(Keyframe&& aOther)
   {
+    mOffset         = aOther.mOffset;
+    mComputedOffset = aOther.mComputedOffset;
+    mTimingFunction = Move(aOther.mTimingFunction);
+    mPropertyValues = Move(aOther.mPropertyValues);
+    return *this;
   }
 
   Maybe<double>                 mOffset;
   double                        mComputedOffset = 0.0;
   Maybe<ComputedTimingFunction> mTimingFunction; // Nothing() here means
                                                  // "linear"
   nsTArray<PropertyValuePair>   mPropertyValues;
 };