Merge pull request #13940 from Snuffleupagus/cleanup-supportsFullscreen

Simplify the `PDFViewerApplication.supportsFullscreen` getter
This commit is contained in:
Tim van der Meij 2021-08-27 22:31:31 +02:00 committed by GitHub
commit b0929dceba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -679,21 +679,13 @@ const PDFViewerApplication = {
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
return shadow(this, "supportsFullscreen", document.fullscreenEnabled); return shadow(this, "supportsFullscreen", document.fullscreenEnabled);
} }
const doc = document.documentElement; return shadow(
let support = !!( this,
doc.requestFullscreen || "supportsFullscreen",
doc.mozRequestFullScreen || document.fullscreenEnabled ||
doc.webkitRequestFullScreen document.mozFullScreenEnabled ||
document.webkitFullscreenEnabled
); );
if (
document.fullscreenEnabled === false ||
document.mozFullScreenEnabled === false ||
document.webkitFullscreenEnabled === false
) {
support = false;
}
return shadow(this, "supportsFullscreen", support);
}, },
get supportsIntegratedFind() { get supportsIntegratedFind() {
@ -853,12 +845,8 @@ const PDFViewerApplication = {
this.pdfAttachmentViewer.reset(); this.pdfAttachmentViewer.reset();
this.pdfLayerViewer.reset(); this.pdfLayerViewer.reset();
if (this.pdfHistory) { this.pdfHistory?.reset();
this.pdfHistory.reset(); this.findBar?.reset();
}
if (this.findBar) {
this.findBar.reset();
}
this.toolbar.reset(); this.toolbar.reset();
this.secondaryToolbar.reset(); this.secondaryToolbar.reset();
@ -1850,9 +1838,7 @@ const PDFViewerApplication = {
this.printService.destroy(); this.printService.destroy();
this.printService = null; this.printService = null;
if (this.pdfDocument) { this.pdfDocument?.annotationStorage.resetModified();
this.pdfDocument.annotationStorage.resetModified();
}
} }
this.forceRendering(); this.forceRendering();
}, },
@ -1864,10 +1850,7 @@ const PDFViewerApplication = {
}, },
requestPresentationMode() { requestPresentationMode() {
if (!this.pdfPresentationMode) { this.pdfPresentationMode?.request();
return;
}
this.pdfPresentationMode.request();
}, },
triggerPrinting() { triggerPrinting() {