Only define the renderer
-option in the GENERIC viewer
Given that the SVG back-end is not defined anywhere except in GENERIC builds, we can remove a little bit of unnecessary code in e.g. the Firefox PDF Viewer.
This commit is contained in:
parent
c3d0858062
commit
df79b18a31
@ -521,7 +521,11 @@ const PDFViewerApplication = {
|
|||||||
findController,
|
findController,
|
||||||
scriptingManager:
|
scriptingManager:
|
||||||
AppOptions.get("enableScripting") && pdfScriptingManager,
|
AppOptions.get("enableScripting") && pdfScriptingManager,
|
||||||
renderer: AppOptions.get("renderer"),
|
renderer:
|
||||||
|
typeof PDFJSDev === "undefined" ||
|
||||||
|
PDFJSDev.test("!PRODUCTION || GENERIC")
|
||||||
|
? AppOptions.get("renderer")
|
||||||
|
: null,
|
||||||
l10n: this.l10n,
|
l10n: this.l10n,
|
||||||
textLayerMode: AppOptions.get("textLayerMode"),
|
textLayerMode: AppOptions.get("textLayerMode"),
|
||||||
annotationMode: AppOptions.get("annotationMode"),
|
annotationMode: AppOptions.get("annotationMode"),
|
||||||
|
@ -160,11 +160,6 @@ const defaultOptions = {
|
|||||||
value: 150,
|
value: 150,
|
||||||
kind: OptionKind.VIEWER,
|
kind: OptionKind.VIEWER,
|
||||||
},
|
},
|
||||||
renderer: {
|
|
||||||
/** @type {string} */
|
|
||||||
value: "canvas",
|
|
||||||
kind: OptionKind.VIEWER,
|
|
||||||
},
|
|
||||||
sidebarViewOnLoad: {
|
sidebarViewOnLoad: {
|
||||||
/** @type {number} */
|
/** @type {number} */
|
||||||
value: -1,
|
value: -1,
|
||||||
@ -306,6 +301,11 @@ if (
|
|||||||
value: navigator.language || "en-US",
|
value: navigator.language || "en-US",
|
||||||
kind: OptionKind.VIEWER,
|
kind: OptionKind.VIEWER,
|
||||||
};
|
};
|
||||||
|
defaultOptions.renderer = {
|
||||||
|
/** @type {string} */
|
||||||
|
value: "canvas",
|
||||||
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
||||||
|
};
|
||||||
defaultOptions.sandboxBundleSrc = {
|
defaultOptions.sandboxBundleSrc = {
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
value:
|
value:
|
||||||
@ -317,8 +317,6 @@ if (
|
|||||||
|
|
||||||
defaultOptions.annotationEditorEnabled.compatibility =
|
defaultOptions.annotationEditorEnabled.compatibility =
|
||||||
compatibilityParams.annotationEditorEnabled;
|
compatibilityParams.annotationEditorEnabled;
|
||||||
|
|
||||||
defaultOptions.renderer.kind += OptionKind.PREFERENCE;
|
|
||||||
} else if (PDFJSDev.test("CHROME")) {
|
} else if (PDFJSDev.test("CHROME")) {
|
||||||
defaultOptions.disableTelemetry = {
|
defaultOptions.disableTelemetry = {
|
||||||
/** @type {boolean} */
|
/** @type {boolean} */
|
||||||
|
@ -926,18 +926,13 @@ class PDFPageView {
|
|||||||
|
|
||||||
paintOnSvg(wrapper) {
|
paintOnSvg(wrapper) {
|
||||||
if (
|
if (
|
||||||
typeof PDFJSDev !== "undefined" &&
|
!(
|
||||||
PDFJSDev.test("MOZCENTRAL || CHROME")
|
typeof PDFJSDev === "undefined" ||
|
||||||
|
PDFJSDev.test("!PRODUCTION || GENERIC")
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
// Return a mock object, to prevent errors such as e.g.
|
throw new Error("Not implemented: paintOnSvg");
|
||||||
// "TypeError: paintTask.promise is undefined".
|
|
||||||
return {
|
|
||||||
promise: Promise.reject(new Error("SVG rendering is not supported.")),
|
|
||||||
onRenderContinue(cont) {},
|
|
||||||
cancel() {},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
const ensureNotCancelled = () => {
|
const ensureNotCancelled = () => {
|
||||||
if (cancelled) {
|
if (cancelled) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user