Attach (recommended) or Link to PDF file here:
https://www.placementsmondiauxsunlife.com/content/dam/sunlife/regional/canada/documents/slgi/4839-I-F.pdf

Configuration:

- Web browser and its version: 91.0a1 (2021-07-03) (64-bit)
- Operating system and its version: Windows 10

Steps to reproduce the problem:
1. enableXfa = true
2. Open form

What is the expected behavior? (add screenshot)

![image](https://user-images.githubusercontent.com/7104454/124389449-1ede2b80-dcb5-11eb-98ba-01e1f3d6c6f5.png)


What went wrong? (add screenshot)

![image](https://user-images.githubusercontent.com/7104454/124389460-2c93b100-dcb5-11eb-9768-98ddd2c8f1e7.png)

$isThereMoreWidth,
} from "./xfa_object.js";
import { measureToString } from "./html_utils.js";
/**
 * How layout works ?
 *
 * A container has an initial space (with a width and a height) to fit in,
 * which means that once all the children have been added then
 * the total width/height must be lower than the given ones in
 * the initial space.
 * So if the container has known dimensions and these ones are ok with the
 * space then continue else we return HTMLResult.FAILURE: it's up to the
 * parent to deal with this failure (e.g. if parent layout is lr-tb and
 * we fail to add a child at end of line (lr) then we try to add it on the
 * next line).
 * And then we run through the children, each child gets its initial space
 * in calling its parent $getAvailableSpace method
 * (see _filteredChildrenGenerator and $childrenToHTML in xfa_object.js)
 * then we try to layout child in its space. If everything is ok then we add
 * the result to its parent through $addHTML which will recompute the available
 * space in parent according to its layout property else we return
 * HTMLResult.Failure.
 * Before a failure some children may have been layed out: they've been saved in
 * [$extra].children and [$extra] has properties generator and failingNode
 * in order to save the state where we were before a failure.
 * This [$extra].children property is useful when a container has to be splited.
 * So if a container is unbreakable, we must delete its [$extra] property before
 * returning.
 */
function flushHTML(node) {