diff --git a/src/core/xfa/template.js b/src/core/xfa/template.js
index 04428554e..ec1cae051 100644
--- a/src/core/xfa/template.js
+++ b/src/core/xfa/template.js
@@ -18,6 +18,7 @@ import {
$addHTML,
$appendChild,
$childrenToHTML,
+ $clean,
$content,
$extra,
$finalize,
@@ -4820,11 +4821,7 @@ class TextEdit extends XFAObject {
"on",
]);
this.id = attributes.id || "";
- this.multiLine = getInteger({
- data: attributes.multiLine,
- defaultValue: 1,
- validate: x => x === 0,
- });
+ this.multiLine = attributes.multiLine || "";
this.use = attributes.use || "";
this.usehref = attributes.usehref || "";
this.vScrollPolicy = getStringOption(attributes.vScrollPolicy, [
@@ -4838,6 +4835,17 @@ class TextEdit extends XFAObject {
this.margin = null;
}
+ [$clean](builder) {
+ super[$clean](builder);
+ const parent = this[$getParent]();
+ const defaultValue = parent instanceof Draw ? 1 : 0;
+ this.multiLine = getInteger({
+ data: this.multiLine,
+ defaultValue,
+ validate: x => x === 0 || x === 1,
+ });
+ }
+
[$toHTML](availableSpace) {
// TODO: incomplete.
const style = toStyle(this, "border", "font", "margin");
diff --git a/test/pdfs/xfa_bug1716809.pdf.link b/test/pdfs/xfa_bug1716809.pdf.link
new file mode 100644
index 000000000..6539633cb
--- /dev/null
+++ b/test/pdfs/xfa_bug1716809.pdf.link
@@ -0,0 +1 @@
+https://bugzilla.mozilla.org/attachment.cgi?id=9227437
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 355966334..3febc0d91 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -938,6 +938,14 @@
"enableXfa": true,
"type": "eq"
},
+ { "id": "xfa_bug1716809",
+ "file": "pdfs/xfa_bug1716809.pdf",
+ "md5": "7192f9e27e8b84776d107f57cbe353d5",
+ "link": true,
+ "rounds": 1,
+ "enableXfa": true,
+ "type": "eq"
+ },
{ "id": "xfa_annual_expense_report",
"file": "pdfs/xfa_annual_expense_report.pdf",
"md5": "06866e7a6bbc0346789208ef5f6e885c",
diff --git a/test/unit/xfa_tohtml_spec.js b/test/unit/xfa_tohtml_spec.js
index 14bc28da6..b076c2447 100644
--- a/test/unit/xfa_tohtml_spec.js
+++ b/test/unit/xfa_tohtml_spec.js
@@ -137,7 +137,7 @@ describe("XFAFactory", function () {
-
+
@@ -160,9 +160,54 @@ describe("XFAFactory", function () {
expect(factory.numberPages).toEqual(1);
const pages = factory.getPages();
- const field = searchHtmlNode(pages, "name", "textarea");
+ const field = searchHtmlNode(pages, "name", "input");
expect(field.attributes.maxLength).toEqual(123);
});
+
+ it("should have an input or textarea", function () {
+ const xml = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ foo
+
+
+
+
+
+
+
+
+ `;
+ const factory = new XFAFactory({ "xdp:xdp": xml });
+
+ expect(factory.numberPages).toEqual(1);
+
+ const pages = factory.getPages();
+ const field1 = searchHtmlNode(pages, "name", "input");
+ expect(field1).not.toEqual(null);
+
+ const field2 = searchHtmlNode(pages, "name", "textarea");
+ expect(field2).not.toEqual(null);
+ });
});
});