mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Merge remote-tracking branch 'mozilla/master' into mergexref-1
Conflicts: src/core.js src/evaluator.js src/obj.js
This commit is contained in:
commit
cea388201d
18 changed files with 1581 additions and 1589 deletions
46
src/core.js
46
src/core.js
|
@ -72,10 +72,10 @@ var Page = (function PageClosure() {
|
|||
}
|
||||
|
||||
Page.prototype = {
|
||||
getPageProp: function pageGetPageProp(key) {
|
||||
getPageProp: function Page_getPageProp(key) {
|
||||
return this.pageDict.get(key);
|
||||
},
|
||||
inheritPageProp: function pageInheritPageProp(key) {
|
||||
inheritPageProp: function Page_inheritPageProp(key) {
|
||||
var dict = this.pageDict;
|
||||
var obj = dict.get(key);
|
||||
while (obj === undefined) {
|
||||
|
@ -170,8 +170,8 @@ var Page = (function PageClosure() {
|
|||
return shadow(this, 'rotate', rotate);
|
||||
},
|
||||
|
||||
startRenderingFromOperatorList: function pageStartRenderingFromOperatorList(
|
||||
operatorList, fonts) {
|
||||
startRenderingFromOperatorList:
|
||||
function Page_startRenderingFromOperatorList(operatorList, fonts) {
|
||||
var self = this;
|
||||
this.operatorList = operatorList;
|
||||
|
||||
|
@ -190,7 +190,7 @@ var Page = (function PageClosure() {
|
|||
);
|
||||
},
|
||||
|
||||
getOperatorList: function pageGetOperatorList(handler, dependency) {
|
||||
getOperatorList: function Page_getOperatorList(handler, dependency) {
|
||||
if (this.operatorList) {
|
||||
// content was compiled
|
||||
return this.operatorList;
|
||||
|
@ -220,7 +220,7 @@ var Page = (function PageClosure() {
|
|||
return this.operatorList;
|
||||
},
|
||||
|
||||
ensureFonts: function pageEnsureFonts(fonts, callback) {
|
||||
ensureFonts: function Page_ensureFonts(fonts, callback) {
|
||||
this.stats.time('Font Loading');
|
||||
// Convert the font names to the corresponding font obj.
|
||||
for (var i = 0, ii = fonts.length; i < ii; i++) {
|
||||
|
@ -238,7 +238,7 @@ var Page = (function PageClosure() {
|
|||
);
|
||||
},
|
||||
|
||||
display: function pageDisplay(gfx, callback) {
|
||||
display: function Page_display(gfx, callback) {
|
||||
var stats = this.stats;
|
||||
stats.time('Rendering');
|
||||
var xref = this.xref;
|
||||
|
@ -276,7 +276,7 @@ var Page = (function PageClosure() {
|
|||
}
|
||||
next();
|
||||
},
|
||||
rotatePoint: function pageRotatePoint(x, y, reverse) {
|
||||
rotatePoint: function Page_rotatePoint(x, y, reverse) {
|
||||
var rotate = reverse ? (360 - this.rotate) : this.rotate;
|
||||
switch (rotate) {
|
||||
case 180:
|
||||
|
@ -291,7 +291,7 @@ var Page = (function PageClosure() {
|
|||
return {x: x, y: this.height - y};
|
||||
}
|
||||
},
|
||||
getLinks: function pageGetLinks() {
|
||||
getLinks: function Page_getLinks() {
|
||||
var links = [];
|
||||
var annotations = pageGetAnnotations();
|
||||
var i, n = annotations.length;
|
||||
|
@ -302,7 +302,7 @@ var Page = (function PageClosure() {
|
|||
}
|
||||
return links;
|
||||
},
|
||||
getAnnotations: function pageGetAnnotations() {
|
||||
getAnnotations: function Page_getAnnotations() {
|
||||
var xref = this.xref;
|
||||
function getInheritableProperty(annotation, name) {
|
||||
var item = annotation;
|
||||
|
@ -434,7 +434,7 @@ var Page = (function PageClosure() {
|
|||
}
|
||||
return items;
|
||||
},
|
||||
startRendering: function pageStartRendering(ctx, callback, textLayer) {
|
||||
startRendering: function Page_startRendering(ctx, callback, textLayer) {
|
||||
var stats = this.stats;
|
||||
stats.time('Overall');
|
||||
// If there is no displayReadyPromise yet, then the operatorList was never
|
||||
|
@ -571,7 +571,7 @@ var PDFDocModel = (function PDFDocModelClosure() {
|
|||
},
|
||||
// Find the header, remove leading garbage and setup the stream
|
||||
// starting from the header.
|
||||
checkHeader: function pdfDocCheckHeader() {
|
||||
checkHeader: function PDFDocModel_checkHeader() {
|
||||
var stream = this.stream;
|
||||
stream.reset();
|
||||
if (find(stream, '%PDF-', 1024)) {
|
||||
|
@ -581,7 +581,7 @@ var PDFDocModel = (function PDFDocModelClosure() {
|
|||
}
|
||||
// May not be a PDF file, continue anyway.
|
||||
},
|
||||
setup: function pdfDocSetup(ownerPassword, userPassword) {
|
||||
setup: function PDFDocModel_setup(ownerPassword, userPassword) {
|
||||
this.checkHeader();
|
||||
var xref = new XRef(this.stream,
|
||||
this.startXRef,
|
||||
|
@ -595,14 +595,14 @@ var PDFDocModel = (function PDFDocModelClosure() {
|
|||
// shadow the prototype getter
|
||||
return shadow(this, 'numPages', num);
|
||||
},
|
||||
getDocumentInfo: function pdfDocGetDocumentInfo() {
|
||||
getDocumentInfo: function PDFDocModel_getDocumentInfo() {
|
||||
var info;
|
||||
if (this.xref.trailer.has('Info'))
|
||||
info = this.xref.trailer.get('Info');
|
||||
|
||||
return shadow(this, 'getDocumentInfo', info);
|
||||
},
|
||||
getFingerprint: function pdfDocGetFingerprint() {
|
||||
getFingerprint: function PDFDocModel_getFingerprint() {
|
||||
var xref = this.xref, fileID;
|
||||
if (xref.trailer.has('ID')) {
|
||||
fileID = '';
|
||||
|
@ -623,7 +623,7 @@ var PDFDocModel = (function PDFDocModelClosure() {
|
|||
|
||||
return shadow(this, 'getFingerprint', fileID);
|
||||
},
|
||||
getPage: function pdfDocGetPage(n) {
|
||||
getPage: function PDFDocModel_getPage(n) {
|
||||
return this.catalog.getPage(n);
|
||||
}
|
||||
};
|
||||
|
@ -712,13 +712,13 @@ var PDFDoc = (function PDFDocClosure() {
|
|||
}
|
||||
|
||||
PDFDoc.prototype = {
|
||||
setupFakeWorker: function() {
|
||||
setupFakeWorker: function PDFDoc_setupFakeWorker() {
|
||||
// If we don't use a worker, just post/sendMessage to the main thread.
|
||||
var fakeWorker = {
|
||||
postMessage: function pdfDocPostMessage(obj) {
|
||||
postMessage: function PDFDoc_postMessage(obj) {
|
||||
fakeWorker.onmessage({data: obj});
|
||||
},
|
||||
terminate: function pdfDocTerminate() {}
|
||||
terminate: function PDFDoc_terminate() {}
|
||||
};
|
||||
|
||||
var messageHandler = new MessageHandler('main', fakeWorker);
|
||||
|
@ -730,7 +730,7 @@ var PDFDoc = (function PDFDocClosure() {
|
|||
},
|
||||
|
||||
|
||||
setupMessageHandler: function(messageHandler) {
|
||||
setupMessageHandler: function PDFDoc_setupMessageHandler(messageHandler) {
|
||||
this.messageHandler = messageHandler;
|
||||
|
||||
messageHandler.on('page', function pdfDocPage(data) {
|
||||
|
@ -829,7 +829,7 @@ var PDFDoc = (function PDFDocClosure() {
|
|||
return this.pdfModel.numPages;
|
||||
},
|
||||
|
||||
startRendering: function pdfDocStartRendering(page) {
|
||||
startRendering: function PDFDoc_startRendering(page) {
|
||||
// The worker might not be ready to receive the page request yet.
|
||||
this.workerReadyPromise.then(function pdfDocStartRenderingThen() {
|
||||
page.stats.time('Page Request');
|
||||
|
@ -837,7 +837,7 @@ var PDFDoc = (function PDFDocClosure() {
|
|||
}.bind(this));
|
||||
},
|
||||
|
||||
getPage: function pdfDocGetPage(n) {
|
||||
getPage: function PDFDoc_getPage(n) {
|
||||
if (this.pageCache[n])
|
||||
return this.pageCache[n];
|
||||
|
||||
|
@ -849,7 +849,7 @@ var PDFDoc = (function PDFDocClosure() {
|
|||
return (this.pageCache[n] = page);
|
||||
},
|
||||
|
||||
destroy: function pdfDocDestroy() {
|
||||
destroy: function PDFDoc_destroy() {
|
||||
if (this.worker)
|
||||
this.worker.terminate();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue