Expand description
Layout engine — positions form nodes into layout rectangles.
Implements XFA 3.3 §4 (Box Model) and §8 (Layout for Growable Objects). Supports positioned layout and flowed layout (tb, lr-tb, rl-tb).
§XFA Spec 3.3 Chapter 8 — Layout for Growable Objects
This module implements the core layout algorithm described in §8.6 (p288): a content-driven single traversal of the Form DOM, adding layout nodes to a Layout DOM as content is placed into containers. When a container fills up, the engine traverses to a new container (next contentArea, next pageArea, or a new page).
§Spec coverage status (reviewed 2026-04-19):
- §8.1 Text Placement in Growable Containers: ✅ implemented (anchorType via Appendix A)
- §8.2 Flowing Layout (TB, LR-TB, RL-TB): ✅ implemented
- §8.3 hAlign in various layouts: ✅ hAlign on children in TB/LR-TB/RL-TB
- §8.4 Growable + Flowed interaction: ✅ resize then reflow
- §8.5 Layout DOM structure: ✅ pages > nodes hierarchy
- §8.6 Layout Algorithm: ✅ content-driven traversal
- §8.7 Content Splitting: ✅ text-line splitting + container splitting
- §8.8 Pagination Strategies: ✅ orderedOccurrence (sequential by default)
- §8.9 Adhesion (keep): ✅ keep-chain look-ahead (keep.next/previous)
- §8.10 Leaders/Trailers: ✅ per-page leader/trailer; ⚠️ overflow/bookend
- §8.11 Tables: ✅ columnWidths, colSpan, row equalization
- Appendix A: Coordinate algorithms: ✅ anchorType (all 9 variants)
- Appendix B: Layout Objects: ✅ area, exclGroup, subformSet
Structs§
- Layout
Dom - The output of the layout engine: positioned rectangles on pages.
- Layout
Engine - The layout engine.
- Layout
Node - A positioned element on a page.
- Layout
Node Id - A unique identifier for a layout node.
- Layout
Page - A single page in the layout output.
- Layout
Profile - Per-page pagination diagnostics collected only on opt-in code paths.
- Layout
Profile Page - Minimal vertical-space profiling metadata for one laid out page.
Enums§
- Layout
Content - Content type for layout leaf nodes.