Skip to content

Commit a0aff12

Browse files
authored
Merge pull request #13684 from calixteman/typo
XFA - Default background in rectangle is white
2 parents 90d196a + c47f0f0 commit a0aff12

File tree

6 files changed

+37
-37
lines changed

6 files changed

+37
-37
lines changed

src/core/xfa/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class BehaviorOverride extends ContentObject {
171171
this[$content]
172172
.trim()
173173
.split(/\s+/)
174-
.filter(x => !!x && x.include(":"))
174+
.filter(x => x.includes(":"))
175175
.map(x => x.split(":", 2))
176176
);
177177
}

src/core/xfa/html_utils.js

+26-14
Original file line numberDiff line numberDiff line change
@@ -420,40 +420,50 @@ function createWrapper(node, html) {
420420
class: ["xfaWrapper"],
421421
style: Object.create(null),
422422
},
423-
children: [html],
423+
children: [],
424424
};
425425

426426
attributes.class.push("xfaWrapped");
427427

428428
if (node.border) {
429429
const { widths, insets } = node.border[$extra];
430-
let shiftH = 0;
431-
let shiftW = 0;
430+
let width, height;
431+
let top = insets[0];
432+
let left = insets[3];
433+
const insetsH = insets[0] + insets[2];
434+
const insetsW = insets[1] + insets[3];
432435
switch (node.border.hand) {
433436
case "even":
434-
shiftW = widths[0] / 2;
435-
shiftH = widths[3] / 2;
437+
top -= widths[0] / 2;
438+
left -= widths[3] / 2;
439+
width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
440+
height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
436441
break;
437442
case "left":
438-
shiftW = widths[0];
439-
shiftH = widths[3];
443+
top -= widths[0];
444+
left -= widths[3];
445+
width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
446+
height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
447+
break;
448+
case "right":
449+
width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
450+
height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
440451
break;
441452
}
442-
const insetsW = insets[1] + insets[3];
443-
const insetsH = insets[0] + insets[2];
444453
const classNames = ["xfaBorder"];
445454
if (isPrintOnly(node.border)) {
446455
classNames.push("xfaPrintOnly");
447456
}
457+
448458
const border = {
449459
name: "div",
450460
attributes: {
451461
class: classNames,
452462
style: {
453-
top: `${insets[0] - widths[0] + shiftW}px`,
454-
left: `${insets[3] - widths[3] + shiftH}px`,
455-
width: insetsW ? `calc(100% - ${insetsW}px)` : "100%",
456-
height: insetsH ? `calc(100% - ${insetsH}px)` : "100%",
463+
top: `${top}px`,
464+
left: `${left}px`,
465+
width,
466+
height,
457467
},
458468
},
459469
children: [],
@@ -471,7 +481,9 @@ function createWrapper(node, html) {
471481
delete style[key];
472482
}
473483
}
474-
wrapper.children.push(border);
484+
wrapper.children.push(border, html);
485+
} else {
486+
wrapper.children.push(html);
475487
}
476488

477489
for (const key of [

src/core/xfa/template.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2689,7 +2689,7 @@ class Fill extends XFAObject {
26892689
}
26902690
if (parent instanceof Rectangle || parent instanceof Arc) {
26912691
propName = "fill";
2692-
style.fill = "transparent";
2692+
style.fill = "white";
26932693
}
26942694

26952695
for (const name of Object.getOwnPropertyNames(this)) {

test/pdfs/xfa_issue13679.pdf.link

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/mozilla/pdf.js/files/6768253/Form_MGT-7.pdf

test/test_manifest.json

+8
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,14 @@
11381138
"enableXfa": true,
11391139
"type": "eq"
11401140
},
1141+
{ "id": "xfa_issue13679",
1142+
"file": "pdfs/xfa_issue13679.pdf",
1143+
"md5": "b7231495f0c063435e7cfb92b4f281a3",
1144+
"link": true,
1145+
"rounds": 1,
1146+
"enableXfa": true,
1147+
"type": "eq"
1148+
},
11411149
{ "id": "xfa_issue13633",
11421150
"file": "pdfs/xfa_issue13633.pdf",
11431151
"md5": "e5b0d09285ca6a140eba08d740be0ea0",

web/xfa_layer_builder.css

-21
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
text-align: initial;
3232
top: 0;
3333
left: 0;
34-
z-index: 200;
3534
transform-origin: 0 0;
3635
line-height: 1.2;
3736
}
@@ -76,26 +75,6 @@
7675
vertical-align: 0;
7776
}
7877

79-
.xfaDraw {
80-
z-index: 100;
81-
}
82-
83-
.xfaExclgroup {
84-
z-index: 200;
85-
}
86-
87-
.xfaField {
88-
z-index: 300;
89-
}
90-
91-
.xfaRich {
92-
z-index: 300;
93-
}
94-
95-
.xfaSubform {
96-
z-index: 200;
97-
}
98-
9978
.xfaCaption {
10079
overflow: hidden;
10180
flex: 0 1 auto;

0 commit comments

Comments
 (0)