Bug 1260655 - Add an assignment operator to Keyframe that takes an rvalue reference; r=heycam
authorBrian Birtles <birtles@gmail.com>
Tue, 29 Mar 2016 11:29:20 +0900
changeset 316348 bd357fbe96883c012177047b9ab10ebb1b8ce944
parent 316347 51a410cc49c88ae03ca11760f8d914ef206188e4
child 316349 77d2df1822a966b3bae9b8c3a890a081445f21cf
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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;
 };