Bug 1175142 - Update pdf.js to version 1.1.215. r=Mossop, r=yury

This commit is contained in:
Ryan VanderMeulen 2015-06-16 07:38:00 -04:00
parent b0114fa6de
commit 974d172b7a
7 changed files with 810 additions and 591 deletions

View File

@ -1,3 +1,3 @@
This is the pdf.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.1.165
Current extension version is: 1.1.215

View File

@ -161,7 +161,8 @@ function createNewChannel(uri, node, principal) {
uri: uri,
loadingNode: node,
loadingPrincipal: principal,
contentPolicyType: Ci.nsIContentPolicy.TYPE_OTHER});
contentPolicyType: Ci.nsIContentPolicy.TYPE_OTHER,
});
}
function asyncFetchChannel(channel, callback) {

View File

@ -183,7 +183,8 @@ let PdfjsChromeUtils = {
_findbarFromMessage: function(aMsg) {
let browser = aMsg.target;
let tabbrowser = browser.getTabBrowser();
let tab = tabbrowser.getTabForBrowser(browser);
let tab;
tab = tabbrowser.getTabForBrowser(browser);
return tabbrowser.getFindBar(tab);
},

View File

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.1.165';
PDFJS.build = '39d2103';
PDFJS.version = '1.1.215';
PDFJS.build = 'c9a7498';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -4208,7 +4208,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
}
var name = fontObj.loadedName || 'sans-serif';
var bold = fontObj.black ? (fontObj.bold ? 'bolder' : 'bold') :
var bold = fontObj.black ? (fontObj.bold ? '900' : 'bold') :
(fontObj.bold ? 'bold' : 'normal');
var italic = fontObj.italic ? 'italic' : 'normal';
@ -4468,6 +4468,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
if (isTextInvisible || fontSize === 0) {
return;
}
this.cachedGetSinglePixelWidth = null;
ctx.save();
ctx.transform.apply(ctx, current.textMatrix);

View File

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.1.165';
PDFJS.build = '39d2103';
PDFJS.version = '1.1.215';
PDFJS.build = 'c9a7498';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -2062,17 +2062,33 @@ var Page = (function PageClosure() {
return this.pageDict.get(key);
},
getInheritedPageProp: function Page_inheritPageProp(key) {
var dict = this.pageDict;
var value = dict.get(key);
while (value === undefined) {
dict = dict.get('Parent');
if (!dict) {
getInheritedPageProp: function Page_getInheritedPageProp(key) {
var dict = this.pageDict, valueArray = null, loopCount = 0;
var MAX_LOOP_COUNT = 100;
// Always walk up the entire parent chain, to be able to find
// e.g. \Resources placed on multiple levels of the tree.
while (dict) {
var value = dict.get(key);
if (value) {
if (!valueArray) {
valueArray = [];
}
valueArray.push(value);
}
if (++loopCount > MAX_LOOP_COUNT) {
warn('Page_getInheritedPageProp: maximum loop count exceeded.');
break;
}
value = dict.get(key);
dict = dict.get('Parent');
}
return value;
if (!valueArray) {
return Dict.empty;
}
if (valueArray.length === 1 || !isDict(valueArray[0]) ||
loopCount > MAX_LOOP_COUNT) {
return valueArray[0];
}
return Dict.merge(this.xref, valueArray);
},
get content() {
@ -2080,14 +2096,10 @@ var Page = (function PageClosure() {
},
get resources() {
var value = this.getInheritedPageProp('Resources');
// For robustness: The spec states that a \Resources entry has to be
// present, but can be empty. Some document omit it still. In this case
// return an empty dictionary:
if (value === undefined) {
value = Dict.empty;
}
return shadow(this, 'resources', value);
// present, but can be empty. Some document omit it still, in this case
// we return an empty dictionary.
return shadow(this, 'resources', this.getInheritedPageProp('Resources'));
},
get mediaBox() {
@ -2360,6 +2372,10 @@ var PDFDocument = (function PDFDocumentClosure() {
PDFDocument.prototype = {
parse: function PDFDocument_parse(recoveryMode) {
this.setup(recoveryMode);
var version = this.catalog.catDict.get('Version');
if (isName(version)) {
this.pdfFormatVersion = version.name;
}
try {
// checking if AcroForm is present
this.acroForm = this.catalog.catDict.get('AcroForm');
@ -2461,8 +2477,10 @@ var PDFDocument = (function PDFDocumentClosure() {
}
version += String.fromCharCode(ch);
}
// removing "%PDF-"-prefix
this.pdfFormatVersion = version.substring(5);
if (!this.pdfFormatVersion) {
// removing "%PDF-"-prefix
this.pdfFormatVersion = version.substring(5);
}
return;
}
// May not be a PDF file, continue anyway.
@ -2739,6 +2757,24 @@ var Dict = (function DictClosure() {
Dict.empty = new Dict(null);
Dict.merge = function Dict_merge(xref, dictArray) {
var mergedDict = new Dict(xref);
for (var i = 0, ii = dictArray.length; i < ii; i++) {
var dict = dictArray[i];
if (!isDict(dict)) {
continue;
}
for (var keyName in dict.map) {
if (mergedDict.map[keyName]) {
continue;
}
mergedDict.map[keyName] = dict.map[keyName];
}
}
return mergedDict;
};
return Dict;
})();
@ -5213,7 +5249,10 @@ var PDFFunction = (function PDFFunctionClosure() {
var rmin = encode[2 * i];
var rmax = encode[2 * i + 1];
tmpBuf[0] = rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
// Prevent the value from becoming NaN as a result
// of division by zero (fixes issue6113.pdf).
tmpBuf[0] = dmin === dmax ? rmin :
rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
// call the appropriate function
fns[i](tmpBuf, 0, dest, destOffset);
@ -6222,9 +6261,9 @@ var ColorSpace = (function ColorSpaceClosure() {
error('unrecognized colorspace ' + mode);
}
} else if (isArray(cs)) {
mode = cs[0].name;
mode = xref.fetchIfRef(cs[0]).name;
this.mode = mode;
var numComps, params;
var numComps, params, alt;
switch (mode) {
case 'DeviceGray':
@ -6246,6 +6285,17 @@ var ColorSpace = (function ColorSpaceClosure() {
var stream = xref.fetchIfRef(cs[1]);
var dict = stream.dict;
numComps = dict.get('N');
alt = dict.get('Alternate');
if (alt) {
var altIR = ColorSpace.parseToIR(alt, xref, res);
// Parse the /Alternate CS to ensure that the number of components
// are correct, and also (indirectly) that it is not a PatternCS.
var altCS = ColorSpace.fromIR(altIR);
if (altCS.numComps === numComps) {
return altIR;
}
warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
}
if (numComps === 1) {
return 'DeviceGrayCS';
} else if (numComps === 3) {
@ -6255,7 +6305,7 @@ var ColorSpace = (function ColorSpaceClosure() {
}
break;
case 'Pattern':
var basePatternCS = cs[1];
var basePatternCS = xref.fetchIfRef(cs[1]) || null;
if (basePatternCS) {
basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
}
@ -6278,11 +6328,11 @@ var ColorSpace = (function ColorSpaceClosure() {
} else if (isArray(name)) {
numComps = name.length;
}
var alt = ColorSpace.parseToIR(cs[2], xref, res);
alt = ColorSpace.parseToIR(cs[2], xref, res);
var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
return ['AlternateCS', numComps, alt, tintFnIR];
case 'Lab':
params = cs[1].getAll();
params = xref.fetchIfRef(cs[1]).getAll();
return ['LabCS', params];
default:
error('unimplemented color space object "' + mode + '"');
@ -16333,12 +16383,14 @@ var Font = (function FontClosure() {
case 0x7F: // Control char
case 0xA0: // Non breaking space
case 0xAD: // Soft hyphen
case 0x0E33: // Thai character SARA AM
case 0x2011: // Non breaking hyphen
case 0x205F: // Medium mathematical space
case 0x25CC: // Dotted circle (combining mark)
return true;
}
if ((code & ~0xFF) === 0x0E00) { // Thai/Lao chars (with combining mark)
return true;
}
return false;
}
@ -17762,13 +17814,18 @@ var Font = (function FontClosure() {
}
}
var charCodeToGlyphId = [], charCode, toUnicode = properties.toUnicode;
var charCodeToGlyphId = [], charCode;
var toUnicode = properties.toUnicode, widths = properties.widths;
var isIdentityUnicode = toUnicode instanceof IdentityToUnicodeMap;
function hasGlyph(glyphId, charCode) {
function hasGlyph(glyphId, charCode, widthCode) {
if (!missingGlyphs[glyphId]) {
return true;
}
if (charCode >= 0 && toUnicode.has(charCode)) {
if (!isIdentityUnicode && charCode >= 0 && toUnicode.has(charCode)) {
return true;
}
if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
return true;
}
return false;
@ -17788,7 +17845,7 @@ var Font = (function FontClosure() {
}
if (glyphId >= 0 && glyphId < numGlyphs &&
hasGlyph(glyphId, charCode)) {
hasGlyph(glyphId, charCode, cid)) {
charCodeToGlyphId[charCode] = glyphId;
}
});
@ -17849,18 +17906,19 @@ var Font = (function FontClosure() {
var found = false;
for (i = 0; i < cmapMappingsLength; ++i) {
if (cmapMappings[i].charCode === unicodeOrCharCode &&
hasGlyph(cmapMappings[i].glyphId, unicodeOrCharCode)) {
hasGlyph(cmapMappings[i].glyphId, unicodeOrCharCode, -1)) {
charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
found = true;
break;
}
}
if (!found && properties.glyphNames) {
// Try to map using the post table. There are currently no known
// pdfs that this fixes.
// Try to map using the post table.
var glyphId = properties.glyphNames.indexOf(glyphName);
if (glyphId > 0 && hasGlyph(glyphId, -1)) {
if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
charCodeToGlyphId[charCode] = glyphId;
} else {
charCodeToGlyphId[charCode] = 0; // notdef
}
}
}

View File

@ -803,7 +803,7 @@ html[dir='rtl'] .dropdownToolbarButton {
.dropdownToolbarButton {
width: 120px;
max-width: 120px;
padding: 3px 2px 2px;
padding: 0;
overflow: hidden;
background: url(images/toolbarButton-menuArrows.png) no-repeat;
}
@ -819,7 +819,7 @@ html[dir='rtl'] .dropdownToolbarButton {
font-size: 12px;
color: hsl(0,0%,95%);
margin: 0;
padding: 0;
padding: 3px 2px 2px;
border: none;
background: rgba(0,0,0,0); /* Opera does not support 'transparent' <select> background */
}

File diff suppressed because it is too large Load Diff