Bug 1494847 - Part 4: Remove backward compatibility codes before version 62. r=pbro
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Fri, 12 Oct 2018 13:33:54 +0000
changeset 499429 0dfb3afc73572ea842e1fbf6ee08644e5570d79d
parent 499428 4cb3f0e44e9ff613ab7c79518a64428ac91b1a0c
child 499557 94a62c1aad526dc24dc9186a6ccebb0db276ee87
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1494847
milestone64.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 1494847 - Part 4: Remove backward compatibility codes before version 62. r=pbro Depends on D7687 Differential Revision: https://phabricator.services.mozilla.com/D8512
devtools/client/inspector/animation/animation.js
devtools/client/inspector/animation/components/KeyframesProgressBar.js
devtools/client/inspector/animation/utils/timescale.js
--- a/devtools/client/inspector/animation/animation.js
+++ b/devtools/client/inspector/animation/animation.js
@@ -186,28 +186,23 @@ class AnimationInspector {
     return this.inspector.store.getState().animations;
   }
 
   addAnimationsCurrentTimeListener(listener) {
     this.animationsCurrentTimeListeners.push(listener);
   }
 
   /**
-   * This function calls AnimationsFront.setCurrentTimes with considering the createdTime
-   * which was introduced bug 1454392.
+   * This function calls AnimationsFront.setCurrentTimes with considering the createdTime.
    *
    * @param {Number} currentTime
    */
   async doSetCurrentTimes(currentTime) {
     const { animations, timeScale } = this.state;
-
-    // If currentTime is not defined in timeScale (which happens when connected
-    // to server older than FF62), set currentTime as it is. See bug 1454392.
-    currentTime = typeof timeScale.currentTime === "undefined"
-                    ? currentTime : currentTime + timeScale.minStartTime;
+    currentTime = currentTime + timeScale.minStartTime;
     await this.animationsFront.setCurrentTimes(animations, currentTime, true,
                                                { relativeToCreatedTime: true });
   }
 
   /**
    * Return a map of animated property from given animation actor.
    *
    * @param {Object} animation
--- a/devtools/client/inspector/animation/components/KeyframesProgressBar.js
+++ b/devtools/client/inspector/animation/components/KeyframesProgressBar.js
@@ -60,22 +60,17 @@ class KeyframesProgressBar extends PureC
   }
 
   updateOffset(currentTime, animation, timeScale) {
     const {
       createdTime,
       playbackRate,
     } = animation.state;
 
-    // If createdTime is not defined (which happens when connected to server older
-    // than FF62), use previousStartTime instead. See bug 1454392
-    const baseTime = typeof createdTime === "undefined"
-                       ? (animation.state.previousStartTime || 0)
-                       : createdTime;
-    const time = (timeScale.minStartTime + currentTime - baseTime) * playbackRate;
+    const time = (timeScale.minStartTime + currentTime - createdTime) * playbackRate;
 
     if (isNaN(time)) {
       // Setting an invalid currentTime will throw so bail out if time is not a number for
       // any reason.
       return;
     }
 
     this.simulatedAnimation.currentTime = time;
--- a/devtools/client/inspector/animation/utils/timescale.js
+++ b/devtools/client/inspector/animation/utils/timescale.js
@@ -13,21 +13,16 @@ const TIME_FORMAT_MAX_DURATION_IN_MS = 4
 
 /**
  * TimeScale object holds the total duration, start time and end time and zero position
  * time information for all animations which should be displayed, and is used to calculate
  * the displayed area for each animation.
  */
 class TimeScale {
   constructor(animations) {
-    if (!animations.every(animation => animation.state.createdTime)) {
-      // Backward compatibility for createdTime.
-      return this._initializeWithoutCreatedTime(animations);
-    }
-
     let resultCurrentTime = -Number.MAX_VALUE;
     let resultMinStartTime = Infinity;
     let resultMaxEndTime = 0;
     let resultZeroPositionTime = 0;
 
     for (const animation of animations) {
       const {
         currentTime,
@@ -69,64 +64,16 @@ class TimeScale {
 
     this.minStartTime = resultMinStartTime;
     this.maxEndTime = resultMaxEndTime;
     this.currentTime = resultCurrentTime;
     this.zeroPositionTime = resultZeroPositionTime;
   }
 
   /**
-   * Same as the constructor but doesn't use the animation's createdTime property
-   * which has only been added in FF62, for backward compatbility reasons.
-   *
-   * @param {Array} animations
-   */
-  _initializeWithoutCreatedTime(animations) {
-    this.minStartTime = Infinity;
-    this.maxEndTime = 0;
-    this.documentCurrentTime = 0;
-
-    for (const animation of animations) {
-      const {
-        delay,
-        documentCurrentTime,
-        duration,
-        endDelay = 0,
-        iterationCount,
-        playbackRate,
-        previousStartTime = 0,
-      } = animation.state;
-
-      const toRate = v => v / playbackRate;
-      const minZero = v => Math.max(v, 0);
-      const rateRelativeDuration =
-        toRate(duration * (!iterationCount ? 1 : iterationCount));
-      // Negative-delayed animations have their startTimes set such that we would
-      // be displaying the delay outside the time window if we didn't take it into
-      // account here.
-      const relevantDelay = delay < 0 ? toRate(delay) : 0;
-      const startTime = toRate(minZero(delay)) +
-                        rateRelativeDuration +
-                        endDelay;
-      this.minStartTime = Math.min(
-        this.minStartTime,
-        previousStartTime +
-        relevantDelay +
-        Math.min(startTime, 0)
-      );
-      const length = toRate(delay) + rateRelativeDuration + toRate(minZero(endDelay));
-      const endTime = previousStartTime + length;
-      this.maxEndTime = Math.max(this.maxEndTime, endTime);
-
-      this.documentCurrentTime = Math.max(this.documentCurrentTime, documentCurrentTime);
-      this.zeroPositionTime = this.minStartTime;
-    }
-  }
-
-  /**
    *  Convert a distance in % to a time, in the current time scale. The time
    *  will be relative to the zero position time.
    *  i.e., If zeroPositionTime will be negative and specified time is shorter
    *  than the absolute value of zero position time, relative time will be
    *  negative time.
    *
    * @param {Number} distance
    * @return {Number}
@@ -168,21 +115,17 @@ class TimeScale {
   }
 
   /**
    * Return current time of this time scale represents.
    *
    * @return {Number}
    */
   getCurrentTime() {
-    // If currentTime is not defined (which happens when connected to server older
-    // than FF62), use documentCurrentTime instead. See bug 1454392.
-    const baseTime = typeof this.currentTime === "undefined"
-                       ? this.documentCurrentTime : this.currentTime;
-    return baseTime - this.minStartTime;
+    return this.currentTime - this.minStartTime;
   }
 
   /**
    * Return end time of given animation.
    * This time does not include playbackRate and cratedTime.
    * Also, if the animation has infinite iterations, this returns Infinity.
    *
    * @param {Object} animation