Bug 1360718 - Render the webvtt cues when hiding the control bar. r=alwu
"video.controls = false" will remove the binding of videocontrols which is a xul element.
In vtt.jsm, we need to remember the last show/hide status of videocontrols, then render cues when status changed.
MozReview-Commit-ID: 30rebAuqmxy
--- a/dom/media/webvtt/vtt.jsm
+++ b/dom/media/webvtt/vtt.jsm
@@ -933,35 +933,37 @@ const { XPCOMUtils } = require("resource
rootOfCues.style.top = "0";
rootOfCues.style.bottom = "0";
overlay.appendChild(rootOfCues);
// Determine if we need to compute the display states of the cues. This could
// be the case if a cue's state has been changed since the last computation or
// if it has not been computed yet.
function shouldCompute(cues) {
- if (controlBarShown) {
+ if (overlay.lastControlBarShownStatus != controlBarShown) {
return true;
}
for (var i = 0; i < cues.length; i++) {
if (cues[i].hasBeenReset || !cues[i].displayState) {
return true;
}
}
return false;
}
// We don't need to recompute the cues' display states. Just reuse them.
if (!shouldCompute(cues)) {
for (var i = 0; i < cues.length; i++) {
rootOfCues.appendChild(cues[i].displayState);
}
+ overlay.lastControlBarShownStatus = controlBarShown;
return;
}
+ overlay.lastControlBarShownStatus = controlBarShown;
var boxPositions = [],
containerBox = BoxPosition.getSimpleBoxPosition(rootOfCues),
fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;
var styleOptions = {
font: fontSize + "px " + FONT_STYLE
};
deleted file mode 100644
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/disable_controls_reposition.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[disable_controls_reposition.html]
- type: reftest
- expected: FAIL