Bug 1273468 - Revert video controls to use prefixed Fullscreen API again. r?dolske draft
authorXidorn Quan <me@upsuper.org>
Thu, 19 May 2016 10:30:54 +1000
changeset 368545 0d8eab05c652fa854c4eaa508657f404e433ab0f
parent 368027 4bc941f2562db75a568cc720903fdc3106d8341d
child 521313 9c2d6f386967616adf61572c828ec3c3ccc2438e
push id18576
push userxquan@mozilla.com
push dateThu, 19 May 2016 00:35:18 +0000
reviewersdolske
bugs1273468
milestone49.0a1
Bug 1273468 - Revert video controls to use prefixed Fullscreen API again. r?dolske MozReview-Commit-ID: IlxS0MFTxIk
toolkit/content/TopLevelVideoDocument.js
toolkit/content/widgets/videocontrols.xml
--- a/toolkit/content/TopLevelVideoDocument.js
+++ b/toolkit/content/TopLevelVideoDocument.js
@@ -24,20 +24,20 @@ document.addEventListener("keypress", ev
       return;
     }
 
     // If we're not in broser fullscreen mode, prevent entering into that,
     // so we don't end up there after pressing Esc.
     ev.preventDefault();
     ev.stopPropagation();
 
-    if (!document.fullscreenElement) {
-      videoElement.requestFullscreen();
+    if (!document.mozFullScreenElement) {
+      videoElement.mozRequestFullScreen();
     } else {
-      document.exitFullscreen();
+      document.mozCancelFullScreen();
     }
     return;
   }
 
   // Check if the video element is focused, so it already receives
   // keystrokes, and don't send it another one from here.
   if (document.activeElement == videoElement)
     return;
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -1002,17 +1002,17 @@
                         // when we remove the attribute.
                         element.clientTop;
                         element.removeAttribute("fadeout");
                         if (element.classList.contains("controlBar"))
                             this.controlsSpacer.removeAttribute("hideCursor");
                     } else {
                         element.setAttribute("fadeout", true);
                         if (element.classList.contains("controlBar") && !this.hasError() &&
-                            document.fullscreenElement == this.video)
+                            document.mozFullScreenElement == this.video)
                             this.controlsSpacer.setAttribute("hideCursor", true);
 
                     }
                 },
 
                 onTransitionEnd : function (event) {
                     // Ignore events for things other than opacity changes.
                     if (event.propertyName != "opacity")
@@ -1060,27 +1060,27 @@
                     }
 
                     // We'll handle style changes in the event listener for
                     // the "volumechange" event, same as if content script was
                     // controlling volume.
                 },
 
                 isVideoInFullScreen : function () {
-                    return document.fullscreenElement == this.video;
+                    return document.mozFullScreenElement == this.video;
                 },
 
                 toggleFullscreen : function () {
                     this.isVideoInFullScreen() ?
-                        document.exitFullscreen() :
-                        this.video.requestFullscreen();
+                        document.mozCancelFullScreen() :
+                        this.video.mozRequestFullScreen();
                 },
 
                 setFullscreenButtonState : function () {
-                    if (this.isAudioOnly || !document.fullscreenEnabled) {
+                    if (this.isAudioOnly || !document.mozFullScreenEnabled) {
                         this.controlBar.setAttribute("fullscreen-unavailable", true);
                         this.adjustControlSize();
                         return;
                     }
                     this.controlBar.removeAttribute("fullscreen-unavailable");
                     this.adjustControlSize();
 
                     var attrName = this.isVideoInFullScreen() ? "exitfullscreenlabel" : "enterfullscreenlabel";
@@ -1520,17 +1520,17 @@
                     addListener(this.playButton, "command", this.togglePause);
                     addListener(this.fullscreenButton, "command", this.toggleFullscreen);
                     addListener(this.clickToPlay, "click", this.clickToPlayClickHandler);
                     addListener(this.controlsSpacer, "click", this.clickToPlayClickHandler);
                     addListener(this.controlsSpacer, "dblclick", this.toggleFullscreen);
 
                     addListener(this.videocontrols, "resizevideocontrols", this.adjustControlSize);
                     addListener(this.videocontrols, "transitionend", this.onTransitionEnd);
-                    addListener(this.video.ownerDocument, "fullscreenchange", this.onFullscreenChange);
+                    addListener(this.video.ownerDocument, "mozfullscreenchange", this.onFullscreenChange);
                     addListener(this.video, "keypress", this.keyHandler);
 
                     addListener(this.videocontrols, "dragstart", function(event) {
                         event.preventDefault(); //prevent dragging of controls image (bug 517114)
                     });
 
                     this.log("--- videocontrols initialized ---");
                 }