Limit the PDFPageView._isStandalone handling to the GENERIC viewer

This code is completely unnecessary in e.g. the Firefox PDF Viewer.
This commit is contained in:
Jonas Jenwald 2022-07-24 15:43:31 +02:00
parent 3446f15bf3
commit 37dc0e7d6e

View File

@ -153,7 +153,12 @@ class PDFPageView {
this.renderingState = RenderingStates.INITIAL; this.renderingState = RenderingStates.INITIAL;
this.resume = null; this.resume = null;
this._renderError = null; this._renderError = null;
this._isStandalone = !this.renderingQueue?.hasViewer(); if (
typeof PDFJSDev === "undefined" ||
PDFJSDev.test("!PRODUCTION || GENERIC")
) {
this._isStandalone = !this.renderingQueue?.hasViewer();
}
this._annotationCanvasMap = null; this._annotationCanvasMap = null;
@ -177,7 +182,11 @@ class PDFPageView {
container?.append(div); container?.append(div);
if (this._isStandalone) { if (
(typeof PDFJSDev === "undefined" ||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
this._isStandalone
) {
const { optionalContentConfigPromise } = options; const { optionalContentConfigPromise } = options;
if (optionalContentConfigPromise) { if (optionalContentConfigPromise) {
// Ensure that the thumbnails always display the *initial* document // Ensure that the thumbnails always display the *initial* document
@ -377,7 +386,11 @@ class PDFPageView {
this.loadingIconDiv = document.createElement("div"); this.loadingIconDiv = document.createElement("div");
this.loadingIconDiv.className = "loadingIcon notVisible"; this.loadingIconDiv.className = "loadingIcon notVisible";
if (this._isStandalone) { if (
(typeof PDFJSDev === "undefined" ||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
this._isStandalone
) {
this.toggleLoadingIconSpinner(/* viewVisible = */ true); this.toggleLoadingIconSpinner(/* viewVisible = */ true);
} }
this.loadingIconDiv.setAttribute("role", "img"); this.loadingIconDiv.setAttribute("role", "img");
@ -412,7 +425,11 @@ class PDFPageView {
rotation: totalRotation, rotation: totalRotation,
}); });
if (this._isStandalone) { if (
(typeof PDFJSDev === "undefined" ||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
this._isStandalone
) {
docStyle.setProperty("--scale-factor", this.viewport.scale); docStyle.setProperty("--scale-factor", this.viewport.scale);
} }