Skip to content

Commit

Permalink
Limit the PDFPageView._isStandalone handling to the GENERIC viewer
Browse files Browse the repository at this point in the history
This code is completely unnecessary in e.g. the Firefox PDF Viewer.
  • Loading branch information
Snuffleupagus committed Jul 24, 2022
1 parent 3446f15 commit 37dc0e7
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions web/pdf_page_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ class PDFPageView {
this.renderingState = RenderingStates.INITIAL;
this.resume = 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;

Expand All @@ -177,7 +182,11 @@ class PDFPageView {

container?.append(div);

if (this._isStandalone) {
if (
(typeof PDFJSDev === "undefined" ||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
this._isStandalone
) {
const { optionalContentConfigPromise } = options;
if (optionalContentConfigPromise) {
// Ensure that the thumbnails always display the *initial* document
Expand Down Expand Up @@ -377,7 +386,11 @@ class PDFPageView {

this.loadingIconDiv = document.createElement("div");
this.loadingIconDiv.className = "loadingIcon notVisible";
if (this._isStandalone) {
if (
(typeof PDFJSDev === "undefined" ||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
this._isStandalone
) {
this.toggleLoadingIconSpinner(/* viewVisible = */ true);
}
this.loadingIconDiv.setAttribute("role", "img");
Expand Down Expand Up @@ -412,7 +425,11 @@ class PDFPageView {
rotation: totalRotation,
});

if (this._isStandalone) {
if (
(typeof PDFJSDev === "undefined" ||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
this._isStandalone
) {
docStyle.setProperty("--scale-factor", this.viewport.scale);
}

Expand Down

0 comments on commit 37dc0e7

Please sign in to comment.