mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-03 04:47:21 +02:00
Compare commits
No commits in common. "72feb4c25694d1e4dcfe44a3243a5c91605be513" and "6cc37c8415e937b63d21cb13e491b05bbed3fc1a" have entirely different histories.
72feb4c256
...
6cc37c8415
@ -2333,7 +2333,7 @@ function packageJson() {
|
|||||||
url: `git+${DIST_GIT_URL}`,
|
url: `git+${DIST_GIT_URL}`,
|
||||||
},
|
},
|
||||||
engines: {
|
engines: {
|
||||||
node: ">=20.16.0",
|
node: ">=20",
|
||||||
},
|
},
|
||||||
scripts: {},
|
scripts: {},
|
||||||
};
|
};
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@ -63,7 +63,7 @@
|
|||||||
"yargs": "^17.7.2"
|
"yargs": "^17.7.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.16.0"
|
"node": ">=20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
|
|||||||
@ -62,7 +62,7 @@
|
|||||||
"url": "git://github.com/mozilla/pdf.js.git"
|
"url": "git://github.com/mozilla/pdf.js.git"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.16.0"
|
"node": ">=20"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -392,8 +392,10 @@ class AForm {
|
|||||||
AVG: args => args.reduce((acc, value) => acc + value, 0) / args.length,
|
AVG: args => args.reduce((acc, value) => acc + value, 0) / args.length,
|
||||||
SUM: args => args.reduce((acc, value) => acc + value, 0),
|
SUM: args => args.reduce((acc, value) => acc + value, 0),
|
||||||
PRD: args => args.reduce((acc, value) => acc * value, 1),
|
PRD: args => args.reduce((acc, value) => acc * value, 1),
|
||||||
MIN: args => Math.min(...args),
|
MIN: args =>
|
||||||
MAX: args => Math.max(...args),
|
args.reduce((acc, value) => Math.min(acc, value), Number.MAX_VALUE),
|
||||||
|
MAX: args =>
|
||||||
|
args.reduce((acc, value) => Math.max(acc, value), Number.MIN_VALUE),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!(cFunction in actions)) {
|
if (!(cFunction in actions)) {
|
||||||
|
|||||||
@ -1394,116 +1394,6 @@ describe("Scripting", function () {
|
|||||||
formattedValue: null,
|
formattedValue: null,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should compute the max of several fields", async () => {
|
|
||||||
const refIds = [0, 1, 2, 3, 4].map(_ => getId());
|
|
||||||
const data = {
|
|
||||||
objects: {
|
|
||||||
field1: [
|
|
||||||
{
|
|
||||||
id: refIds[0],
|
|
||||||
value: "",
|
|
||||||
actions: {},
|
|
||||||
type: "text",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
field2: [
|
|
||||||
{
|
|
||||||
id: refIds[1],
|
|
||||||
value: "",
|
|
||||||
actions: {},
|
|
||||||
type: "text",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
field3: [
|
|
||||||
{
|
|
||||||
id: refIds[2],
|
|
||||||
value: "",
|
|
||||||
actions: {},
|
|
||||||
type: "text",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
field4: [
|
|
||||||
{
|
|
||||||
id: refIds[3],
|
|
||||||
value: "",
|
|
||||||
actions: {
|
|
||||||
Calculate: [
|
|
||||||
`AFSimple_Calculate("MAX", ["field1", "field2", "field3", "unknown"]);`,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
type: "text",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
field5: [
|
|
||||||
{
|
|
||||||
id: refIds[4],
|
|
||||||
value: "",
|
|
||||||
actions: {
|
|
||||||
Calculate: [
|
|
||||||
`AFSimple_Calculate("MAX", "field1, field2, field3, unknown");`,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
type: "text",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
appInfo: { language: "en-US", platform: "Linux x86_64" },
|
|
||||||
calculationOrder: [refIds[3], refIds[4]],
|
|
||||||
dispatchEventName: "_dispatchMe",
|
|
||||||
};
|
|
||||||
|
|
||||||
sandbox.createSandbox(data);
|
|
||||||
await sandbox.dispatchEventInSandbox({
|
|
||||||
id: refIds[0],
|
|
||||||
value: "1",
|
|
||||||
name: "Keystroke",
|
|
||||||
willCommit: true,
|
|
||||||
});
|
|
||||||
expect(send_queue.has(refIds[3])).toEqual(true);
|
|
||||||
expect(send_queue.get(refIds[3])).toEqual({
|
|
||||||
id: refIds[3],
|
|
||||||
siblings: null,
|
|
||||||
value: 1,
|
|
||||||
formattedValue: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
await sandbox.dispatchEventInSandbox({
|
|
||||||
id: refIds[1],
|
|
||||||
value: "2",
|
|
||||||
name: "Keystroke",
|
|
||||||
willCommit: true,
|
|
||||||
});
|
|
||||||
expect(send_queue.has(refIds[3])).toEqual(true);
|
|
||||||
expect(send_queue.get(refIds[3])).toEqual({
|
|
||||||
id: refIds[3],
|
|
||||||
siblings: null,
|
|
||||||
value: 2,
|
|
||||||
formattedValue: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
await sandbox.dispatchEventInSandbox({
|
|
||||||
id: refIds[2],
|
|
||||||
value: "3",
|
|
||||||
name: "Keystroke",
|
|
||||||
willCommit: true,
|
|
||||||
});
|
|
||||||
expect(send_queue.has(refIds[3])).toEqual(true);
|
|
||||||
expect(send_queue.get(refIds[3])).toEqual({
|
|
||||||
id: refIds[3],
|
|
||||||
siblings: null,
|
|
||||||
value: 3,
|
|
||||||
formattedValue: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(send_queue.has(refIds[4])).toEqual(true);
|
|
||||||
expect(send_queue.get(refIds[4])).toEqual({
|
|
||||||
id: refIds[4],
|
|
||||||
siblings: null,
|
|
||||||
value: 3,
|
|
||||||
formattedValue: null,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("AFSpecial_KeystrokeEx", function () {
|
describe("AFSpecial_KeystrokeEx", function () {
|
||||||
|
|||||||
@ -234,8 +234,9 @@ describe("ui_utils", function () {
|
|||||||
let lineTop = 0,
|
let lineTop = 0,
|
||||||
id = 0;
|
id = 0;
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const heights = line.map(pair => pair[1]);
|
const lineHeight = line.reduce(function (maxHeight, pair) {
|
||||||
const lineHeight = Math.max(...heights);
|
return Math.max(maxHeight, pair[1]);
|
||||||
|
}, 0);
|
||||||
let offsetLeft = -BORDER_WIDTH;
|
let offsetLeft = -BORDER_WIDTH;
|
||||||
for (const [clientWidth, clientHeight] of line) {
|
for (const [clientWidth, clientHeight] of line) {
|
||||||
const offsetTop =
|
const offsetTop =
|
||||||
@ -319,12 +320,14 @@ describe("ui_utils", function () {
|
|||||||
// test to the slower implementation above, for a range of scroll viewport
|
// test to the slower implementation above, for a range of scroll viewport
|
||||||
// sizes and positions.
|
// sizes and positions.
|
||||||
function scrollOverDocument(pages, horizontal = false, rtl = false) {
|
function scrollOverDocument(pages, horizontal = false, rtl = false) {
|
||||||
const sizes = pages.map(({ div }) =>
|
const size = pages.reduce(function (max, { div }) {
|
||||||
|
return Math.max(
|
||||||
|
max,
|
||||||
horizontal
|
horizontal
|
||||||
? Math.abs(div.offsetLeft + div.clientLeft + div.clientWidth)
|
? Math.abs(div.offsetLeft + div.clientLeft + div.clientWidth)
|
||||||
: div.offsetTop + div.clientTop + div.clientHeight
|
: div.offsetTop + div.clientTop + div.clientHeight
|
||||||
);
|
);
|
||||||
const size = Math.max(...sizes);
|
}, 0);
|
||||||
// The numbers (7 and 5) are mostly arbitrary, not magic: increase them to
|
// The numbers (7 and 5) are mostly arbitrary, not magic: increase them to
|
||||||
// make scrollOverDocument tests faster, decrease them to make the tests
|
// make scrollOverDocument tests faster, decrease them to make the tests
|
||||||
// more scrupulous, and keep them coprime to reduce the chance of missing
|
// more scrupulous, and keep them coprime to reduce the chance of missing
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user