Bug 1358966 - Call Servo_AnimationValues_Interpolate for each sub properties of shorthand. r=birtles
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 09 Jun 2017 06:19:37 +0900
changeset 411216 4e730eaffad1568c62771acf447bbb305e731406
parent 411215 00953e22f9f6f4345a2149a7f38dfeb1414e3d8b
child 411217 854d41e31f4bcfbe093b89580b51d72a24c7c095
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1358966
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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,