1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-28 23:28:16 +02:00

XFA - Fix layout issues

- PR #13554 is buggy, so this patch aims to fix bugs.
  - check if a component fits into its parent in taking into account the parent layout.
  - introduce method isSplittable for template nodes to know if a component can be splitted in case of overflow.
This commit is contained in:
Calixte Denizet 2021-06-16 16:02:41 +02:00
parent 326226df45
commit df08b1548b
7 changed files with 337 additions and 232 deletions

View file

@ -47,7 +47,7 @@ const $getContainedChildren = Symbol();
const $getNextPage = Symbol();
const $getSubformParent = Symbol();
const $getParent = Symbol();
const $pushGlyphs = Symbol();
const $getTemplateRoot = Symbol();
const $global = Symbol();
const $hasItem = Symbol();
const $hasSettableValue = Symbol();
@ -57,6 +57,7 @@ const $insertAt = Symbol();
const $isCDATAXml = Symbol();
const $isDataValue = Symbol();
const $isDescendent = Symbol();
const $isSplittable = Symbol();
const $isTransparent = Symbol();
const $lastAttribute = Symbol();
const $namespaceId = Symbol("namespaceId");
@ -65,6 +66,7 @@ const $nsAttributes = Symbol();
const $onChild = Symbol();
const $onChildCheck = Symbol();
const $onText = Symbol();
const $pushGlyphs = Symbol();
const $removeChild = Symbol();
const $root = Symbol("root");
const $resolvePrototypes = Symbol();
@ -162,6 +164,18 @@ class XFAObject {
}
}
[$getTemplateRoot]() {
let parent = this[$getParent]();
while (parent[$nodeName] !== "template") {
parent = parent[$getParent]();
}
return parent;
}
[$isSplittable]() {
return false;
}
[$appendChild](child) {
child[_parent] = this;
this[_children].push(child);
@ -985,6 +999,7 @@ export {
$getParent,
$getRealChildrenByNameIt,
$getSubformParent,
$getTemplateRoot,
$global,
$hasItem,
$hasSettableValue,
@ -994,6 +1009,7 @@ export {
$isCDATAXml,
$isDataValue,
$isDescendent,
$isSplittable,
$isTransparent,
$namespaceId,
$nodeName,