Bug 1245748 - 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
--- 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;
};