mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Limit more SVG-specific code to the GENERIC viewer
Given that the SVG back-end is not defined anywhere except in GENERIC builds, we can remove a little bit more unnecessary code in e.g. the Firefox PDF Viewer.
This commit is contained in:
parent
90bf659b29
commit
290aeaf755
2 changed files with 23 additions and 6 deletions
15
web/app.js
15
web/app.js
|
@ -1795,10 +1795,17 @@ const PDFViewerApplication = {
|
|||
this.pdfViewer.cleanup();
|
||||
this.pdfThumbnailViewer.cleanup();
|
||||
|
||||
// We don't want to remove fonts used by active page SVGs.
|
||||
this.pdfDocument.cleanup(
|
||||
/* keepLoadedFonts = */ this.pdfViewer.renderer === RendererType.SVG
|
||||
);
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || GENERIC")
|
||||
) {
|
||||
// We don't want to remove fonts used by active page SVGs.
|
||||
this.pdfDocument.cleanup(
|
||||
/* keepLoadedFonts = */ this.pdfViewer.renderer === RendererType.SVG
|
||||
);
|
||||
} else {
|
||||
this.pdfDocument.cleanup();
|
||||
}
|
||||
},
|
||||
|
||||
forceRendering() {
|
||||
|
|
|
@ -344,7 +344,11 @@ class PDFPageView {
|
|||
}
|
||||
this._resetZoomLayer();
|
||||
}
|
||||
if (this.svg) {
|
||||
if (
|
||||
(typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||
this.svg
|
||||
) {
|
||||
this.paintedViewportMap.delete(this.svg);
|
||||
delete this.svg;
|
||||
}
|
||||
|
@ -380,7 +384,11 @@ class PDFPageView {
|
|||
docStyle.setProperty("--scale-factor", this.viewport.scale);
|
||||
}
|
||||
|
||||
if (this.svg) {
|
||||
if (
|
||||
(typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||
this.svg
|
||||
) {
|
||||
this.cssTransform({
|
||||
target: this.svg,
|
||||
redrawAnnotationLayer: true,
|
||||
|
@ -733,6 +741,8 @@ class PDFPageView {
|
|||
};
|
||||
|
||||
const paintTask =
|
||||
(typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||
this.renderer === RendererType.SVG
|
||||
? this.paintOnSvg(canvasWrapper)
|
||||
: this.paintOnCanvas(canvasWrapper);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue