Bug 1485133 - Remove Web Animation polyfill in video controls r=birtles

Differential Revision: https://phabricator.services.mozilla.com/D3918

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Timothy Guan-tin Chien 2018-08-21 22:43:55 +00:00
Родитель d56d102ae0
Коммит 4b6408eacd
3 изменённых файлов: 0 добавлений и 78 удалений

Просмотреть файл

@ -1107,32 +1107,6 @@ this.VideoControlsImplPageWidget = class {
}
},
// Polyfill animation.finished promise, also invalidate
// the previous promise.
// Remove when the platform implementation ships.
// (currently behind dom.animations-api.core.enabled)
installFinishedPromisePolyfill(animation) {
let handler = {
handleEvent(evt) {
animation.removeEventListener("finish", this);
animation.removeEventListener("cancel", this);
if (evt.type == "finish" &&
this === animation.finished) {
this.fn();
}
},
then(fn) {
this.fn = fn;
}
};
// Note that handler is not a real Promise.
// All it offered is a then() method to register a callback
// to be triggered at the right time.
Object.defineProperty(animation, "finished", { value: handler, configurable: true });
animation.addEventListener("finish", handler);
animation.addEventListener("cancel", handler);
},
startFade(element, fadeIn, immediate = false) {
let animationProp =
this.animationProps[element.id];
@ -1143,15 +1117,8 @@ this.VideoControlsImplPageWidget = class {
let animation = this.animationMap.get(element);
if (!animation) {
// Create the animation object but don't start it.
// To be replaced with the following when the constructors ship
// (currently behind dom.animations-api.core.enabled)
/*
animation = new this.window.Animation(new this.window.KeyframeEffect(
element, animationProp.keyframes, animationProp.options));
*/
animation = element.animate(animationProp.keyframes, animationProp.options);
animation.cancel();
this.animationMap.set(element, animation);
}
@ -1193,7 +1160,6 @@ this.VideoControlsImplPageWidget = class {
if (!immediate) {
animation.playbackRate = fadeIn ? 1 : -1;
animation.play();
this.installFinishedPromisePolyfill(animation);
finishedPromise = animation.finished;
} else {
animation.cancel();

Просмотреть файл

@ -1128,32 +1128,6 @@
}
},
// Polyfill animation.finished promise, also invalidate
// the previous promise.
// Remove when the platform implementation ships.
// (currently behind dom.animations-api.core.enabled)
installFinishedPromisePolyfill(animation) {
let handler = {
handleEvent(evt) {
animation.removeEventListener("finish", this);
animation.removeEventListener("cancel", this);
if (evt.type == "finish" &&
this === animation.finished) {
this.fn();
}
},
then(fn) {
this.fn = fn;
}
};
// Note that handler is not a real Promise.
// All it offered is a then() method to register a callback
// to be triggered at the right time.
animation.finished = handler;
animation.addEventListener("finish", handler);
animation.addEventListener("cancel", handler);
},
startFade(element, fadeIn, immediate = false) {
// Bug 493523, the scrubber doesn't call valueChanged while hidden,
// so our dependent state (eg, timestamp in the thumb) will be stale.
@ -1171,15 +1145,8 @@
let animation = this.animationMap.get(element);
if (!animation) {
// Create the animation object but don't start it.
// To be replaced with the following when the constructors ship
// (currently behind dom.animations-api.core.enabled)
/*
animation = new Animation(new KeyframeEffect(
element, animationProp.keyframes, animationProp.options));
*/
animation = element.animate(animationProp.keyframes, animationProp.options);
animation.cancel();
this.animationMap.set(element, animation);
}
@ -1219,7 +1186,6 @@
if (!immediate) {
animation.playbackRate = fadeIn ? 1 : -1;
animation.play();
this.installFinishedPromisePolyfill(animation);
finishedPromise = animation.finished;
} else {
animation.cancel();

Просмотреть файл

@ -66,16 +66,6 @@ audio > xul|videocontrols,
--volumeStack-width: 64px;
}
/*
XXX this is needed because of bug 1354501.
Can be removed when the bug is fixed, or when we move away from
the finish event to the finished promise.
(currently behind dom.animations-api.core.enabled)
*/
.fadeout {
opacity: 0;
}
.controlsContainer [hidden],
.controlBar[hidden] {
display: none;