[Pkg-javascript-commits] [pdf.js] 188/246: Minor changes for api.js, font_loader.js and svg.js
David Prévot
taffit at moszumanska.debian.org
Sun Sep 7 15:36:39 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 6d53fc4db7022cc3bade725a360da2def09adc78
Author: pramodhkp <prmdh1 at gmail.com>
Date: Thu Aug 14 00:29:28 2014 +0530
Minor changes for api.js, font_loader.js and svg.js
---
examples/svgviewer/viewer.js | 11 ++---------
src/display/api.js | 2 +-
src/display/font_loader.js | 3 +++
src/display/svg.js | 9 +++++----
4 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/examples/svgviewer/viewer.js b/examples/svgviewer/viewer.js
index e05807a..90d8de3 100644
--- a/examples/svgviewer/viewer.js
+++ b/examples/svgviewer/viewer.js
@@ -46,17 +46,10 @@ PDFJS.getDocument(url).then(function(pdf) {
container.style.height = viewport.height + 'px';
anchor.appendChild(container);
- var renderContext = {
- viewport: viewport,
- pageNum: pageNum,
- container: container
- };
- // the next page fetch will start only after this page rendering is done
return page.getOperatorList().then(function (opList) {
- var svgGfx = new SVGGraphics(page.commonObjs, page.objs);
+ var svgGfx = new PDFJS.SVGGraphics(page.commonObjs, page.objs);
return svgGfx.loadDependencies(opList).then(function (values) {
- return svgGfx.beginDrawing(renderContext.viewport,
- renderContext.pageNum, renderContext.container, opList);
+ container.appendChild(svgGfx.getSVG(viewport, pageNum, opList));
});
});
});
diff --git a/src/display/api.js b/src/display/api.js
index ed58657..a2d9823 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -992,7 +992,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
messageHandler.on('PageError', function transportError(data) {
var page = this.pageCache[data.pageNum - 1];
var intentState = page.intentStates[data.intent];
- if (intentState.displayReadyCapability.promise) {
+ if (intentState.displayReadyCapability) {
intentState.displayReadyCapability.reject(data.error);
} else {
error(data.error);
diff --git a/src/display/font_loader.js b/src/display/font_loader.js
index 2083ea7..105ed83 100644
--- a/src/display/font_loader.js
+++ b/src/display/font_loader.js
@@ -91,6 +91,9 @@ var FontLoader = {
return true;
}
// TODO other browsers
+ if (userAgent === 'node') {
+ return true;
+ }
return false;
})(),
diff --git a/src/display/svg.js b/src/display/svg.js
index 52bd230..124861a 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -431,10 +431,8 @@ var SVGGraphics = (function SVGGraphicsClosure() {
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
},
- beginDrawing: function SVGGraphics_beginDrawing(viewport, pageNum,
- container, operatorList) {
+ getSVG: function SVGGraphics_getSVG(viewport, pageNum, operatorList) {
this.svg = createScratchSVG(viewport.width, viewport.height);
- this.container = container;
this.viewport = viewport;
this.transformMatrix = IDENTITY_MATRIX;
this.pgrp = document.createElementNS(NS, 'svg:g'); // Parent group
@@ -445,9 +443,9 @@ var SVGGraphics = (function SVGGraphicsClosure() {
this.pgrp.appendChild(this.defs);
this.pgrp.appendChild(this.tgrp);
this.svg.appendChild(this.pgrp);
- this.container.appendChild(this.svg);
var opTree = this.convertOpList(operatorList);
this.executeOpTree(opTree);
+ return this.svg;
},
convertOpList: function SVGGraphics_convertOpList(operatorList) {
@@ -1114,3 +1112,6 @@ var SVGGraphics = (function SVGGraphicsClosure() {
};
return SVGGraphics;
})();
+
+PDFJS.SVGGraphics = SVGGraphics;
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list