Bump PDF.js from 4.3.118 to 4.3.136 (#1420)

Changelog: https://github.com/mozilla/pdf.js/releases/tag/v4.3.136
This commit is contained in:
Ludy 2024-06-09 11:45:25 +02:00 committed by GitHub
parent 7a15930453
commit 327a44d487
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 398 additions and 454 deletions

View file

@ -13,6 +13,242 @@
* limitations under the License.
*/
.dialog{
--dialog-bg-color:white;
--dialog-border-color:white;
--dialog-shadow:0 2px 14px 0 rgb(58 57 68 / 0.2);
--text-primary-color:#15141a;
--text-secondary-color:#5b5b66;
--hover-filter:brightness(0.9);
--focus-ring-color:#0060df;
--focus-ring-outline:2px solid var(--focus-ring-color);
--textarea-border-color:#8f8f9d;
--textarea-bg-color:white;
--textarea-fg-color:var(--text-secondary-color);
--radio-bg-color:#f0f0f4;
--radio-checked-bg-color:#fbfbfe;
--radio-border-color:#8f8f9d;
--radio-checked-border-color:#0060df;
--button-secondary-bg-color:#f0f0f4;
--button-secondary-fg-color:var(--text-primary-color);
--button-secondary-border-color:var(--button-secondary-bg-color);
--button-secondary-hover-bg-color:var(--button-secondary-bg-color);
--button-secondary-hover-fg-color:var(--button-secondary-fg-color);
--button-secondary-hover-border-color:var(--button-secondary-hover-bg-color);
--button-primary-bg-color:#0060df;
--button-primary-fg-color:#fbfbfe;
--button-primary-hover-bg-color:var(--button-primary-bg-color);
--button-primary-hover-fg-color:var(--button-primary-fg-color);
--button-primary-hover-border-color:var(--button-primary-hover-bg-color);
font:message-box;
font-size:13px;
font-weight:400;
line-height:150%;
border-radius:4px;
padding:12px 16px;
border:1px solid var(--dialog-border-color);
background:var(--dialog-bg-color);
color:var(--text-primary-color);
box-shadow:var(--dialog-shadow);
}
@media (prefers-color-scheme: dark){
:where(html:not(.is-light)) .dialog{
--dialog-bg-color:#1c1b22;
--dialog-border-color:#1c1b22;
--dialog-shadow:0 2px 14px 0 #15141a;
--text-primary-color:#fbfbfe;
--text-secondary-color:#cfcfd8;
--focus-ring-color:#0df;
--hover-filter:brightness(1.4);
--textarea-bg-color:#42414d;
--radio-bg-color:#2b2a33;
--radio-checked-bg-color:#15141a;
--radio-checked-border-color:#0df;
--button-secondary-bg-color:#2b2a33;
--button-primary-bg-color:#0df;
--button-primary-fg-color:#15141a;
}
}
:where(html.is-dark) .dialog{
--dialog-bg-color:#1c1b22;
--dialog-border-color:#1c1b22;
--dialog-shadow:0 2px 14px 0 #15141a;
--text-primary-color:#fbfbfe;
--text-secondary-color:#cfcfd8;
--focus-ring-color:#0df;
--hover-filter:brightness(1.4);
--textarea-bg-color:#42414d;
--radio-bg-color:#2b2a33;
--radio-checked-bg-color:#15141a;
--radio-checked-border-color:#0df;
--button-secondary-bg-color:#2b2a33;
--button-primary-bg-color:#0df;
--button-primary-fg-color:#15141a;
}
@media screen and (forced-colors: active){
.dialog{
--dialog-bg-color:Canvas;
--dialog-border-color:CanvasText;
--dialog-shadow:none;
--text-primary-color:CanvasText;
--text-secondary-color:CanvasText;
--hover-filter:none;
--focus-ring-color:ButtonBorder;
--textarea-border-color:ButtonBorder;
--textarea-bg-color:Field;
--textarea-fg-color:ButtonText;
--radio-bg-color:ButtonFace;
--radio-checked-bg-color:ButtonFace;
--radio-border-color:ButtonText;
--radio-checked-border-color:ButtonText;
--button-secondary-bg-color:ButtonFace;
--button-secondary-fg-color:ButtonText;
--button-secondary-border-color:ButtonText;
--button-secondary-hover-bg-color:AccentColor;
--button-secondary-hover-fg-color:AccentColorText;
--button-primary-bg-color:ButtonText;
--button-primary-fg-color:ButtonFace;
--button-primary-hover-bg-color:AccentColor;
--button-primary-hover-fg-color:AccentColorText;
}
}
.dialog .mainContainer *:focus-visible{
outline:var(--focus-ring-outline);
outline-offset:2px;
}
.dialog .mainContainer .radio{
display:flex;
flex-direction:column;
align-items:flex-start;
gap:4px;
}
.dialog .mainContainer .radio > .radioButton{
display:flex;
gap:8px;
align-self:stretch;
align-items:center;
}
.dialog .mainContainer .radio > .radioButton input{
-webkit-appearance:none;
-moz-appearance:none;
appearance:none;
box-sizing:border-box;
width:16px;
height:16px;
border-radius:50%;
background-color:var(--radio-bg-color);
border:1px solid var(--radio-border-color);
}
.dialog .mainContainer .radio > .radioButton input:hover{
filter:var(--hover-filter);
}
.dialog .mainContainer .radio > .radioButton input:checked{
background-color:var(--radio-checked-bg-color);
border:4px solid var(--radio-checked-border-color);
}
.dialog .mainContainer .radio > .radioLabel{
display:flex;
padding-inline-start:24px;
align-items:flex-start;
gap:10px;
align-self:stretch;
}
.dialog .mainContainer .radio > .radioLabel > span{
flex:1 0 0;
font-size:11px;
color:var(--text-secondary-color);
}
.dialog .mainContainer button{
border-radius:4px;
border:1px solid;
font:menu;
font-weight:600;
padding:4px 16px;
width:auto;
height:32px;
}
.dialog .mainContainer button:hover{
cursor:pointer;
filter:var(--hover-filter);
}
.dialog .mainContainer button.secondaryButton{
color:var(--button-secondary-fg-color);
background-color:var(--button-secondary-bg-color);
border-color:var(--button-secondary-border-color);
}
.dialog .mainContainer button.secondaryButton:hover{
color:var(--button-secondary-hover-fg-color);
background-color:var(--button-secondary-hover-bg-color);
border-color:var(--button-secondary-hover-border-color);
}
.dialog .mainContainer button.primaryButton{
color:var(--button-primary-hover-fg-color);
background-color:var(--button-primary-hover-bg-color);
border-color:var(--button-primary-hover-border-color);
opacity:1;
}
.dialog .mainContainer button.primaryButton:hover{
color:var(--button-primary-hover-fg-color);
background-color:var(--button-primary-hover-bg-color);
border-color:var(--button-primary-hover-border-color);
}
.dialog .mainContainer textarea{
font:inherit;
padding:8px;
resize:none;
margin:0;
box-sizing:border-box;
border-radius:4px;
border:1px solid var(--textarea-border-color);
background:var(--textarea-bg-color);
color:var(--textarea-fg-color);
}
.dialog .mainContainer textarea:focus{
outline-offset:0;
border-color:transparent;
}
.dialog .mainContainer textarea:disabled{
pointer-events:none;
opacity:0.4;
}
.textLayer{
position:absolute;
text-align:initial;
@ -1946,136 +2182,16 @@
inset-block-start:0;
}
#altTextDialog{
--dialog-bg-color:white;
--dialog-border-color:white;
--dialog-shadow:0 2px 14px 0 rgb(58 57 68 / 0.2);
--text-primary-color:#15141a;
--text-secondary-color:#5b5b66;
--hover-filter:brightness(0.9);
--focus-ring-color:#0060df;
--focus-ring-outline:2px solid var(--focus-ring-color);
--textarea-border-color:#8f8f9d;
--textarea-bg-color:white;
--textarea-fg-color:var(--text-secondary-color);
--radio-bg-color:#f0f0f4;
--radio-checked-bg-color:#fbfbfe;
--radio-border-color:#8f8f9d;
--radio-checked-border-color:#0060df;
--button-cancel-bg-color:#f0f0f4;
--button-cancel-fg-color:var(--text-primary-color);
--button-cancel-border-color:var(--button-cancel-bg-color);
--button-cancel-hover-bg-color:var(--button-cancel-bg-color);
--button-cancel-hover-fg-color:var(--button-cancel-fg-color);
--button-cancel-hover-border-color:var(--button-cancel-hover-bg-color);
--button-save-bg-color:#0060df;
--button-save-fg-color:#fbfbfe;
--button-save-hover-bg-color:var(--button-save-bg-color);
--button-save-hover-fg-color:var(--button-save-fg-color);
--button-save-hover-border-color:var(--button-save-hover-bg-color);
font:message-box;
font-size:13px;
font-weight:400;
line-height:150%;
border-radius:4px;
padding:12px 16px;
border:1px solid var(--dialog-border-color);
background:var(--dialog-bg-color);
color:var(--text-primary-color);
box-shadow:var(--dialog-shadow);
}
@media (prefers-color-scheme: dark){
:where(html:not(.is-light)) #altTextDialog{
--dialog-bg-color:#1c1b22;
--dialog-border-color:#1c1b22;
--dialog-shadow:0 2px 14px 0 #15141a;
--text-primary-color:#fbfbfe;
--text-secondary-color:#cfcfd8;
--focus-ring-color:#0df;
--hover-filter:brightness(1.4);
--textarea-bg-color:#42414d;
--radio-bg-color:#2b2a33;
--radio-checked-bg-color:#15141a;
--radio-checked-border-color:#0df;
--button-cancel-bg-color:#2b2a33;
--button-save-bg-color:#0df;
--button-save-fg-color:#15141a;
}
}
:where(html.is-dark) #altTextDialog{
--dialog-bg-color:#1c1b22;
--dialog-border-color:#1c1b22;
--dialog-shadow:0 2px 14px 0 #15141a;
--text-primary-color:#fbfbfe;
--text-secondary-color:#cfcfd8;
--focus-ring-color:#0df;
--hover-filter:brightness(1.4);
--textarea-bg-color:#42414d;
--radio-bg-color:#2b2a33;
--radio-checked-bg-color:#15141a;
--radio-checked-border-color:#0df;
--button-cancel-bg-color:#2b2a33;
--button-save-bg-color:#0df;
--button-save-fg-color:#15141a;
}
@media screen and (forced-colors: active){
#altTextDialog{
--dialog-bg-color:Canvas;
--dialog-border-color:CanvasText;
--dialog-shadow:none;
--text-primary-color:CanvasText;
--text-secondary-color:CanvasText;
--hover-filter:none;
--focus-ring-color:ButtonBorder;
--textarea-border-color:ButtonBorder;
--textarea-bg-color:Field;
--textarea-fg-color:ButtonText;
--radio-bg-color:ButtonFace;
--radio-checked-bg-color:ButtonFace;
--radio-border-color:ButtonText;
--radio-checked-border-color:ButtonText;
--button-cancel-bg-color:ButtonFace;
--button-cancel-fg-color:ButtonText;
--button-cancel-border-color:ButtonText;
--button-cancel-hover-bg-color:AccentColor;
--button-cancel-hover-fg-color:AccentColorText;
--button-save-bg-color:ButtonText;
--button-save-fg-color:ButtonFace;
--button-save-hover-bg-color:AccentColor;
--button-save-hover-fg-color:AccentColorText;
}
}
#altTextDialog::backdrop{
.dialog.altText::backdrop{
-webkit-mask:url(#alttext-manager-mask);
mask:url(#alttext-manager-mask);
}
#altTextDialog.positioned{
.dialog.altText.positioned{
margin:0;
}
#altTextDialog #altTextContainer{
.dialog.altText #altTextContainer{
width:300px;
height:-moz-fit-content;
height:fit-content;
@ -2085,61 +2201,7 @@
gap:16px;
}
#altTextDialog #altTextContainer *:focus-visible{
outline:var(--focus-ring-outline);
outline-offset:2px;
}
#altTextDialog #altTextContainer .radio{
display:flex;
flex-direction:column;
align-items:flex-start;
gap:4px;
}
#altTextDialog #altTextContainer .radio .radioButton{
display:flex;
gap:8px;
align-self:stretch;
align-items:center;
}
#altTextDialog #altTextContainer .radio .radioButton input{
-webkit-appearance:none;
-moz-appearance:none;
appearance:none;
box-sizing:border-box;
width:16px;
height:16px;
border-radius:50%;
background-color:var(--radio-bg-color);
border:1px solid var(--radio-border-color);
}
#altTextDialog #altTextContainer .radio .radioButton input:hover{
filter:var(--hover-filter);
}
#altTextDialog #altTextContainer .radio .radioButton input:checked{
background-color:var(--radio-checked-bg-color);
border:4px solid var(--radio-checked-border-color);
}
#altTextDialog #altTextContainer .radio .radioLabel{
display:flex;
padding-inline-start:24px;
align-items:flex-start;
gap:10px;
align-self:stretch;
}
#altTextDialog #altTextContainer .radio .radioLabel span{
flex:1 0 0;
font-size:11px;
color:var(--text-secondary-color);
}
#altTextDialog #altTextContainer #overallDescription{
.dialog.altText #altTextContainer #overallDescription{
display:flex;
flex-direction:column;
align-items:flex-start;
@ -2147,53 +2209,34 @@
align-self:stretch;
}
#altTextDialog #altTextContainer #overallDescription span{
.dialog.altText #altTextContainer #overallDescription span{
align-self:stretch;
}
#altTextDialog #altTextContainer #overallDescription .title{
.dialog.altText #altTextContainer #overallDescription .title{
font-size:13px;
font-style:normal;
font-weight:590;
}
#altTextDialog #altTextContainer #addDescription{
.dialog.altText #altTextContainer #addDescription{
display:flex;
flex-direction:column;
align-items:stretch;
gap:8px;
}
#altTextDialog #altTextContainer #addDescription .descriptionArea{
.dialog.altText #altTextContainer #addDescription .descriptionArea{
flex:1;
padding-inline:24px 10px;
}
#altTextDialog #altTextContainer #addDescription .descriptionArea textarea{
font:inherit;
.dialog.altText #altTextContainer #addDescription .descriptionArea textarea{
width:100%;
min-height:75px;
padding:8px;
resize:none;
margin:0;
box-sizing:border-box;
border-radius:4px;
border:1px solid var(--textarea-border-color);
background:var(--textarea-bg-color);
color:var(--textarea-fg-color);
}
#altTextDialog #altTextContainer #addDescription .descriptionArea textarea:focus{
outline-offset:0;
border-color:transparent;
}
#altTextDialog #altTextContainer #addDescription .descriptionArea textarea:disabled{
pointer-events:none;
opacity:0.4;
}
#altTextDialog #altTextContainer #buttons{
.dialog.altText #altTextContainer #buttons{
display:flex;
justify-content:flex-end;
align-items:flex-start;
@ -2201,46 +2244,6 @@
align-self:stretch;
}
#altTextDialog #altTextContainer #buttons button{
border-radius:4px;
border:1px solid;
font:menu;
font-weight:600;
padding:4px 16px;
width:auto;
height:32px;
}
#altTextDialog #altTextContainer #buttons button:hover{
cursor:pointer;
filter:var(--hover-filter);
}
#altTextDialog #altTextContainer #buttons button#altTextCancel{
color:var(--button-cancel-fg-color);
background-color:var(--button-cancel-bg-color);
border-color:var(--button-cancel-border-color);
}
#altTextDialog #altTextContainer #buttons button#altTextCancel:hover{
color:var(--button-cancel-hover-fg-color);
background-color:var(--button-cancel-hover-bg-color);
border-color:var(--button-cancel-hover-border-color);
}
#altTextDialog #altTextContainer #buttons button#altTextSave{
color:var(--button-save-hover-fg-color);
background-color:var(--button-save-hover-bg-color);
border-color:var(--button-save-hover-border-color);
opacity:1;
}
#altTextDialog #altTextContainer #buttons button#altTextSave:hover{
color:var(--button-save-hover-fg-color);
background-color:var(--button-save-hover-bg-color);
border-color:var(--button-save-hover-border-color);
}
.colorPicker{
--hover-outline-color:#0250bb;
--selected-outline-color:#0060df;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -8912,17 +8912,18 @@ class TextHighlighter {
class TextLayerBuilder {
#enablePermissions = false;
#onAppend = null;
#textContentSource = null;
#renderingDone = false;
#textLayer = null;
static #textLayers = new Map();
static #selectionChangeAbortController = null;
constructor({
pdfPage,
highlighter = null,
accessibilityManager = null,
enablePermissions = false,
onAppend = null
}) {
this.renderingDone = false;
this.pdfPage = pdfPage;
this.highlighter = highlighter;
this.accessibilityManager = accessibilityManager;
this.#enablePermissions = enablePermissions === true;
@ -8932,17 +8933,14 @@ class TextLayerBuilder {
this.div.className = "textLayer";
}
#finishRendering() {
this.renderingDone = true;
this.#renderingDone = true;
const endOfContent = document.createElement("div");
endOfContent.className = "endOfContent";
this.div.append(endOfContent);
this.#bindMouse(endOfContent);
}
async render(viewport) {
if (!this.#textContentSource) {
throw new Error('No "textContentSource" parameter specified.');
}
if (this.renderingDone && this.#textLayer) {
async render(viewport, textContentParams = null) {
if (this.#renderingDone && this.#textLayer) {
this.#textLayer.update({
viewport,
onBefore: this.hide.bind(this)
@ -8952,7 +8950,10 @@ class TextLayerBuilder {
}
this.cancel();
this.#textLayer = new TextLayer({
textContentSource: this.#textContentSource,
textContentSource: this.pdfPage.streamTextContent(textContentParams || {
includeMarkedContent: true,
disableNormalization: true
}),
container: this.div,
viewport
});
@ -8969,13 +8970,13 @@ class TextLayerBuilder {
this.accessibilityManager?.enable();
}
hide() {
if (!this.div.hidden && this.renderingDone) {
if (!this.div.hidden && this.#renderingDone) {
this.highlighter?.disable();
this.div.hidden = true;
}
}
show() {
if (this.div.hidden && this.renderingDone) {
if (this.div.hidden && this.#renderingDone) {
this.div.hidden = false;
this.highlighter?.enable();
}
@ -8987,10 +8988,6 @@ class TextLayerBuilder {
this.accessibilityManager?.disable();
TextLayerBuilder.#removeGlobalSelectionListener(this.div);
}
setTextContentSource(source) {
this.cancel();
this.#textContentSource = source;
}
#bindMouse(end) {
const {
div
@ -9261,6 +9258,13 @@ class PDFPageView {
findController: this.#layerProperties.findController
}));
}
#dispatchLayerRendered(name, error) {
this.eventBus.dispatch(name, {
source: this,
pageNumber: this.id,
error
});
}
async #renderAnnotationLayer() {
let error = null;
try {
@ -9269,11 +9273,7 @@ class PDFPageView {
console.error(`#renderAnnotationLayer: "${ex}".`);
error = ex;
} finally {
this.eventBus.dispatch("annotationlayerrendered", {
source: this,
pageNumber: this.id,
error
});
this.#dispatchLayerRendered("annotationlayerrendered", error);
}
}
async #renderAnnotationEditorLayer() {
@ -9284,11 +9284,7 @@ class PDFPageView {
console.error(`#renderAnnotationEditorLayer: "${ex}".`);
error = ex;
} finally {
this.eventBus.dispatch("annotationeditorlayerrendered", {
source: this,
pageNumber: this.id,
error
});
this.#dispatchLayerRendered("annotationeditorlayerrendered", error);
}
}
async #renderDrawLayer() {
@ -9314,32 +9310,16 @@ class PDFPageView {
this.#addLayer(this.xfaLayer.div, "xfaLayer");
this.l10n.resume();
}
this.eventBus.dispatch("xfalayerrendered", {
source: this,
pageNumber: this.id,
error
});
this.#dispatchLayerRendered("xfalayerrendered", error);
}
}
async #renderTextLayer() {
const {
pdfPage,
textLayer,
viewport
} = this;
if (!textLayer) {
if (!this.textLayer) {
return;
}
let error = null;
try {
if (!textLayer.renderingDone) {
const readableStream = pdfPage.streamTextContent({
includeMarkedContent: true,
disableNormalization: true
});
textLayer.setTextContentSource(readableStream);
}
await textLayer.render(viewport);
await this.textLayer.render(this.viewport);
} catch (ex) {
if (ex instanceof AbortException) {
return;
@ -9347,11 +9327,7 @@ class PDFPageView {
console.error(`#renderTextLayer: "${ex}".`);
error = ex;
}
this.eventBus.dispatch("textlayerrendered", {
source: this,
pageNumber: this.id,
error
});
this.#dispatchLayerRendered("textlayerrendered", error);
this.#renderStructTreeLayer();
}
async #renderStructTreeLayer() {
@ -9694,6 +9670,7 @@ class PDFPageView {
if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) {
this._accessibilityManager ||= new TextAccessibilityManager();
this.textLayer = new TextLayerBuilder({
pdfPage,
highlighter: this._textHighlighter,
accessibilityManager: this._accessibilityManager,
enablePermissions: this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,
@ -9801,7 +9778,7 @@ class PDFPageView {
annotationCanvasMap: this._annotationCanvasMap,
pageColors
};
const renderTask = this.renderTask = this.pdfPage.render(renderContext);
const renderTask = this.renderTask = pdfPage.render(renderContext);
renderTask.onContinue = renderContinueCallback;
const resultPromise = renderTask.promise.then(async () => {
showCanvas?.(true);
@ -9969,7 +9946,7 @@ class PDFViewer {
#scaleTimeoutId = null;
#textLayerMode = TextLayerMode.ENABLE;
constructor(options) {
const viewerVersion = "4.3.118";
const viewerVersion = "4.3.136";
if (version !== viewerVersion) {
throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
}
@ -10634,7 +10611,8 @@ class PDFViewer {
#setScaleUpdatePages(newScale, newValue, {
noScroll = false,
preset = false,
drawingDelay = -1
drawingDelay = -1,
origin = null
}) {
this._currentScaleValue = newValue.toString();
if (this.#isSameScale(newScale)) {
@ -10659,6 +10637,7 @@ class PDFViewer {
this.refresh();
}, drawingDelay);
}
const previousScale = this._currentScale;
this._currentScale = newScale;
if (!noScroll) {
let page = this._currentPageNumber,
@ -10674,6 +10653,12 @@ class PDFViewer {
destArray: dest,
allowNegativeOffset: true
});
if (Array.isArray(origin)) {
const scaleDiff = newScale / previousScale - 1;
const [top, left] = this.containerTopLeft;
this.container.scrollLeft += (origin[0] - left) * scaleDiff;
this.container.scrollTop += (origin[1] - top) * scaleDiff;
}
}
this.eventBus.dispatch("scalechanging", {
source: this,
@ -11281,48 +11266,46 @@ class PDFViewer {
this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
return true;
}
increaseScale({
updateScale({
drawingDelay,
scaleFactor,
steps
} = {}) {
scaleFactor = null,
steps = null,
origin
}) {
if (steps === null && scaleFactor === null) {
throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");
}
if (!this.pdfDocument) {
return;
}
let newScale = this._currentScale;
if (scaleFactor > 1) {
if (scaleFactor > 0 && scaleFactor !== 1) {
newScale = Math.round(newScale * scaleFactor * 100) / 100;
} else {
steps ??= 1;
} else if (steps) {
const delta = steps > 0 ? DEFAULT_SCALE_DELTA : 1 / DEFAULT_SCALE_DELTA;
const round = steps > 0 ? Math.ceil : Math.floor;
steps = Math.abs(steps);
do {
newScale = Math.ceil((newScale * DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;
} while (--steps > 0 && newScale < MAX_SCALE);
newScale = round((newScale * delta).toFixed(2) * 10) / 10;
} while (--steps > 0);
}
this.#setScale(Math.min(MAX_SCALE, newScale), {
newScale = Math.max(MIN_SCALE, Math.min(MAX_SCALE, newScale));
this.#setScale(newScale, {
noScroll: false,
drawingDelay
drawingDelay,
origin
});
}
decreaseScale({
drawingDelay,
scaleFactor,
steps
} = {}) {
if (!this.pdfDocument) {
return;
increaseScale(options = {}) {
this.updateScale({
...options,
steps: options.steps ?? 1
});
}
let newScale = this._currentScale;
if (scaleFactor > 0 && scaleFactor < 1) {
newScale = Math.round(newScale * scaleFactor * 100) / 100;
} else {
steps ??= 1;
do {
newScale = Math.floor((newScale / DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;
} while (--steps > 0 && newScale > MIN_SCALE);
}
this.#setScale(Math.max(MIN_SCALE, newScale), {
noScroll: false,
drawingDelay
decreaseScale(options = {}) {
this.updateScale({
...options,
steps: -(options.steps ?? 1)
});
}
#updateContainerHeightCss(height = this.container.clientHeight) {
@ -12465,25 +12448,22 @@ const PDFViewerApplication = {
get initializedPromise() {
return this._initializedCapability.promise;
},
zoomIn(steps, scaleFactor) {
updateZoom(steps, scaleFactor, origin) {
if (this.pdfViewer.isInPresentationMode) {
return;
}
this.pdfViewer.increaseScale({
this.pdfViewer.updateScale({
drawingDelay: AppOptions.get("defaultZoomDelay"),
steps,
scaleFactor
scaleFactor,
origin
});
},
zoomOut(steps, scaleFactor) {
if (this.pdfViewer.isInPresentationMode) {
return;
}
this.pdfViewer.decreaseScale({
drawingDelay: AppOptions.get("defaultZoomDelay"),
steps,
scaleFactor
});
zoomIn() {
this.updateZoom(1);
},
zoomOut() {
this.updateZoom(-1);
},
zoomReset() {
if (this.pdfViewer.isInPresentationMode) {
@ -13510,17 +13490,6 @@ const PDFViewerApplication = {
this[prop] = factor / newFactor;
return newFactor;
},
_centerAtPos(previousScale, x, y) {
const {
pdfViewer
} = this;
const scaleDiff = pdfViewer.currentScale / previousScale - 1;
if (scaleDiff !== 0) {
const [top, left] = pdfViewer.containerTopLeft;
pdfViewer.container.scrollLeft += (x - left) * scaleDiff;
pdfViewer.container.scrollTop += (y - top) * scaleDiff;
}
},
_unblockDocumentLoadEvent() {
document.blockUnblockOnload?.(false);
this._unblockDocumentLoadEvent = () => {};
@ -13866,21 +13835,15 @@ function webViewerWheel(evt) {
let scaleFactor = Math.exp(-evt.deltaY / 100);
const isBuiltInMac = false;
const isPinchToZoom = evt.ctrlKey && !PDFViewerApplication._isCtrlKeyDown && deltaMode === WheelEvent.DOM_DELTA_PIXEL && evt.deltaX === 0 && (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) && evt.deltaZ === 0;
const origin = [evt.clientX, evt.clientY];
if (isPinchToZoom || evt.ctrlKey && supportsMouseWheelZoomCtrlKey || evt.metaKey && supportsMouseWheelZoomMetaKey) {
evt.preventDefault();
if (PDFViewerApplication._isScrolling || zoomDisabledTimeout || document.visibilityState === "hidden" || PDFViewerApplication.overlayManager.active) {
return;
}
const previousScale = pdfViewer.currentScale;
if (isPinchToZoom && supportsPinchToZoom) {
scaleFactor = PDFViewerApplication._accumulateFactor(previousScale, scaleFactor, "_wheelUnusedFactor");
if (scaleFactor < 1) {
PDFViewerApplication.zoomOut(null, scaleFactor);
} else if (scaleFactor > 1) {
PDFViewerApplication.zoomIn(null, scaleFactor);
} else {
return;
}
scaleFactor = PDFViewerApplication._accumulateFactor(pdfViewer.currentScale, scaleFactor, "_wheelUnusedFactor");
PDFViewerApplication.updateZoom(null, scaleFactor, origin);
} else {
const delta = normalizeWheelEventDirection(evt);
let ticks = 0;
@ -13894,16 +13857,9 @@ function webViewerWheel(evt) {
const PIXELS_PER_LINE_SCALE = 30;
ticks = PDFViewerApplication._accumulateTicks(delta / PIXELS_PER_LINE_SCALE, "_wheelUnusedTicks");
}
if (ticks < 0) {
PDFViewerApplication.zoomOut(-ticks);
} else if (ticks > 0) {
PDFViewerApplication.zoomIn(ticks);
} else {
return;
PDFViewerApplication.updateZoom(ticks, null, origin);
}
}
PDFViewerApplication._centerAtPos(previousScale, evt.clientX, evt.clientY);
}
}
function webViewerTouchStart(evt) {
if (PDFViewerApplication.pdfViewer.isInPresentationMode || evt.touches.length < 2) {
@ -13988,31 +13944,18 @@ function webViewerTouchMove(evt) {
}
}
evt.preventDefault();
const origin = [(page0X + page1X) / 2, (page0Y + page1Y) / 2];
const distance = Math.hypot(page0X - page1X, page0Y - page1Y) || 1;
const pDistance = Math.hypot(pTouch0X - pTouch1X, pTouch0Y - pTouch1Y) || 1;
const previousScale = pdfViewer.currentScale;
if (supportsPinchToZoom) {
const newScaleFactor = PDFViewerApplication._accumulateFactor(previousScale, distance / pDistance, "_touchUnusedFactor");
if (newScaleFactor < 1) {
PDFViewerApplication.zoomOut(null, newScaleFactor);
} else if (newScaleFactor > 1) {
PDFViewerApplication.zoomIn(null, newScaleFactor);
} else {
return;
}
const newScaleFactor = PDFViewerApplication._accumulateFactor(pdfViewer.currentScale, distance / pDistance, "_touchUnusedFactor");
PDFViewerApplication.updateZoom(null, newScaleFactor, origin);
} else {
const PIXELS_PER_LINE_SCALE = 30;
const ticks = PDFViewerApplication._accumulateTicks((distance - pDistance) / PIXELS_PER_LINE_SCALE, "_touchUnusedTicks");
if (ticks < 0) {
PDFViewerApplication.zoomOut(-ticks);
} else if (ticks > 0) {
PDFViewerApplication.zoomIn(ticks);
} else {
return;
PDFViewerApplication.updateZoom(ticks, null, origin);
}
}
PDFViewerApplication._centerAtPos(previousScale, (page0X + page1X) / 2, (page0Y + page1Y) / 2);
}
function webViewerTouchEnd(evt) {
if (!PDFViewerApplication._touchInfo) {
return;
@ -14329,8 +14272,8 @@ function webViewerReportTelemetry({
const pdfjsVersion = "4.3.118";
const pdfjsBuild = "17e09e547";
const pdfjsVersion = "4.3.136";
const pdfjsBuild = "0cec64437";
const AppConstants = {
LinkTarget: LinkTarget,
RenderingStates: RenderingStates,
@ -14465,7 +14408,7 @@ function getViewerConfiguration() {
editorFreeHighlightThickness: document.getElementById("editorFreeHighlightThickness"),
editorHighlightShowAll: document.getElementById("editorHighlightShowAll")
},
printContainer: document.getElementById("printContainer"),
printContainer: document.getElementById("printContainer")
};
}
function webViewerLoad() {

File diff suppressed because one or more lines are too long

View file

@ -10256,7 +10256,6 @@ class TextLayer {
this.#pageWidth = pageWidth;
this.#pageHeight = pageHeight;
setLayerDimensions(container, viewport);
TextLayer.#pendingTextLayers.add(this);
this.#capability.promise.catch(() => {}).then(() => {
TextLayer.#pendingTextLayers.delete(this);
this.#layoutTextParams = null;
@ -10280,6 +10279,7 @@ class TextLayer {
}, this.#capability.reject);
};
this.#reader = this.#textContentSource.getReader();
TextLayer.#pendingTextLayers.add(this);
pump();
return this.#capability.promise;
}
@ -10724,7 +10724,7 @@ function getDocument(src) {
}
const docParams = {
docId,
apiVersion: "4.3.118",
apiVersion: "4.3.136",
data,
password,
disableAutoFetch,
@ -12491,8 +12491,8 @@ class InternalRenderTask {
}
}
}
const version = "4.3.118";
const build = "17e09e547";
const version = "4.3.136";
const build = "0cec64437";
;// CONCATENATED MODULE: ./src/shared/scripting_utils.js
function makeColorComp(n) {
@ -19367,8 +19367,8 @@ class DrawLayer {
const pdfjsVersion = "4.3.118";
const pdfjsBuild = "17e09e547";
const pdfjsVersion = "4.3.136";
const pdfjsBuild = "0cec64437";
var __webpack_exports__AbortException = __webpack_exports__.AbortException;
var __webpack_exports__AnnotationEditorLayer = __webpack_exports__.AnnotationEditorLayer;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -8930,11 +8930,10 @@ class Parser {
if (this.tryShift() && isCmd(this.buf2, "endstream")) {
this.shift();
} else {
const actualLength = this.#findStreamLength(startPos);
if (actualLength < 0) {
length = this.#findStreamLength(startPos);
if (length < 0) {
throw new FormatError("Missing endstream command.");
}
length = actualLength;
lexer.nextChar();
this.shift();
this.shift();
@ -29696,7 +29695,7 @@ class PartialEvaluator {
this.globalImageCache = globalImageCache;
this.systemFontCache = systemFontCache;
this.options = options || DefaultPartialEvaluatorOptions;
this.parsingType3Font = false;
this.type3FontRefs = null;
this._regionalImageCache = new RegionalImageCache();
this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
ImageResizer.setMaxArea(this.options.canvasMaxAreaInBytes);
@ -29708,6 +29707,9 @@ class PartialEvaluator {
});
return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
}
get parsingType3Font() {
return !!this.type3FontRefs;
}
clone(newOptions = null) {
const newEvaluator = Object.create(this);
newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
@ -30396,7 +30398,7 @@ class PartialEvaluator {
}
}
if (fontRef) {
if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
if (this.type3FontRefs?.has(fontRef)) {
return errorFont();
}
if (this.fontCache.has(fontRef)) {
@ -32831,7 +32833,6 @@ class TranslatedFont {
const type3Evaluator = evaluator.clone({
ignoreErrors: false
});
type3Evaluator.parsingType3Font = true;
const type3FontRefs = new RefSet(evaluator.type3FontRefs);
if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
type3FontRefs.put(this.dict.objId);
@ -53722,19 +53723,18 @@ class Page {
systemFontCache: this.systemFontCache,
options: this.evaluatorOptions
});
const newAnnotationsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
let deletedAnnotations = null;
const newAnnotsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
const newAnnots = newAnnotsByPage?.get(this.pageIndex);
let newAnnotationsPromise = Promise.resolve(null);
if (newAnnotationsByPage) {
const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
if (newAnnotations) {
let deletedAnnotations = null;
if (newAnnots) {
const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
let imagePromises;
const missingBitmaps = new Set();
for (const {
bitmapId,
bitmap
} of newAnnotations) {
} of newAnnots) {
if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
missingBitmaps.add(bitmapId);
}
@ -53743,7 +53743,7 @@ class Page {
isOffscreenCanvasSupported
} = this.evaluatorOptions;
if (missingBitmaps.size > 0) {
const annotationWithBitmaps = newAnnotations.slice();
const annotationWithBitmaps = newAnnots.slice();
for (const [key, annotation] of annotationStorage) {
if (!key.startsWith(AnnotationEditorPrefix)) {
continue;
@ -53754,20 +53754,18 @@ class Page {
}
imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
} else {
imagePromises = AnnotationFactory.generateImages(newAnnotations, this.xref, isOffscreenCanvasSupported);
imagePromises = AnnotationFactory.generateImages(newAnnots, this.xref, isOffscreenCanvasSupported);
}
deletedAnnotations = new RefSet();
this.#replaceIdByRef(newAnnotations, deletedAnnotations, null);
this.#replaceIdByRef(newAnnots, deletedAnnotations, null);
newAnnotationsPromise = annotationGlobalsPromise.then(annotationGlobals => {
if (!annotationGlobals) {
return null;
}
return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnotations, imagePromises);
return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnots, imagePromises);
});
}
}
const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
const pageListPromise = dataPromises.then(([contentStream]) => {
const pageListPromise = Promise.all([contentStreamPromise, resourcesPromise]).then(([contentStream]) => {
const opList = new OperatorList(intent, sink);
handler.send("StartRenderPage", {
transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
@ -55532,7 +55530,7 @@ class WorkerMessageHandler {
docId,
apiVersion
} = docParams;
const workerVersion = "4.3.118";
const workerVersion = "4.3.136";
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}
@ -56102,8 +56100,8 @@ if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" &&
;// CONCATENATED MODULE: ./src/pdf.worker.js
const pdfjsVersion = "4.3.118";
const pdfjsBuild = "17e09e547";
const pdfjsVersion = "4.3.136";
const pdfjsBuild = "0cec64437";
var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };

File diff suppressed because one or more lines are too long

View file

@ -461,8 +461,8 @@ See https://github.com/adobe-type-tools/cmap-resources
<button id="documentPropertiesClose" class="dialogButton"><span data-l10n-id="pdfjs-document-properties-close-button">Close</span></button>
</div>
</dialog>
<dialog id="altTextDialog" aria-labelledby="dialogLabel" aria-describedby="dialogDescription">
<div id="altTextContainer">
<dialog class="dialog altText" id="altTextDialog" aria-labelledby="dialogLabel" aria-describedby="dialogDescription">
<div id="altTextContainer" class="mainContainer">
<div id="overallDescription">
<span id="dialogLabel" data-l10n-id="pdfjs-editor-alt-text-dialog-label" class="title">Choose an option</span>
<span id="dialogDescription" data-l10n-id="pdfjs-editor-alt-text-dialog-description">
@ -499,8 +499,8 @@ See https://github.com/adobe-type-tools/cmap-resources
</div>
</div>
<div id="buttons">
<button id="altTextCancel" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-cancel-button">Cancel</span></button>
<button id="altTextSave" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-save-button">Save</span></button>
<button id="altTextCancel" class="secondaryButton" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-cancel-button">Cancel</span></button>
<button id="altTextSave" class="primaryButton" tabindex="0"><span data-l10n-id="pdfjs-editor-alt-text-save-button">Save</span></button>
</div>
</div>
</dialog>