Bug 1273468 - Revert video controls to use prefixed Fullscreen API again. r?dolske
MozReview-Commit-ID: IlxS0MFTxIk
--- 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 ---");
}