Bug 1338404 - Fix keyframe handling for single-valued lists draft
authorBrian Birtles <birtles@gmail.com>
Fri, 10 Feb 2017 15:21:15 +0900
changeset 481618 00fa1e3c49800a9362adf7edb4db1b955671a3c4
parent 481595 25a94c1047e793ef096d8556fa3c26dd72bd37d7
child 545249 b833084248d3cae72ae81d9f44af0190515d5b1a
push id44877
push userbbirtles@mozilla.com
push dateFri, 10 Feb 2017 06:22:05 +0000
bugs1338404
milestone54.0a1
Bug 1338404 - Fix keyframe handling for single-valued lists MozReview-Commit-ID: 5MNSDm3Qr8b
dom/animation/KeyframeUtils.cpp
testing/web-platform/meta/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument.html.ini
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -1482,17 +1482,19 @@ GetKeyframeListFromPropertyIndexedKeyfra
       aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
       return;
     }
 
     size_t n = pair.mValues.Length() - 1;
     size_t i = 0;
 
     for (const nsString& stringValue : pair.mValues) {
-      double offset = i++ / double(n);
+      // For single-valued lists, the single value should be added to a
+      // keyframe with offset 1.
+      double offset = n ? i++ / double(n) : 1;
       Keyframe* keyframe = processedKeyframes.LookupOrAdd(offset);
       if (keyframe->mPropertyValues.IsEmpty()) {
         keyframe->mTimingFunction = easing;
         keyframe->mComposite = composite;
         keyframe->mComputedOffset = offset;
       }
       keyframe->mPropertyValues.AppendElement(
         MakePropertyValuePair(pair.mProperty, stringValue, parser, aDocument));
--- a/testing/web-platform/meta/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument.html.ini
+++ b/testing/web-platform/meta/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument.html.ini
@@ -1,8 +1,5 @@
 [processing-a-keyframes-argument.html]
   type: testharness
-  [Equivalent property indexed and sequenced keyframes: two properties with one value]
-    expected: FAIL
-
   [Equivalent property indexed and sequenced keyframes: same offset applied to all keyframes]
     expected: FAIL