From 08e08d5852e1f576ffda04f0a0d6c04cd962d937 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Wed, 30 Jun 2021 17:13:59 +0200 Subject: [PATCH] XFA - Don't fill when the fill element is not visible (bug 1718735) --- src/core/xfa/template.js | 6 +++--- test/pdfs/xfa_bug1718735.pdf.link | 1 + test/test_manifest.json | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 test/pdfs/xfa_bug1718735.pdf.link diff --git a/src/core/xfa/template.js b/src/core/xfa/template.js index f9fed95d5..f027ca6c3 100644 --- a/src/core/xfa/template.js +++ b/src/core/xfa/template.js @@ -181,7 +181,7 @@ class Arc extends XFAObject { const edge = this.edge ? this.edge : new Edge({}); const edgeStyle = edge[$toStyle](); const style = Object.create(null); - if (this.fill) { + if (this.fill && this.fill.presence === "visible") { Object.assign(style, this.fill[$toStyle]()); } else { style.fill = "transparent"; @@ -631,7 +631,7 @@ class Border extends XFAObject { Object.assign(style, this.margin[$toStyle]()); } - if (this.fill) { + if (this.fill && this.fill.presence === "visible") { Object.assign(style, this.fill[$toStyle]()); } @@ -3918,7 +3918,7 @@ class Rectangle extends XFAObject { : new Edge({}); const edgeStyle = edge[$toStyle](); const style = Object.create(null); - if (this.fill) { + if (this.fill && this.fill.presence === "visible") { Object.assign(style, this.fill[$toStyle]()); } else { style.fill = "transparent"; diff --git a/test/pdfs/xfa_bug1718735.pdf.link b/test/pdfs/xfa_bug1718735.pdf.link new file mode 100644 index 000000000..a2dcc28f9 --- /dev/null +++ b/test/pdfs/xfa_bug1718735.pdf.link @@ -0,0 +1 @@ +https://bugzilla.mozilla.org/attachment.cgi?id=9229357 diff --git a/test/test_manifest.json b/test/test_manifest.json index 34608b5d4..bd54584bc 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -938,6 +938,14 @@ "lastPage": 2, "type": "eq" }, + { "id": "xfa_bug1718735", + "file": "pdfs/xfa_bug1718735.pdf", + "md5": "1001f5c02c026943cbd37f646725d82f", + "link": true, + "rounds": 1, + "enableXfa": true, + "type": "eq" + }, { "id": "xfa_bug1718053", "file": "pdfs/xfa_bug1718053.pdf", "md5": "252d728d2c456dcb81699342a71c42ea",