Browse Source

PDF.js version 1.0.169

Yury Delendik 11 years ago
parent
commit
128d2860d8
6 changed files with 50 additions and 26 deletions
  1. 1 1
      bower.json
  2. 17 11
      build/pdf.combined.js
  3. 17 11
      build/pdf.js
  4. 2 2
      build/pdf.worker.js
  5. 1 1
      package.json
  6. 12 0
      web/compatibility.js

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "pdfjs-dist",
   "name": "pdfjs-dist",
-  "version": "1.0.167",
+  "version": "1.0.169",
   "keywords": [
   "keywords": [
     "Mozilla",
     "Mozilla",
     "pdf",
     "pdf",

+ 17 - 11
build/pdf.combined.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 }
 
 
-PDFJS.version = '1.0.167';
-PDFJS.build = 'a26d28a';
+PDFJS.version = '1.0.169';
+PDFJS.build = 'fd4fc89';
 
 
 (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
@@ -5096,6 +5096,10 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
     this.graphicsReady = false;
     this.graphicsReady = false;
     this.cancelled = false;
     this.cancelled = false;
     this.capability = createPromiseCapability();
     this.capability = createPromiseCapability();
+    // caching this-bound methods
+    this._continueBound = this._continue.bind(this);
+    this._scheduleNextBound = this._scheduleNext.bind(this);
+    this._nextBound = this._next.bind(this);
   }
   }
 
 
   InternalRenderTask.prototype = {
   InternalRenderTask.prototype = {
@@ -5134,7 +5138,7 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
     operatorListChanged: function InternalRenderTask_operatorListChanged() {
     operatorListChanged: function InternalRenderTask_operatorListChanged() {
       if (!this.graphicsReady) {
       if (!this.graphicsReady) {
         if (!this.graphicsReadyCallback) {
         if (!this.graphicsReadyCallback) {
-          this.graphicsReadyCallback = this._continue.bind(this);
+          this.graphicsReadyCallback = this._continueBound;
         }
         }
         return;
         return;
       }
       }
@@ -5155,19 +5159,23 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
         return;
         return;
       }
       }
       if (this.params.continueCallback) {
       if (this.params.continueCallback) {
-        this.params.continueCallback(this._next.bind(this));
+        this.params.continueCallback(this._scheduleNextBound);
       } else {
       } else {
-        this._next();
+        this._scheduleNext();
       }
       }
     },
     },
 
 
+    _scheduleNext: function InternalRenderTask__scheduleNext() {
+      window.requestAnimationFrame(this._nextBound);
+    },
+
     _next: function InternalRenderTask__next() {
     _next: function InternalRenderTask__next() {
       if (this.cancelled) {
       if (this.cancelled) {
         return;
         return;
       }
       }
       this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList,
       this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList,
                                         this.operatorListIdx,
                                         this.operatorListIdx,
-                                        this._continue.bind(this),
+                                        this._continueBound,
                                         this.stepper);
                                         this.stepper);
       if (this.operatorListIdx === this.operatorList.argsArray.length) {
       if (this.operatorListIdx === this.operatorList.argsArray.length) {
         this.running = false;
         this.running = false;
@@ -5989,7 +5997,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
       var commonObjs = this.commonObjs;
       var commonObjs = this.commonObjs;
       var objs = this.objs;
       var objs = this.objs;
       var fnId;
       var fnId;
-      var deferred = Promise.resolve();
 
 
       while (true) {
       while (true) {
         if (stepper && i === stepper.nextBreakPoint) {
         if (stepper && i === stepper.nextBreakPoint) {
@@ -6027,11 +6034,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
           return i;
           return i;
         }
         }
 
 
-        // If the execution took longer then a certain amount of time, schedule
-        // to continue exeution after a short delay.
-        // However, this is only possible if a 'continueCallback' is passed in.
+        // If the execution took longer then a certain amount of time and
+        // `continueCallback` is specified, interrupt the execution.
         if (continueCallback && Date.now() > endTime) {
         if (continueCallback && Date.now() > endTime) {
-          deferred.then(continueCallback);
+          continueCallback();
           return i;
           return i;
         }
         }
 
 

+ 17 - 11
build/pdf.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 }
 
 
-PDFJS.version = '1.0.167';
-PDFJS.build = 'a26d28a';
+PDFJS.version = '1.0.169';
+PDFJS.build = 'fd4fc89';
 
 
 (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
@@ -5144,6 +5144,10 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
     this.graphicsReady = false;
     this.graphicsReady = false;
     this.cancelled = false;
     this.cancelled = false;
     this.capability = createPromiseCapability();
     this.capability = createPromiseCapability();
+    // caching this-bound methods
+    this._continueBound = this._continue.bind(this);
+    this._scheduleNextBound = this._scheduleNext.bind(this);
+    this._nextBound = this._next.bind(this);
   }
   }
 
 
   InternalRenderTask.prototype = {
   InternalRenderTask.prototype = {
@@ -5182,7 +5186,7 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
     operatorListChanged: function InternalRenderTask_operatorListChanged() {
     operatorListChanged: function InternalRenderTask_operatorListChanged() {
       if (!this.graphicsReady) {
       if (!this.graphicsReady) {
         if (!this.graphicsReadyCallback) {
         if (!this.graphicsReadyCallback) {
-          this.graphicsReadyCallback = this._continue.bind(this);
+          this.graphicsReadyCallback = this._continueBound;
         }
         }
         return;
         return;
       }
       }
@@ -5203,19 +5207,23 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
         return;
         return;
       }
       }
       if (this.params.continueCallback) {
       if (this.params.continueCallback) {
-        this.params.continueCallback(this._next.bind(this));
+        this.params.continueCallback(this._scheduleNextBound);
       } else {
       } else {
-        this._next();
+        this._scheduleNext();
       }
       }
     },
     },
 
 
+    _scheduleNext: function InternalRenderTask__scheduleNext() {
+      window.requestAnimationFrame(this._nextBound);
+    },
+
     _next: function InternalRenderTask__next() {
     _next: function InternalRenderTask__next() {
       if (this.cancelled) {
       if (this.cancelled) {
         return;
         return;
       }
       }
       this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList,
       this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList,
                                         this.operatorListIdx,
                                         this.operatorListIdx,
-                                        this._continue.bind(this),
+                                        this._continueBound,
                                         this.stepper);
                                         this.stepper);
       if (this.operatorListIdx === this.operatorList.argsArray.length) {
       if (this.operatorListIdx === this.operatorList.argsArray.length) {
         this.running = false;
         this.running = false;
@@ -6037,7 +6045,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
       var commonObjs = this.commonObjs;
       var commonObjs = this.commonObjs;
       var objs = this.objs;
       var objs = this.objs;
       var fnId;
       var fnId;
-      var deferred = Promise.resolve();
 
 
       while (true) {
       while (true) {
         if (stepper && i === stepper.nextBreakPoint) {
         if (stepper && i === stepper.nextBreakPoint) {
@@ -6075,11 +6082,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
           return i;
           return i;
         }
         }
 
 
-        // If the execution took longer then a certain amount of time, schedule
-        // to continue exeution after a short delay.
-        // However, this is only possible if a 'continueCallback' is passed in.
+        // If the execution took longer then a certain amount of time and
+        // `continueCallback` is specified, interrupt the execution.
         if (continueCallback && Date.now() > endTime) {
         if (continueCallback && Date.now() > endTime) {
-          deferred.then(continueCallback);
+          continueCallback();
           return i;
           return i;
         }
         }
 
 

+ 2 - 2
build/pdf.worker.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 }
 
 
-PDFJS.version = '1.0.167';
-PDFJS.build = 'a26d28a';
+PDFJS.version = '1.0.169';
+PDFJS.build = 'fd4fc89';
 
 
 (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.0.167",
+  "version": "1.0.169",
   "description": "Generic build of Mozilla's PDF.js library.",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [
   "keywords": [
     "Mozilla",
     "Mozilla",

+ 12 - 0
web/compatibility.js

@@ -564,3 +564,15 @@ if (typeof PDFJS === 'undefined') {
     console.log('Unable to create polyfill for localStorage');
     console.log('Unable to create polyfill for localStorage');
   }
   }
 })();
 })();
+
+(function checkRequestAnimationFrame() {
+  if ('requestAnimationFrame' in window) {
+    return;
+  }
+  window.requestAnimationFrame =
+    window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame ||
+    window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
+    (function fakeRequestAnimationFrame(callback) {
+      window.setTimeout(callback, 20);
+    });
+})();