1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Revert "XFA - Avoid to have containers not pushed in the html"

This commit is contained in:
calixteman 2021-07-12 09:46:38 +02:00 committed by GitHub
parent b6445ddc08
commit 140c2bc563
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 66 deletions

View file

@ -52,21 +52,10 @@ import { measureToString } from "./html_utils.js";
* returning.
*/
function createLine(node, children) {
return {
name: "div",
attributes: {
class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"],
},
children,
};
}
function flushHTML(node) {
if (!node[$extra]) {
return null;
}
const attributes = node[$extra].attributes;
const html = {
name: "div",
@ -77,11 +66,7 @@ function flushHTML(node) {
if (node[$extra].failingNode) {
const htmlFromFailing = node[$extra].failingNode[$flushHTML]();
if (htmlFromFailing) {
if (node.layout.endsWith("-tb")) {
html.children.push(createLine(node, [htmlFromFailing]));
} else {
html.children.push(htmlFromFailing);
}
html.children.push(htmlFromFailing);
}
}
@ -89,6 +74,10 @@ function flushHTML(node) {
return null;
}
node[$extra].children = [];
delete node[$extra].line;
node[$extra].numberInLine = 0;
return html;
}
@ -107,7 +96,13 @@ function addHTML(node, html, bbox) {
case "lr-tb":
case "rl-tb":
if (!extra.line || extra.attempt === 1) {
extra.line = createLine(node, []);
extra.line = {
name: "div",
attributes: {
class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"],
},
children: [],
};
extra.children.push(extra.line);
extra.numberInLine = 0;
}