Bug 1338404 - Fix keyframe handling for single-valued lists
MozReview-Commit-ID: 5MNSDm3Qr8b
--- 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