Bug 1463372 - Part 1: Introduce createdTime to keyframes progress bar. r?pbro
MozReview-Commit-ID: Biy0AhZZxLQ
--- a/devtools/client/inspector/animation/components/KeyframesProgressBar.js
+++ b/devtools/client/inspector/animation/components/KeyframesProgressBar.js
@@ -57,22 +57,27 @@ class KeyframesProgressBar extends PureC
onCurrentTimeUpdated(currentTime) {
const { animation, timeScale } = this.props;
this.updateOffset(currentTime, animation, timeScale);
}
updateOffset(currentTime, animation, timeScale) {
const {
+ createdTime,
playbackRate,
- previousStartTime = 0,
} = animation.state;
- const time =
- (timeScale.minStartTime + currentTime - previousStartTime) * playbackRate;
+ // 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;
+
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;
const offset = this.element.offsetWidth *