commit dddd088549bed24de7c5c4650ccb32a733814e2e
parent 613c818f5c45ba120180399aa16fde1ffc292820
Author: Calixte Denizet <calixte.denizet@gmail.com>
Date: Mon, 6 Oct 2025 09:12:54 +0000
Bug 1992661 - Update PDF.js to new version f4104326f3aa6d09e95e446af179772b2231d739 r=pdfjs-reviewers,marco
Differential Revision: https://phabricator.services.mozilla.com/D267555
Diffstat:
8 files changed, 70 insertions(+), 40 deletions(-)
diff --git a/toolkit/components/pdfjs/content/build/pdf.mjs b/toolkit/components/pdfjs/content/build/pdf.mjs
@@ -21,8 +21,8 @@
*/
/**
- * pdfjsVersion = 5.4.282
- * pdfjsBuild = 9d917b289
+ * pdfjsVersion = 5.4.305
+ * pdfjsBuild = f4104326f
*/
/******/ // The require scope
/******/ var __webpack_require__ = {};
@@ -12788,7 +12788,7 @@ function getDocument(src = {}) {
}
const docParams = {
docId,
- apiVersion: "5.4.282",
+ apiVersion: "5.4.305",
data,
password,
disableAutoFetch,
@@ -14365,8 +14365,8 @@ class InternalRenderTask {
}
}
}
-const version = "5.4.282";
-const build = "9d917b289";
+const version = "5.4.305";
+const build = "f4104326f";
;// ./src/display/editor/color_picker.js
@@ -19716,7 +19716,7 @@ class HighlightEditor extends AnnotationEditor {
highlightOutlines: this.#highlightOutlines.getNewOutline(thickness / 2)
});
this.fixAndSetPosition();
- this.setDims(this.width, this.height);
+ this.setDims();
}
#cleanDrawLayer() {
if (this.#id === null || !this.parent) {
@@ -19819,7 +19819,7 @@ class HighlightEditor extends AnnotationEditor {
highlightDiv.setAttribute("aria-hidden", "true");
highlightDiv.className = "internal";
highlightDiv.style.clipPath = this.#clipPathId;
- this.setDims(this.width, this.height);
+ this.setDims();
bindEvents(this, this.#highlightDiv, ["pointerover", "pointerleave"]);
this.enableEditing();
return div;
diff --git a/toolkit/components/pdfjs/content/build/pdf.scripting.mjs b/toolkit/components/pdfjs/content/build/pdf.scripting.mjs
@@ -21,9 +21,10 @@
*/
/**
- * pdfjsVersion = 5.4.282
- * pdfjsBuild = 9d917b289
+ * pdfjsVersion = 5.4.305
+ * pdfjsBuild = f4104326f
*/
+var __webpack_exports__ = {};
;// ./src/scripting_api/constants.js
const Border = Object.freeze({
diff --git a/toolkit/components/pdfjs/content/build/pdf.worker.mjs b/toolkit/components/pdfjs/content/build/pdf.worker.mjs
@@ -21,8 +21,8 @@
*/
/**
- * pdfjsVersion = 5.4.282
- * pdfjsBuild = 9d917b289
+ * pdfjsVersion = 5.4.305
+ * pdfjsBuild = f4104326f
*/
/******/ // The require scope
/******/ var __webpack_require__ = {};
@@ -25304,10 +25304,14 @@ class Font {
this._glyphCache = Object.create(null);
let isSerifFont = !!(properties.flags & FontFlags.Serif);
if (!isSerifFont && !properties.isSimulatedFlags) {
- const baseName = name.replaceAll(/[,_]/g, "-").split("-", 1)[0],
+ const stdFontMap = getStdFontMap(),
+ nonStdFontMap = getNonStdFontMap(),
serifFonts = getSerifFonts();
- for (const namePart of baseName.split("+")) {
- if (serifFonts[namePart]) {
+ for (const namePart of name.split("+")) {
+ let fontName = namePart.replaceAll(/[,_]/g, "-");
+ fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
+ fontName = fontName.split("-", 1)[0];
+ if (serifFonts[fontName]) {
isSerifFont = true;
break;
}
@@ -33571,7 +33575,8 @@ class PartialEvaluator {
for (let i = 0, ii = glyphs.length; i < ii; i++) {
const glyph = glyphs[i];
const {
- category
+ category,
+ originalCharCode
} = glyph;
if (category.isInvisibleFormatMark) {
continue;
@@ -33582,12 +33587,15 @@ class PartialEvaluator {
glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
}
let scaledDim = glyphWidth * scale;
+ if (originalCharCode === 0x20) {
+ charSpacing += textState.wordSpacing;
+ }
if (!keepWhiteSpace && category.isWhitespace) {
if (!font.vertical) {
- charSpacing += scaledDim + textState.wordSpacing;
+ charSpacing += scaledDim;
textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
} else {
- charSpacing += -scaledDim + textState.wordSpacing;
+ charSpacing += -scaledDim;
textState.translateTextMatrix(0, -charSpacing);
}
saveLastChar(" ");
@@ -54791,7 +54799,6 @@ class CipherTransformFactory {
class XRef {
- #firstXRefStmPos = null;
constructor(stream, pdfManager) {
this.stream = stream;
this.pdfManager = pdfManager;
@@ -55320,7 +55327,6 @@ class XRef {
if (Number.isInteger(obj) && !this._xrefStms.has(obj)) {
this._xrefStms.add(obj);
this.startXRefQueue.push(obj);
- this.#firstXRefStmPos ??= obj;
}
} else if (Number.isInteger(obj)) {
if (!Number.isInteger(parser.getObj()) || !isCmd(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof BaseStream)) {
@@ -55358,9 +55364,6 @@ class XRef {
}
throw new XRefParseException();
}
- get lastXRefStreamPos() {
- return this.#firstXRefStmPos ?? (this._xrefStms.size > 0 ? Math.max(...this._xrefStms) : null);
- }
getEntry(i) {
const xrefEntry = this.entries[i];
if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
@@ -58123,7 +58126,7 @@ class WorkerMessageHandler {
docId,
apiVersion
} = docParams;
- const workerVersion = "5.4.282";
+ const workerVersion = "5.4.305";
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}
@@ -58448,11 +58451,11 @@ class WorkerMessageHandler {
annotationStorage,
filename
}) {
- const globalPromises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("startXRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("structTreeRoot")];
+ const globalPromises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("startXRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureCatalog("structTreeRoot")];
const changes = new RefSetCache();
const promises = [];
const newAnnotationsByPage = !isPureXfa ? getNewAnnotationsMap(annotationStorage) : null;
- const [stream, acroForm, acroFormRef, startXRef, xref, linearization, _structTreeRoot] = await Promise.all(globalPromises);
+ const [stream, acroForm, acroFormRef, startXRef, xref, _structTreeRoot] = await Promise.all(globalPromises);
const catalogRef = xref.trailer.getRaw("Root") || null;
let structTreeRoot;
if (newAnnotationsByPage) {
@@ -58559,7 +58562,7 @@ class WorkerMessageHandler {
infoRef: xref.trailer.getRaw("Info") || null,
infoMap,
fileIds: xref.trailer.get("ID") || null,
- startXRef: linearization ? startXRef : xref.lastXRefStreamPos ?? startXRef,
+ startXRef,
filename
};
}
diff --git a/toolkit/components/pdfjs/content/web/viewer-geckoview.css b/toolkit/components/pdfjs/content/web/viewer-geckoview.css
@@ -1412,11 +1412,14 @@
--sidebar-min-width:180px;
--sidebar-max-width:632px;
--sidebar-width:239px;
+ --resizer-width:4px;
+ --resizer-hover-bg-color:light-dark(#0062fa, #00cadb);
@media screen and (forced-colors: active){
--sidebar-bg-color:Canvas;
--sidebar-border-color:CanvasText;
--sidebar-box-shadow:none;
+ --resizer-hover-bg-color:CanvasText;
}
border-radius:var(--sidebar-border-radius);
@@ -1430,12 +1433,22 @@
max-width:var(--sidebar-max-width);
.sidebarResizer{
- width:4px;
+ width:var(--resizer-width);
background-color:transparent;
forced-color-adjust:none;
cursor:ew-resize;
position:absolute;
inset-block:calc(var(--sidebar-padding) + var(--sidebar-border-radius));
+ inset-inline-start:calc(0px - var(--resizer-width) / 2);
+ transition:background-color 0.5s ease-in-out;
+ box-sizing:border-box;
+ border:1px solid transparent;
+ border-block-width:0;
+ background-clip:content-box;
+
+ &:hover{
+ background-color:var(--resizer-hover-bg-color);
+ }
}
&.resizing{
diff --git a/toolkit/components/pdfjs/content/web/viewer-geckoview.mjs b/toolkit/components/pdfjs/content/web/viewer-geckoview.mjs
@@ -21,8 +21,8 @@
*/
/**
- * pdfjsVersion = 5.4.282
- * pdfjsBuild = 9d917b289
+ * pdfjsVersion = 5.4.305
+ * pdfjsBuild = f4104326f
*/
/******/ // The require scope
/******/ var __webpack_require__ = {};
@@ -3126,8 +3126,8 @@ class CommentDialog {
posY = 0;
}
}
- posX /= innerWidth;
- posY /= innerHeight;
+ posX = MathClamp(posX / innerWidth, 0, 1);
+ posY = MathClamp(posY / innerHeight, 0, 1);
this.#setPosition(posX, posY);
await this.#overlayManager.open(this.#dialog);
textInput.focus();
@@ -8213,7 +8213,7 @@ class PDFViewer {
#textLayerMode = TextLayerMode.ENABLE;
#viewerAlert = null;
constructor(options) {
- const viewerVersion = "5.4.282";
+ const viewerVersion = "5.4.305";
if (version !== viewerVersion) {
throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
}
diff --git a/toolkit/components/pdfjs/content/web/viewer.css b/toolkit/components/pdfjs/content/web/viewer.css
@@ -4530,11 +4530,14 @@
--sidebar-min-width:180px;
--sidebar-max-width:632px;
--sidebar-width:239px;
+ --resizer-width:4px;
+ --resizer-hover-bg-color:light-dark(#0062fa, #00cadb);
@media screen and (forced-colors: active){
--sidebar-bg-color:Canvas;
--sidebar-border-color:CanvasText;
--sidebar-box-shadow:none;
+ --resizer-hover-bg-color:CanvasText;
}
border-radius:var(--sidebar-border-radius);
@@ -4548,12 +4551,22 @@
max-width:var(--sidebar-max-width);
.sidebarResizer{
- width:4px;
+ width:var(--resizer-width);
background-color:transparent;
forced-color-adjust:none;
cursor:ew-resize;
position:absolute;
inset-block:calc(var(--sidebar-padding) + var(--sidebar-border-radius));
+ inset-inline-start:calc(0px - var(--resizer-width) / 2);
+ transition:background-color 0.5s ease-in-out;
+ box-sizing:border-box;
+ border:1px solid transparent;
+ border-block-width:0;
+ background-clip:content-box;
+
+ &:hover{
+ background-color:var(--resizer-hover-bg-color);
+ }
}
&.resizing{
diff --git a/toolkit/components/pdfjs/content/web/viewer.mjs b/toolkit/components/pdfjs/content/web/viewer.mjs
@@ -21,8 +21,8 @@
*/
/**
- * pdfjsVersion = 5.4.282
- * pdfjsBuild = 9d917b289
+ * pdfjsVersion = 5.4.305
+ * pdfjsBuild = f4104326f
*/
/******/ // The require scope
/******/ var __webpack_require__ = {};
@@ -3973,8 +3973,8 @@ class CommentDialog {
posY = 0;
}
}
- posX /= innerWidth;
- posY /= innerHeight;
+ posX = MathClamp(posX / innerWidth, 0, 1);
+ posY = MathClamp(posY / innerHeight, 0, 1);
this.#setPosition(posX, posY);
await this.#overlayManager.open(this.#dialog);
textInput.focus();
@@ -11398,7 +11398,7 @@ class PDFViewer {
#textLayerMode = TextLayerMode.ENABLE;
#viewerAlert = null;
constructor(options) {
- const viewerVersion = "5.4.282";
+ const viewerVersion = "5.4.305";
if (version !== viewerVersion) {
throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
}
diff --git a/toolkit/components/pdfjs/moz.yaml b/toolkit/components/pdfjs/moz.yaml
@@ -20,8 +20,8 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
- release: 9d917b289696ee9e6b90b249f251e90c7d060a2e (2025-10-01T17:29:17Z).
- revision: 9d917b289696ee9e6b90b249f251e90c7d060a2e
+ release: f4104326f3aa6d09e95e446af179772b2231d739 (2025-10-05T18:24:02Z).
+ revision: f4104326f3aa6d09e95e446af179772b2231d739
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/