Bug 1456688 - Set easing member in result of getComputedTiming(); r=hiro
authorBrian Birtles <birtles@gmail.com>
Wed, 25 Apr 2018 12:25:26 +0900
changeset 471561 e786f1edbbefa7dadbb2e0ba5b7939f2bf4f1273
parent 471560 09928d75cfec04a499aa886e629382003a221d07
child 471593 a83a4ef50f6ca754ec451320dfefbffa707bad1a
child 471597 a2d670a8074e2c93beb71fd90a0cd829d041bbb9
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1456688
milestone61.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 1456688 - Set easing member in result of getComputedTiming(); r=hiro The test added in this patch fails without the corresponding code changes (specifically the second gGetComputedTimingTests test fails the comparison of the 'easing' member). MozReview-Commit-ID: 9eyXruVrPuN
dom/animation/AnimationEffectReadOnly.cpp
testing/web-platform/tests/web-animations/interfaces/AnimationEffect/getComputedTiming.html
--- a/dom/animation/AnimationEffectReadOnly.cpp
+++ b/dom/animation/AnimationEffectReadOnly.cpp
@@ -279,21 +279,25 @@ GetComputedTimingDictionary(const Comput
                             const Nullable<TimeDuration>& aLocalTime,
                             const TimingParams& aTiming,
                             ComputedTimingProperties& aRetVal)
 {
   // AnimationEffectTimingProperties
   aRetVal.mDelay = aTiming.Delay().ToMilliseconds();
   aRetVal.mEndDelay = aTiming.EndDelay().ToMilliseconds();
   aRetVal.mFill = aComputedTiming.mFill;
+  aRetVal.mIterationStart = aComputedTiming.mIterationStart;
   aRetVal.mIterations = aComputedTiming.mIterations;
-  aRetVal.mIterationStart = aComputedTiming.mIterationStart;
   aRetVal.mDuration.SetAsUnrestrictedDouble() =
     aComputedTiming.mDuration.ToMilliseconds();
   aRetVal.mDirection = aTiming.Direction();
+  if (aTiming.TimingFunction()) {
+    aRetVal.mEasing.Truncate();
+    aTiming.TimingFunction()->AppendToString(aRetVal.mEasing);
+  }
 
   // ComputedTimingProperties
   aRetVal.mActiveDuration = aComputedTiming.mActiveDuration.ToMilliseconds();
   aRetVal.mEndTime = aComputedTiming.mEndTime.ToMilliseconds();
   aRetVal.mLocalTime = AnimationUtils::TimeDurationToDouble(aLocalTime);
   aRetVal.mProgress = aComputedTiming.mProgress;
 
   if (!aRetVal.mProgress.IsNull()) {
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffect/getComputedTiming.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffect/getComputedTiming.html
@@ -10,38 +10,47 @@
 <script>
 'use strict';
 
 test(t => {
   const effect = new KeyframeEffect(null, null);
 
   const ct = effect.getComputedTiming();
   assert_equals(ct.delay, 0, 'computed delay');
+  assert_equals(ct.endDelay, 0, 'computed endDelay');
   assert_equals(ct.fill, 'none', 'computed fill');
+  assert_equals(ct.iterationStart, 0.0, 'computed iterationStart');
   assert_equals(ct.iterations, 1.0, 'computed iterations');
   assert_equals(ct.duration, 0, 'computed duration');
   assert_equals(ct.direction, 'normal', 'computed direction');
+  assert_equals(ct.easing, 'linear', 'computed easing');
 }, 'values of getComputedTiming() when a KeyframeEffect is ' +
    'constructed without any KeyframeEffectOptions object');
 
 const gGetComputedTimingTests = [
   { desc:     'an empty KeyframeEffectOptions object',
     input:    { },
     expected: { } },
   { desc:     'a normal KeyframeEffectOptions object',
     input:    { delay: 1000,
+                endDelay: 2000,
                 fill: 'auto',
+                iterationStart: 0.5,
                 iterations: 5.5,
                 duration: 'auto',
-                direction: 'alternate' },
+                direction: 'alternate',
+                easing: 'steps(2)' },
     expected: { delay: 1000,
+                endDelay: 2000,
                 fill: 'none',
+                iterationStart: 0.5,
                 iterations: 5.5,
                 duration: 0,
-                direction: 'alternate' } },
+                direction: 'alternate',
+                easing: 'steps(2)' } },
   { desc:     'a double value',
     input:    3000,
     timing:   { duration: 3000 },
     expected: { delay: 0,
                 fill: 'none',
                 iterations: 1,
                 duration: 3000,
                 direction: 'normal' } },
@@ -73,24 +82,30 @@ for (const stest of gGetComputedTimingTe
     // not supply them.
     const expected = (field, defaultValue) => {
       return field in stest.expected ? stest.expected[field] : defaultValue;
     };
 
     const ct = effect.getComputedTiming();
     assert_equals(ct.delay, expected('delay', 0),
                   'computed delay');
+    assert_equals(ct.endDelay, expected('endDelay', 0),
+                  'computed endDelay');
     assert_equals(ct.fill, expected('fill', 'none'),
                   'computed fill');
+    assert_equals(ct.iterationStart, expected('iterationStart', 0),
+                  'computed iterations');
     assert_equals(ct.iterations, expected('iterations', 1),
                   'computed iterations');
     assert_equals(ct.duration, expected('duration', 0),
                   'computed duration');
     assert_equals(ct.direction, expected('direction', 'normal'),
                   'computed direction');
+    assert_equals(ct.easing, expected('easing', 'linear'),
+                  'computed easing');
 
   }, 'values of getComputedTiming() when a KeyframeEffect is'
      + ` constructed by ${stest.desc}`);
 }
 
 const gActiveDurationTests = [
   { desc:     'an empty KeyframeEffectOptions object',
     input:    { },