Merge pull request #12935 from Snuffleupagus/fullscreen-MOZCENTRAL-rm-prefixes

Remove prefixed fullscreen properties/methods from the MOZCENTRAL builds
This commit is contained in:
Tim van der Meij 2021-01-31 14:20:50 +01:00 committed by GitHub
commit c92011e093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 30 deletions

View File

@ -657,14 +657,11 @@ const PDFViewerApplication = {
}, },
get supportsFullscreen() { get supportsFullscreen() {
let support;
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
support = return shadow(this, "supportsFullscreen", document.fullscreenEnabled);
document.fullscreenEnabled === true || }
document.mozFullScreenEnabled === true;
} else {
const doc = document.documentElement; const doc = document.documentElement;
support = !!( let support = !!(
doc.requestFullscreen || doc.requestFullscreen ||
doc.mozRequestFullScreen || doc.mozRequestFullScreen ||
doc.webkitRequestFullScreen doc.webkitRequestFullScreen
@ -677,7 +674,6 @@ const PDFViewerApplication = {
) { ) {
support = false; support = false;
} }
}
return shadow(this, "supportsFullscreen", support); return shadow(this, "supportsFullscreen", support);
}, },

View File

@ -86,6 +86,13 @@ class PDFPresentationMode {
this._setSwitchInProgress(); this._setSwitchInProgress();
this._notifyStateChange(); this._notifyStateChange();
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
if (this.container.requestFullscreen) {
this.container.requestFullscreen();
} else {
return false;
}
} else {
if (this.container.requestFullscreen) { if (this.container.requestFullscreen) {
this.container.requestFullscreen(); this.container.requestFullscreen();
} else if (this.container.mozRequestFullScreen) { } else if (this.container.mozRequestFullScreen) {
@ -95,6 +102,7 @@ class PDFPresentationMode {
} else { } else {
return false; return false;
} }
}
this.args = { this.args = {
page: this.pdfViewer.currentPageNumber, page: this.pdfViewer.currentPageNumber,
@ -148,6 +156,9 @@ class PDFPresentationMode {
} }
get isFullscreen() { get isFullscreen() {
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
return !!document.fullscreenElement;
}
return !!( return !!(
document.fullscreenElement || document.fullscreenElement ||
document.mozFullScreen || document.mozFullScreen ||
@ -468,8 +479,8 @@ class PDFPresentationMode {
this.fullscreenChangeBind = this._fullscreenChange.bind(this); this.fullscreenChangeBind = this._fullscreenChange.bind(this);
window.addEventListener("fullscreenchange", this.fullscreenChangeBind); window.addEventListener("fullscreenchange", this.fullscreenChangeBind);
window.addEventListener("mozfullscreenchange", this.fullscreenChangeBind);
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) { if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
window.addEventListener("mozfullscreenchange", this.fullscreenChangeBind);
window.addEventListener( window.addEventListener(
"webkitfullscreenchange", "webkitfullscreenchange",
this.fullscreenChangeBind this.fullscreenChangeBind
@ -482,11 +493,11 @@ class PDFPresentationMode {
*/ */
_removeFullscreenChangeListeners() { _removeFullscreenChangeListeners() {
window.removeEventListener("fullscreenchange", this.fullscreenChangeBind); window.removeEventListener("fullscreenchange", this.fullscreenChangeBind);
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
window.removeEventListener( window.removeEventListener(
"mozfullscreenchange", "mozfullscreenchange",
this.fullscreenChangeBind this.fullscreenChangeBind
); );
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
window.removeEventListener( window.removeEventListener(
"webkitfullscreenchange", "webkitfullscreenchange",
this.fullscreenChangeBind this.fullscreenChangeBind