Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XFA - Add support for overflow element #13554

Merged
merged 1 commit into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 28 additions & 18 deletions src/core/xfa/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,48 +146,58 @@ function addHTML(node, html, bbox) {

function getAvailableSpace(node) {
const availableSpace = node[$extra].availableSpace;
const [marginW, marginH] = node.margin
? [
node.margin.leftInset + node.margin.rightInset,
node.margin.topInset + node.margin.leftInset,
]
: [0, 0];
const marginH = node.margin
? node.margin.topInset + node.margin.bottomInset
: 0;

switch (node.layout) {
case "lr-tb":
case "rl-tb":
switch (node[$extra].attempt) {
case 0:
return {
width: availableSpace.width - marginW - node[$extra].currentWidth,
width: availableSpace.width - node[$extra].currentWidth,
height: availableSpace.height - marginH - node[$extra].prevHeight,
};
case 1:
return {
width: availableSpace.width - marginW,
width: availableSpace.width,
height: availableSpace.height - marginH - node[$extra].height,
};
default:
// Overflow must stay in the container.
return {
width: Infinity,
height: availableSpace.height - marginH - node[$extra].prevHeight,
height: Infinity,
};
}
case "rl-row":
case "row":
const width = node[$extra].columnWidths
.slice(node[$extra].currentColumn)
.reduce((a, x) => a + x);
return { width, height: availableSpace.height - marginH };
if (node[$extra].attempt === 0) {
const width = node[$extra].columnWidths
.slice(node[$extra].currentColumn)
.reduce((a, x) => a + x);
return { width, height: availableSpace.height - marginH };
}
// Overflow must stay in the container.
return { width: Infinity, height: Infinity };
case "table":
case "tb":
return {
width: availableSpace.width - marginW,
height: availableSpace.height - marginH - node[$extra].height,
};
if (node[$extra].attempt === 0) {
return {
width: availableSpace.width,
height: availableSpace.height - marginH - node[$extra].height,
};
}
// Overflow must stay in the container.
return { width: Infinity, height: Infinity };
case "position":
default:
return availableSpace;
if (node[$extra].attempt === 0) {
return availableSpace;
}
// Overflow must stay in the container.
return { width: Infinity, height: Infinity };
}
}

Expand Down
Loading