Bug 1304922 - Part 12: Add move assignment operator for StyleAnimationValue. r?birtles draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Mon, 03 Oct 2016 18:47:15 +0900
changeset 420110 dffd0cb4f119c72037a889a7109ee15a2b9ac220
parent 420109 04d24c64bb22e5199cbe6c8795f306e82e25334f
child 532720 81740920041fb9764c644c127353063b1d5508ab
push id31094
push userbmo:hiikezoe@mozilla-japan.org
push dateMon, 03 Oct 2016 10:02:30 +0000
reviewersbirtles
bugs1304922
milestone52.0a1
Bug 1304922 - Part 12: Add move assignment operator for StyleAnimationValue. r?birtles MozReview-Commit-ID: dvAx8eViRR
layout/style/StyleAnimationValue.h
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -509,16 +509,27 @@ public:
   void SetAndAdoptCSSValueTripletValue(nsCSSValueTriplet *aValue, Unit aUnit);
   void SetAndAdoptCSSRectValue(nsCSSRect *aValue, Unit aUnit);
   void SetAndAdoptCSSValueListValue(nsCSSValueList *aValue, Unit aUnit);
   void SetAndAdoptCSSValuePairListValue(nsCSSValuePairList *aValue);
 
   void SetTransformValue(nsCSSValueSharedList* aList);
 
   StyleAnimationValue& operator=(const StyleAnimationValue& aOther);
+  StyleAnimationValue& operator=(StyleAnimationValue&& aOther)
+  {
+    MOZ_ASSERT(this != &aOther, "Do not move itself");
+    if (this != &aOther) {
+      FreeValue();
+      mUnit = aOther.mUnit;
+      mValue = aOther.mValue;
+      aOther.mUnit = eUnit_Null;
+    }
+    return *this;
+  }
 
   bool operator==(const StyleAnimationValue& aOther) const;
   bool operator!=(const StyleAnimationValue& aOther) const
     { return !(*this == aOther); }
 
 private:
   void FreeValue();