Bug 1245748 - Add a Move constructor to Keyframe
I have confirmed that by adding this, we end up calling SwapElements() on the
mPropertyValues member when we build up the nsTArray<Keyframe> result in
GetKeyframeListFromPropertyIndexedKeyframe. Without this explicit move
constructor (i.e. with only the default move constructor) the copy-constructor
for mPropertyValues is called.
MozReview-Commit-ID: 6IWkP97RFUr
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -77,16 +77,25 @@ struct PropertyValuePair
* values, etc.
*
* 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))
+ {
+ }
+
Maybe<double> mOffset;
double mComputedOffset = 0.0;
Maybe<ComputedTimingFunction> mTimingFunction; // Nothing() here means
// "linear"
nsTArray<PropertyValuePair> mPropertyValues;
};
struct AnimationPropertySegment