Bug 1290535 - Part 1: Sort paced subproperties before calculation. draft
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 19 Aug 2016 12:21:22 +0800
changeset 403188 d0b1bc6f446a5fe6a060474a36359ef6fb5053b4
parent 401500 fe895421dfbe1f1f8f1fc6a39bb20774423a6d74
child 403189 6fe8b4e6cdbb4c0de234d16a8644efc38ac1cdf0
child 403195 f228a7e79a5d97cc446ce66ceb3a45d59e1c6773
push id26848
push userbmo:boris.chiou@gmail.com
push dateFri, 19 Aug 2016 08:34:27 +0000
bugs1290535
milestone51.0a1
Bug 1290535 - Part 1: Sort paced subproperties before calculation. MozReview-Commit-ID: 9sEghbxLlzO
dom/animation/KeyframeUtils.cpp
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -1538,16 +1538,23 @@ GetCumulativeDistances(const nsTArray<Co
 
     // Check we have values for all the paceable longhand components.
     if (pacedValues.Length() != pacedPropertyCount) {
       // This keyframe is not paceable, assign kNotPaceable and skip it.
       cumulativeDistances[i] = kNotPaceable;
       continue;
     }
 
+    // Sort the pacedValues first, so the order of subproperties of
+    // pacedValues is always the same as that of prevPacedValues.
+    if (isShorthand) {
+      pacedValues.Sort(
+        TPropertyPriorityComparator<PropertyStyleAnimationValuePair>());
+    }
+
     if (prevPacedValues.IsEmpty()) {
       // This is the first paceable keyframe so its cumulative distance is 0.0.
       cumulativeDistances[i] = 0.0;
     } else {
       double dist = 0.0;
       if (isShorthand) {
         // Apply the distance by the square root of the sum of squares of
         // longhand component distances.