XFA - Default background in rectangle is white
- Fix a typo in order to open the pdf in issue #13679 - After fixing the fill default color there wer some regressions because of z-index and when fixing z-index there were some regressions because of borders - So fix the borders rendering.
This commit is contained in:
parent
90d196a080
commit
c47f0f0f40
@ -171,7 +171,7 @@ class BehaviorOverride extends ContentObject {
|
|||||||
this[$content]
|
this[$content]
|
||||||
.trim()
|
.trim()
|
||||||
.split(/\s+/)
|
.split(/\s+/)
|
||||||
.filter(x => !!x && x.include(":"))
|
.filter(x => x.includes(":"))
|
||||||
.map(x => x.split(":", 2))
|
.map(x => x.split(":", 2))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -420,40 +420,50 @@ function createWrapper(node, html) {
|
|||||||
class: ["xfaWrapper"],
|
class: ["xfaWrapper"],
|
||||||
style: Object.create(null),
|
style: Object.create(null),
|
||||||
},
|
},
|
||||||
children: [html],
|
children: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
attributes.class.push("xfaWrapped");
|
attributes.class.push("xfaWrapped");
|
||||||
|
|
||||||
if (node.border) {
|
if (node.border) {
|
||||||
const { widths, insets } = node.border[$extra];
|
const { widths, insets } = node.border[$extra];
|
||||||
let shiftH = 0;
|
let width, height;
|
||||||
let shiftW = 0;
|
let top = insets[0];
|
||||||
|
let left = insets[3];
|
||||||
|
const insetsH = insets[0] + insets[2];
|
||||||
|
const insetsW = insets[1] + insets[3];
|
||||||
switch (node.border.hand) {
|
switch (node.border.hand) {
|
||||||
case "even":
|
case "even":
|
||||||
shiftW = widths[0] / 2;
|
top -= widths[0] / 2;
|
||||||
shiftH = widths[3] / 2;
|
left -= widths[3] / 2;
|
||||||
|
width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
|
||||||
|
height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
|
||||||
break;
|
break;
|
||||||
case "left":
|
case "left":
|
||||||
shiftW = widths[0];
|
top -= widths[0];
|
||||||
shiftH = widths[3];
|
left -= widths[3];
|
||||||
|
width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
|
||||||
|
height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
|
||||||
|
break;
|
||||||
|
case "right":
|
||||||
|
width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
|
||||||
|
height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const insetsW = insets[1] + insets[3];
|
|
||||||
const insetsH = insets[0] + insets[2];
|
|
||||||
const classNames = ["xfaBorder"];
|
const classNames = ["xfaBorder"];
|
||||||
if (isPrintOnly(node.border)) {
|
if (isPrintOnly(node.border)) {
|
||||||
classNames.push("xfaPrintOnly");
|
classNames.push("xfaPrintOnly");
|
||||||
}
|
}
|
||||||
|
|
||||||
const border = {
|
const border = {
|
||||||
name: "div",
|
name: "div",
|
||||||
attributes: {
|
attributes: {
|
||||||
class: classNames,
|
class: classNames,
|
||||||
style: {
|
style: {
|
||||||
top: `${insets[0] - widths[0] + shiftW}px`,
|
top: `${top}px`,
|
||||||
left: `${insets[3] - widths[3] + shiftH}px`,
|
left: `${left}px`,
|
||||||
width: insetsW ? `calc(100% - ${insetsW}px)` : "100%",
|
width,
|
||||||
height: insetsH ? `calc(100% - ${insetsH}px)` : "100%",
|
height,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
children: [],
|
children: [],
|
||||||
@ -471,7 +481,9 @@ function createWrapper(node, html) {
|
|||||||
delete style[key];
|
delete style[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wrapper.children.push(border);
|
wrapper.children.push(border, html);
|
||||||
|
} else {
|
||||||
|
wrapper.children.push(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of [
|
for (const key of [
|
||||||
|
@ -2689,7 +2689,7 @@ class Fill extends XFAObject {
|
|||||||
}
|
}
|
||||||
if (parent instanceof Rectangle || parent instanceof Arc) {
|
if (parent instanceof Rectangle || parent instanceof Arc) {
|
||||||
propName = "fill";
|
propName = "fill";
|
||||||
style.fill = "transparent";
|
style.fill = "white";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const name of Object.getOwnPropertyNames(this)) {
|
for (const name of Object.getOwnPropertyNames(this)) {
|
||||||
|
1
test/pdfs/xfa_issue13679.pdf.link
Normal file
1
test/pdfs/xfa_issue13679.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://github.com/mozilla/pdf.js/files/6768253/Form_MGT-7.pdf
|
@ -1138,6 +1138,14 @@
|
|||||||
"enableXfa": true,
|
"enableXfa": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "xfa_issue13679",
|
||||||
|
"file": "pdfs/xfa_issue13679.pdf",
|
||||||
|
"md5": "b7231495f0c063435e7cfb92b4f281a3",
|
||||||
|
"link": true,
|
||||||
|
"rounds": 1,
|
||||||
|
"enableXfa": true,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "xfa_issue13633",
|
{ "id": "xfa_issue13633",
|
||||||
"file": "pdfs/xfa_issue13633.pdf",
|
"file": "pdfs/xfa_issue13633.pdf",
|
||||||
"md5": "e5b0d09285ca6a140eba08d740be0ea0",
|
"md5": "e5b0d09285ca6a140eba08d740be0ea0",
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
text-align: initial;
|
text-align: initial;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 200;
|
|
||||||
transform-origin: 0 0;
|
transform-origin: 0 0;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
@ -76,26 +75,6 @@
|
|||||||
vertical-align: 0;
|
vertical-align: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xfaDraw {
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
.xfaExclgroup {
|
|
||||||
z-index: 200;
|
|
||||||
}
|
|
||||||
|
|
||||||
.xfaField {
|
|
||||||
z-index: 300;
|
|
||||||
}
|
|
||||||
|
|
||||||
.xfaRich {
|
|
||||||
z-index: 300;
|
|
||||||
}
|
|
||||||
|
|
||||||
.xfaSubform {
|
|
||||||
z-index: 200;
|
|
||||||
}
|
|
||||||
|
|
||||||
.xfaCaption {
|
.xfaCaption {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex: 0 1 auto;
|
flex: 0 1 auto;
|
||||||
|
Loading…
Reference in New Issue
Block a user