Backed out changeset a1e9e031f3a1 (bug 1764886) for causing failures on browser_parsable_script.js . CLOSED TREE

This commit is contained in:
criss 2022-04-15 16:57:08 +03:00
Родитель addedf097a
Коммит 4666a062b0
10 изменённых файлов: 813 добавлений и 1216 удалений

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

@ -65,12 +65,6 @@ 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,
@ -148,6 +142,7 @@ 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.171
Current extension version is: 2.14.102
Taken from upstream commit: 3f5c31e20
Taken from upstream commit: db4f3adc5

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

@ -29,7 +29,7 @@
exports["pdfjs-dist/build/pdf"] = factory();
else
root["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory();
})(this, () => {
})(this, function() {
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.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.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.arrayByteLength = arrayByteLength;
exports.arraysToBytes = arraysToBytes;
exports.assert = assert;
@ -698,6 +698,14 @@ function isLittleEndian() {
return view32[0] === 1;
}
const IsLittleEndianCached = {
get value() {
return shadow(this, "value", isLittleEndian());
}
};
exports.IsLittleEndianCached = IsLittleEndianCached;
function isEvalSupported() {
try {
new Function("");
@ -707,22 +715,13 @@ function isEvalSupported() {
}
}
class FeatureTest {
static get isLittleEndian() {
return shadow(this, "isLittleEndian", isLittleEndian());
const IsEvalSupportedCached = {
get value() {
return shadow(this, "value", isEvalSupported());
}
static get isEvalSupported() {
return shadow(this, "isEvalSupported", isEvalSupported());
}
static get isOffscreenCanvasSupported() {
return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
}
}
exports.FeatureTest = FeatureTest;
};
exports.IsEvalSupportedCached = IsEvalSupportedCached;
const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
class Util {
@ -1060,19 +1059,19 @@ var _annotation_storage = __w_pdfjs_require__(9);
var _canvas = __w_pdfjs_require__(10);
var _worker_options = __w_pdfjs_require__(13);
var _worker_options = __w_pdfjs_require__(12);
var _is_node = __w_pdfjs_require__(3);
var _message_handler = __w_pdfjs_require__(14);
var _message_handler = __w_pdfjs_require__(13);
var _metadata = __w_pdfjs_require__(15);
var _metadata = __w_pdfjs_require__(14);
var _optional_content_config = __w_pdfjs_require__(16);
var _optional_content_config = __w_pdfjs_require__(15);
var _transport_stream = __w_pdfjs_require__(17);
var _transport_stream = __w_pdfjs_require__(16);
var _xfa_text = __w_pdfjs_require__(18);
var _xfa_text = __w_pdfjs_require__(17);
const DEFAULT_RANGE_CHUNK_SIZE = 65536;
const RENDERING_CANCELLED_TIMEOUT = 100;
@ -1298,7 +1297,7 @@ async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", {
docId,
apiVersion: '2.14.171',
apiVersion: '2.14.102',
source: {
data: source.data,
url: source.url,
@ -1585,7 +1584,6 @@ 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();
@ -1901,12 +1899,6 @@ class PDFPageProxy {
this.objs.clear();
for (const bitmap of this._bitmaps) {
bitmap.close();
}
this._bitmaps.clear();
this._annotationPromises.clear();
this._jsActionsPromise = null;
@ -1947,12 +1939,6 @@ class PDFPageProxy {
this._stats = new _display_utils.StatTimer();
}
for (const bitmap of this._bitmaps) {
bitmap.close();
}
this._bitmaps.clear();
this.pendingCleanup = false;
return true;
}
@ -2800,25 +2786,8 @@ class WorkerTransport {
pageProxy.objs.resolve(id, imageData);
const MAX_IMAGE_SIZE_TO_STORE = 8000000;
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;
}
if (imageData?.data?.length > MAX_IMAGE_SIZE_TO_STORE) {
pageProxy.cleanupAfterRender = true;
}
break;
@ -3318,9 +3287,9 @@ class InternalRenderTask {
}
const version = '2.14.171';
const version = '2.14.102';
exports.version = version;
const build = '3f5c31e20';
const build = 'db4f3adc5';
exports.build = build;
/***/ }),
@ -4170,7 +4139,7 @@ class FontFaceObject {
return this.compiledGlyphs[character] = function (c, size) {};
}
if (this.isEvalSupported && _util.FeatureTest.isEvalSupported) {
if (this.isEvalSupported && _util.IsEvalSupportedCached.value) {
const jsBuf = [];
for (const current of cmds) {
@ -4348,8 +4317,6 @@ 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;
@ -4959,7 +4926,7 @@ function putBinaryImageData(ctx, imgData, transferMaps = null) {
const dest32DataLength = dest32.length;
const fullSrcDiff = width + 7 >> 3;
let white = 0xffffffff;
let black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
let black = _util.IsLittleEndianCached.value ? 0xff000000 : 0x000000ff;
if (transferMapGray) {
if (transferMapGray[0] === 0xff && transferMapGray[0xff] === 0) {
@ -5103,11 +5070,6 @@ 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;
@ -5120,15 +5082,24 @@ function putBinaryImageMask(ctx, imgData) {
for (let i = 0; i < totalChunks; i++) {
const thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
({
srcPos
} = (0, _image_utils.applyMaskImageData)({
src,
srcPos,
dest,
width,
height: thisChunkHeight
}));
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;
}
}
ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
}
}
@ -5316,14 +5287,6 @@ 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,
@ -6653,9 +6616,8 @@ class CanvasGraphics {
canvas,
context
} = this.annotationCanvas;
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})`;
canvas.style.width = `calc(${width}px * var(--viewport-scale-factor))`;
canvas.style.height = `calc(${height}px * var(--viewport-scale-factor))`;
this.annotationCanvasMap.set(id, canvas);
this.annotationCanvas.savedCtx = this.ctx;
this.ctx = context;
@ -6690,7 +6652,6 @@ class CanvasGraphics {
return;
}
img = this.getObject(img.data, img);
const ctx = this.ctx;
const width = img.width,
height = img.height;
@ -6723,18 +6684,17 @@ class CanvasGraphics {
this.compose();
}
paintImageMaskXObjectRepeat(img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
paintImageMaskXObjectRepeat(imgData, 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(img);
const mask = this._createMaskCanvas(imgData);
ctx.setTransform(1, 0, 0, 1, 0, 0);
@ -6786,7 +6746,7 @@ class CanvasGraphics {
return;
}
const imgData = this.getObject(objId);
const imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId);
if (!imgData) {
(0, _util.warn)("Dependent image isn't ready yet");
@ -6801,7 +6761,7 @@ class CanvasGraphics {
return;
}
const imgData = this.getObject(objId);
const imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId);
if (!imgData) {
(0, _util.warn)("Dependent image isn't ready yet");
@ -7649,65 +7609,6 @@ 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) => {
@ -7722,7 +7623,7 @@ GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ?
GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? "" : GlobalWorkerOptions.workerSrc;
/***/ }),
/* 14 */
/* 13 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8208,7 +8109,7 @@ class MessageHandler {
exports.MessageHandler = MessageHandler;
/***/ }),
/* 15 */
/* 14 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8253,7 +8154,7 @@ class Metadata {
exports.Metadata = Metadata;
/***/ }),
/* 16 */
/* 15 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8474,7 +8375,7 @@ class OptionalContentConfig {
exports.OptionalContentConfig = OptionalContentConfig;
/***/ }),
/* 17 */
/* 16 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8829,7 +8730,7 @@ class PDFDataTransportStreamRangeReader {
}
/***/ }),
/* 18 */
/* 17 */
/***/ ((__unused_webpack_module, exports) => {
@ -8893,7 +8794,7 @@ class XfaText {
exports.XfaText = XfaText;
/***/ }),
/* 19 */
/* 18 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -8909,9 +8810,9 @@ var _display_utils = __w_pdfjs_require__(5);
var _annotation_storage = __w_pdfjs_require__(9);
var _scripting_utils = __w_pdfjs_require__(20);
var _scripting_utils = __w_pdfjs_require__(19);
var _xfa_layer = __w_pdfjs_require__(21);
var _xfa_layer = __w_pdfjs_require__(20);
const DEFAULT_TAB_INDEX = 1000;
const GetElementsByNameSet = new WeakSet();
@ -10131,8 +10032,8 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
this.container.className = "choiceWidgetAnnotation";
const storage = this.annotationStorage;
const id = this.data.id;
const storedData = storage.getValue(id, {
value: this.data.fieldValue
storage.getValue(id, {
value: this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : undefined
});
let {
fontSize
@ -10176,7 +10077,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
optionElement.style.fontSize = fontSizeStyle;
}
if (storedData.value.includes(option.exportValue)) {
if (this.data.fieldValue.includes(option.exportValue)) {
optionElement.setAttribute("selected", true);
}
@ -10345,7 +10246,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
} else {
selectElement.addEventListener("input", function (event) {
storage.setValue(id, {
value: getValue(event, true)
value: getValue(event)
});
});
}
@ -11101,7 +11002,7 @@ class AnnotationLayer {
exports.AnnotationLayer = AnnotationLayer;
/***/ }),
/* 20 */
/* 19 */
/***/ ((__unused_webpack_module, exports) => {
@ -11169,7 +11070,7 @@ class ColorConverters {
exports.ColorConverters = ColorConverters;
/***/ }),
/* 21 */
/* 20 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -11179,7 +11080,7 @@ Object.defineProperty(exports, "__esModule", ({
}));
exports.XfaLayer = void 0;
var _xfa_text = __w_pdfjs_require__(18);
var _xfa_text = __w_pdfjs_require__(17);
class XfaLayer {
static setupStorage(html, id, element, storage, intent) {
@ -11417,7 +11318,7 @@ class XfaLayer {
exports.XfaLayer = XfaLayer;
/***/ }),
/* 22 */
/* 21 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -12199,7 +12100,7 @@ function renderTextLayer(renderParameters) {
}
/***/ }),
/* 23 */
/* 22 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
@ -12466,20 +12367,20 @@ var _api = __w_pdfjs_require__(4);
var _display_utils = __w_pdfjs_require__(5);
var _annotation_layer = __w_pdfjs_require__(19);
var _annotation_layer = __w_pdfjs_require__(18);
var _worker_options = __w_pdfjs_require__(13);
var _worker_options = __w_pdfjs_require__(12);
var _is_node = __w_pdfjs_require__(3);
var _text_layer = __w_pdfjs_require__(22);
var _text_layer = __w_pdfjs_require__(21);
var _svg = __w_pdfjs_require__(23);
var _svg = __w_pdfjs_require__(22);
var _xfa_layer = __w_pdfjs_require__(21);
var _xfa_layer = __w_pdfjs_require__(20);
const pdfjsVersion = '2.14.171';
const pdfjsBuild = '3f5c31e20';
const pdfjsVersion = '2.14.102';
const pdfjsBuild = 'db4f3adc5';
;
})();

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

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

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

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

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

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

@ -24,7 +24,6 @@
opacity: 0.2;
line-height: 1;
text-size-adjust: none;
forced-color-adjust: none;
}
.textLayer span,
@ -639,6 +638,7 @@
--page-border: 9px solid transparent;
--spreadHorizontalWrapped-margin-LR: -3.5px;
--zoom-factor: 1;
--viewport-scale-factor: 1;
}
@media screen and (forced-colors: active) {
@ -776,7 +776,6 @@
}
:root {
--dir-factor: 1;
--sidebar-width: 200px;
--sidebar-transition-duration: 200ms;
--sidebar-transition-timing-function: ease;
@ -822,9 +821,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);
--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);
--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);
--loading-icon: url(images/loading.svg);
--treeitem-expanded-icon: url(images/treeitem-expanded.svg);
@ -865,10 +864,6 @@
--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);
@ -906,8 +901,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);
--dialog-button-bg-color: rgba(92, 92, 97, 1);
--dialog-button-hover-bg-color: rgba(115, 115, 115, 1);
--overlay-button-bg-color: rgba(92, 92, 97, 1);
--overlay-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
@ -928,9 +923,9 @@
--doorhanger-hover-color: ButtonFace;
--doorhanger-border-color-whcm: 1px solid ButtonText;
--doorhanger-triangle-opacity-whcm: 0;
--dialog-button-border: 1px solid Highlight;
--dialog-button-hover-bg-color: Highlight;
--dialog-button-hover-color: ButtonFace;
--overlay-button-border: 1px solid Highlight;
--overlay-button-hover-bg-color: Highlight;
--overlay-button-hover-color: ButtonFace;
--field-border-color: ButtonText;
}
}
@ -1014,6 +1009,8 @@ 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,
@ -1041,7 +1038,12 @@ select {
position: absolute;
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
box-shadow: inset calc(-1px * var(--dir-factor)) 0 0 rgba(0, 0, 0, 0.25);
}
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);
}
#viewerContainer {
@ -1084,8 +1086,14 @@ select {
width: 100%;
height: 32px;
background-color: var(--sidebar-toolbar-bg-color);
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);
}
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);
}
#toolbarSidebar .toolbarButton {
@ -1187,6 +1195,7 @@ select {
position: absolute;
z-index: 10000;
height: auto;
min-width: 16px;
padding: 0 4px;
margin: 4px 2px;
color: rgba(217, 217, 217, 1);
@ -1204,11 +1213,10 @@ select {
.findbar > div {
height: 32px;
}
.findbar.wrapContainers > div,
.findbar.wrapContainers > div#findbarMessageContainer > * {
.findbar.wrapContainers > div {
clear: both;
}
.findbar.wrapContainers > div#findbarMessageContainer {
.findbar.wrapContainers > div.findbarMessageContainer {
height: auto;
}
@ -1266,7 +1274,10 @@ select {
#findInput[data-status="pending"] {
background-image: var(--loading-icon);
background-repeat: no-repeat;
background-position: calc(50% + 48% * var(--dir-factor));
background-position: 98%;
}
html[dir="rtl"] #findInput[data-status="pending"] {
background-position: 3px;
}
#findInput[data-status="notFound"] {
background-color: rgba(255, 102, 102, 1);
@ -1383,21 +1394,21 @@ select {
.toolbarButton,
.secondaryToolbarButton,
.dialogButton {
.overlayButton {
border: 0 none;
background: none;
width: 28px;
height: 28px;
}
.dialogButton:hover,
.dialogButton:focus-visible {
background-color: var(--dialog-button-hover-bg-color);
.overlayButton:hover,
.overlayButton:focus-visible {
background-color: var(--overlay-button-hover-bg-color);
}
.dialogButton:hover > span,
.dialogButton:focus-visible > span {
color: var(--dialog-button-hover-color);
.overlayButton:hover > span,
.overlayButton:focus-visible > span {
color: var(--overlay-button-hover-color);
}
.toolbarButton > span {
@ -1409,7 +1420,7 @@ select {
.toolbarButton[disabled],
.secondaryToolbarButton[disabled],
.dialogButton[disabled] {
.overlayButton[disabled] {
opacity: 0.5;
}
@ -1452,7 +1463,7 @@ select {
.toolbarButton,
.dropdownToolbarButton,
.secondaryToolbarButton,
.dialogButton {
.overlayButton {
min-width: 16px;
margin: 2px 1px;
padding: 2px 6px 0;
@ -1541,6 +1552,14 @@ select {
color: var(--main-color);
}
#customScaleOption {
display: none;
}
#pageWidthOption {
border-bottom: 1px rgba(255, 255, 255, 0.5) solid;
}
.toolbarButtonSpacer {
width: 30px;
display: inline-block;
@ -1590,12 +1609,16 @@ select {
.toolbarButton#sidebarToggle::before {
mask-image: var(--toolbarButton-sidebarToggle-icon);
transform: scaleX(var(--dir-factor));
}
html[dir="rtl"] .toolbarButton#sidebarToggle::before {
transform: scaleX(-1);
}
.toolbarButton#secondaryToolbarToggle::before {
mask-image: var(--toolbarButton-secondaryToolbarToggle-icon);
transform: scaleX(var(--dir-factor));
}
html[dir="rtl"] .toolbarButton#secondaryToolbarToggle::before {
transform: scaleX(-1);
}
.toolbarButton.findPrevious::before {
@ -1663,7 +1686,9 @@ select {
#viewOutline.toolbarButton::before {
mask-image: var(--toolbarButton-viewOutline-icon);
transform: scaleX(var(--dir-factor));
}
html[dir="rtl"] #viewOutline.toolbarButton::before {
transform: scaleX(-1);
}
#viewAttachments.toolbarButton::before {
@ -1676,7 +1701,9 @@ select {
#currentOutlineItem.toolbarButton::before {
mask-image: var(--toolbarButton-currentOutlineItem-icon);
transform: scaleX(var(--dir-factor));
}
html[dir="rtl"] #currentOutlineItem.toolbarButton::before {
transform: scaleX(-1);
}
#viewFind.toolbarButton::before {
@ -1812,6 +1839,7 @@ select {
.toolbarField.pageNumber {
-moz-appearance: textfield; /* hides the spinner in moz */
min-width: 16px;
text-align: right;
width: 40px;
}
@ -1843,21 +1871,13 @@ select {
padding-inline-start: 3px;
}
#thumbnailView,
#outlineView,
#attachmentsView,
#layersView {
#thumbnailView {
position: absolute;
width: calc(100% - 8px);
width: calc(100% - 60px);
top: 0;
bottom: 0;
padding: 4px 4px 0;
overflow: auto;
user-select: none;
}
#thumbnailView {
width: calc(100% - 60px);
padding: 10px 30px 0;
overflow: auto;
}
#thumbnailView > a:active,
@ -1918,6 +1938,18 @@ 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;
@ -1926,6 +1958,7 @@ 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;
@ -1961,7 +1994,9 @@ a:focus > .thumbnail > .thumbnailSelectionRing,
}
.treeItemToggler.treeItemsHidden::before {
mask-image: var(--treeitem-collapsed-icon);
transform: scaleX(var(--dir-factor));
}
html[dir="rtl"] .treeItemToggler.treeItemsHidden::before {
transform: scaleX(-1);
}
.treeItemToggler.treeItemsHidden ~ .treeItems {
display: none;
@ -1990,7 +2025,7 @@ a:focus > .thumbnail > .thumbnailSelectionRing,
}
#errorWrapper {
background-color: var(--errorWrapper-bg-color);
background: none repeat scroll 0 0 var(--errorWrapper-bg-color);
color: var(--main-color);
left: 0;
position: absolute;
@ -2015,17 +2050,32 @@ a:focus > .thumbnail > .thumbnailSelectionRing,
width: 98%;
}
.dialogButton {
.overlayButton {
width: auto;
margin: 3px 4px 2px !important;
padding: 2px 11px;
color: var(--main-color);
background-color: var(--dialog-button-bg-color);
border: var(--dialog-button-border) !important;
background-color: var(--overlay-button-bg-color);
border: var(--overlay-button-border) !important;
}
dialog {
margin: auto;
#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;
padding: 15px;
border-spacing: 4px;
color: var(--main-color);
@ -2036,23 +2086,20 @@ dialog {
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;
@ -2060,38 +2107,38 @@ dialog .separator {
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);
}
#passwordDialog {
#passwordOverlay > .dialog {
text-align: center;
}
#passwordDialog .toolbarField {
#passwordOverlay .toolbarField {
width: 200px;
}
#documentPropertiesDialog {
#documentPropertiesOverlay > .dialog {
text-align: left;
}
#documentPropertiesDialog .row > * {
#documentPropertiesOverlay .row > * {
min-width: 100px;
text-align: start;
}
#documentPropertiesDialog .row > span {
#documentPropertiesOverlay .row > span {
width: 125px;
word-wrap: break-word;
}
#documentPropertiesDialog .row > p {
#documentPropertiesOverlay .row > p {
max-width: 225px;
word-wrap: break-word;
}
#documentPropertiesDialog .buttonRow {
#documentPropertiesOverlay .buttonRow {
margin-top: 10px;
}
@ -2099,8 +2146,18 @@ dialog :link {
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-color: rgba(255, 255, 255, 1);
background: none repeat scroll 0 0 rgba(255, 255, 255, 1);
border: 1px solid rgba(102, 102, 102, 1);
position: fixed;
top: 32px;
@ -2129,9 +2186,12 @@ dialog :link {
#PDFBug button.active {
font-weight: bold;
}
.debuggerShowText,
.debuggerShowText {
background: none repeat scroll 0 0 rgba(255, 255, 0, 1);
color: rgba(0, 0, 255, 1);
}
.debuggerHideText:hover {
background-color: rgba(255, 255, 0, 1);
background: none repeat scroll 0 0 rgba(255, 255, 0, 1);
}
#PDFBug .stats {
font-family: courier;
@ -2259,6 +2319,10 @@ dialog :link {
display: block;
}
.fileInput {
display: none;
}
/* Rules for browsers that support PDF.js printing */
body[data-pdfjsprinting] #outerContainer {
display: none;
@ -2327,9 +2391,19 @@ dialog :link {
#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" aria-invalid="false">
<input id="findInput" class="toolbarField" title="Find" placeholder="Find in document…" tabindex="91" data-l10n-id="find_input">
<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,8 +112,10 @@ 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 id="findbarMessageContainer" aria-live="polite">
<div class="findbarMessageContainer">
<span id="findResultsCount" class="toolbarLabel"></span>
</div>
<div class="findbarMessageContainer">
<span id="findMsg" class="toolbarLabel"></span>
</div>
</div> <!-- findbar -->
@ -202,7 +204,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" aria-controls="documentPropertiesDialog">
<button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties…" tabindex="69" data-l10n-id="document_properties">
<span data-l10n-id="document_properties_label">Document Properties…</span>
</button>
</div>
@ -301,87 +303,76 @@ See https://github.com/adobe-type-tools/cmap-resources
</div> <!-- mainContainer -->
<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 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>
<div class="row">
<input type="password" id="password" class="toolbarField">
</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>
<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>
</div> <!-- overlayContainer -->
</div> <!-- outerContainer -->
<div id="printContainer"></div>
</body>
</html>

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

@ -460,7 +460,6 @@ const PDFViewerApplication = {
_docStats: null,
_wheelUnusedTicks: 0,
_idleCallbacks: new Set(),
_PDFBug: null,
async initialize(appConfig) {
this.preferences = this.externalServices.createPreferences();
@ -946,7 +945,11 @@ const PDFViewerApplication = {
this.findBar?.reset();
this.toolbar.reset();
this.secondaryToolbar.reset();
this._PDFBug?.cleanup();
if (typeof PDFBug !== "undefined") {
PDFBug.cleanup();
}
await Promise.all(promises);
},
@ -2040,7 +2043,9 @@ const PDFViewerApplication = {
},
_unblockDocumentLoadEvent() {
document.blockUnblockOnload?.(false);
if (document.blockUnblockOnload) {
document.blockUnblockOnload(false);
}
this._unblockDocumentLoadEvent = () => {};
},
@ -2069,7 +2074,10 @@ let validateFileURL;
;
async function loadFakeWorker() {
_pdfjsLib.GlobalWorkerOptions.workerSrc ||= _app_options.AppOptions.get("workerSrc");
if (!_pdfjsLib.GlobalWorkerOptions.workerSrc) {
_pdfjsLib.GlobalWorkerOptions.workerSrc = _app_options.AppOptions.get("workerSrc");
}
await (0, _pdfjsLib.loadScript)(_pdfjsLib.PDFWorker.workerSrc);
}
@ -2078,31 +2086,31 @@ async function initPDFBug(enabledTabs) {
debuggerScriptPath,
mainContainer
} = PDFViewerApplication.appConfig;
const {
PDFBug
} = await import(debuggerScriptPath);
await (0, _pdfjsLib.loadScript)(debuggerScriptPath);
PDFBug.init({
OPS: _pdfjsLib.OPS
}, mainContainer, enabledTabs);
PDFViewerApplication._PDFBug = PDFBug;
}
function reportPageStatsPDFBug({
pageNumber
}) {
if (!globalThis.Stats?.enabled) {
if (typeof Stats === "undefined" || !Stats.enabled) {
return;
}
const pageView = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1);
globalThis.Stats.add(pageNumber, pageView?.pdfPage?.stats);
const pageStats = pageView?.pdfPage?.stats;
if (!pageStats) {
return;
}
Stats.add(pageNumber, pageStats);
}
function webViewerInitialized() {
const {
appConfig,
eventBus
} = PDFViewerApplication;
const appConfig = PDFViewerApplication.appConfig;
let file;
file = window.location.href;
appConfig.toolbar.openFile.hidden = true;
@ -2132,7 +2140,7 @@ function webViewerInitialized() {
appConfig.mainContainer.addEventListener("transitionend", function (evt) {
if (evt.target === this) {
eventBus.dispatch("resize", {
PDFViewerApplication.eventBus.dispatch("resize", {
source: this
});
}
@ -4479,66 +4487,92 @@ Object.defineProperty(exports, "__esModule", ({
exports.OverlayManager = void 0;
class OverlayManager {
#overlays = new WeakMap();
#overlays = Object.create(null);
#active = null;
#keyDownBound = null;
get active() {
return this.#active;
}
async register(dialog, canForceClose = false) {
if (typeof dialog !== "object") {
async register(name, element, callerCloseMethod = null, canForceClose = false) {
let container;
if (!name || !element || !(container = element.parentNode)) {
throw new Error("Not enough parameters.");
} else if (this.#overlays.has(dialog)) {
} else if (this.#overlays[name]) {
throw new Error("The overlay is already registered.");
}
this.#overlays.set(dialog, {
this.#overlays[name] = {
element,
container,
callerCloseMethod,
canForceClose
});
dialog.addEventListener("cancel", evt => {
this.#active = null;
});
};
}
async unregister(dialog) {
if (!this.#overlays.has(dialog)) {
async unregister(name) {
if (!this.#overlays[name]) {
throw new Error("The overlay does not exist.");
} else if (this.#active === dialog) {
} else if (this.#active === name) {
throw new Error("The overlay cannot be removed while it is active.");
}
this.#overlays.delete(dialog);
delete this.#overlays[name];
}
async open(dialog) {
if (!this.#overlays.has(dialog)) {
async open(name) {
if (!this.#overlays[name]) {
throw new Error("The overlay does not exist.");
} else if (this.#active) {
if (this.#active === dialog) {
if (this.#active === name) {
throw new Error("The overlay is already active.");
} else if (this.#overlays.get(dialog).canForceClose) {
await this.close();
} else if (this.#overlays[name].canForceClose) {
this.#closeThroughCaller();
} else {
throw new Error("Another overlay is currently active.");
}
}
this.#active = dialog;
dialog.showModal();
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);
}
async close(dialog = this.#active) {
if (!this.#overlays.has(dialog)) {
async close(name) {
if (!this.#overlays[name]) {
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 !== dialog) {
} else if (this.#active !== name) {
throw new Error("Another overlay is currently active.");
}
dialog.close();
this.#overlays[this.#active].container.classList.add("hidden");
this.#overlays[this.#active].element.classList.add("hidden");
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);
}
}
}
@ -4559,11 +4593,9 @@ exports.PasswordPrompt = void 0;
var _pdfjsLib = __webpack_require__(5);
class PasswordPrompt {
#updateCallback = null;
#reason = null;
constructor(options, overlayManager, l10n, isViewerEmbedded = false) {
this.dialog = options.dialog;
this.overlayName = options.overlayName;
this.container = options.container;
this.label = options.label;
this.input = options.input;
this.submitButton = options.submitButton;
@ -4571,6 +4603,8 @@ 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 => {
@ -4578,13 +4612,12 @@ class PasswordPrompt {
this.#verify();
}
});
this.overlayManager.register(this.dialog, true);
this.dialog.addEventListener("close", this.#cancel.bind(this));
this.overlayManager.register(this.overlayName, this.container, this.#cancel.bind(this), true);
}
async open() {
await this.overlayManager.open(this.dialog);
const passwordIncorrect = this.#reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD;
await this.overlayManager.open(this.overlayName);
const passwordIncorrect = this.reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD;
if (!this._isViewerEmbedded || passwordIncorrect) {
this.input.focus();
@ -4594,37 +4627,27 @@ class PasswordPrompt {
}
async close() {
if (this.overlayManager.active === this.dialog) {
this.overlayManager.close(this.dialog);
}
await this.overlayManager.close(this.overlayName);
this.input.value = "";
}
#verify() {
const password = this.input.value;
if (password?.length > 0) {
this.#invokeCallback(password);
this.close();
this.updateCallback(password);
}
}
#cancel() {
this.#invokeCallback(new Error("PasswordPrompt cancelled."));
}
#invokeCallback(password) {
if (!this.#updateCallback) {
return;
}
this.close();
this.input.value = "";
this.#updateCallback(password);
this.#updateCallback = null;
this.updateCallback(new Error("PasswordPrompt cancelled."));
}
setUpdateCallback(updateCallback, reason) {
this.#updateCallback = updateCallback;
this.#reason = reason;
this.updateCallback = updateCallback;
this.reason = reason;
}
}
@ -4956,17 +4979,19 @@ class PDFDocumentProperties {
#fieldData = null;
constructor({
dialog,
overlayName,
fields,
container,
closeButton
}, overlayManager, eventBus, l10n) {
this.dialog = dialog;
this.overlayName = overlayName;
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.dialog);
this.overlayManager.register(this.overlayName, this.container, this.close.bind(this));
eventBus._on("pagechanging", evt => {
this._currentPageNumber = evt.pageNumber;
@ -4983,7 +5008,7 @@ class PDFDocumentProperties {
}
async open() {
await Promise.all([this.overlayManager.open(this.dialog), this._dataAvailableCapability.promise]);
await Promise.all([this.overlayManager.open(this.overlayName), this._dataAvailableCapability.promise]);
const currentPageNumber = this._currentPageNumber;
const pagesRotation = this._pagesRotation;
@ -5033,8 +5058,8 @@ class PDFDocumentProperties {
this.#updateUI();
}
async close() {
this.overlayManager.close(this.dialog);
close() {
this.overlayManager.close(this.overlayName);
}
setDocument(pdfDocument, url = null) {
@ -5071,7 +5096,7 @@ class PDFDocumentProperties {
return;
}
if (this.overlayManager.active !== this.dialog) {
if (this.overlayManager.active !== this.overlayName) {
return;
}
@ -5290,7 +5315,6 @@ 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();
@ -6274,6 +6298,11 @@ 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;
@ -6658,7 +6687,7 @@ class PDFHistory {
}
this._position = {
hash: location.pdfOpenParams.substring(1),
hash: this._isViewerInPresentationMode ? `page=${location.pageNumber}` : location.pdfOpenParams.substring(1),
page: this.linkService.page,
first: location.pageNumber,
rotation: location.rotation
@ -7379,6 +7408,7 @@ 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";
@ -7388,9 +7418,6 @@ 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,
@ -7399,45 +7426,30 @@ 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;
}
async request() {
const {
container,
pdfViewer
} = this;
if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) {
request() {
if (this.switchInProgress || this.active || !this.pdfViewer.pagesCount || !this.container.requestFullscreen) {
return false;
}
this.#addFullscreenChangeListeners();
this.#notifyStateChange(_ui_utils.PresentationModeState.CHANGING);
const promise = container.requestFullscreen();
this.#args = {
pageNumber: pdfViewer.currentPageNumber,
scaleValue: pdfViewer.currentScaleValue,
scrollMode: pdfViewer.scrollMode,
spreadMode: pdfViewer.spreadMode
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
};
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;
return true;
}
#mouseWheel(evt) {
@ -7471,21 +7483,49 @@ class PDFPresentationMode {
}
}
#notifyStateChange(state) {
this.#state = state;
#notifyStateChange() {
let state = _ui_utils.PresentationModeState.NORMAL;
if (this.switchInProgress) {
state = _ui_utils.PresentationModeState.CHANGING;
} else if (this.active) {
state = _ui_utils.PresentationModeState.FULLSCREEN;
}
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.#notifyStateChange(_ui_utils.PresentationModeState.FULLSCREEN);
this.active = true;
this.#resetSwitchInProgress();
this.#notifyStateChange();
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();
@ -7498,13 +7538,14 @@ class PDFPresentationMode {
const pageNumber = this.pdfViewer.currentPageNumber;
this.container.classList.remove(ACTIVE_SELECTOR);
setTimeout(() => {
this.active = false;
this.#removeFullscreenChangeListeners();
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.#notifyStateChange();
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();
@ -8368,7 +8409,7 @@ class PDFSidebar {
this.pdfViewer = pdfViewer;
this.pdfThumbnailViewer = pdfThumbnailViewer;
this.outerContainer = elements.outerContainer;
this.sidebarContainer = elements.sidebarContainer;
this.viewerContainer = elements.viewerContainer;
this.toggleButton = elements.toggleButton;
this.thumbnailButton = elements.thumbnailButton;
this.outlineButton = elements.outlineButton;
@ -8495,10 +8536,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);
@ -8627,8 +8668,8 @@ class PDFSidebar {
}
_addEventListeners() {
this.sidebarContainer.addEventListener("transitionend", evt => {
if (evt.target === this.sidebarContainer) {
this.viewerContainer.addEventListener("transitionend", evt => {
if (evt.target === this.viewerContainer) {
this.outerContainer.classList.remove("sidebarMoving");
}
});
@ -9675,7 +9716,7 @@ class BaseViewer {
throw new Error("Cannot initialize BaseViewer.");
}
const viewerVersion = '2.14.171';
const viewerVersion = '2.14.102';
if (_pdfjsLib.version !== viewerVersion) {
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
@ -10363,6 +10404,8 @@ 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
};
@ -10625,17 +10668,14 @@ 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]);
let pdfOpenParams = `#page=${pageNumber}`;
if (!this.isInPresentationMode) {
pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;
}
pdfOpenParams += "," + intLeft + "," + intTop;
this._location = {
pageNumber,
scale: normalizedScaleValue,
@ -10719,7 +10759,35 @@ 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;
@ -11766,8 +11834,9 @@ 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: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
scale: viewportScale,
rotation: totalRotation
});
@ -11776,6 +11845,7 @@ class PDFPageView {
style
} = document.documentElement;
style.setProperty("--zoom-factor", this.scale);
style.setProperty("--viewport-scale-factor", viewportScale);
}
if (this.svg) {
@ -13113,8 +13183,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}`);
});
}
@ -13138,10 +13208,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;
@ -13177,9 +13247,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);
@ -14513,8 +14583,8 @@ var _app_options = __webpack_require__(1);
var _app = __webpack_require__(2);
const pdfjsVersion = '2.14.171';
const pdfjsBuild = '3f5c31e20';
const pdfjsVersion = '2.14.102';
const pdfjsBuild = 'db4f3adc5';
window.PDFViewerApplication = _app.PDFViewerApplication;
window.PDFViewerApplicationOptions = _app_options.AppOptions;
;
@ -14576,7 +14646,7 @@ function getViewerConfiguration() {
},
sidebar: {
outerContainer: document.getElementById("outerContainer"),
sidebarContainer: document.getElementById("sidebarContainer"),
viewerContainer: document.getElementById("viewerContainer"),
toggleButton: document.getElementById("sidebarToggle"),
thumbnailButton: document.getElementById("viewThumbnail"),
outlineButton: document.getElementById("viewOutline"),
@ -14607,14 +14677,16 @@ function getViewerConfiguration() {
findNextButton: document.getElementById("findNext")
},
passwordOverlay: {
dialog: document.getElementById("passwordDialog"),
overlayName: "passwordOverlay",
container: document.getElementById("passwordOverlay"),
label: document.getElementById("passwordText"),
input: document.getElementById("password"),
submitButton: document.getElementById("passwordSubmit"),
cancelButton: document.getElementById("passwordCancel")
},
documentProperties: {
dialog: document.getElementById("documentPropertiesDialog"),
overlayName: "documentPropertiesOverlay",
container: document.getElementById("documentPropertiesOverlay"),
closeButton: document.getElementById("documentPropertiesClose"),
fields: {
fileName: document.getElementById("fileNameField"),
@ -14635,7 +14707,7 @@ function getViewerConfiguration() {
},
errorWrapper,
printContainer: document.getElementById("printContainer"),
openFileInput: null,
openFileInputName: "fileInput",
debuggerScriptPath: "./debugger.js"
};
}
@ -14646,7 +14718,9 @@ function webViewerLoad() {
_app.PDFViewerApplication.run(config);
}
document.blockUnblockOnload?.(true);
if (document.blockUnblockOnload) {
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.171
release: version 2.14.102
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/