Bug 1360718 - Render the webvtt cues when hiding the control bar. r=alwu draft
authorbechen <bechen@mozilla.com>
Tue, 09 May 2017 17:49:42 +0800
changeset 574707 e011ec0679ab03071e01b91c124c5b72e481a8da
parent 574706 dee55b621680eef6ba36a3c2f5b5279f2ddc13d0
child 574744 77b93c9082130509c03e409d557e16079a9313be
push id57808
push userbechen@mozilla.com
push dateTue, 09 May 2017 10:18:49 +0000
reviewersalwu
bugs1360718
milestone55.0a1
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
dom/media/webvtt/vtt.jsm
testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/disable_controls_reposition.html.ini
--- 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