Skip to content

Commit b0929dc

Browse files
Merge pull request #13940 from Snuffleupagus/cleanup-supportsFullscreen
Simplify the `PDFViewerApplication.supportsFullscreen` getter
2 parents c82381e + bc2bb18 commit b0929dc

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

web/app.js

+10-27
Original file line numberDiff line numberDiff line change
@@ -679,21 +679,13 @@ const PDFViewerApplication = {
679679
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
680680
return shadow(this, "supportsFullscreen", document.fullscreenEnabled);
681681
}
682-
const doc = document.documentElement;
683-
let support = !!(
684-
doc.requestFullscreen ||
685-
doc.mozRequestFullScreen ||
686-
doc.webkitRequestFullScreen
682+
return shadow(
683+
this,
684+
"supportsFullscreen",
685+
document.fullscreenEnabled ||
686+
document.mozFullScreenEnabled ||
687+
document.webkitFullscreenEnabled
687688
);
688-
689-
if (
690-
document.fullscreenEnabled === false ||
691-
document.mozFullScreenEnabled === false ||
692-
document.webkitFullscreenEnabled === false
693-
) {
694-
support = false;
695-
}
696-
return shadow(this, "supportsFullscreen", support);
697689
},
698690

699691
get supportsIntegratedFind() {
@@ -853,12 +845,8 @@ const PDFViewerApplication = {
853845
this.pdfAttachmentViewer.reset();
854846
this.pdfLayerViewer.reset();
855847

856-
if (this.pdfHistory) {
857-
this.pdfHistory.reset();
858-
}
859-
if (this.findBar) {
860-
this.findBar.reset();
861-
}
848+
this.pdfHistory?.reset();
849+
this.findBar?.reset();
862850
this.toolbar.reset();
863851
this.secondaryToolbar.reset();
864852

@@ -1850,9 +1838,7 @@ const PDFViewerApplication = {
18501838
this.printService.destroy();
18511839
this.printService = null;
18521840

1853-
if (this.pdfDocument) {
1854-
this.pdfDocument.annotationStorage.resetModified();
1855-
}
1841+
this.pdfDocument?.annotationStorage.resetModified();
18561842
}
18571843
this.forceRendering();
18581844
},
@@ -1864,10 +1850,7 @@ const PDFViewerApplication = {
18641850
},
18651851

18661852
requestPresentationMode() {
1867-
if (!this.pdfPresentationMode) {
1868-
return;
1869-
}
1870-
this.pdfPresentationMode.request();
1853+
this.pdfPresentationMode?.request();
18711854
},
18721855

18731856
triggerPrinting() {

0 commit comments

Comments
 (0)