author | Daisuke Akatsuka <dakatsuka@mozilla.com> |
Tue, 29 May 2018 10:09:40 +0900 | |
changeset 420177 | 9353259c9adfd54bdfb6859f9e8a5f186eb7c3e1 |
parent 420176 | 732a958aa5cd2d822f80993e8d7be5cf3e8b6128 |
child 420178 | 97aee105338e761c5179cb943b60d5c15ba40f97 |
push id | 34066 |
push user | shindli@mozilla.com |
push date | Tue, 29 May 2018 09:51:43 +0000 |
treeherder | mozilla-central@4342f8a66345 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | pbro |
bugs | 1464396 |
milestone | 62.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
|
--- a/devtools/client/inspector/animation/animation.js +++ b/devtools/client/inspector/animation/animation.js @@ -653,13 +653,17 @@ class AnimationInspector { } this.stopAnimationsCurrentTimeTimer(); this.inspector.store.dispatch(updateAnimations(animations)); if (hasRunningAnimation(animations)) { this.startAnimationsCurrentTimeTimer(); + } else { + // Even no running animations, update the current time once + // so as to show the state. + this.onCurrentTimeTimerUpdated(this.state.timeScale.getCurrentTime()); } } } module.exports = AnimationInspector;
--- a/devtools/client/inspector/animation/current-time-timer.js +++ b/devtools/client/inspector/animation/current-time-timer.js @@ -22,21 +22,17 @@ class CurrentTimeTimer { * @param {Function} onUpdated * Listener function to get updating. * This function is called with 2 parameters. * 1st: current time * 2nd: if shouldStopAfterEndTime is true and * the current time is over the end time, true is given. */ constructor(timeScale, shouldStopAfterEndTime, win, onUpdated) { - // If currentTime is not defined (which happens when connected to server older - // than FF62), use documentCurrentTime instead. See bug 1454392. - const baseTime = typeof timeScale.currentTime === "undefined" - ? timeScale.documentCurrentTime : timeScale.currentTime; - this.baseCurrentTime = baseTime - timeScale.minStartTime; + this.baseCurrentTime = timeScale.getCurrentTime(); this.endTime = timeScale.getDuration(); this.timerStartTime = win.performance.now(); this.shouldStopAfterEndTime = shouldStopAfterEndTime; this.onUpdated = onUpdated; this.win = win; this.next = this.next.bind(this); }
--- a/devtools/client/inspector/animation/utils/timescale.js +++ b/devtools/client/inspector/animation/utils/timescale.js @@ -146,16 +146,29 @@ class TimeScale { * * @return {Number} duration */ getDuration() { return this.maxEndTime - this.minStartTime; } /** + * 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 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 * @return {Numbber} end time */ getEndTime({ state }) {