Bug 1273468 - Revert video controls to use prefixed Fullscreen API again. r=dolske a=ritu
authorXidorn Quan <me@upsuper.org>
Sat, 21 May 2016 10:10:37 +1000
changeset 332955 d6efd86f9b0c773c8d59516ec909c1218e147b45
parent 332954 782b4767770b8d7f9ddea913167c49a12087d6af
child 332956 e348401d11232d732c0c8551115dd4869499d0c4
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, ritu
bugs1273468
milestone48.0a2
Bug 1273468 - Revert video controls to use prefixed Fullscreen API again. r=dolske a=ritu 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
@@ -989,17 +989,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")
@@ -1047,27 +1047,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";
@@ -1507,17 +1507,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 ---");
                 }