From 1279880b8d1725a87217a5d29d8de5cf89d6704d Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Fri, 17 Sep 2021 12:41:50 +0200 Subject: [PATCH] Annotation - For checkboxes, get field value from AS (if any) instead of V (bug 1722036) - it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1722036. - AS and V should share the same value for checkbox: it's at least what the specs say; - the pdf in the above bug opens correctly in Acrobat so it likely means that AS is chosen over V. --- src/core/annotation.js | 6 ++++++ test/pdfs/bug1722036.pdf.link | 1 + test/test_manifest.json | 7 +++++++ 3 files changed, 14 insertions(+) create mode 100644 test/pdfs/bug1722036.pdf.link diff --git a/src/core/annotation.js b/src/core/annotation.js index 197012cd3deea7..9a092b9a8ce593 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -2083,6 +2083,12 @@ class ButtonWidgetAnnotation extends WidgetAnnotation { return; } + if (this.appearance) { + // See https://bugzilla.mozilla.org/show_bug.cgi?id=1722036 + // If we've an AS and V then take AS. + this.data.fieldValue = this._decodeFormValue(params.dict.get("AS")); + } + const exportValues = normalAppearance.getKeys(); if (!exportValues.includes("Off")) { // The /Off appearance is optional. diff --git a/test/pdfs/bug1722036.pdf.link b/test/pdfs/bug1722036.pdf.link new file mode 100644 index 00000000000000..d82c95addbf900 --- /dev/null +++ b/test/pdfs/bug1722036.pdf.link @@ -0,0 +1 @@ +https://bugzilla.mozilla.org/attachment.cgi?id=9232845 diff --git a/test/test_manifest.json b/test/test_manifest.json index 508fc52081d883..406140b0675492 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -5899,5 +5899,12 @@ "rounds": 1, "lastPage": 1, "type": "eq" + }, + { "id": "bug1722036", + "file": "pdfs/bug1722036.pdf", + "md5": "bbc7f62ca85609c97069bd3ce2658288", + "rounds": 1, + "link": true, + "type": "eq" } ]