1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Make sure that only one radio button is checked in its group (bug 1864136)

When the first checked radio is met, the others in the group are set to false.
This commit is contained in:
Calixte Denizet 2023-11-22 20:23:52 +01:00
parent 5781e722bf
commit 1f0f51613a
5 changed files with 53 additions and 5 deletions

View file

@ -219,6 +219,8 @@ class Rasterize {
outputScale,
annotations,
annotationCanvasMap,
annotationStorage,
fieldObjects,
page,
imageResourcesPath,
renderForms = false
@ -244,6 +246,8 @@ class Rasterize {
linkService: new SimpleLinkService(),
imageResourcesPath,
renderForms,
annotationStorage,
fieldObjects,
};
// Ensure that the annotationLayer gets translated.
@ -682,6 +686,10 @@ class Driver {
}
}
if (task.forms) {
task.fieldObjects = await doc.getFieldObjects();
}
this._nextPage(task, failure);
},
err => {
@ -928,9 +936,7 @@ class Driver {
transform,
};
if (renderForms) {
renderContext.annotationMode = task.annotationStorage
? AnnotationMode.ENABLE_STORAGE
: AnnotationMode.ENABLE_FORMS;
renderContext.annotationMode = AnnotationMode.ENABLE_FORMS;
} else if (renderPrint) {
if (task.annotationStorage) {
renderContext.annotationMode = AnnotationMode.ENABLE_STORAGE;
@ -984,6 +990,8 @@ class Driver {
outputScale,
data,
annotationCanvasMap,
task.pdfDoc.annotationStorage,
task.fieldObjects,
page,
IMAGE_RESOURCES_PATH,
renderForms

View file

@ -2261,9 +2261,15 @@ describe("Interaction", () => {
expect(storage)
.withContext(`In ${browserName}`)
.toEqual({
"22R": { value: false },
"25R": { value: true },
"28R": { value: false },
"35R": { value: false },
"38R": { value: false },
"41R": { value: false },
"44R": { value: false },
"47R": { value: false },
"50R": { value: false },
"22R": { value: false },
});
await page.click(getSelector("22R"));
@ -2273,9 +2279,15 @@ describe("Interaction", () => {
expect(storage)
.withContext(`In ${browserName}`)
.toEqual({
"22R": { value: true },
"25R": { value: false },
"28R": { value: false },
"35R": { value: false },
"38R": { value: false },
"41R": { value: false },
"44R": { value: false },
"47R": { value: false },
"50R": { value: false },
"22R": { value: true },
});
})
);

View file

@ -0,0 +1,2 @@
https://bugzilla.mozilla.org/attachment.cgi?id=9363183

View file

@ -8361,5 +8361,16 @@
"rotation": 0
}
}
},
{
"id": "bug1864136-forms",
"file": "pdfs/bug1864136.pdf",
"md5": "97357ad5b0fde2c4e79c07819e4d9710",
"rounds": 1,
"link": true,
"firstPage": 2,
"lastPage": 2,
"type": "eq",
"forms": true
}
]