Simplify the PDFViewerApplication.supportsFullscreen getter

A lot of the code in this getter has existed ever since the initial PresentationMode-implementation was first added all the way back in PR 1938 (which is nine years ago now).
At this point in time however, there's now a simpler way detect if a browser supports the FullScreen API and we should thus be able to simplify this getter; please refer to https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenEnabled#browser_compatibility
This commit is contained in:
Jonas Jenwald 2021-08-27 17:45:34 +02:00
parent 8ff0f8e4df
commit bc2bb18af7

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() {