Bug 1358966 - Call Servo_AnimationValues_Interpolate for each sub properties of shorthand. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 09 Jun 2017 06:19:37 +0900
changeset 591338 1d71ecdb6d00e24902ae1443daccc5fe1b390594
parent 591337 0504ba616c2a5af1457894da0696cde9991573f2
child 591339 df91ee4982672960f84200417340948b12171ba0
push id63021
push userhikezoe@mozilla.com
push dateThu, 08 Jun 2017 22:52:23 +0000
reviewersbirtles
bugs1358966
milestone55.0a1
Bug 1358966 - Call Servo_AnimationValues_Interpolate for each sub properties of shorthand. r?birtles MozReview-Commit-ID: Ath0b06j5zm
dom/smil/nsSMILCSSValueType.cpp
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -492,34 +492,43 @@ InterpolateForGecko(const ValueWrapper* 
 }
 
 static nsresult
 InterpolateForServo(const ValueWrapper* aStartWrapper,
                     const ValueWrapper& aEndWrapper,
                     double aUnitDistance,
                     nsSMILValue& aResult)
 {
-  const RefPtr<RawServoAnimationValue>*
-    startValue = aStartWrapper
-                 ? &aStartWrapper->mServoValues[0]
-                 : nullptr;
-  const RefPtr<RawServoAnimationValue>* endValue = &aEndWrapper.mServoValues[0];
-  RefPtr<RawServoAnimationValue> zeroValueStorage;
-  if (!FinalizeServoAnimationValues(startValue, endValue, zeroValueStorage)) {
-    return NS_ERROR_FAILURE;
+  ServoAnimationValues results;
+  size_t len = aEndWrapper.mServoValues.Length();
+  results.SetCapacity(len);
+  MOZ_ASSERT(!aStartWrapper || aStartWrapper->mServoValues.Length() == len,
+             "Start and end values length should be the same if "
+             "The start value exists");
+  for (size_t i = 0; i < len; i++) {
+    const RefPtr<RawServoAnimationValue>*
+      startValue = aStartWrapper
+                   ? &aStartWrapper->mServoValues[i]
+                   : nullptr;
+    const RefPtr<RawServoAnimationValue>* endValue = &aEndWrapper.mServoValues[i];
+    RefPtr<RawServoAnimationValue> zeroValueStorage;
+    if (!FinalizeServoAnimationValues(startValue, endValue, zeroValueStorage)) {
+      return NS_ERROR_FAILURE;
+    }
+
+    RefPtr<RawServoAnimationValue> result =
+      Servo_AnimationValues_Interpolate(*startValue,
+                                        *endValue,
+                                        aUnitDistance).Consume();
+    if (!result) {
+      return NS_ERROR_FAILURE;
+    }
+    results.AppendElement(result);
   }
-
-  RefPtr<RawServoAnimationValue> result =
-    Servo_AnimationValues_Interpolate(*startValue,
-                                      *endValue,
-                                      aUnitDistance).Consume();
-  if (!result) {
-    return NS_ERROR_FAILURE;
-  }
-  aResult.mU.mPtr = new ValueWrapper(aEndWrapper.mPropID, Move(result));
+  aResult.mU.mPtr = new ValueWrapper(aEndWrapper.mPropID, Move(results));
 
   return NS_OK;
 }
 
 nsresult
 nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal,
                                 const nsSMILValue& aEndVal,
                                 double aUnitDistance,