mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-10 21:11:52 +00:00
Designer style sheets give fields and draws their size, anchor, borders, fills, fonts and caption placement through usehref references to elements in a <proto> subform (XFA 3.3, chapter 6, "Prototypes"). The parser did not follow them, so such forms lost their section bars, input boxes and check-box placement. The new crates/xfa/src/proto.rs writes the template again with every reference into the same template merged in, and parse() reads that: - references: usehref "#id", "#som(expr)" (with or without the legacy "."), and use "#id" or a SOM expression; usehref wins over use; - rules from "Overriding Prototype Properties": own attributes, data content and children win; id and name are not inherited; children match by class and position, and a matched prototype child is the prototype of the element's own; a ui widget or value kind and rich text come from the nearest layer that has one; - prototypes in other documents are not followed (no file or network access); a missing target, a loop (Example 6.8) or a long chain is left out with a warning; - caps: 32 merged layers, 256 levels of nesting, 2 million elements of SOM search, and growth to 4x the template (1 MB floor, 64 MB ceiling); past a cap the template is read unresolved, with a warning. The resolver is ported from the closed #1566 by EULArule, who invited reuse, and changed: the name attribute is no longer inherited, use takes SOM expressions, ids and SOM look-ups are indexed and cached under one search budget, loops through ancestors are cut, the output cap is relative, every fallback is a warning, and the saved form state is still read from the original XDP. Part of #3432. Co-authored-by: EULA <90616501+EULArule@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0175FWj4xFhMhSH3UpMU8DSC