Bug 1815097 - Update PDF.js to e69866492735c36623fbdbc9a96ce5e51a065f55 r=pdfjs-reviewers,marco

Differential Revision: https://phabricator.services.mozilla.com/D168904
This commit is contained in:
Updatebot 2023-02-06 09:40:16 +00:00
parent fa1c952e5c
commit 75d950c89e
9 changed files with 191 additions and 300 deletions

View File

@ -207,7 +207,6 @@ page_scale_actual=Actual Size
page_scale_percent={{scale}}%
# Loading indicator messages
loading=Loading…
loading_error=An error occurred while loading the PDF.
invalid_file_error=Invalid or corrupted PDF file.
missing_file_error=Missing PDF file.

View File

@ -910,15 +910,9 @@ function getDocument(src) {
const val = src[key];
switch (key) {
case "url":
if (val instanceof URL) {
params[key] = val.href;
{
continue;
}
try {
params[key] = new URL(val, window.location).href;
continue;
} catch (ex) {}
throw new Error("Invalid PDF url data: " + "either string or URL-object is expected in the url property.");
case "range":
rangeTransport = val;
continue;
@ -939,6 +933,7 @@ function getDocument(src) {
}
params[key] = val;
}
params.cMapPacked = params.cMapPacked !== false;
params.CMapReaderFactory = params.CMapReaderFactory || DefaultCMapReaderFactory;
params.StandardFontDataFactory = params.StandardFontDataFactory || DefaultStandardFontDataFactory;
params.ignoreErrors = params.stopAtErrors !== true;
@ -1043,7 +1038,7 @@ async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
const transfers = source.data ? [source.data.buffer] : null;
const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", {
docId,
apiVersion: '3.3.122',
apiVersion: '3.4.37',
data: source.data,
password: source.password,
disableAutoFetch: source.disableAutoFetch,
@ -1892,9 +1887,9 @@ class PDFWorker {
}
exports.PDFWorker = PDFWorker;
class WorkerTransport {
#methodPromises = new Map();
#pageCache = new Map();
#pagePromises = new Map();
#metadataPromise = null;
constructor(messageHandler, loadingTask, networkStream, params) {
this.messageHandler = messageHandler;
this.loadingTask = loadingTask;
@ -1923,6 +1918,15 @@ class WorkerTransport {
this.downloadInfoCapability = (0, _util.createPromiseCapability)();
this.setupMessageHandler();
}
#cacheSimpleMethod(name, data = null) {
const cachedPromise = this.#methodPromises.get(name);
if (cachedPromise) {
return cachedPromise;
}
const promise = this.messageHandler.sendWithPromise(name, data);
this.#methodPromises.set(name, promise);
return promise;
}
get annotationStorage() {
return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage());
}
@ -1990,9 +1994,7 @@ class WorkerTransport {
Promise.all(waitOn).then(() => {
this.commonObjs.clear();
this.fontLoader.clear();
this.#metadataPromise = null;
this._getFieldObjectsPromise = null;
this._hasJSActionsPromise = null;
this.#methodPromises.clear();
if (this._networkStream) {
this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated."));
}
@ -2337,10 +2339,10 @@ class WorkerTransport {
});
}
getFieldObjects() {
return this._getFieldObjectsPromise ||= this.messageHandler.sendWithPromise("GetFieldObjects", null);
return this.#cacheSimpleMethod("GetFieldObjects");
}
hasJSActions() {
return this._hasJSActionsPromise ||= this.messageHandler.sendWithPromise("HasJSActions", null);
return this.#cacheSimpleMethod("HasJSActions");
}
getCalculationOrderIds() {
return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
@ -2402,7 +2404,12 @@ class WorkerTransport {
return this.messageHandler.sendWithPromise("GetPermissions", null);
}
getMetadata() {
return this.#metadataPromise ||= this.messageHandler.sendWithPromise("GetMetadata", null).then(results => {
const name = "GetMetadata",
cachedPromise = this.#methodPromises.get(name);
if (cachedPromise) {
return cachedPromise;
}
const promise = this.messageHandler.sendWithPromise(name, null).then(results => {
return {
info: results[0],
metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
@ -2410,6 +2417,8 @@ class WorkerTransport {
contentLength: this._fullReader?.contentLength ?? null
};
});
this.#methodPromises.set(name, promise);
return promise;
}
getMarkInfo() {
return this.messageHandler.sendWithPromise("GetMarkInfo", null);
@ -2429,9 +2438,7 @@ class WorkerTransport {
if (!keepLoadedFonts) {
this.fontLoader.clear();
}
this.#metadataPromise = null;
this._getFieldObjectsPromise = null;
this._hasJSActionsPromise = null;
this.#methodPromises.clear();
}
get loadingParams() {
const params = this._params;
@ -2642,9 +2649,9 @@ class InternalRenderTask {
}
}
}
const version = '3.3.122';
const version = '3.4.37';
exports.version = version;
const build = '562045607';
const build = 'e69866492';
exports.build = build;
/***/ }),
@ -4273,7 +4280,7 @@ exports.BaseCanvasFactory = BaseCanvasFactory;
class BaseCMapReaderFactory {
constructor({
baseUrl = null,
isCompressed = false
isCompressed = true
}) {
if (this.constructor === BaseCMapReaderFactory) {
(0, _util.unreachable)("Cannot initialize BaseCMapReaderFactory.");
@ -8804,6 +8811,9 @@ class AnnotationEditorLayer {
this.#accessibilityManager = options.accessibilityManager;
this.#uiManager.addLayer(this);
}
get isEmpty() {
return this.#editors.size === 0;
}
updateToolbar(mode) {
this.#uiManager.updateToolbar(mode);
}
@ -8816,8 +8826,11 @@ class AnnotationEditorLayer {
this.enableClick();
}
this.#uiManager.unselectAll();
this.div.classList.toggle("freeTextEditing", mode === _util.AnnotationEditorType.FREETEXT);
this.div.classList.toggle("inkEditing", mode === _util.AnnotationEditorType.INK);
if (mode !== _util.AnnotationEditorType.NONE) {
this.div.classList.toggle("freeTextEditing", mode === _util.AnnotationEditorType.FREETEXT);
this.div.classList.toggle("inkEditing", mode === _util.AnnotationEditorType.INK);
this.div.hidden = false;
}
}
addInkEditorIfNeeded(isCommitting) {
if (!isCommitting && this.#uiManager.getMode() !== _util.AnnotationEditorType.INK) {
@ -8854,6 +8867,10 @@ class AnnotationEditorLayer {
for (const editor of this.#editors.values()) {
editor.disableEditing();
}
this.#cleanup();
if (this.isEmpty) {
this.div.hidden = true;
}
}
setActiveEditor(editor) {
const currentActive = this.#uiManager.getActive();
@ -13041,8 +13058,8 @@ var _annotation_layer = __w_pdfjs_require__(26);
var _worker_options = __w_pdfjs_require__(14);
var _svg = __w_pdfjs_require__(29);
var _xfa_layer = __w_pdfjs_require__(28);
const pdfjsVersion = '3.3.122';
const pdfjsBuild = '562045607';
const pdfjsVersion = '3.4.37';
const pdfjsBuild = 'e69866492';
})();
/******/ return __webpack_exports__;

View File

@ -4258,8 +4258,8 @@ Object.defineProperty(exports, "initSandbox", ({
}
}));
var _initialization = __w_pdfjs_require__(1);
const pdfjsVersion = '3.3.122';
const pdfjsBuild = '562045607';
const pdfjsVersion = '3.4.37';
const pdfjsBuild = 'e69866492';
})();
/******/ return __webpack_exports__;

View File

@ -101,7 +101,7 @@ class WorkerMessageHandler {
docId,
apiVersion
} = docParams;
const workerVersion = '3.3.122';
const workerVersion = '3.4.37';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}
@ -25605,6 +25605,7 @@ const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(funct
t[182] = 8217;
t[200] = 193;
t[203] = 205;
t[207] = 211;
t[210] = 218;
t[223] = 711;
t[224] = 321;
@ -39491,7 +39492,7 @@ class MetadataParser {
}
throw new Error(`_repair: ${name} isn't defined.`);
});
const charBuf = [];
const charBuf = [">"];
for (let i = 0, ii = bytes.length; i < ii; i += 2) {
const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
@ -39500,7 +39501,7 @@ class MetadataParser {
charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
}
}
return ">" + charBuf.join("");
return charBuf.join("");
});
}
_getSequence(entry) {
@ -52417,8 +52418,8 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({
}
}));
var _worker = __w_pdfjs_require__(1);
const pdfjsVersion = '3.3.122';
const pdfjsBuild = '562045607';
const pdfjsVersion = '3.4.37';
const pdfjsBuild = 'e69866492';
})();
/******/ return __webpack_exports__;

View File

@ -954,20 +954,6 @@
height: var(--viewer-container-height);
}
.pdfViewer.removePageBorders .page {
margin: 0 auto 10px;
border: none;
}
.pdfViewer.singlePageView {
display: inline-block;
}
.pdfViewer.singlePageView .page {
margin: 0;
border: none;
}
.pdfViewer.scrollHorizontal,
.pdfViewer.scrollWrapped,
.spread {
@ -981,7 +967,6 @@
white-space: nowrap;
}
.pdfViewer.removePageBorders,
.pdfViewer.scrollHorizontal .spread,
.pdfViewer.scrollWrapped .spread {
margin-left: 0;
@ -1005,13 +990,6 @@
margin-right: var(--spreadHorizontalWrapped-margin-LR);
}
.pdfViewer.removePageBorders .spread .page,
.pdfViewer.removePageBorders.scrollHorizontal .page,
.pdfViewer.removePageBorders.scrollWrapped .page {
margin-left: 5px;
margin-right: 5px;
}
.pdfViewer .page canvas {
margin: 0;
display: block;
@ -1026,22 +1004,28 @@
height: 100%;
}
.pdfViewer .page .loadingIcon {
.pdfViewer .page.loadingIcon:after {
position: absolute;
display: block;
left: 0;
top: 0;
right: 0;
bottom: 0;
left: 0;
content: "";
width: 100%;
height: 100%;
background: url("images/loading-icon.gif") center no-repeat;
visibility: visible;
visibility: hidden;
/* Using a delay with background-image doesn't work,
consequently we use the visibility. */
transition-property: visibility;
transition-delay: var(--loading-icon-delay);
z-index: 5;
contain: strict;
}
.pdfViewer .page .loadingIcon.notVisible {
.pdfViewer .page.loading:after {
visibility: visible;
}
.pdfViewer .page:not(.loading):after {
transition-property: none;
visibility: hidden;
}
@ -1270,88 +1254,6 @@ dialog :link {
width: 200px;
}
.grab-to-pan-grab {
cursor: grab !important;
}
.grab-to-pan-grab
*:not(input):not(textarea):not(button):not(select):not(:link) {
cursor: inherit !important;
}
.grab-to-pan-grab:active,
.grab-to-pan-grabbing {
cursor: grabbing !important;
position: fixed;
background: rgba(0, 0, 0, 0);
display: block;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: 50000; /* should be higher than anything else in PDF.js! */
}
@page {
margin: 0;
}
.visibleLargeView,
.visibleMediumView {
display: none;
}
@media all and (max-width: 900px) {
#toolbarViewerMiddle {
display: table;
margin: auto;
left: auto;
position: inherit;
transform: none;
}
}
@media all and (max-width: 840px) {
#sidebarContainer {
background-color: var(--sidebar-narrow-bg-color);
}
#outerContainer.sidebarOpen #viewerContainer {
inset-inline-start: 0 !important;
}
}
@media all and (max-width: 820px) {
#outerContainer .hiddenLargeView {
display: none;
}
#outerContainer .visibleLargeView {
display: inherit;
}
}
@media all and (max-width: 750px) {
#outerContainer .hiddenMediumView {
display: none;
}
#outerContainer .visibleMediumView {
display: inherit;
}
}
@media all and (max-width: 690px) {
.hiddenSmallView,
.hiddenSmallView * {
display: none;
}
.toolbarButtonSpacer {
width: 0;
}
.findbar {
inset-inline-start: 34px;
}
}
@media all and (max-width: 560px) {
#scaleSelectContainer {
display: none;
}
}

View File

@ -1635,11 +1635,13 @@ const PDFViewerApplication = {
return this._docFilename;
});
}
this.pdfCursorTools = new _pdf_cursor_tools.PDFCursorTools({
container,
eventBus,
cursorToolOnLoad: _app_options.AppOptions.get("cursorToolOnLoad")
});
if (appConfig.secondaryToolbar?.cursorHandToolButton) {
this.pdfCursorTools = new _pdf_cursor_tools.PDFCursorTools({
container,
eventBus,
cursorToolOnLoad: _app_options.AppOptions.get("cursorToolOnLoad")
});
}
if (appConfig.toolbar) {
this.toolbar = new _toolbar.Toolbar(appConfig.toolbar, eventBus, this.l10n);
}
@ -1759,11 +1761,9 @@ const PDFViewerApplication = {
},
initPassiveLoading() {
this.externalServices.initPassiveLoading({
onOpenWithTransport: (url, length, transport) => {
onOpenWithTransport: range => {
this.open({
url,
length,
range: transport
range
});
},
onOpenWithData: (data, contentDispositionFilename) => {
@ -1876,23 +1876,15 @@ const PDFViewerApplication = {
if (this.pdfLoadingTask) {
await this.close();
}
const workerParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.WORKER);
for (const key in workerParameters) {
_pdfjsLib.GlobalWorkerOptions[key] = workerParameters[key];
}
const parameters = Object.create(null);
const apiParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.API);
for (const key in apiParameters) {
let value = apiParameters[key];
if (key === "docBaseUrl") {
value ||= this.baseUrl;
}
parameters[key] = value;
}
for (const key in args) {
parameters[key] = args[key];
}
const loadingTask = (0, _pdfjsLib.getDocument)(parameters);
const workerParams = _app_options.AppOptions.getAll(_app_options.OptionKind.WORKER);
Object.assign(_pdfjsLib.GlobalWorkerOptions, workerParams);
const apiParams = _app_options.AppOptions.getAll(_app_options.OptionKind.API);
const params = {
...apiParams,
...args
};
params.docBaseUrl ||= this.baseUrl;
const loadingTask = (0, _pdfjsLib.getDocument)(params);
this.pdfLoadingTask = loadingTask;
loadingTask.onPassword = (updateCallback, reason) => {
if (this.isViewerEmbedded) {
@ -8170,7 +8162,7 @@ class PDFViewer {
#onVisibilityChange = null;
#scaleTimeoutId = null;
constructor(options) {
const viewerVersion = '3.3.122';
const viewerVersion = '3.4.37';
if (_pdfjsLib.version !== viewerVersion) {
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
}
@ -8182,7 +8174,6 @@ class PDFViewer {
this.downloadManager = options.downloadManager || null;
this.findController = options.findController || null;
this._scriptingManager = options.scriptingManager || null;
this.removePageBorders = options.removePageBorders || false;
this.textLayerMode = options.textLayerMode ?? _ui_utils.TextLayerMode.ENABLE;
this.#annotationMode = options.annotationMode ?? _pdfjsLib.AnnotationMode.ENABLE_FORMS;
this.#annotationEditorMode = options.annotationEditorMode ?? _pdfjsLib.AnnotationEditorType.NONE;
@ -8205,9 +8196,6 @@ class PDFViewer {
this.presentationModeState = _ui_utils.PresentationModeState.UNKNOWN;
this._onBeforeDraw = this._onAfterDraw = null;
this._resetView();
if (this.removePageBorders) {
this.viewer.classList.add("removePageBorders");
}
this.#updateContainerHeightCss();
}
get pagesCount() {
@ -8818,8 +8806,6 @@ class PDFViewer {
if (this._spreadMode !== _ui_utils.SpreadMode.NONE) {
hPadding *= 2;
}
} else if (this.removePageBorders) {
hPadding = vPadding = 0;
} else if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL) {
[hPadding, vPadding] = [vPadding, hPadding];
}
@ -8932,8 +8918,9 @@ class PDFViewer {
y = destArray[3];
width = destArray[4] - x;
height = destArray[5] - y;
const hPadding = this.removePageBorders ? 0 : _ui_utils.SCROLLBAR_PADDING;
const vPadding = this.removePageBorders ? 0 : _ui_utils.VERTICAL_PADDING;
let hPadding = _ui_utils.SCROLLBAR_PADDING,
vPadding = _ui_utils.VERTICAL_PADDING;
;
widthScale = (this.container.clientWidth - hPadding) / width / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
heightScale = (this.container.clientHeight - vPadding) / height / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
@ -9559,7 +9546,6 @@ const DEFAULT_L10N_STRINGS = {
page_scale_auto: "Automatic Zoom",
page_scale_actual: "Actual Size",
page_scale_percent: "{{scale}}%",
loading: "Loading…",
loading_error: "An error occurred while loading the PDF.",
invalid_file_error: "Invalid or corrupted PDF file.",
missing_file_error: "Missing PDF file.",
@ -9654,6 +9640,7 @@ const DEFAULT_LAYER_PROPERTIES = () => {
class PDFPageView {
#annotationMode = _pdfjsLib.AnnotationMode.ENABLE_FORMS;
#layerProperties = null;
#loadingId = null;
#previousRotation = null;
#renderingState = _ui_utils.RenderingStates.INITIAL;
#useThumbnailCanvas = {
@ -9712,20 +9699,28 @@ class PDFPageView {
return this.#renderingState;
}
set renderingState(state) {
if (state === this.#renderingState) {
return;
}
this.#renderingState = state;
if (this.#loadingId) {
clearTimeout(this.#loadingId);
this.#loadingId = null;
}
switch (state) {
case _ui_utils.RenderingStates.INITIAL:
case _ui_utils.RenderingStates.PAUSED:
this.loadingIconDiv?.classList.add("notVisible");
this.div.classList.remove("loading");
break;
case _ui_utils.RenderingStates.RUNNING:
this.loadingIconDiv?.classList.remove("notVisible");
this.div.classList.add("loadingIcon");
this.#loadingId = setTimeout(() => {
this.div.classList.add("loading");
this.#loadingId = null;
}, 0);
break;
case _ui_utils.RenderingStates.INITIAL:
case _ui_utils.RenderingStates.FINISHED:
if (this.loadingIconDiv) {
this.loadingIconDiv.remove();
delete this.loadingIconDiv;
}
this.div.classList.remove("loadingIcon", "loading");
break;
}
}
@ -9906,7 +9901,6 @@ class PDFPageView {
case annotationEditorLayerNode:
case xfaLayerNode:
case textLayerNode:
case this.loadingIconDiv:
continue;
}
node.remove();
@ -9933,15 +9927,6 @@ class PDFPageView {
}
this._resetZoomLayer();
}
if (!this.loadingIconDiv) {
this.loadingIconDiv = document.createElement("div");
this.loadingIconDiv.className = "loadingIcon notVisible";
this.loadingIconDiv.setAttribute("role", "img");
this.l10n.get("loading").then(msg => {
this.loadingIconDiv?.setAttribute("aria-label", msg);
});
div.append(this.loadingIconDiv);
}
}
update({
scale = 0,
@ -10428,6 +10413,7 @@ class AnnotationEditorLayerBuilder {
const div = this.div = document.createElement("div");
div.className = "annotationEditorLayer";
div.tabIndex = 0;
div.hidden = true;
this.pageDiv.append(div);
this.annotationEditorLayer = new _pdfjsLib.AnnotationEditorLayer({
uiManager: this.#uiManager,
@ -10444,6 +10430,7 @@ class AnnotationEditorLayerBuilder {
intent
};
this.annotationEditorLayer.render(parameters);
this.show();
}
cancel() {
this._cancelled = true;
@ -10461,7 +10448,7 @@ class AnnotationEditorLayerBuilder {
this.div.hidden = true;
}
show() {
if (!this.div) {
if (!this.div || this.annotationEditorLayer.isEmpty) {
return;
}
this.div.hidden = false;
@ -11901,7 +11888,8 @@ class Toolbar {
}
maxWidth += 0.3 * scaleSelectWidth;
if (maxWidth > scaleSelectWidth) {
_ui_utils.docStyle.setProperty("--scale-select-width", `${maxWidth}px`);
const container = items.scaleSelect.parentNode;
container.style.setProperty("--scale-select-width", `${maxWidth}px`);
}
canvas.width = 0;
canvas.height = 0;
@ -12255,7 +12243,7 @@ class FirefoxExternalServices extends _app.DefaultExternalServices {
break;
}
pdfDataRangeTransport = new FirefoxComDataRangeTransport(args.length, args.data, args.done, args.filename);
callbacks.onOpenWithTransport(args.pdfUrl, args.length, pdfDataRangeTransport);
callbacks.onOpenWithTransport(pdfDataRangeTransport);
break;
case "range":
pdfDataRangeTransport.onDataRange(args.begin, args.chunk);
@ -12605,8 +12593,8 @@ var _ui_utils = __webpack_require__(1);
var _app_options = __webpack_require__(2);
var _pdf_link_service = __webpack_require__(3);
var _app = __webpack_require__(4);
const pdfjsVersion = '3.3.122';
const pdfjsBuild = '562045607';
const pdfjsVersion = '3.4.37';
const pdfjsBuild = 'e69866492';
const AppConstants = null;
exports.PDFViewerApplicationConstants = AppConstants;
window.PDFViewerApplication = _app.PDFViewerApplication;

View File

@ -954,20 +954,6 @@
height: var(--viewer-container-height);
}
.pdfViewer.removePageBorders .page {
margin: 0 auto 10px;
border: none;
}
.pdfViewer.singlePageView {
display: inline-block;
}
.pdfViewer.singlePageView .page {
margin: 0;
border: none;
}
.pdfViewer.scrollHorizontal,
.pdfViewer.scrollWrapped,
.spread {
@ -981,7 +967,6 @@
white-space: nowrap;
}
.pdfViewer.removePageBorders,
.pdfViewer.scrollHorizontal .spread,
.pdfViewer.scrollWrapped .spread {
margin-left: 0;
@ -1005,13 +990,6 @@
margin-right: var(--spreadHorizontalWrapped-margin-LR);
}
.pdfViewer.removePageBorders .spread .page,
.pdfViewer.removePageBorders.scrollHorizontal .page,
.pdfViewer.removePageBorders.scrollWrapped .page {
margin-left: 5px;
margin-right: 5px;
}
.pdfViewer .page canvas {
margin: 0;
display: block;
@ -1026,22 +1004,28 @@
height: 100%;
}
.pdfViewer .page .loadingIcon {
.pdfViewer .page.loadingIcon:after {
position: absolute;
display: block;
left: 0;
top: 0;
right: 0;
bottom: 0;
left: 0;
content: "";
width: 100%;
height: 100%;
background: url("images/loading-icon.gif") center no-repeat;
visibility: visible;
visibility: hidden;
/* Using a delay with background-image doesn't work,
consequently we use the visibility. */
transition-property: visibility;
transition-delay: var(--loading-icon-delay);
z-index: 5;
contain: strict;
}
.pdfViewer .page .loadingIcon.notVisible {
.pdfViewer .page.loading:after {
visibility: visible;
}
.pdfViewer .page:not(.loading):after {
transition-property: none;
visibility: hidden;
}
@ -1066,10 +1050,12 @@
:root {
--dir-factor: 1;
--inline-start: inline-start;
--inline-end: inline-end;
--sidebar-width: 200px;
--sidebar-transition-duration: 200ms;
--sidebar-transition-timing-function: ease;
--scale-select-width: 140px;
--toolbar-icon-opacity: 0.7;
--doorhanger-icon-opacity: 0.9;
@ -1235,6 +1221,12 @@
}
}
@media screen and (prefers-reduced-motion: reduce) {
:root {
--sidebar-transition-duration: 0;
}
}
* {
padding: 0;
margin: 0;
@ -1693,11 +1685,11 @@ body {
#toolbarViewerLeft,
#toolbarSidebarLeft {
float: inline-start;
float: var(--inline-start);
}
#toolbarViewerRight,
#toolbarSidebarRight {
float: inline-end;
float: var(--inline-end);
}
#toolbarViewerLeft > *,
@ -1707,7 +1699,7 @@ body {
#toolbarSidebarRight *,
.findbar * {
position: relative;
float: inline-start;
float: var(--inline-start);
}
#toolbarViewerLeft {
@ -1725,7 +1717,7 @@ body {
display: inline-block;
}
.splitToolbarButton > .toolbarButton {
float: inline-start;
float: var(--inline-start);
}
.toolbarButton,
@ -1775,7 +1767,7 @@ body {
}
.splitToolbarButtonSeparator {
float: inline-start;
float: var(--inline-start);
margin: 4px 0;
width: 1px;
height: 20px;
@ -1828,6 +1820,10 @@ body {
}
.dropdownToolbarButton {
/* Define this variable here, and not in :root, to avoid reflowing the
entire viewer when updating the width. */
--scale-select-width: 140px;
width: var(--scale-select-width);
padding: 0;
background-color: var(--dropdown-btn-bg-color);
@ -2192,7 +2188,7 @@ a.secondaryToolbarButton[href="#"] {
}
.thumbnail {
float: inline-start;
float: var(--inline-start);
margin: 0 10px 5px;
}
@ -2274,13 +2270,13 @@ a:focus > .thumbnail > .thumbnailSelectionRing,
padding-inline-start: 4px;
}
#layersView .treeItem > a > label > input {
float: inline-start;
float: var(--inline-start);
margin-top: 1px;
}
.treeItemToggler {
position: relative;
float: inline-start;
float: var(--inline-start);
height: 0;
width: 0;
color: rgba(255, 255, 255, 0.5);

View File

@ -1635,11 +1635,13 @@ const PDFViewerApplication = {
return this._docFilename;
});
}
this.pdfCursorTools = new _pdf_cursor_tools.PDFCursorTools({
container,
eventBus,
cursorToolOnLoad: _app_options.AppOptions.get("cursorToolOnLoad")
});
if (appConfig.secondaryToolbar?.cursorHandToolButton) {
this.pdfCursorTools = new _pdf_cursor_tools.PDFCursorTools({
container,
eventBus,
cursorToolOnLoad: _app_options.AppOptions.get("cursorToolOnLoad")
});
}
if (appConfig.toolbar) {
this.toolbar = new _toolbar.Toolbar(appConfig.toolbar, eventBus, this.l10n);
}
@ -1759,11 +1761,9 @@ const PDFViewerApplication = {
},
initPassiveLoading() {
this.externalServices.initPassiveLoading({
onOpenWithTransport: (url, length, transport) => {
onOpenWithTransport: range => {
this.open({
url,
length,
range: transport
range
});
},
onOpenWithData: (data, contentDispositionFilename) => {
@ -1876,23 +1876,15 @@ const PDFViewerApplication = {
if (this.pdfLoadingTask) {
await this.close();
}
const workerParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.WORKER);
for (const key in workerParameters) {
_pdfjsLib.GlobalWorkerOptions[key] = workerParameters[key];
}
const parameters = Object.create(null);
const apiParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.API);
for (const key in apiParameters) {
let value = apiParameters[key];
if (key === "docBaseUrl") {
value ||= this.baseUrl;
}
parameters[key] = value;
}
for (const key in args) {
parameters[key] = args[key];
}
const loadingTask = (0, _pdfjsLib.getDocument)(parameters);
const workerParams = _app_options.AppOptions.getAll(_app_options.OptionKind.WORKER);
Object.assign(_pdfjsLib.GlobalWorkerOptions, workerParams);
const apiParams = _app_options.AppOptions.getAll(_app_options.OptionKind.API);
const params = {
...apiParams,
...args
};
params.docBaseUrl ||= this.baseUrl;
const loadingTask = (0, _pdfjsLib.getDocument)(params);
this.pdfLoadingTask = loadingTask;
loadingTask.onPassword = (updateCallback, reason) => {
if (this.isViewerEmbedded) {
@ -8179,7 +8171,7 @@ class PDFViewer {
#onVisibilityChange = null;
#scaleTimeoutId = null;
constructor(options) {
const viewerVersion = '3.3.122';
const viewerVersion = '3.4.37';
if (_pdfjsLib.version !== viewerVersion) {
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
}
@ -8191,7 +8183,6 @@ class PDFViewer {
this.downloadManager = options.downloadManager || null;
this.findController = options.findController || null;
this._scriptingManager = options.scriptingManager || null;
this.removePageBorders = options.removePageBorders || false;
this.textLayerMode = options.textLayerMode ?? _ui_utils.TextLayerMode.ENABLE;
this.#annotationMode = options.annotationMode ?? _pdfjsLib.AnnotationMode.ENABLE_FORMS;
this.#annotationEditorMode = options.annotationEditorMode ?? _pdfjsLib.AnnotationEditorType.NONE;
@ -8214,9 +8205,6 @@ class PDFViewer {
this.presentationModeState = _ui_utils.PresentationModeState.UNKNOWN;
this._onBeforeDraw = this._onAfterDraw = null;
this._resetView();
if (this.removePageBorders) {
this.viewer.classList.add("removePageBorders");
}
this.#updateContainerHeightCss();
}
get pagesCount() {
@ -8827,8 +8815,6 @@ class PDFViewer {
if (this._spreadMode !== _ui_utils.SpreadMode.NONE) {
hPadding *= 2;
}
} else if (this.removePageBorders) {
hPadding = vPadding = 0;
} else if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL) {
[hPadding, vPadding] = [vPadding, hPadding];
}
@ -8941,8 +8927,9 @@ class PDFViewer {
y = destArray[3];
width = destArray[4] - x;
height = destArray[5] - y;
const hPadding = this.removePageBorders ? 0 : _ui_utils.SCROLLBAR_PADDING;
const vPadding = this.removePageBorders ? 0 : _ui_utils.VERTICAL_PADDING;
let hPadding = _ui_utils.SCROLLBAR_PADDING,
vPadding = _ui_utils.VERTICAL_PADDING;
;
widthScale = (this.container.clientWidth - hPadding) / width / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
heightScale = (this.container.clientHeight - vPadding) / height / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
@ -9568,7 +9555,6 @@ const DEFAULT_L10N_STRINGS = {
page_scale_auto: "Automatic Zoom",
page_scale_actual: "Actual Size",
page_scale_percent: "{{scale}}%",
loading: "Loading…",
loading_error: "An error occurred while loading the PDF.",
invalid_file_error: "Invalid or corrupted PDF file.",
missing_file_error: "Missing PDF file.",
@ -9663,6 +9649,7 @@ const DEFAULT_LAYER_PROPERTIES = () => {
class PDFPageView {
#annotationMode = _pdfjsLib.AnnotationMode.ENABLE_FORMS;
#layerProperties = null;
#loadingId = null;
#previousRotation = null;
#renderingState = _ui_utils.RenderingStates.INITIAL;
#useThumbnailCanvas = {
@ -9721,20 +9708,28 @@ class PDFPageView {
return this.#renderingState;
}
set renderingState(state) {
if (state === this.#renderingState) {
return;
}
this.#renderingState = state;
if (this.#loadingId) {
clearTimeout(this.#loadingId);
this.#loadingId = null;
}
switch (state) {
case _ui_utils.RenderingStates.INITIAL:
case _ui_utils.RenderingStates.PAUSED:
this.loadingIconDiv?.classList.add("notVisible");
this.div.classList.remove("loading");
break;
case _ui_utils.RenderingStates.RUNNING:
this.loadingIconDiv?.classList.remove("notVisible");
this.div.classList.add("loadingIcon");
this.#loadingId = setTimeout(() => {
this.div.classList.add("loading");
this.#loadingId = null;
}, 0);
break;
case _ui_utils.RenderingStates.INITIAL:
case _ui_utils.RenderingStates.FINISHED:
if (this.loadingIconDiv) {
this.loadingIconDiv.remove();
delete this.loadingIconDiv;
}
this.div.classList.remove("loadingIcon", "loading");
break;
}
}
@ -9915,7 +9910,6 @@ class PDFPageView {
case annotationEditorLayerNode:
case xfaLayerNode:
case textLayerNode:
case this.loadingIconDiv:
continue;
}
node.remove();
@ -9942,15 +9936,6 @@ class PDFPageView {
}
this._resetZoomLayer();
}
if (!this.loadingIconDiv) {
this.loadingIconDiv = document.createElement("div");
this.loadingIconDiv.className = "loadingIcon notVisible";
this.loadingIconDiv.setAttribute("role", "img");
this.l10n.get("loading").then(msg => {
this.loadingIconDiv?.setAttribute("aria-label", msg);
});
div.append(this.loadingIconDiv);
}
}
update({
scale = 0,
@ -10437,6 +10422,7 @@ class AnnotationEditorLayerBuilder {
const div = this.div = document.createElement("div");
div.className = "annotationEditorLayer";
div.tabIndex = 0;
div.hidden = true;
this.pageDiv.append(div);
this.annotationEditorLayer = new _pdfjsLib.AnnotationEditorLayer({
uiManager: this.#uiManager,
@ -10453,6 +10439,7 @@ class AnnotationEditorLayerBuilder {
intent
};
this.annotationEditorLayer.render(parameters);
this.show();
}
cancel() {
this._cancelled = true;
@ -10470,7 +10457,7 @@ class AnnotationEditorLayerBuilder {
this.div.hidden = true;
}
show() {
if (!this.div) {
if (!this.div || this.annotationEditorLayer.isEmpty) {
return;
}
this.div.hidden = false;
@ -11910,7 +11897,8 @@ class Toolbar {
}
maxWidth += 0.3 * scaleSelectWidth;
if (maxWidth > scaleSelectWidth) {
_ui_utils.docStyle.setProperty("--scale-select-width", `${maxWidth}px`);
const container = items.scaleSelect.parentNode;
container.style.setProperty("--scale-select-width", `${maxWidth}px`);
}
canvas.width = 0;
canvas.height = 0;
@ -12264,7 +12252,7 @@ class FirefoxExternalServices extends _app.DefaultExternalServices {
break;
}
pdfDataRangeTransport = new FirefoxComDataRangeTransport(args.length, args.data, args.done, args.filename);
callbacks.onOpenWithTransport(args.pdfUrl, args.length, pdfDataRangeTransport);
callbacks.onOpenWithTransport(pdfDataRangeTransport);
break;
case "range":
pdfDataRangeTransport.onDataRange(args.begin, args.chunk);
@ -12764,8 +12752,8 @@ var _ui_utils = __webpack_require__(1);
var _app_options = __webpack_require__(2);
var _pdf_link_service = __webpack_require__(3);
var _app = __webpack_require__(4);
const pdfjsVersion = '3.3.122';
const pdfjsBuild = '562045607';
const pdfjsVersion = '3.4.37';
const pdfjsBuild = 'e69866492';
const AppConstants = null;
exports.PDFViewerApplicationConstants = AppConstants;
window.PDFViewerApplication = _app.PDFViewerApplication;

View File

@ -20,8 +20,8 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: 5620456072246f4f9f9eda37137b580863e6526c (2023-01-28T18:10:01Z).
revision: 5620456072246f4f9f9eda37137b580863e6526c
release: e69866492735c36623fbdbc9a96ce5e51a065f55 (2023-02-04T14:13:12Z).
revision: e69866492735c36623fbdbc9a96ce5e51a065f55
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/