Bug 1764886 - Update pdf.js to version 2.14.171 r=pdfjs-reviewers,marco

Differential Revision: https://phabricator.services.mozilla.com/D143819
This commit is contained in:
Calixte 2022-04-15 12:50:55 +00:00
Родитель ff61b6f5ba
Коммит addedf097a
10 изменённых файлов: 1216 добавлений и 813 удалений

Просмотреть файл

@ -65,6 +65,12 @@ let whitelist = [
errorMessage: /Unknown property text-size-adjust\. {2}Declaration dropped\./i,
isFromDevTools: false,
},
// PDF.js uses a property that is currently only supported in chrome.
{
sourceName: /web\/viewer\.css$/i,
errorMessage: /Unknown property forced-color-adjust\. {2}Declaration dropped\./i,
isFromDevTools: false,
},
{
sourceName: /overlay\.css$/i,
errorMessage: /Unknown pseudo-class.*moz-native-anonymous/i,
@ -142,7 +148,6 @@ let propNameWhitelist = [
// This variable is used from CSS embedded in JS in pdf.js
{ propName: "--zoom-factor", isFromDevTools: false },
{ propName: "--viewport-scale-factor", isFromDevTools: false },
];
// Add suffix to stylesheets' URI so that we always load them here and

Просмотреть файл

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.14.102
Current extension version is: 2.14.171
Taken from upstream commit: db4f3adc5
Taken from upstream commit: 3f5c31e20

Просмотреть файл

@ -29,7 +29,7 @@
exports["pdfjs-dist/build/pdf"] = factory();
else
root["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory();
})(this, function() {
})(this, () => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
@ -42,7 +42,7 @@ return /******/ (() => { // webpackBootstrap
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
exports.arrayByteLength = arrayByteLength;
exports.arraysToBytes = arraysToBytes;
exports.assert = assert;
@ -698,14 +698,6 @@ function isLittleEndian() {
return view32[0] === 1;
}
const IsLittleEndianCached = {
get value() {
return shadow(this, "value", isLittleEndian());
}
};
exports.IsLittleEndianCached = IsLittleEndianCached;
function isEvalSupported() {
try {
new Function("");
@ -715,13 +707,22 @@ function isEvalSupported() {
}
}
const IsEvalSupportedCached = {
get value() {
return shadow(this, "value", isEvalSupported());
class FeatureTest {
static get isLittleEndian() {
return shadow(this, "isLittleEndian", isLittleEndian());
}
};
exports.IsEvalSupportedCached = IsEvalSupportedCached;
static get isEvalSupported() {
return shadow(this, "isEvalSupported", isEvalSupported());
}
static get isOffscreenCanvasSupported() {
return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
}
}
exports.FeatureTest = FeatureTest;
const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
class Util {
@ -1059,19 +1060,19 @@ var _annotation_storage = __w_pdfjs_require__(9);
var _canvas = __w_pdfjs_require__(10);
var _worker_options = __w_pdfjs_require__(12);
var _worker_options = __w_pdfjs_require__(13);
var _is_node = __w_pdfjs_require__(3);
var _message_handler = __w_pdfjs_require__(13);
var _message_handler = __w_pdfjs_require__(14);
var _metadata = __w_pdfjs_require__(14);
var _metadata = __w_pdfjs_require__(15);
var _optional_content_config = __w_pdfjs_require__(15);
var _optional_content_config = __w_pdfjs_require__(16);
var _transport_stream = __w_pdfjs_require__(16);
var _transport_stream = __w_pdfjs_require__(17);
var _xfa_text = __w_pdfjs_require__(17);
var _xfa_text = __w_pdfjs_require__(18);
const DEFAULT_RANGE_CHUNK_SIZE = 65536;
const RENDERING_CANCELLED_TIMEOUT = 100;
@ -1297,7 +1298,7 @@ async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", {
docId,
apiVersion: '2.14.102',
apiVersion: '2.14.171',
source: {
data: source.data,
url: source.url,
@ -1584,6 +1585,7 @@ class PDFPageProxy {
this._pdfBug = pdfBug;
this.commonObjs = transport.commonObjs;
this.objs = new PDFObjects();
this._bitmaps = new Set();
this.cleanupAfterRender = false;
this.pendingCleanup = false;
this._intentStates = new Map();
@ -1899,6 +1901,12 @@ class PDFPageProxy {
this.objs.clear();
for (const bitmap of this._bitmaps) {
bitmap.close();
}
this._bitmaps.clear();
this._annotationPromises.clear();
this._jsActionsPromise = null;
@ -1939,6 +1947,12 @@ class PDFPageProxy {
this._stats = new _display_utils.StatTimer();
}
for (const bitmap of this._bitmaps) {
bitmap.close();
}
this._bitmaps.clear();
this.pendingCleanup = false;
return true;
}
@ -2786,8 +2800,25 @@ class WorkerTransport {
pageProxy.objs.resolve(id, imageData);
const MAX_IMAGE_SIZE_TO_STORE = 8000000;
if (imageData?.data?.length > MAX_IMAGE_SIZE_TO_STORE) {
pageProxy.cleanupAfterRender = true;
if (imageData) {
let length;
if (imageData.bitmap) {
const {
bitmap,
width,
height
} = imageData;
length = width * height * 4;
pageProxy._bitmaps.add(bitmap);
} else {
length = imageData.data?.length || 0;
}
if (length > MAX_IMAGE_SIZE_TO_STORE) {
pageProxy.cleanupAfterRender = true;
}
}
break;
@ -3287,9 +3318,9 @@ class InternalRenderTask {
}
const version = '2.14.102';
const version = '2.14.171';
exports.version = version;
const build = 'db4f3adc5';
const build = '3f5c31e20';
exports.build = build;
/***/ }),
@ -4139,7 +4170,7 @@ class FontFaceObject {
return this.compiledGlyphs[character] = function (c, size) {};
}
if (this.isEvalSupported && _util.IsEvalSupportedCached.value) {
if (this.isEvalSupported && _util.FeatureTest.isEvalSupported) {
const jsBuf = [];
for (const current of cmds) {
@ -4317,6 +4348,8 @@ var _util = __w_pdfjs_require__(1);
var _pattern_helper = __w_pdfjs_require__(11);
var _image_utils = __w_pdfjs_require__(12);
var _display_utils = __w_pdfjs_require__(5);
const MIN_FONT_SIZE = 16;
@ -4926,7 +4959,7 @@ function putBinaryImageData(ctx, imgData, transferMaps = null) {
const dest32DataLength = dest32.length;
const fullSrcDiff = width + 7 >> 3;
let white = 0xffffffff;
let black = _util.IsLittleEndianCached.value ? 0xff000000 : 0x000000ff;
let black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
if (transferMapGray) {
if (transferMapGray[0] === 0xff && transferMapGray[0xff] === 0) {
@ -5070,6 +5103,11 @@ function putBinaryImageData(ctx, imgData, transferMaps = null) {
}
function putBinaryImageMask(ctx, imgData) {
if (imgData.bitmap) {
ctx.drawImage(imgData.bitmap, 0, 0);
return;
}
const height = imgData.height,
width = imgData.width;
const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
@ -5082,24 +5120,15 @@ function putBinaryImageMask(ctx, imgData) {
for (let i = 0; i < totalChunks; i++) {
const thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
let destPos = 3;
for (let j = 0; j < thisChunkHeight; j++) {
let elem,
mask = 0;
for (let k = 0; k < width; k++) {
if (!mask) {
elem = src[srcPos++];
mask = 128;
}
dest[destPos] = elem & mask ? 0 : 255;
destPos += 4;
mask >>= 1;
}
}
({
srcPos
} = (0, _image_utils.applyMaskImageData)({
src,
srcPos,
dest,
width,
height: thisChunkHeight
}));
ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
}
}
@ -5287,6 +5316,14 @@ class CanvasGraphics {
this._cachedGetSinglePixelWidth = null;
}
getObject(data, fallback = null) {
if (typeof data === "string") {
return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
}
return fallback;
}
beginDrawing({
transform,
viewport,
@ -6616,8 +6653,9 @@ class CanvasGraphics {
canvas,
context
} = this.annotationCanvas;
canvas.style.width = `calc(${width}px * var(--viewport-scale-factor))`;
canvas.style.height = `calc(${height}px * var(--viewport-scale-factor))`;
const viewportScaleFactorStr = `var(--zoom-factor) * ${_display_utils.PixelsPerInch.PDF_TO_CSS_UNITS}`;
canvas.style.width = `calc(${width}px * ${viewportScaleFactorStr})`;
canvas.style.height = `calc(${height}px * ${viewportScaleFactorStr})`;
this.annotationCanvasMap.set(id, canvas);
this.annotationCanvas.savedCtx = this.ctx;
this.ctx = context;
@ -6652,6 +6690,7 @@ class CanvasGraphics {
return;
}
img = this.getObject(img.data, img);
const ctx = this.ctx;
const width = img.width,
height = img.height;
@ -6684,17 +6723,18 @@ class CanvasGraphics {
this.compose();
}
paintImageMaskXObjectRepeat(imgData, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
paintImageMaskXObjectRepeat(img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
if (!this.contentVisible) {
return;
}
img = this.getObject(img.data, img);
const ctx = this.ctx;
ctx.save();
const currentTransform = ctx.mozCurrentTransform;
ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
const mask = this._createMaskCanvas(imgData);
const mask = this._createMaskCanvas(img);
ctx.setTransform(1, 0, 0, 1, 0, 0);
@ -6746,7 +6786,7 @@ class CanvasGraphics {
return;
}
const imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId);
const imgData = this.getObject(objId);
if (!imgData) {
(0, _util.warn)("Dependent image isn't ready yet");
@ -6761,7 +6801,7 @@ class CanvasGraphics {
return;
}
const imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId);
const imgData = this.getObject(objId);
if (!imgData) {
(0, _util.warn)("Dependent image isn't ready yet");
@ -7609,6 +7649,65 @@ exports.TilingPattern = TilingPattern;
/***/ }),
/* 12 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.applyMaskImageData = applyMaskImageData;
var _util = __w_pdfjs_require__(1);
function applyMaskImageData({
src,
srcPos = 0,
dest,
destPos = 0,
width,
height,
inverseDecode = false
}) {
const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
const widthInSource = width >> 3;
const widthRemainder = width & 7;
const srcLength = src.length;
dest = new Uint32Array(dest.buffer);
for (let i = 0; i < height; i++) {
for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
const elem = srcPos < srcLength ? src[srcPos] : 255;
dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
}
if (widthRemainder === 0) {
continue;
}
const elem = srcPos < srcLength ? src[srcPos++] : 255;
for (let j = 0; j < widthRemainder; j++) {
dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
}
}
return {
srcPos,
destPos
};
}
/***/ }),
/* 13 */
/***/ ((__unused_webpack_module, exports) => {
@ -7623,7 +7722,7 @@ GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ?
GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? "" : GlobalWorkerOptions.workerSrc;
/***/ }),
/* 13 */
/* 14 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8109,7 +8208,7 @@ class MessageHandler {
exports.MessageHandler = MessageHandler;
/***/ }),
/* 14 */
/* 15 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8154,7 +8253,7 @@ class Metadata {
exports.Metadata = Metadata;
/***/ }),
/* 15 */
/* 16 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8375,7 +8474,7 @@ class OptionalContentConfig {
exports.OptionalContentConfig = OptionalContentConfig;
/***/ }),
/* 16 */
/* 17 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8730,7 +8829,7 @@ class PDFDataTransportStreamRangeReader {
}
/***/ }),
/* 17 */
/* 18 */
/***/ ((__unused_webpack_module, exports) => {
@ -8794,7 +8893,7 @@ class XfaText {
exports.XfaText = XfaText;
/***/ }),
/* 18 */
/* 19 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8810,9 +8909,9 @@ var _display_utils = __w_pdfjs_require__(5);
var _annotation_storage = __w_pdfjs_require__(9);
var _scripting_utils = __w_pdfjs_require__(19);
var _scripting_utils = __w_pdfjs_require__(20);
var _xfa_layer = __w_pdfjs_require__(20);
var _xfa_layer = __w_pdfjs_require__(21);
const DEFAULT_TAB_INDEX = 1000;
const GetElementsByNameSet = new WeakSet();
@ -10032,8 +10131,8 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
this.container.className = "choiceWidgetAnnotation";
const storage = this.annotationStorage;
const id = this.data.id;
storage.getValue(id, {
value: this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : undefined
const storedData = storage.getValue(id, {
value: this.data.fieldValue
});
let {
fontSize
@ -10077,7 +10176,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
optionElement.style.fontSize = fontSizeStyle;
}
if (this.data.fieldValue.includes(option.exportValue)) {
if (storedData.value.includes(option.exportValue)) {
optionElement.setAttribute("selected", true);
}
@ -10246,7 +10345,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
} else {
selectElement.addEventListener("input", function (event) {
storage.setValue(id, {
value: getValue(event)
value: getValue(event, true)
});
});
}
@ -11002,7 +11101,7 @@ class AnnotationLayer {
exports.AnnotationLayer = AnnotationLayer;
/***/ }),
/* 19 */
/* 20 */
/***/ ((__unused_webpack_module, exports) => {
@ -11070,7 +11169,7 @@ class ColorConverters {
exports.ColorConverters = ColorConverters;
/***/ }),
/* 20 */
/* 21 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -11080,7 +11179,7 @@ Object.defineProperty(exports, "__esModule", ({
}));
exports.XfaLayer = void 0;
var _xfa_text = __w_pdfjs_require__(17);
var _xfa_text = __w_pdfjs_require__(18);
class XfaLayer {
static setupStorage(html, id, element, storage, intent) {
@ -11318,7 +11417,7 @@ class XfaLayer {
exports.XfaLayer = XfaLayer;
/***/ }),
/* 21 */
/* 22 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -12100,7 +12199,7 @@ function renderTextLayer(renderParameters) {
}
/***/ }),
/* 22 */
/* 23 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -12367,20 +12466,20 @@ var _api = __w_pdfjs_require__(4);
var _display_utils = __w_pdfjs_require__(5);
var _annotation_layer = __w_pdfjs_require__(18);
var _annotation_layer = __w_pdfjs_require__(19);
var _worker_options = __w_pdfjs_require__(12);
var _worker_options = __w_pdfjs_require__(13);
var _is_node = __w_pdfjs_require__(3);
var _text_layer = __w_pdfjs_require__(21);
var _text_layer = __w_pdfjs_require__(22);
var _svg = __w_pdfjs_require__(22);
var _svg = __w_pdfjs_require__(23);
var _xfa_layer = __w_pdfjs_require__(20);
var _xfa_layer = __w_pdfjs_require__(21);
const pdfjsVersion = '2.14.102';
const pdfjsBuild = 'db4f3adc5';
const pdfjsVersion = '2.14.171';
const pdfjsBuild = '3f5c31e20';
;
})();

Просмотреть файл

@ -29,7 +29,7 @@
exports["pdfjs-dist/build/pdf.scripting"] = factory();
else
root.pdfjsScripting = factory();
})(this, function() {
})(this, () => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
@ -641,7 +641,12 @@ class Field extends _pdf_object.PDFObject {
if (this._isChoice) {
if (this.multipleSelection) {
const values = new Set(value);
this._currentValueIndices.length = 0;
if (Array.isArray(this._currentValueIndices)) {
this._currentValueIndices.length = 0;
} else {
this._currentValueIndices = [];
}
this._items.forEach(({
displayValue
@ -2614,6 +2619,10 @@ class EventDispatcher {
mergeChange(event) {
let value = event.value;
if (Array.isArray(value)) {
return value;
}
if (typeof value !== "string") {
value = value.toString();
}
@ -4947,8 +4956,8 @@ Object.defineProperty(exports, "initSandbox", ({
var _initialization = __w_pdfjs_require__(1);
const pdfjsVersion = '2.14.102';
const pdfjsBuild = 'db4f3adc5';
const pdfjsVersion = '2.14.171';
const pdfjsBuild = '3f5c31e20';
})();
/******/ return __webpack_exports__;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -13,10 +13,9 @@
* limitations under the License.
*/
"use strict";
let opMap;
// eslint-disable-next-line no-var
var FontInspector = (function FontInspectorClosure() {
const FontInspector = (function FontInspectorClosure() {
let fonts;
let active = false;
const fontAttribute = "data-font-name";
@ -49,8 +48,7 @@ var FontInspector = (function FontInspectorClosure() {
}
const fontName = e.target.dataset.fontName;
const selects = document.getElementsByTagName("input");
for (let i = 0; i < selects.length; ++i) {
const select = selects[i];
for (const select of selects) {
if (select.dataset.fontName !== fontName) {
continue;
}
@ -65,7 +63,7 @@ var FontInspector = (function FontInspectorClosure() {
name: "Font Inspector",
panel: null,
manager: null,
init: function init(pdfjsLib) {
init(pdfjsLib) {
const panel = this.panel;
const tmp = document.createElement("button");
tmp.addEventListener("click", resetSelection);
@ -75,7 +73,7 @@ var FontInspector = (function FontInspectorClosure() {
fonts = document.createElement("div");
panel.appendChild(fonts);
},
cleanup: function cleanup() {
cleanup() {
fonts.textContent = "";
},
enabled: false,
@ -93,16 +91,16 @@ var FontInspector = (function FontInspectorClosure() {
}
},
// FontInspector specific functions.
fontAdded: function fontAdded(fontObj, url) {
fontAdded(fontObj, url) {
function properties(obj, list) {
const moreInfo = document.createElement("table");
for (let i = 0; i < list.length; i++) {
for (const entry of list) {
const tr = document.createElement("tr");
const td1 = document.createElement("td");
td1.textContent = list[i];
td1.textContent = entry;
tr.appendChild(td1);
const td2 = document.createElement("td");
td2.textContent = obj[list[i]].toString();
td2.textContent = obj[entry].toString();
tr.appendChild(td2);
moreInfo.appendChild(tr);
}
@ -155,12 +153,8 @@ var FontInspector = (function FontInspectorClosure() {
};
})();
let opMap;
// Manages all the page steppers.
//
// eslint-disable-next-line no-var
var StepperManager = (function StepperManagerClosure() {
const StepperManager = (function StepperManagerClosure() {
let steppers = [];
let stepperDiv = null;
let stepperControls = null;
@ -172,7 +166,7 @@ var StepperManager = (function StepperManagerClosure() {
name: "Stepper",
panel: null,
manager: null,
init: function init(pdfjsLib) {
init(pdfjsLib) {
const self = this;
stepperControls = document.createElement("div");
stepperChooser = document.createElement("select");
@ -192,7 +186,7 @@ var StepperManager = (function StepperManagerClosure() {
opMap[pdfjsLib.OPS[key]] = key;
}
},
cleanup: function cleanup() {
cleanup() {
stepperChooser.textContent = "";
stepperDiv.textContent = "";
steppers = [];
@ -200,7 +194,7 @@ var StepperManager = (function StepperManagerClosure() {
enabled: false,
active: false,
// Stepper specific functions.
create: function create(pageIndex) {
create(pageIndex) {
const debug = document.createElement("div");
debug.id = "stepper" + pageIndex;
debug.hidden = true;
@ -218,23 +212,19 @@ var StepperManager = (function StepperManagerClosure() {
}
return stepper;
},
selectStepper: function selectStepper(pageIndex, selectPanel) {
let i;
selectStepper(pageIndex, selectPanel) {
pageIndex |= 0;
if (selectPanel) {
this.manager.selectPanel(this);
}
for (i = 0; i < steppers.length; ++i) {
const stepper = steppers[i];
for (const stepper of steppers) {
stepper.panel.hidden = stepper.pageIndex !== pageIndex;
}
const options = stepperChooser.options;
for (i = 0; i < options.length; ++i) {
const option = options[i];
for (const option of stepperChooser.options) {
option.selected = (option.value | 0) === pageIndex;
}
},
saveBreakPoints: function saveBreakPoints(pageIndex, bps) {
saveBreakPoints(pageIndex, bps) {
breakPoints[pageIndex] = bps;
sessionStorage.setItem("pdfjsBreakPoints", JSON.stringify(breakPoints));
},
@ -361,8 +351,7 @@ const Stepper = (function StepperClosure() {
const charCodeRow = c("tr");
const fontCharRow = c("tr");
const unicodeRow = c("tr");
for (let j = 0; j < glyphs.length; j++) {
const glyph = glyphs[j];
for (const glyph of glyphs) {
if (typeof glyph === "object" && glyph !== null) {
charCodeRow.appendChild(c("td", glyph.originalCharCode));
fontCharRow.appendChild(c("td", glyph.fontChar));
@ -410,9 +399,9 @@ const Stepper = (function StepperClosure() {
this.breakPoints.sort(function (a, b) {
return a - b;
});
for (let i = 0; i < this.breakPoints.length; i++) {
if (this.breakPoints[i] > this.currentIdx) {
return this.breakPoints[i];
for (const breakPoint of this.breakPoints) {
if (breakPoint > this.currentIdx) {
return breakPoint;
}
}
return null;
@ -444,8 +433,7 @@ const Stepper = (function StepperClosure() {
goTo(idx) {
const allRows = this.panel.getElementsByClassName("line");
for (let x = 0, xx = allRows.length; x < xx; ++x) {
const row = allRows[x];
for (const row of allRows) {
if ((row.dataset.idx | 0) === idx) {
row.style.backgroundColor = "rgb(251,250,207)";
row.scrollIntoView();
@ -458,15 +446,14 @@ const Stepper = (function StepperClosure() {
return Stepper;
})();
// eslint-disable-next-line no-var
var Stats = (function Stats() {
const Stats = (function Stats() {
let stats = [];
function clear(node) {
node.textContent = ""; // Remove any `node` contents from the DOM.
}
function getStatIndex(pageNumber) {
for (let i = 0, ii = stats.length; i < ii; ++i) {
if (stats[i].pageNumber === pageNumber) {
for (const [i, stat] of stats.entries()) {
if (stat.pageNumber === pageNumber) {
return i;
}
}
@ -505,8 +492,8 @@ var Stats = (function Stats() {
return a.pageNumber - b.pageNumber;
});
clear(this.panel);
for (let i = 0, ii = stats.length; i < ii; ++i) {
this.panel.appendChild(stats[i].div);
for (const entry of stats) {
this.panel.appendChild(entry.div);
}
},
cleanup() {
@ -517,7 +504,7 @@ var Stats = (function Stats() {
})();
// Manages all the debugging tools.
window.PDFBug = (function PDFBugClosure() {
const PDFBug = (function PDFBugClosure() {
const panelWidth = 300;
const buttons = [];
let activePanel = null;
@ -527,8 +514,7 @@ window.PDFBug = (function PDFBugClosure() {
enable(ids) {
const all = ids.length === 1 && ids[0] === "all";
const tools = this.tools;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
for (const tool of tools) {
if (all || ids.includes(tool.id)) {
tool.enabled = true;
}
@ -570,22 +556,14 @@ window.PDFBug = (function PDFBugClosure() {
container.style.right = panelWidth + "px";
// Initialize all the debugging tools.
const tools = this.tools;
const self = this;
for (let i = 0; i < tools.length; ++i) {
const tool = tools[i];
for (const tool of this.tools) {
const panel = document.createElement("div");
const panelButton = document.createElement("button");
panelButton.textContent = tool.name;
panelButton.addEventListener(
"click",
(function (selected) {
return function (event) {
event.preventDefault();
self.selectPanel(selected);
};
})(i)
);
panelButton.addEventListener("click", event => {
event.preventDefault();
this.selectPanel(tool);
});
controls.appendChild(panelButton);
panels.appendChild(panel);
tool.panel = panel;
@ -602,9 +580,9 @@ window.PDFBug = (function PDFBugClosure() {
this.selectPanel(0);
},
cleanup() {
for (let i = 0, ii = this.tools.length; i < ii; i++) {
if (this.tools[i].enabled) {
this.tools[i].cleanup();
for (const tool of this.tools) {
if (tool.enabled) {
tool.cleanup();
}
}
},
@ -616,13 +594,18 @@ window.PDFBug = (function PDFBugClosure() {
return;
}
activePanel = index;
const tools = this.tools;
for (let j = 0; j < tools.length; ++j) {
for (const [j, tool] of this.tools.entries()) {
const isActive = j === index;
buttons[j].classList.toggle("active", isActive);
tools[j].active = isActive;
tools[j].panel.hidden = !isActive;
tool.active = isActive;
tool.panel.hidden = !isActive;
}
},
};
})();
globalThis.FontInspector = FontInspector;
globalThis.StepperManager = StepperManager;
globalThis.Stats = Stats;
export { PDFBug };

Просмотреть файл

@ -24,6 +24,7 @@
opacity: 0.2;
line-height: 1;
text-size-adjust: none;
forced-color-adjust: none;
}
.textLayer span,
@ -638,7 +639,6 @@
--page-border: 9px solid transparent;
--spreadHorizontalWrapped-margin-LR: -3.5px;
--zoom-factor: 1;
--viewport-scale-factor: 1;
}
@media screen and (forced-colors: active) {
@ -776,6 +776,7 @@
}
:root {
--dir-factor: 1;
--sidebar-width: 200px;
--sidebar-transition-duration: 200ms;
--sidebar-transition-timing-function: ease;
@ -821,9 +822,9 @@
--doorhanger-hover-color: rgba(12, 12, 13, 1);
--doorhanger-hover-bg-color: rgba(237, 237, 237, 1);
--doorhanger-separator-color: rgba(222, 222, 222, 1);
--overlay-button-border: 0 none;
--overlay-button-bg-color: rgba(12, 12, 13, 0.1);
--overlay-button-hover-bg-color: rgba(12, 12, 13, 0.3);
--dialog-button-border: 0 none;
--dialog-button-bg-color: rgba(12, 12, 13, 0.1);
--dialog-button-hover-bg-color: rgba(12, 12, 13, 0.3);
--loading-icon: url(images/loading.svg);
--treeitem-expanded-icon: url(images/treeitem-expanded.svg);
@ -864,6 +865,10 @@
--secondaryToolbarButton-documentProperties-icon: url(images/secondaryToolbarButton-documentProperties.svg);
}
:root:dir(rtl) {
--dir-factor: -1;
}
@media (prefers-color-scheme: dark) {
:root {
--main-color: rgba(249, 249, 250, 1);
@ -901,8 +906,8 @@
--doorhanger-hover-color: rgba(249, 249, 250, 1);
--doorhanger-hover-bg-color: rgba(93, 94, 98, 1);
--doorhanger-separator-color: rgba(92, 92, 97, 1);
--overlay-button-bg-color: rgba(92, 92, 97, 1);
--overlay-button-hover-bg-color: rgba(115, 115, 115, 1);
--dialog-button-bg-color: rgba(92, 92, 97, 1);
--dialog-button-hover-bg-color: rgba(115, 115, 115, 1);
/* This image is used in <input> elements, which unfortunately means that
* the `mask-image` approach used with all of the other images doesn't work
@ -923,9 +928,9 @@
--doorhanger-hover-color: ButtonFace;
--doorhanger-border-color-whcm: 1px solid ButtonText;
--doorhanger-triangle-opacity-whcm: 0;
--overlay-button-border: 1px solid Highlight;
--overlay-button-hover-bg-color: Highlight;
--overlay-button-hover-color: ButtonFace;
--dialog-button-border: 1px solid Highlight;
--dialog-button-hover-bg-color: Highlight;
--dialog-button-hover-color: ButtonFace;
--field-border-color: ButtonText;
}
}
@ -1009,8 +1014,6 @@ select {
#outerContainer.sidebarResizing #sidebarContainer {
/* Improve responsiveness and avoid visual glitches when the sidebar is resized. */
transition-duration: 0s;
/* Prevent e.g. the thumbnails being selected when the sidebar is resized. */
user-select: none;
}
#outerContainer.sidebarMoving #sidebarContainer,
@ -1038,12 +1041,7 @@ select {
position: absolute;
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
}
html[dir="ltr"] #sidebarContent {
box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25);
}
html[dir="rtl"] #sidebarContent {
box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.25);
box-shadow: inset calc(-1px * var(--dir-factor)) 0 0 rgba(0, 0, 0, 0.25);
}
#viewerContainer {
@ -1086,14 +1084,8 @@ html[dir="rtl"] #sidebarContent {
width: 100%;
height: 32px;
background-color: var(--sidebar-toolbar-bg-color);
}
html[dir="ltr"] #toolbarSidebar {
box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(0, 0, 0, 0.15),
0 0 1px rgba(0, 0, 0, 0.1);
}
html[dir="rtl"] #toolbarSidebar {
box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(0, 0, 0, 0.15),
0 0 1px rgba(0, 0, 0, 0.1);
box-shadow: inset calc(-1px * var(--dir-factor)) 0 0 rgba(0, 0, 0, 0.25),
0 1px 0 rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
}
#toolbarSidebar .toolbarButton {
@ -1195,7 +1187,6 @@ html[dir="rtl"] #toolbarSidebar {
position: absolute;
z-index: 10000;
height: auto;
min-width: 16px;
padding: 0 4px;
margin: 4px 2px;
color: rgba(217, 217, 217, 1);
@ -1213,10 +1204,11 @@ html[dir="rtl"] #toolbarSidebar {
.findbar > div {
height: 32px;
}
.findbar.wrapContainers > div {
.findbar.wrapContainers > div,
.findbar.wrapContainers > div#findbarMessageContainer > * {
clear: both;
}
.findbar.wrapContainers > div.findbarMessageContainer {
.findbar.wrapContainers > div#findbarMessageContainer {
height: auto;
}
@ -1274,10 +1266,7 @@ html[dir="rtl"] #toolbarSidebar {
#findInput[data-status="pending"] {
background-image: var(--loading-icon);
background-repeat: no-repeat;
background-position: 98%;
}
html[dir="rtl"] #findInput[data-status="pending"] {
background-position: 3px;
background-position: calc(50% + 48% * var(--dir-factor));
}
#findInput[data-status="notFound"] {
background-color: rgba(255, 102, 102, 1);
@ -1394,21 +1383,21 @@ html[dir="rtl"] #findInput[data-status="pending"] {
.toolbarButton,
.secondaryToolbarButton,
.overlayButton {
.dialogButton {
border: 0 none;
background: none;
width: 28px;
height: 28px;
}
.overlayButton:hover,
.overlayButton:focus-visible {
background-color: var(--overlay-button-hover-bg-color);
.dialogButton:hover,
.dialogButton:focus-visible {
background-color: var(--dialog-button-hover-bg-color);
}
.overlayButton:hover > span,
.overlayButton:focus-visible > span {
color: var(--overlay-button-hover-color);
.dialogButton:hover > span,
.dialogButton:focus-visible > span {
color: var(--dialog-button-hover-color);
}
.toolbarButton > span {
@ -1420,7 +1409,7 @@ html[dir="rtl"] #findInput[data-status="pending"] {
.toolbarButton[disabled],
.secondaryToolbarButton[disabled],
.overlayButton[disabled] {
.dialogButton[disabled] {
opacity: 0.5;
}
@ -1463,7 +1452,7 @@ html[dir="rtl"] #findInput[data-status="pending"] {
.toolbarButton,
.dropdownToolbarButton,
.secondaryToolbarButton,
.overlayButton {
.dialogButton {
min-width: 16px;
margin: 2px 1px;
padding: 2px 6px 0;
@ -1552,14 +1541,6 @@ html[dir="rtl"] #findInput[data-status="pending"] {
color: var(--main-color);
}
#customScaleOption {
display: none;
}
#pageWidthOption {
border-bottom: 1px rgba(255, 255, 255, 0.5) solid;
}
.toolbarButtonSpacer {
width: 30px;
display: inline-block;
@ -1609,16 +1590,12 @@ html[dir="rtl"] #findInput[data-status="pending"] {
.toolbarButton#sidebarToggle::before {
mask-image: var(--toolbarButton-sidebarToggle-icon);
}
html[dir="rtl"] .toolbarButton#sidebarToggle::before {
transform: scaleX(-1);
transform: scaleX(var(--dir-factor));
}
.toolbarButton#secondaryToolbarToggle::before {
mask-image: var(--toolbarButton-secondaryToolbarToggle-icon);
}
html[dir="rtl"] .toolbarButton#secondaryToolbarToggle::before {
transform: scaleX(-1);
transform: scaleX(var(--dir-factor));
}
.toolbarButton.findPrevious::before {
@ -1686,9 +1663,7 @@ html[dir="rtl"] .toolbarButton#secondaryToolbarToggle::before {
#viewOutline.toolbarButton::before {
mask-image: var(--toolbarButton-viewOutline-icon);
}
html[dir="rtl"] #viewOutline.toolbarButton::before {
transform: scaleX(-1);
transform: scaleX(var(--dir-factor));
}
#viewAttachments.toolbarButton::before {
@ -1701,9 +1676,7 @@ html[dir="rtl"] #viewOutline.toolbarButton::before {
#currentOutlineItem.toolbarButton::before {
mask-image: var(--toolbarButton-currentOutlineItem-icon);
}
html[dir="rtl"] #currentOutlineItem.toolbarButton::before {
transform: scaleX(-1);
transform: scaleX(var(--dir-factor));
}
#viewFind.toolbarButton::before {
@ -1839,7 +1812,6 @@ html[dir="rtl"] #currentOutlineItem.toolbarButton::before {
.toolbarField.pageNumber {
-moz-appearance: textfield; /* hides the spinner in moz */
min-width: 16px;
text-align: right;
width: 40px;
}
@ -1871,13 +1843,21 @@ html[dir="rtl"] #currentOutlineItem.toolbarButton::before {
padding-inline-start: 3px;
}
#thumbnailView {
#thumbnailView,
#outlineView,
#attachmentsView,
#layersView {
position: absolute;
width: calc(100% - 60px);
width: calc(100% - 8px);
top: 0;
bottom: 0;
padding: 10px 30px 0;
padding: 4px 4px 0;
overflow: auto;
user-select: none;
}
#thumbnailView {
width: calc(100% - 60px);
padding: 10px 30px 0;
}
#thumbnailView > a:active,
@ -1938,18 +1918,6 @@ a:focus > .thumbnail > .thumbnailSelectionRing,
color: rgba(255, 255, 255, 1);
}
#outlineView,
#attachmentsView,
#layersView {
position: absolute;
width: calc(100% - 8px);
top: 0;
bottom: 0;
padding: 4px 4px 0;
overflow: auto;
user-select: none;
}
.treeWithDeepNesting > .treeItem,
.treeItem > .treeItems {
margin-inline-start: 20px;
@ -1958,7 +1926,6 @@ a:focus > .thumbnail > .thumbnailSelectionRing,
.treeItem > a {
text-decoration: none;
display: inline-block;
min-width: 95%;
/* Subtract the right padding (left, in RTL mode) of the container: */
min-width: calc(100% - 4px);
height: auto;
@ -1994,9 +1961,7 @@ a:focus > .thumbnail > .thumbnailSelectionRing,
}
.treeItemToggler.treeItemsHidden::before {
mask-image: var(--treeitem-collapsed-icon);
}
html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
transform: scaleX(-1);
transform: scaleX(var(--dir-factor));
}
.treeItemToggler.treeItemsHidden ~ .treeItems {
display: none;
@ -2025,7 +1990,7 @@ html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
}
#errorWrapper {
background: none repeat scroll 0 0 var(--errorWrapper-bg-color);
background-color: var(--errorWrapper-bg-color);
color: var(--main-color);
left: 0;
position: absolute;
@ -2050,32 +2015,17 @@ html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
width: 98%;
}
.overlayButton {
.dialogButton {
width: auto;
margin: 3px 4px 2px !important;
padding: 2px 11px;
color: var(--main-color);
background-color: var(--overlay-button-bg-color);
border: var(--overlay-button-border) !important;
background-color: var(--dialog-button-bg-color);
border: var(--dialog-button-border) !important;
}
#overlayContainer {
display: table;
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.2);
z-index: 40000;
}
#overlayContainer > .container {
display: table-cell;
vertical-align: middle;
text-align: center;
}
#overlayContainer > .container > .dialog {
display: inline-block;
dialog {
margin: auto;
padding: 15px;
border-spacing: 4px;
color: var(--main-color);
@ -2086,20 +2036,23 @@ html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
border-radius: 4px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
dialog::backdrop {
background-color: rgba(0, 0, 0, 0.2);
}
.dialog > .row {
dialog > .row {
display: table-row;
}
.dialog > .row > * {
dialog > .row > * {
display: table-cell;
}
.dialog .toolbarField {
dialog .toolbarField {
margin: 5px 0;
}
.dialog .separator {
dialog .separator {
display: block;
margin: 4px 0;
height: 1px;
@ -2107,38 +2060,38 @@ html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
background-color: var(--separator-color);
}
.dialog .buttonRow {
dialog .buttonRow {
text-align: center;
vertical-align: middle;
}
.dialog :link {
dialog :link {
color: rgba(255, 255, 255, 1);
}
#passwordOverlay > .dialog {
#passwordDialog {
text-align: center;
}
#passwordOverlay .toolbarField {
#passwordDialog .toolbarField {
width: 200px;
}
#documentPropertiesOverlay > .dialog {
#documentPropertiesDialog {
text-align: left;
}
#documentPropertiesOverlay .row > * {
#documentPropertiesDialog .row > * {
min-width: 100px;
text-align: start;
}
#documentPropertiesOverlay .row > span {
#documentPropertiesDialog .row > span {
width: 125px;
word-wrap: break-word;
}
#documentPropertiesOverlay .row > p {
#documentPropertiesDialog .row > p {
max-width: 225px;
word-wrap: break-word;
}
#documentPropertiesOverlay .buttonRow {
#documentPropertiesDialog .buttonRow {
margin-top: 10px;
}
@ -2146,18 +2099,8 @@ html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
clear: both;
}
.fileInput {
background: rgba(255, 255, 255, 1);
color: rgba(0, 0, 0, 1);
margin-top: 5px;
visibility: hidden;
position: fixed;
right: 0;
top: 0;
}
#PDFBug {
background: none repeat scroll 0 0 rgba(255, 255, 255, 1);
background-color: rgba(255, 255, 255, 1);
border: 1px solid rgba(102, 102, 102, 1);
position: fixed;
top: 32px;
@ -2186,12 +2129,9 @@ html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
#PDFBug button.active {
font-weight: bold;
}
.debuggerShowText {
background: none repeat scroll 0 0 rgba(255, 255, 0, 1);
color: rgba(0, 0, 255, 1);
}
.debuggerShowText,
.debuggerHideText:hover {
background: none repeat scroll 0 0 rgba(255, 255, 0, 1);
background-color: rgba(255, 255, 0, 1);
}
#PDFBug .stats {
font-family: courier;
@ -2319,10 +2259,6 @@ html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
display: block;
}
.fileInput {
display: none;
}
/* Rules for browsers that support PDF.js printing */
body[data-pdfjsprinting] #outerContainer {
display: none;
@ -2391,19 +2327,9 @@ html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
#sidebarContainer {
background-color: var(--sidebar-narrow-bg-color);
}
#outerContainer.sidebarOpen #viewerContainer {
inset-inline-start: 0 !important;
}
#outerContainer .hiddenLargeView,
#outerContainer .hiddenMediumView {
display: inherit;
}
#outerContainer .visibleLargeView,
#outerContainer .visibleMediumView {
display: none;
}
}
@media all and (max-width: 770px) {

Просмотреть файл

@ -87,7 +87,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<div id="mainContainer">
<div class="findbar hidden doorHanger" id="findbar">
<div id="findbarInputContainer">
<input id="findInput" class="toolbarField" title="Find" placeholder="Find in document…" tabindex="91" data-l10n-id="find_input">
<input id="findInput" class="toolbarField" title="Find" placeholder="Find in document…" tabindex="91" data-l10n-id="find_input" aria-invalid="false">
<div class="splitToolbarButton">
<button id="findPrevious" class="toolbarButton findPrevious" title="Find the previous occurrence of the phrase" tabindex="92" data-l10n-id="find_previous">
<span data-l10n-id="find_previous_label">Previous</span>
@ -112,10 +112,8 @@ See https://github.com/adobe-type-tools/cmap-resources
<label for="findEntireWord" class="toolbarLabel" data-l10n-id="find_entire_word_label">Whole Words</label>
</div>
<div class="findbarMessageContainer">
<div id="findbarMessageContainer" aria-live="polite">
<span id="findResultsCount" class="toolbarLabel"></span>
</div>
<div class="findbarMessageContainer">
<span id="findMsg" class="toolbarLabel"></span>
</div>
</div> <!-- findbar -->
@ -204,7 +202,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<div class="horizontalToolbarSeparator"></div>
<button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties…" tabindex="69" data-l10n-id="document_properties">
<button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties…" tabindex="69" data-l10n-id="document_properties" aria-controls="documentPropertiesDialog">
<span data-l10n-id="document_properties_label">Document Properties…</span>
</button>
</div>
@ -303,76 +301,87 @@ See https://github.com/adobe-type-tools/cmap-resources
</div> <!-- mainContainer -->
<div id="overlayContainer" class="hidden">
<div id="passwordOverlay" class="container hidden">
<div class="dialog">
<div class="row">
<p id="passwordText" data-l10n-id="password_label">Enter the password to open this PDF file:</p>
</div>
<div class="row">
<input type="password" id="password" class="toolbarField">
</div>
<div class="buttonRow">
<button id="passwordCancel" class="overlayButton"><span data-l10n-id="password_cancel">Cancel</span></button>
<button id="passwordSubmit" class="overlayButton"><span data-l10n-id="password_ok">OK</span></button>
</div>
<div id="dialogContainer">
<dialog id="passwordDialog">
<div class="row">
<label for="password" id="passwordText" data-l10n-id="password_label">Enter the password to open this PDF file:</label>
</div>
</div>
<div id="documentPropertiesOverlay" class="container hidden">
<div class="dialog">
<div class="row">
<span data-l10n-id="document_properties_file_name">File name:</span> <p id="fileNameField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_file_size">File size:</span> <p id="fileSizeField">-</p>
</div>
<div class="separator"></div>
<div class="row">
<span data-l10n-id="document_properties_title">Title:</span> <p id="titleField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_author">Author:</span> <p id="authorField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_subject">Subject:</span> <p id="subjectField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_keywords">Keywords:</span> <p id="keywordsField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_creation_date">Creation Date:</span> <p id="creationDateField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_modification_date">Modification Date:</span> <p id="modificationDateField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_creator">Creator:</span> <p id="creatorField">-</p>
</div>
<div class="separator"></div>
<div class="row">
<span data-l10n-id="document_properties_producer">PDF Producer:</span> <p id="producerField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_version">PDF Version:</span> <p id="versionField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_page_count">Page Count:</span> <p id="pageCountField">-</p>
</div>
<div class="row">
<span data-l10n-id="document_properties_page_size">Page Size:</span> <p id="pageSizeField">-</p>
</div>
<div class="separator"></div>
<div class="row">
<span data-l10n-id="document_properties_linearized">Fast Web View:</span> <p id="linearizedField">-</p>
</div>
<div class="buttonRow">
<button id="documentPropertiesClose" class="overlayButton"><span data-l10n-id="document_properties_close">Close</span></button>
</div>
<div class="row">
<input type="password" id="password" class="toolbarField">
</div>
</div>
</div> <!-- overlayContainer -->
<div class="buttonRow">
<button id="passwordCancel" class="dialogButton"><span data-l10n-id="password_cancel">Cancel</span></button>
<button id="passwordSubmit" class="dialogButton"><span data-l10n-id="password_ok">OK</span></button>
</div>
</dialog>
<dialog id="documentPropertiesDialog">
<div class="row">
<span id="fileNameLabel" data-l10n-id="document_properties_file_name">File name:</span>
<p id="fileNameField" aria-labelledby="fileNameLabel">-</p>
</div>
<div class="row">
<span id="fileSizeLabel" data-l10n-id="document_properties_file_size">File size:</span>
<p id="fileSizeField" aria-labelledby="fileSizeLabel">-</p>
</div>
<div class="separator"></div>
<div class="row">
<span id="titleLabel" data-l10n-id="document_properties_title">Title:</span>
<p id="titleField" aria-labelledby="titleLabel">-</p>
</div>
<div class="row">
<span id="authorLabel" data-l10n-id="document_properties_author">Author:</span>
<p id="authorField" aria-labelledby="authorLabel">-</p>
</div>
<div class="row">
<span id="subjectLabel" data-l10n-id="document_properties_subject">Subject:</span>
<p id="subjectField" aria-labelledby="subjectLabel">-</p>
</div>
<div class="row">
<span id="keywordsLabel" data-l10n-id="document_properties_keywords">Keywords:</span>
<p id="keywordsField" aria-labelledby="keywordsLabel">-</p>
</div>
<div class="row">
<span id="creationDateLabel" data-l10n-id="document_properties_creation_date">Creation Date:</span>
<p id="creationDateField" aria-labelledby="creationDateLabel">-</p>
</div>
<div class="row">
<span id="modificationDateLabel" data-l10n-id="document_properties_modification_date">Modification Date:</span>
<p id="modificationDateField" aria-labelledby="modificationDateLabel">-</p>
</div>
<div class="row">
<span id="creatorLabel" data-l10n-id="document_properties_creator">Creator:</span>
<p id="creatorField" aria-labelledby="creatorLabel">-</p>
</div>
<div class="separator"></div>
<div class="row">
<span id="producerLabel" data-l10n-id="document_properties_producer">PDF Producer:</span>
<p id="producerField" aria-labelledby="producerLabel">-</p>
</div>
<div class="row">
<span id="versionLabel" data-l10n-id="document_properties_version">PDF Version:</span>
<p id="versionField" aria-labelledby="versionLabel">-</p>
</div>
<div class="row">
<span id="pageCountLabel" data-l10n-id="document_properties_page_count">Page Count:</span>
<p id="pageCountField" aria-labelledby="pageCountLabel">-</p>
</div>
<div class="row">
<span id="pageSizeLabel" data-l10n-id="document_properties_page_size">Page Size:</span>
<p id="pageSizeField" aria-labelledby="pageSizeLabel">-</p>
</div>
<div class="separator"></div>
<div class="row">
<span id="linearizedLabel" data-l10n-id="document_properties_linearized">Fast Web View:</span>
<p id="linearizedField" aria-labelledby="linearizedLabel">-</p>
</div>
<div class="buttonRow">
<button id="documentPropertiesClose" class="dialogButton"><span data-l10n-id="document_properties_close">Close</span></button>
</div>
</dialog>
</div> <!-- dialogContainer -->
</div> <!-- outerContainer -->
<div id="printContainer"></div>
</body>
</html>

Просмотреть файл

@ -460,6 +460,7 @@ const PDFViewerApplication = {
_docStats: null,
_wheelUnusedTicks: 0,
_idleCallbacks: new Set(),
_PDFBug: null,
async initialize(appConfig) {
this.preferences = this.externalServices.createPreferences();
@ -945,11 +946,7 @@ const PDFViewerApplication = {
this.findBar?.reset();
this.toolbar.reset();
this.secondaryToolbar.reset();
if (typeof PDFBug !== "undefined") {
PDFBug.cleanup();
}
this._PDFBug?.cleanup();
await Promise.all(promises);
},
@ -2043,9 +2040,7 @@ const PDFViewerApplication = {
},
_unblockDocumentLoadEvent() {
if (document.blockUnblockOnload) {
document.blockUnblockOnload(false);
}
document.blockUnblockOnload?.(false);
this._unblockDocumentLoadEvent = () => {};
},
@ -2074,10 +2069,7 @@ let validateFileURL;
;
async function loadFakeWorker() {
if (!_pdfjsLib.GlobalWorkerOptions.workerSrc) {
_pdfjsLib.GlobalWorkerOptions.workerSrc = _app_options.AppOptions.get("workerSrc");
}
_pdfjsLib.GlobalWorkerOptions.workerSrc ||= _app_options.AppOptions.get("workerSrc");
await (0, _pdfjsLib.loadScript)(_pdfjsLib.PDFWorker.workerSrc);
}
@ -2086,31 +2078,31 @@ async function initPDFBug(enabledTabs) {
debuggerScriptPath,
mainContainer
} = PDFViewerApplication.appConfig;
await (0, _pdfjsLib.loadScript)(debuggerScriptPath);
const {
PDFBug
} = await import(debuggerScriptPath);
PDFBug.init({
OPS: _pdfjsLib.OPS
}, mainContainer, enabledTabs);
PDFViewerApplication._PDFBug = PDFBug;
}
function reportPageStatsPDFBug({
pageNumber
}) {
if (typeof Stats === "undefined" || !Stats.enabled) {
if (!globalThis.Stats?.enabled) {
return;
}
const pageView = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1);
const pageStats = pageView?.pdfPage?.stats;
if (!pageStats) {
return;
}
Stats.add(pageNumber, pageStats);
globalThis.Stats.add(pageNumber, pageView?.pdfPage?.stats);
}
function webViewerInitialized() {
const appConfig = PDFViewerApplication.appConfig;
const {
appConfig,
eventBus
} = PDFViewerApplication;
let file;
file = window.location.href;
appConfig.toolbar.openFile.hidden = true;
@ -2140,7 +2132,7 @@ function webViewerInitialized() {
appConfig.mainContainer.addEventListener("transitionend", function (evt) {
if (evt.target === this) {
PDFViewerApplication.eventBus.dispatch("resize", {
eventBus.dispatch("resize", {
source: this
});
}
@ -4487,92 +4479,66 @@ Object.defineProperty(exports, "__esModule", ({
exports.OverlayManager = void 0;
class OverlayManager {
#overlays = Object.create(null);
#overlays = new WeakMap();
#active = null;
#keyDownBound = null;
get active() {
return this.#active;
}
async register(name, element, callerCloseMethod = null, canForceClose = false) {
let container;
if (!name || !element || !(container = element.parentNode)) {
async register(dialog, canForceClose = false) {
if (typeof dialog !== "object") {
throw new Error("Not enough parameters.");
} else if (this.#overlays[name]) {
} else if (this.#overlays.has(dialog)) {
throw new Error("The overlay is already registered.");
}
this.#overlays[name] = {
element,
container,
callerCloseMethod,
this.#overlays.set(dialog, {
canForceClose
};
});
dialog.addEventListener("cancel", evt => {
this.#active = null;
});
}
async unregister(name) {
if (!this.#overlays[name]) {
async unregister(dialog) {
if (!this.#overlays.has(dialog)) {
throw new Error("The overlay does not exist.");
} else if (this.#active === name) {
} else if (this.#active === dialog) {
throw new Error("The overlay cannot be removed while it is active.");
}
delete this.#overlays[name];
this.#overlays.delete(dialog);
}
async open(name) {
if (!this.#overlays[name]) {
async open(dialog) {
if (!this.#overlays.has(dialog)) {
throw new Error("The overlay does not exist.");
} else if (this.#active) {
if (this.#active === name) {
if (this.#active === dialog) {
throw new Error("The overlay is already active.");
} else if (this.#overlays[name].canForceClose) {
this.#closeThroughCaller();
} else if (this.#overlays.get(dialog).canForceClose) {
await this.close();
} else {
throw new Error("Another overlay is currently active.");
}
}
this.#active = name;
this.#overlays[this.#active].element.classList.remove("hidden");
this.#overlays[this.#active].container.classList.remove("hidden");
this.#keyDownBound = this.#keyDown.bind(this);
window.addEventListener("keydown", this.#keyDownBound);
this.#active = dialog;
dialog.showModal();
}
async close(name) {
if (!this.#overlays[name]) {
async close(dialog = this.#active) {
if (!this.#overlays.has(dialog)) {
throw new Error("The overlay does not exist.");
} else if (!this.#active) {
throw new Error("The overlay is currently not active.");
} else if (this.#active !== name) {
} else if (this.#active !== dialog) {
throw new Error("Another overlay is currently active.");
}
this.#overlays[this.#active].container.classList.add("hidden");
this.#overlays[this.#active].element.classList.add("hidden");
dialog.close();
this.#active = null;
window.removeEventListener("keydown", this.#keyDownBound);
this.#keyDownBound = null;
}
#keyDown(evt) {
if (this.#active && evt.keyCode === 27) {
this.#closeThroughCaller();
evt.preventDefault();
}
}
#closeThroughCaller() {
if (this.#overlays[this.#active].callerCloseMethod) {
this.#overlays[this.#active].callerCloseMethod();
}
if (this.#active) {
this.close(this.#active);
}
}
}
@ -4593,9 +4559,11 @@ exports.PasswordPrompt = void 0;
var _pdfjsLib = __webpack_require__(5);
class PasswordPrompt {
#updateCallback = null;
#reason = null;
constructor(options, overlayManager, l10n, isViewerEmbedded = false) {
this.overlayName = options.overlayName;
this.container = options.container;
this.dialog = options.dialog;
this.label = options.label;
this.input = options.input;
this.submitButton = options.submitButton;
@ -4603,8 +4571,6 @@ class PasswordPrompt {
this.overlayManager = overlayManager;
this.l10n = l10n;
this._isViewerEmbedded = isViewerEmbedded;
this.updateCallback = null;
this.reason = null;
this.submitButton.addEventListener("click", this.#verify.bind(this));
this.cancelButton.addEventListener("click", this.#cancel.bind(this));
this.input.addEventListener("keydown", e => {
@ -4612,12 +4578,13 @@ class PasswordPrompt {
this.#verify();
}
});
this.overlayManager.register(this.overlayName, this.container, this.#cancel.bind(this), true);
this.overlayManager.register(this.dialog, true);
this.dialog.addEventListener("close", this.#cancel.bind(this));
}
async open() {
await this.overlayManager.open(this.overlayName);
const passwordIncorrect = this.reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD;
await this.overlayManager.open(this.dialog);
const passwordIncorrect = this.#reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD;
if (!this._isViewerEmbedded || passwordIncorrect) {
this.input.focus();
@ -4627,27 +4594,37 @@ class PasswordPrompt {
}
async close() {
await this.overlayManager.close(this.overlayName);
this.input.value = "";
if (this.overlayManager.active === this.dialog) {
this.overlayManager.close(this.dialog);
}
}
#verify() {
const password = this.input.value;
if (password?.length > 0) {
this.close();
this.updateCallback(password);
this.#invokeCallback(password);
}
}
#cancel() {
this.#invokeCallback(new Error("PasswordPrompt cancelled."));
}
#invokeCallback(password) {
if (!this.#updateCallback) {
return;
}
this.close();
this.updateCallback(new Error("PasswordPrompt cancelled."));
this.input.value = "";
this.#updateCallback(password);
this.#updateCallback = null;
}
setUpdateCallback(updateCallback, reason) {
this.updateCallback = updateCallback;
this.reason = reason;
this.#updateCallback = updateCallback;
this.#reason = reason;
}
}
@ -4979,19 +4956,17 @@ class PDFDocumentProperties {
#fieldData = null;
constructor({
overlayName,
dialog,
fields,
container,
closeButton
}, overlayManager, eventBus, l10n) {
this.overlayName = overlayName;
this.dialog = dialog;
this.fields = fields;
this.container = container;
this.overlayManager = overlayManager;
this.l10n = l10n;
this.#reset();
closeButton.addEventListener("click", this.close.bind(this));
this.overlayManager.register(this.overlayName, this.container, this.close.bind(this));
this.overlayManager.register(this.dialog);
eventBus._on("pagechanging", evt => {
this._currentPageNumber = evt.pageNumber;
@ -5008,7 +4983,7 @@ class PDFDocumentProperties {
}
async open() {
await Promise.all([this.overlayManager.open(this.overlayName), this._dataAvailableCapability.promise]);
await Promise.all([this.overlayManager.open(this.dialog), this._dataAvailableCapability.promise]);
const currentPageNumber = this._currentPageNumber;
const pagesRotation = this._pagesRotation;
@ -5058,8 +5033,8 @@ class PDFDocumentProperties {
this.#updateUI();
}
close() {
this.overlayManager.close(this.overlayName);
async close() {
this.overlayManager.close(this.dialog);
}
setDocument(pdfDocument, url = null) {
@ -5096,7 +5071,7 @@ class PDFDocumentProperties {
return;
}
if (this.overlayManager.active !== this.overlayName) {
if (this.overlayManager.active !== this.dialog) {
return;
}
@ -5315,6 +5290,7 @@ class PDFFindBar {
}
this.findField.setAttribute("data-status", status);
this.findField.setAttribute("aria-invalid", state === _pdf_find_controller.FindState.NOT_FOUND);
findMsg.then(msg => {
this.findMsg.textContent = msg;
this.#adjustWidth();
@ -6298,11 +6274,6 @@ class PDFHistory {
this._fingerprint = "";
this.reset();
this._boundEvents = null;
this._isViewerInPresentationMode = false;
this.eventBus._on("presentationmodechanged", evt => {
this._isViewerInPresentationMode = evt.state !== _ui_utils.PresentationModeState.NORMAL;
});
this.eventBus._on("pagesinit", () => {
this._isPagesLoaded = false;
@ -6687,7 +6658,7 @@ class PDFHistory {
}
this._position = {
hash: this._isViewerInPresentationMode ? `page=${location.pageNumber}` : location.pdfOpenParams.substring(1),
hash: location.pdfOpenParams.substring(1),
page: this.linkService.page,
first: location.pageNumber,
rotation: location.rotation
@ -7408,7 +7379,6 @@ exports.PDFPresentationMode = void 0;
var _ui_utils = __webpack_require__(3);
const DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500;
const DELAY_BEFORE_HIDING_CONTROLS = 3000;
const ACTIVE_SELECTOR = "pdfPresentationMode";
const CONTROLS_SELECTOR = "pdfPresentationModeControls";
@ -7418,6 +7388,9 @@ const SWIPE_MIN_DISTANCE_THRESHOLD = 50;
const SWIPE_ANGLE_THRESHOLD = Math.PI / 6;
class PDFPresentationMode {
#state = _ui_utils.PresentationModeState.UNKNOWN;
#args = null;
constructor({
container,
pdfViewer,
@ -7426,30 +7399,45 @@ class PDFPresentationMode {
this.container = container;
this.pdfViewer = pdfViewer;
this.eventBus = eventBus;
this.active = false;
this.args = null;
this.contextMenuOpen = false;
this.mouseScrollTimeStamp = 0;
this.mouseScrollDelta = 0;
this.touchSwipeState = null;
}
request() {
if (this.switchInProgress || this.active || !this.pdfViewer.pagesCount || !this.container.requestFullscreen) {
async request() {
const {
container,
pdfViewer
} = this;
if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) {
return false;
}
this.#addFullscreenChangeListeners();
this.#setSwitchInProgress();
this.#notifyStateChange();
this.container.requestFullscreen();
this.args = {
pageNumber: this.pdfViewer.currentPageNumber,
scaleValue: this.pdfViewer.currentScaleValue,
scrollMode: this.pdfViewer.scrollMode,
spreadMode: this.pdfViewer.spreadMode
this.#notifyStateChange(_ui_utils.PresentationModeState.CHANGING);
const promise = container.requestFullscreen();
this.#args = {
pageNumber: pdfViewer.currentPageNumber,
scaleValue: pdfViewer.currentScaleValue,
scrollMode: pdfViewer.scrollMode,
spreadMode: pdfViewer.spreadMode
};
return true;
try {
await promise;
return true;
} catch (reason) {
this.#removeFullscreenChangeListeners();
this.#notifyStateChange(_ui_utils.PresentationModeState.NORMAL);
}
return false;
}
get active() {
return this.#state === _ui_utils.PresentationModeState.CHANGING || this.#state === _ui_utils.PresentationModeState.FULLSCREEN;
}
#mouseWheel(evt) {
@ -7483,49 +7471,21 @@ class PDFPresentationMode {
}
}
#notifyStateChange() {
let state = _ui_utils.PresentationModeState.NORMAL;
if (this.switchInProgress) {
state = _ui_utils.PresentationModeState.CHANGING;
} else if (this.active) {
state = _ui_utils.PresentationModeState.FULLSCREEN;
}
#notifyStateChange(state) {
this.#state = state;
this.eventBus.dispatch("presentationmodechanged", {
source: this,
state
});
}
#setSwitchInProgress() {
if (this.switchInProgress) {
clearTimeout(this.switchInProgress);
}
this.switchInProgress = setTimeout(() => {
this.#removeFullscreenChangeListeners();
delete this.switchInProgress;
this.#notifyStateChange();
}, DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS);
}
#resetSwitchInProgress() {
if (this.switchInProgress) {
clearTimeout(this.switchInProgress);
delete this.switchInProgress;
}
}
#enter() {
this.active = true;
this.#resetSwitchInProgress();
this.#notifyStateChange();
this.#notifyStateChange(_ui_utils.PresentationModeState.FULLSCREEN);
this.container.classList.add(ACTIVE_SELECTOR);
setTimeout(() => {
this.pdfViewer.scrollMode = _ui_utils.ScrollMode.PAGE;
this.pdfViewer.spreadMode = _ui_utils.SpreadMode.NONE;
this.pdfViewer.currentPageNumber = this.args.pageNumber;
this.pdfViewer.currentPageNumber = this.#args.pageNumber;
this.pdfViewer.currentScaleValue = "page-fit";
}, 0);
this.#addWindowListeners();
@ -7538,14 +7498,13 @@ class PDFPresentationMode {
const pageNumber = this.pdfViewer.currentPageNumber;
this.container.classList.remove(ACTIVE_SELECTOR);
setTimeout(() => {
this.active = false;
this.#removeFullscreenChangeListeners();
this.#notifyStateChange();
this.pdfViewer.scrollMode = this.args.scrollMode;
this.pdfViewer.spreadMode = this.args.spreadMode;
this.pdfViewer.currentScaleValue = this.args.scaleValue;
this.#notifyStateChange(_ui_utils.PresentationModeState.NORMAL);
this.pdfViewer.scrollMode = this.#args.scrollMode;
this.pdfViewer.spreadMode = this.#args.spreadMode;
this.pdfViewer.currentScaleValue = this.#args.scaleValue;
this.pdfViewer.currentPageNumber = pageNumber;
this.args = null;
this.#args = null;
}, 0);
this.#removeWindowListeners();
this.#hideControls();
@ -8409,7 +8368,7 @@ class PDFSidebar {
this.pdfViewer = pdfViewer;
this.pdfThumbnailViewer = pdfThumbnailViewer;
this.outerContainer = elements.outerContainer;
this.viewerContainer = elements.viewerContainer;
this.sidebarContainer = elements.sidebarContainer;
this.toggleButton = elements.toggleButton;
this.thumbnailButton = elements.thumbnailButton;
this.outlineButton = elements.outlineButton;
@ -8536,10 +8495,10 @@ class PDFSidebar {
this.outlineButton.classList.toggle("toggled", isOutline);
this.attachmentsButton.classList.toggle("toggled", isAttachments);
this.layersButton.classList.toggle("toggled", isLayers);
this.thumbnailButton.setAttribute("aria-checked", `${isThumbs}`);
this.outlineButton.setAttribute("aria-checked", `${isOutline}`);
this.attachmentsButton.setAttribute("aria-checked", `${isAttachments}`);
this.layersButton.setAttribute("aria-checked", `${isLayers}`);
this.thumbnailButton.setAttribute("aria-checked", isThumbs);
this.outlineButton.setAttribute("aria-checked", isOutline);
this.attachmentsButton.setAttribute("aria-checked", isAttachments);
this.layersButton.setAttribute("aria-checked", isLayers);
this.thumbnailView.classList.toggle("hidden", !isThumbs);
this.outlineView.classList.toggle("hidden", !isOutline);
this.attachmentsView.classList.toggle("hidden", !isAttachments);
@ -8668,8 +8627,8 @@ class PDFSidebar {
}
_addEventListeners() {
this.viewerContainer.addEventListener("transitionend", evt => {
if (evt.target === this.viewerContainer) {
this.sidebarContainer.addEventListener("transitionend", evt => {
if (evt.target === this.sidebarContainer) {
this.outerContainer.classList.remove("sidebarMoving");
}
});
@ -9716,7 +9675,7 @@ class BaseViewer {
throw new Error("Cannot initialize BaseViewer.");
}
const viewerVersion = '2.14.102';
const viewerVersion = '2.14.171';
if (_pdfjsLib.version !== viewerVersion) {
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
@ -10404,8 +10363,6 @@ class BaseViewer {
this._doc.style.setProperty("--zoom-factor", newScale);
this._doc.style.setProperty("--viewport-scale-factor", newScale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS);
const updateArgs = {
scale: newScale
};
@ -10668,14 +10625,17 @@ class BaseViewer {
const currentScaleValue = this._currentScaleValue;
const normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue;
const pageNumber = firstPage.id;
let pdfOpenParams = "#page=" + pageNumber;
pdfOpenParams += "&zoom=" + normalizedScaleValue;
const currentPageView = this._pages[pageNumber - 1];
const container = this.container;
const topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y);
const intLeft = Math.round(topLeft[0]);
const intTop = Math.round(topLeft[1]);
pdfOpenParams += "," + intLeft + "," + intTop;
let pdfOpenParams = `#page=${pageNumber}`;
if (!this.isInPresentationMode) {
pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;
}
this._location = {
pageNumber,
scale: normalizedScaleValue,
@ -10759,35 +10719,7 @@ class BaseViewer {
return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight;
}
_getCurrentVisiblePage() {
if (!this.pagesCount) {
return {
views: []
};
}
const pageView = this._pages[this._currentPageNumber - 1];
const element = pageView.div;
const view = {
id: pageView.id,
x: element.offsetLeft + element.clientLeft,
y: element.offsetTop + element.clientTop,
view: pageView
};
const ids = new Set([pageView.id]);
return {
first: view,
last: view,
views: [view],
ids
};
}
_getVisiblePages() {
if (this.isInPresentationMode) {
return this._getCurrentVisiblePage();
}
const views = this._scrollMode === _ui_utils.ScrollMode.PAGE ? this.#scrollModePageState.pages : this._pages,
horizontal = this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL,
rtl = horizontal && this._isContainerRtl;
@ -11834,9 +11766,8 @@ class PDFPageView {
}
const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
const viewportScale = this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
this.viewport = this.viewport.clone({
scale: viewportScale,
scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
rotation: totalRotation
});
@ -11845,7 +11776,6 @@ class PDFPageView {
style
} = document.documentElement;
style.setProperty("--zoom-factor", this.scale);
style.setProperty("--viewport-scale-factor", viewportScale);
}
if (this.svg) {
@ -13183,8 +13113,8 @@ class SecondaryToolbar {
isHand = tool === _pdf_cursor_tools.CursorTool.HAND;
cursorSelectToolButton.classList.toggle("toggled", isSelect);
cursorHandToolButton.classList.toggle("toggled", isHand);
cursorSelectToolButton.setAttribute("aria-checked", `${isSelect}`);
cursorHandToolButton.setAttribute("aria-checked", `${isHand}`);
cursorSelectToolButton.setAttribute("aria-checked", isSelect);
cursorHandToolButton.setAttribute("aria-checked", isHand);
});
}
@ -13208,10 +13138,10 @@ class SecondaryToolbar {
scrollVerticalButton.classList.toggle("toggled", isVertical);
scrollHorizontalButton.classList.toggle("toggled", isHorizontal);
scrollWrappedButton.classList.toggle("toggled", isWrapped);
scrollPageButton.setAttribute("aria-checked", `${isPage}`);
scrollVerticalButton.setAttribute("aria-checked", `${isVertical}`);
scrollHorizontalButton.setAttribute("aria-checked", `${isHorizontal}`);
scrollWrappedButton.setAttribute("aria-checked", `${isWrapped}`);
scrollPageButton.setAttribute("aria-checked", isPage);
scrollVerticalButton.setAttribute("aria-checked", isVertical);
scrollHorizontalButton.setAttribute("aria-checked", isHorizontal);
scrollWrappedButton.setAttribute("aria-checked", isWrapped);
const forceScrollModePage = this.pagesCount > _base_viewer.PagesCountLimit.FORCE_SCROLL_MODE_PAGE;
scrollPageButton.disabled = forceScrollModePage;
scrollVerticalButton.disabled = forceScrollModePage;
@ -13247,9 +13177,9 @@ class SecondaryToolbar {
spreadNoneButton.classList.toggle("toggled", isNone);
spreadOddButton.classList.toggle("toggled", isOdd);
spreadEvenButton.classList.toggle("toggled", isEven);
spreadNoneButton.setAttribute("aria-checked", `${isNone}`);
spreadOddButton.setAttribute("aria-checked", `${isOdd}`);
spreadEvenButton.setAttribute("aria-checked", `${isEven}`);
spreadNoneButton.setAttribute("aria-checked", isNone);
spreadOddButton.setAttribute("aria-checked", isOdd);
spreadEvenButton.setAttribute("aria-checked", isEven);
}
this.eventBus._on("spreadmodechanged", spreadModeChanged);
@ -14583,8 +14513,8 @@ var _app_options = __webpack_require__(1);
var _app = __webpack_require__(2);
const pdfjsVersion = '2.14.102';
const pdfjsBuild = 'db4f3adc5';
const pdfjsVersion = '2.14.171';
const pdfjsBuild = '3f5c31e20';
window.PDFViewerApplication = _app.PDFViewerApplication;
window.PDFViewerApplicationOptions = _app_options.AppOptions;
;
@ -14646,7 +14576,7 @@ function getViewerConfiguration() {
},
sidebar: {
outerContainer: document.getElementById("outerContainer"),
viewerContainer: document.getElementById("viewerContainer"),
sidebarContainer: document.getElementById("sidebarContainer"),
toggleButton: document.getElementById("sidebarToggle"),
thumbnailButton: document.getElementById("viewThumbnail"),
outlineButton: document.getElementById("viewOutline"),
@ -14677,16 +14607,14 @@ function getViewerConfiguration() {
findNextButton: document.getElementById("findNext")
},
passwordOverlay: {
overlayName: "passwordOverlay",
container: document.getElementById("passwordOverlay"),
dialog: document.getElementById("passwordDialog"),
label: document.getElementById("passwordText"),
input: document.getElementById("password"),
submitButton: document.getElementById("passwordSubmit"),
cancelButton: document.getElementById("passwordCancel")
},
documentProperties: {
overlayName: "documentPropertiesOverlay",
container: document.getElementById("documentPropertiesOverlay"),
dialog: document.getElementById("documentPropertiesDialog"),
closeButton: document.getElementById("documentPropertiesClose"),
fields: {
fileName: document.getElementById("fileNameField"),
@ -14707,7 +14635,7 @@ function getViewerConfiguration() {
},
errorWrapper,
printContainer: document.getElementById("printContainer"),
openFileInputName: "fileInput",
openFileInput: null,
debuggerScriptPath: "./debugger.js"
};
}
@ -14718,9 +14646,7 @@ function webViewerLoad() {
_app.PDFViewerApplication.run(config);
}
if (document.blockUnblockOnload) {
document.blockUnblockOnload(true);
}
document.blockUnblockOnload?.(true);
if (document.readyState === "interactive" || document.readyState === "complete") {
webViewerLoad();

Просмотреть файл

@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: version 2.14.102
release: version 2.14.171
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/