зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1550514 - Update pdf.js to version 2.2.167. r=bdahl
This commit is contained in:
Родитель
d4d63edb8f
Коммит
8c6309e4ae
|
@ -1,5 +1,5 @@
|
|||
This is the PDF.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 2.2.160
|
||||
Current extension version is: 2.2.167
|
||||
|
||||
Taken from upstream commit: 155304a0
|
||||
Taken from upstream commit: ca2fee3d
|
||||
|
|
|
@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
"use strict";
|
||||
|
||||
|
||||
var pdfjsVersion = '2.2.160';
|
||||
var pdfjsBuild = '155304a0';
|
||||
var pdfjsVersion = '2.2.167';
|
||||
var pdfjsBuild = 'ca2fee3d';
|
||||
|
||||
var pdfjsSharedUtil = __w_pdfjs_require__(1);
|
||||
|
||||
|
@ -175,6 +175,7 @@ exports.getFilenameFromUrl = pdfjsDisplayDisplayUtils.getFilenameFromUrl;
|
|||
exports.LinkTarget = pdfjsDisplayDisplayUtils.LinkTarget;
|
||||
exports.addLinkAttributes = pdfjsDisplayDisplayUtils.addLinkAttributes;
|
||||
exports.loadScript = pdfjsDisplayDisplayUtils.loadScript;
|
||||
exports.PDFDateString = pdfjsDisplayDisplayUtils.PDFDateString;
|
||||
exports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions;
|
||||
exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityParams;
|
||||
|
||||
|
@ -1303,7 +1304,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
|
|||
|
||||
return worker.messageHandler.sendWithPromise('GetDocRequest', {
|
||||
docId,
|
||||
apiVersion: '2.2.160',
|
||||
apiVersion: '2.2.167',
|
||||
source: {
|
||||
data: source.data,
|
||||
url: source.url,
|
||||
|
@ -3097,9 +3098,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
|
|||
return InternalRenderTask;
|
||||
}();
|
||||
|
||||
const version = '2.2.160';
|
||||
const version = '2.2.167';
|
||||
exports.version = version;
|
||||
const build = '155304a0';
|
||||
const build = 'ca2fee3d';
|
||||
exports.build = build;
|
||||
|
||||
/***/ }),
|
||||
|
@ -3119,7 +3120,7 @@ exports.isValidFetchUrl = isValidFetchUrl;
|
|||
exports.loadScript = loadScript;
|
||||
exports.deprecated = deprecated;
|
||||
exports.releaseImageResources = releaseImageResources;
|
||||
exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0;
|
||||
exports.PDFDateString = exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0;
|
||||
|
||||
var _util = __w_pdfjs_require__(1);
|
||||
|
||||
|
@ -3516,6 +3517,56 @@ function releaseImageResources(img) {
|
|||
img.removeAttribute('src');
|
||||
}
|
||||
|
||||
let pdfDateStringRegex;
|
||||
|
||||
class PDFDateString {
|
||||
static toDateObject(input) {
|
||||
if (!input || !(0, _util.isString)(input)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!pdfDateStringRegex) {
|
||||
pdfDateStringRegex = new RegExp('^D:' + '(\\d{4})' + '(\\d{2})?' + '(\\d{2})?' + '(\\d{2})?' + '(\\d{2})?' + '(\\d{2})?' + '([Z|+|-])?' + '(\\d{2})?' + '\'?' + '(\\d{2})?' + '\'?');
|
||||
}
|
||||
|
||||
const matches = pdfDateStringRegex.exec(input);
|
||||
|
||||
if (!matches) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const year = parseInt(matches[1], 10);
|
||||
let month = parseInt(matches[2], 10);
|
||||
month = month >= 1 && month <= 12 ? month - 1 : 0;
|
||||
let day = parseInt(matches[3], 10);
|
||||
day = day >= 1 && day <= 31 ? day : 1;
|
||||
let hour = parseInt(matches[4], 10);
|
||||
hour = hour >= 0 && hour <= 23 ? hour : 0;
|
||||
let minute = parseInt(matches[5], 10);
|
||||
minute = minute >= 0 && minute <= 59 ? minute : 0;
|
||||
let second = parseInt(matches[6], 10);
|
||||
second = second >= 0 && second <= 59 ? second : 0;
|
||||
const universalTimeRelation = matches[7] || 'Z';
|
||||
let offsetHour = parseInt(matches[8], 10);
|
||||
offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;
|
||||
let offsetMinute = parseInt(matches[9], 10) || 0;
|
||||
offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;
|
||||
|
||||
if (universalTimeRelation === '-') {
|
||||
hour += offsetHour;
|
||||
minute += offsetMinute;
|
||||
} else if (universalTimeRelation === '+') {
|
||||
hour -= offsetHour;
|
||||
minute -= offsetMinute;
|
||||
}
|
||||
|
||||
return new Date(Date.UTC(year, month, day, hour, minute, second));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.PDFDateString = PDFDateString;
|
||||
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/***/ (function(module, exports, __w_pdfjs_require__) {
|
||||
|
@ -8999,6 +9050,7 @@ class AnnotationElement {
|
|||
trigger,
|
||||
color: data.color,
|
||||
title: data.title,
|
||||
modificationDate: data.modificationDate,
|
||||
contents: data.contents,
|
||||
hideWrapper: true
|
||||
});
|
||||
|
@ -9296,6 +9348,7 @@ class PopupAnnotationElement extends AnnotationElement {
|
|||
trigger: parentElement,
|
||||
color: this.data.color,
|
||||
title: this.data.title,
|
||||
modificationDate: this.data.modificationDate,
|
||||
contents: this.data.contents
|
||||
});
|
||||
let parentLeft = parseFloat(parentElement.style.left);
|
||||
|
@ -9314,6 +9367,7 @@ class PopupElement {
|
|||
this.trigger = parameters.trigger;
|
||||
this.color = parameters.color;
|
||||
this.title = parameters.title;
|
||||
this.modificationDate = parameters.modificationDate;
|
||||
this.contents = parameters.contents;
|
||||
this.hideWrapper = parameters.hideWrapper || false;
|
||||
this.pinned = false;
|
||||
|
@ -9336,16 +9390,30 @@ class PopupElement {
|
|||
popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0);
|
||||
}
|
||||
|
||||
let contents = this._formatContents(this.contents);
|
||||
|
||||
let title = document.createElement('h1');
|
||||
title.textContent = this.title;
|
||||
popup.appendChild(title);
|
||||
|
||||
const dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate);
|
||||
|
||||
if (dateObject) {
|
||||
const modificationDate = document.createElement('span');
|
||||
modificationDate.textContent = '{{date}}, {{time}}';
|
||||
modificationDate.dataset.l10nId = 'annotation_date_string';
|
||||
modificationDate.dataset.l10nArgs = JSON.stringify({
|
||||
date: dateObject.toLocaleDateString(),
|
||||
time: dateObject.toLocaleTimeString()
|
||||
});
|
||||
popup.appendChild(modificationDate);
|
||||
}
|
||||
|
||||
let contents = this._formatContents(this.contents);
|
||||
|
||||
popup.appendChild(contents);
|
||||
this.trigger.addEventListener('click', this._toggle.bind(this));
|
||||
this.trigger.addEventListener('mouseover', this._show.bind(this, false));
|
||||
this.trigger.addEventListener('mouseout', this._hide.bind(this, false));
|
||||
popup.addEventListener('click', this._hide.bind(this, true));
|
||||
popup.appendChild(title);
|
||||
popup.appendChild(contents);
|
||||
wrapper.appendChild(popup);
|
||||
return wrapper;
|
||||
}
|
||||
|
|
|
@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
"use strict";
|
||||
|
||||
|
||||
const pdfjsVersion = '2.2.160';
|
||||
const pdfjsBuild = '155304a0';
|
||||
const pdfjsVersion = '2.2.167';
|
||||
const pdfjsBuild = 'ca2fee3d';
|
||||
|
||||
const pdfjsCoreWorker = __w_pdfjs_require__(1);
|
||||
|
||||
|
@ -378,7 +378,7 @@ var WorkerMessageHandler = {
|
|||
var WorkerTasks = [];
|
||||
const verbosity = (0, _util.getVerbosityLevel)();
|
||||
let apiVersion = docParams.apiVersion;
|
||||
let workerVersion = '2.2.160';
|
||||
let workerVersion = '2.2.167';
|
||||
|
||||
if (apiVersion !== workerVersion) {
|
||||
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
||||
|
@ -18318,6 +18318,8 @@ function getTransformMatrix(rect, bbox, matrix) {
|
|||
class Annotation {
|
||||
constructor(params) {
|
||||
let dict = params.dict;
|
||||
this.setCreationDate(dict.get('CreationDate'));
|
||||
this.setModificationDate(dict.get('M'));
|
||||
this.setFlags(dict.get('F'));
|
||||
this.setRectangle(dict.getArray('Rect'));
|
||||
this.setColor(dict.getArray('C'));
|
||||
|
@ -18327,8 +18329,10 @@ class Annotation {
|
|||
annotationFlags: this.flags,
|
||||
borderStyle: this.borderStyle,
|
||||
color: this.color,
|
||||
creationDate: this.creationDate,
|
||||
hasAppearance: !!this.appearance,
|
||||
id: params.id,
|
||||
modificationDate: this.modificationDate,
|
||||
rect: this.rectangle,
|
||||
subtype: params.subtype
|
||||
};
|
||||
|
@ -18362,6 +18366,14 @@ class Annotation {
|
|||
return this._isPrintable(this.flags);
|
||||
}
|
||||
|
||||
setCreationDate(creationDate) {
|
||||
this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
|
||||
}
|
||||
|
||||
setModificationDate(modificationDate) {
|
||||
this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
|
||||
}
|
||||
|
||||
setFlags(flags) {
|
||||
this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
|
||||
}
|
||||
|
@ -18948,6 +18960,20 @@ class PopupAnnotation extends Annotation {
|
|||
this.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || '');
|
||||
this.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || '');
|
||||
|
||||
if (!parentItem.has('CreationDate')) {
|
||||
this.data.creationDate = null;
|
||||
} else {
|
||||
this.setCreationDate(parentItem.get('CreationDate'));
|
||||
this.data.creationDate = this.creationDate;
|
||||
}
|
||||
|
||||
if (!parentItem.has('M')) {
|
||||
this.data.modificationDate = null;
|
||||
} else {
|
||||
this.setModificationDate(parentItem.get('M'));
|
||||
this.data.modificationDate = this.modificationDate;
|
||||
}
|
||||
|
||||
if (!parentItem.has('C')) {
|
||||
this.data.color = null;
|
||||
} else {
|
||||
|
@ -20582,7 +20608,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|||
}
|
||||
},
|
||||
|
||||
handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task) {
|
||||
async handleColorN(operatorList, fn, args, cs, patterns, resources, task) {
|
||||
var patternName = args[args.length - 1];
|
||||
var pattern;
|
||||
|
||||
|
@ -20598,14 +20624,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|||
var matrix = dict.getArray('Matrix');
|
||||
pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory);
|
||||
operatorList.addOp(fn, pattern.getIR());
|
||||
return Promise.resolve();
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return Promise.reject(new Error('Unknown PatternType: ' + typeNum));
|
||||
throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
|
||||
}
|
||||
|
||||
operatorList.addOp(fn, args);
|
||||
return Promise.resolve();
|
||||
throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
|
||||
},
|
||||
|
||||
getOperatorList({
|
||||
|
|
|
@ -222,25 +222,33 @@
|
|||
z-index: 200;
|
||||
max-width: 20em;
|
||||
background-color: #FFFF99;
|
||||
box-shadow: 0px 2px 5px #333;
|
||||
box-shadow: 0px 2px 5px #888;
|
||||
border-radius: 2px;
|
||||
padding: 0.6em;
|
||||
padding: 6px;
|
||||
margin-left: 5px;
|
||||
cursor: pointer;
|
||||
font: message-box;
|
||||
font-size: 9px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.annotationLayer .popup > * {
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.annotationLayer .popup h1 {
|
||||
font-size: 1em;
|
||||
border-bottom: 1px solid #000000;
|
||||
margin: 0;
|
||||
padding-bottom: 0.2em;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.annotationLayer .popup span {
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.annotationLayer .popup p {
|
||||
margin: 0;
|
||||
padding-top: 0.2em;
|
||||
border-top: 1px solid #333;
|
||||
margin-top: 2px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.annotationLayer .highlightAnnotation,
|
||||
|
|
|
@ -4550,10 +4550,10 @@ Object.defineProperty(exports, "__esModule", {
|
|||
});
|
||||
exports.PDFDocumentProperties = void 0;
|
||||
|
||||
var _ui_utils = __webpack_require__(2);
|
||||
|
||||
var _pdfjsLib = __webpack_require__(4);
|
||||
|
||||
var _ui_utils = __webpack_require__(2);
|
||||
|
||||
const DEFAULT_FIELD_CONTENT = '-';
|
||||
const NON_METRIC_LOCALES = ['en-us', 'en-lr', 'my'];
|
||||
const US_PAGE_NAMES = {
|
||||
|
@ -4817,41 +4817,16 @@ class PDFDocumentProperties {
|
|||
}
|
||||
|
||||
_parseDate(inputDate) {
|
||||
if (!inputDate) {
|
||||
return;
|
||||
const dateObject = _pdfjsLib.PDFDateString.toDateObject(inputDate);
|
||||
|
||||
if (dateObject) {
|
||||
const dateString = dateObject.toLocaleDateString();
|
||||
const timeString = dateObject.toLocaleTimeString();
|
||||
return this.l10n.get('document_properties_date_string', {
|
||||
date: dateString,
|
||||
time: timeString
|
||||
}, '{{date}}, {{time}}');
|
||||
}
|
||||
|
||||
let dateToParse = inputDate;
|
||||
|
||||
if (dateToParse.substring(0, 2) === 'D:') {
|
||||
dateToParse = dateToParse.substring(2);
|
||||
}
|
||||
|
||||
let year = parseInt(dateToParse.substring(0, 4), 10);
|
||||
let month = parseInt(dateToParse.substring(4, 6), 10) - 1;
|
||||
let day = parseInt(dateToParse.substring(6, 8), 10);
|
||||
let hours = parseInt(dateToParse.substring(8, 10), 10);
|
||||
let minutes = parseInt(dateToParse.substring(10, 12), 10);
|
||||
let seconds = parseInt(dateToParse.substring(12, 14), 10);
|
||||
let utRel = dateToParse.substring(14, 15);
|
||||
let offsetHours = parseInt(dateToParse.substring(15, 17), 10);
|
||||
let offsetMinutes = parseInt(dateToParse.substring(18, 20), 10);
|
||||
|
||||
if (utRel === '-') {
|
||||
hours += offsetHours;
|
||||
minutes += offsetMinutes;
|
||||
} else if (utRel === '+') {
|
||||
hours -= offsetHours;
|
||||
minutes -= offsetMinutes;
|
||||
}
|
||||
|
||||
let date = new Date(Date.UTC(year, month, day, hours, minutes, seconds));
|
||||
let dateString = date.toLocaleDateString();
|
||||
let timeString = date.toLocaleTimeString();
|
||||
return this.l10n.get('document_properties_date_string', {
|
||||
date: dateString,
|
||||
time: timeString
|
||||
}, '{{date}}, {{time}}');
|
||||
}
|
||||
|
||||
_parseLinearization(isLinearized) {
|
||||
|
|
|
@ -20,7 +20,7 @@ origin:
|
|||
|
||||
# Human-readable identifier for this version/release
|
||||
# Generally "version NNN", "tag SSS", "bookmark SSS"
|
||||
release: version 2.2.160
|
||||
release: version 2.2.167
|
||||
|
||||
# The package's license, where possible using the mnemonic from
|
||||
# https://spdx.org/licenses/
|
||||
|
|
|
@ -226,6 +226,10 @@ invalid_file_error=Invalid or corrupted PDF file.
|
|||
missing_file_error=Missing PDF file.
|
||||
unexpected_response_error=Unexpected server response.
|
||||
|
||||
# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be
|
||||
# replaced by the modification date, and time, of the annotation.
|
||||
annotation_date_string={{date}}, {{time}}
|
||||
|
||||
# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.
|
||||
# "{{type}}" will be replaced with an annotation type from a list defined in
|
||||
# the PDF spec (32000-1:2008 Table 169 – Annotation types).
|
||||
|
|
Загрузка…
Ссылка в новой задаче