Browse Source

PDF.js version 1.1.483

Pdf Bot 9 năm trước cách đây
mục cha
commit
2ed0c5f5de
6 tập tin đã thay đổi với 29 bổ sung21 xóa
  1. 1 1
      bower.json
  2. 2 2
      build/pdf.combined.js
  3. 2 2
      build/pdf.js
  4. 2 2
      build/pdf.worker.js
  5. 1 1
      package.json
  6. 21 13
      web/pdf_viewer.js

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "pdfjs-dist",
   "name": "pdfjs-dist",
-  "version": "1.1.480",
+  "version": "1.1.483",
   "main": [
   "main": [
     "build/pdf.js",
     "build/pdf.js",
     "build/pdf.worker.js"
     "build/pdf.worker.js"

+ 2 - 2
build/pdf.combined.js

@@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 }
 
 
-PDFJS.version = '1.1.480';
-PDFJS.build = '973b15c';
+PDFJS.version = '1.1.483';
+PDFJS.build = '7cdc6f3';
 
 
 (function pdfjsWrapper() {
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
   // Use strict in our context only - users might not want it

+ 2 - 2
build/pdf.js

@@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 }
 
 
-PDFJS.version = '1.1.480';
-PDFJS.build = '973b15c';
+PDFJS.version = '1.1.483';
+PDFJS.build = '7cdc6f3';
 
 
 (function pdfjsWrapper() {
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
   // Use strict in our context only - users might not want it

+ 2 - 2
build/pdf.worker.js

@@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 }
 
 
-PDFJS.version = '1.1.480';
-PDFJS.build = '973b15c';
+PDFJS.version = '1.1.483';
+PDFJS.build = '7cdc6f3';
 
 
 (function pdfjsWrapper() {
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
   // Use strict in our context only - users might not want it

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "pdfjs-dist",
   "name": "pdfjs-dist",
-  "version": "1.1.480",
+  "version": "1.1.483",
   "description": "Generic build of Mozilla's PDF.js library.",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [
   "keywords": [
     "Mozilla",
     "Mozilla",

+ 21 - 13
web/pdf_viewer.js

@@ -972,7 +972,7 @@ var PDFPageView = (function PDFPageViewClosure() {
       }
       }
     },
     },
 
 
-    reset: function PDFPageView_reset(keepAnnotations) {
+    reset: function PDFPageView_reset(keepZoomLayer, keepAnnotations) {
       if (this.renderTask) {
       if (this.renderTask) {
         this.renderTask.cancel();
         this.renderTask.cancel();
       }
       }
@@ -984,12 +984,12 @@ var PDFPageView = (function PDFPageViewClosure() {
       div.style.height = Math.floor(this.viewport.height) + 'px';
       div.style.height = Math.floor(this.viewport.height) + 'px';
 
 
       var childNodes = div.childNodes;
       var childNodes = div.childNodes;
-      var currentZoomLayer = this.zoomLayer || null;
+      var currentZoomLayerNode = (keepZoomLayer && this.zoomLayer) || null;
       var currentAnnotationNode = (keepAnnotations && this.annotationLayer &&
       var currentAnnotationNode = (keepAnnotations && this.annotationLayer &&
                                    this.annotationLayer.div) || null;
                                    this.annotationLayer.div) || null;
       for (var i = childNodes.length - 1; i >= 0; i--) {
       for (var i = childNodes.length - 1; i >= 0; i--) {
         var node = childNodes[i];
         var node = childNodes[i];
-        if (currentZoomLayer === node || currentAnnotationNode === node) {
+        if (currentZoomLayerNode === node || currentAnnotationNode === node) {
           continue;
           continue;
         }
         }
         div.removeChild(node);
         div.removeChild(node);
@@ -1006,7 +1006,7 @@ var PDFPageView = (function PDFPageViewClosure() {
         this.annotationLayer = null;
         this.annotationLayer = null;
       }
       }
 
 
-      if (this.canvas) {
+      if (this.canvas && !currentZoomLayerNode) {
         // Zeroing the width and height causes Firefox to release graphics
         // Zeroing the width and height causes Firefox to release graphics
         // resources immediately, which can greatly reduce memory consumption.
         // resources immediately, which can greatly reduce memory consumption.
         this.canvas.width = 0;
         this.canvas.width = 0;
@@ -1045,19 +1045,21 @@ var PDFPageView = (function PDFPageViewClosure() {
         }
         }
       }
       }
 
 
-      if (this.canvas &&
-          (PDFJS.useOnlyCssZoom ||
-            (this.hasRestrictedScaling && isScalingRestricted))) {
-        this.cssTransform(this.canvas, true);
-        return;
-      } else if (this.canvas && !this.zoomLayer) {
-        this.zoomLayer = this.canvas.parentNode;
-        this.zoomLayer.style.position = 'absolute';
+      if (this.canvas) {
+        if (PDFJS.useOnlyCssZoom ||
+            (this.hasRestrictedScaling && isScalingRestricted)) {
+          this.cssTransform(this.canvas, true);
+          return;
+        }
+        if (!this.zoomLayer) {
+          this.zoomLayer = this.canvas.parentNode;
+          this.zoomLayer.style.position = 'absolute';
+        }
       }
       }
       if (this.zoomLayer) {
       if (this.zoomLayer) {
         this.cssTransform(this.zoomLayer.firstChild);
         this.cssTransform(this.zoomLayer.firstChild);
       }
       }
-      this.reset(true);
+      this.reset(/* keepZoomLayer = */ true, /* keepAnnotations = */ true);
     },
     },
 
 
     /**
     /**
@@ -1266,6 +1268,12 @@ var PDFPageView = (function PDFPageViewClosure() {
         }
         }
 
 
         if (self.zoomLayer) {
         if (self.zoomLayer) {
+          // Zeroing the width and height causes Firefox to release graphics
+          // resources immediately, which can greatly reduce memory consumption.
+          var zoomLayerCanvas = self.zoomLayer.firstChild;
+          zoomLayerCanvas.width = 0;
+          zoomLayerCanvas.height = 0;
+
           div.removeChild(self.zoomLayer);
           div.removeChild(self.zoomLayer);
           self.zoomLayer = null;
           self.zoomLayer = null;
         }
         }