Commit Graph
474 Commits
Author SHA1 Message Date
FredApps f53cab766c Merge main into #4538 2026-11-26 20:27:19 +01:00
FredApps c7020ab493 Merge main into #4369
# Conflicts:
#	parity/acrobat-features.toml
2026-11-26 19:06:19 +01:00
FredApps 448cd37405 Merge main into #4538
# Conflicts:
#	parity/acrobat-features.toml
2026-11-26 19:06:02 +01:00
FredApps 1e05eefeae Merge main into #4369 2026-11-27 00:10:52 +07:00
FredApps e4144bfdde Merge main into #4538 2026-11-27 00:09:02 +07:00
FredApps a462b8c6ad Merge main into #4522 2026-11-27 00:01:37 +07:00
FredApps e334d6d4be Merge pull request #4527 from EricKaden/fix/xfa-ready-events
XFA: ready events run in the other viewer's order, and layout:ready again after a new layout
2026-11-26 17:50:24 +01:00
FredApps 328a1bca2b Merge main into #4538 2026-11-26 17:33:12 +01:00
FredApps 05f31ac058 Merge pull request #5470 from croquete1/fix/4744-repeat-min-instances
M12: um subformulário repetido mantém o mínimo de instâncias de occur, seja qual for o dado (#4744)
2026-11-26 17:27:42 +01:00
FredApps 781ab07f8c Merge main into #4369 2026-11-26 23:23:46 +07:00
FredApps cb061454b2 Merge main into #4522 2026-11-26 23:20:14 +07:00
FredApps 0b47a83928 Merge main into #4527 2026-11-26 23:05:58 +07:00
FredApps 4825ebfbf2 Merge pull request #3526 from EricKaden/fix/xfa-hanging-indent
M12: a negative XFA text indent hangs the first line
2026-11-26 16:53:39 +01:00
FredApps c2bd7c14b7 Merge pull request #4604 from mtlcl410/fix/xfa-script-relayout-full-refresh
M12: an XFA form laid out again by its scripts rebuilds its pages in the view (#4603)
2026-11-26 16:51:38 +01:00
FredApps 6a8ce2537a Merge main into #5470 2026-11-26 22:33:52 +07:00
FredApps 497809244f Merge main into #4522 2026-11-26 22:22:03 +07:00
FredApps 2ebe4e6ac3 Merge main into #4369 2026-11-26 22:14:30 +07:00
FredApps 86ace6de4a xfa: a negative marginLeft without a hanging indent moves every line left again
indents() clamped marginLeft to at least the hang even when textIndent wasn't
negative, so a negative marginLeft stopped moving the lines left of the box as it
does on main. The margins are now as given unless textIndent is negative (review
note on #3526).
2026-11-26 22:10:46 +07:00
FredApps c63e7853e9 Merge main into #3526 2026-11-26 22:09:39 +07:00
FredApps 8723f5ba4a Merge main into #4604 2026-11-26 21:24:21 +07:00
jonathanwxh-cell cf43526dc2 Merge remote-tracking branch 'upstream/main' into fix/xfa-named-page-area-breaks-3910
# Conflicts:
#	crates/xfa/src/layout.rs
#	crates/xfa/src/layout/draw.rs
#	crates/xfa/src/layout/flow.rs
#	crates/xfa/src/layout/pages.rs
#	crates/xfa/src/model.rs
#	crates/xfa/src/parse.rs
#	crates/xfa/src/tests.rs
2026-11-20 14:15:38 +08:00
FredApps fe16ea4834 fix(xfa): classify shared namespace admission as too large 2026-11-18 18:07:30 +01:00
Dylan M. Taylor 7c15cb5019 Merge pull request #7642 from storytold/refactor/shared-xfa-xml
XFA: use shared namespace-aware XML DOM
2026-11-18 09:47:03 -05:00
Dylan M. Taylor 8d0ed386c0 Merge remote-tracking branch 'origin/main' into pr-7642 2026-11-18 09:11:50 -05:00
Dylan M. Taylor add7f7b509 Merge remote-tracking branch 'origin/pr7702-current' into fix/xfa-count-cache-20261117 2026-11-18 08:35:44 -05:00
manurosado f435c182d2 fix(xfa): render lines without width as vertical and without height as horizontal
## What this changes

XFA templates often draw a vertical divider as a `<line>` with `h` but no `w`, and a horizontal one with `w` but no `h`, while still declaring `slope="/"`. A width-less draw was measured as wide as its row and every line was drawn corner to corner along its slope, so these dividers came out as diagonals running across the form to the page edge. DAF Form 988 shows it on all 3 pages: its 66 vertical separators are all width-less lines.

- `layout/measure.rs`: a line draw without a width is as wide as its stroke (clamped to 0.1 to 20pt, as it is drawn) plus its margin, capped at the available width, so a separator sits at its own x.
- `layout/draw.rs`: a line without a width is vertical and one without a height is horizontal, whatever its slope says. A line whose box is no wider or no taller than twice its drawn stroke runs along the box's longer side, so a zero-height line is horizontal. Only a box with room for its stroke both ways follows `slope`.
- `tests.rs`: `xfa_line_without_width_is_vertical_and_without_height_is_horizontal` covers six shapes: no width, no height, 1pt high, 1pt wide, a 48x72pt box with a 25pt stroke (drawn 20pt, so it still follows its slope) and 2pt by 0pt. It also pins the width-less line's x.

## How you verified it

- `cargo test -p pdfcraft-xfa`: 314 passed. The new test fails with either half of the fix reverted.
- `cargo test -p pdfcraft-engine xfa`: 86 passed.
- `cargo fmt --all -- --check` and `cargo clippy -p pdfcraft-xfa --all-targets -- -D warnings`: clean.
- DAF Form 988 laid out with `render_into`: 66 diagonal lines on `main`, none with this change (66 vertical, 68 horizontal).

- [x] `cargo fmt --check`
- [x] clippy with `-D warnings` on the crates I changed
- [x] tests pass on the crates I changed
- [ ] `cargo xtask layers` and `cargo xtask assets` (if you touched crate boundaries or any asset)

## Never-crash

- [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests, unless it is provably infallible with a comment saying why
- [x] No indexing or slicing with input-derived positions (`get`, and strings only at char boundaries); checked or saturating arithmetic; allocations sized by input are capped; recursion is bounded
- [x] No `unsafe`
- [x] Any crash this fixes has a small synthetic regression test

## Provenance

- [x] No asset from an Adobe product, and no Adobe icon recreated, traced or imitated
- [x] No font files committed here (they live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts))
- [x] No GPL/AGPL code copied in — MuPDF, Ghostscript, Poppler, veraPDF and DSS may only be run as external oracle processes
- [x] Behaviour comes from the specification or black-box observation, **not** from reading another implementation's source
- [x] Every new asset has an `ATTRIBUTION.toml` entry and `cargo xtask assets` passes

## Security

- [x] `--root` confinement still holds on every path, including ones reached by nested tool dispatch
- [x] MCP and the UI control channel stay opt-in, loopback-only and token-authenticated
- [x] No new outbound network access (that decision is the owner's)

## Parity and reach

- [ ] `parity/acrobat-features.toml` updated in this PR, with `notes` saying what is *still* missing — `shipped` means "exists and tested", not "as good as Acrobat"
- [ ] Reachable headlessly through an `automation` tool where that applies (`AGENTS.md` §3), so agents can drive it and not just the UI
- [x] Docs updated if this changes a documented behaviour (`docs/`, crate README)

## Anything a reviewer should look at first

The thin-box rule in `draw_draw`: it compares the box with twice the drawn (clamped) stroke and picks the longer side, so hairline borders never come out diagonal and a degenerate box never yields a zero-length segment.
2026-11-18 16:31:43 +07:00
Dylan M. Taylor 2f8820eda3 test(xfa): verify cached layers consume the same writer budget 2026-11-17 13:57:45 -05:00
Dylan M. Taylor c8d0f17b25 xfa: cache repeated prototype child counts without changing work charges 2026-11-17 13:57:22 -05:00
Dylan M. Taylor 79fc51b740 Use shared XFA XML DOM while retaining app form policy 2026-11-17 09:59:30 -05:00
Dylan M. Taylor 7d44e65412 fix(xfa): resolve clippy lints on main (#7354)
* fix(xfa): resolve clippy needless_update and field_reassign_with_default

* fix(create,xfdf): resolve remaining clippy lints

* fix(export): remove needless borrow in pptx and as_docx

* fix(engine): resolve clippy lints in signature_image

* fix(automation): resolve clippy lints in tests

* fix(create): avoid clippy::unreachable in tests

* chore(deny): allow IJG license for jpeg-encoder via craft-image-codecs
2026-11-14 16:37:43 -05:00
Dylan M. Taylor eead454105 Cut over remaining codecs, xfa XML, and export packaging to craft-libs (#7326)
* chore: cut over image, png, tiff, and zune-jpeg to craft-image-codecs

* chore: cut over xfa XML parsing from roxmltree to craft-xml

* chore: cut over export DOCX and PPTX packaging to craft-opc and craft-xml

* style: cargo fmt
2026-11-14 13:49:46 -05:00
Dylan M. Taylor 9f763636fd fix(forms,xfa): find every password field before a save skips scrubbing it (#5864)
* fix(forms,xfa): find every password field before a save skips scrubbing it

The quick Password-flag check in pdfcraft-forms stopped silently at its
depth limit, and visited the tree in an order where a field the full
field walk reaches could be cut off on a long branch first. It now
answers true (read every field) whenever it cannot look as far as the
field walk, and also walks below fields adopted from page widgets.

XFA password classification walked AcroForm fields only 32 levels deep,
shallower than editing and dataset synchronization, and read the
datasets packet of an XFA array without the prefixes its preamble
declares, so a typed password could stay in the saved datasets. It now
walks as deep as the field walk, refuses to clear (and so to save) when
the tree is deeper than it can check, and reads the packet the way the
datasets writer does.

* address review: check every page widget's /Parent chain for the password flag

* address review: password scan follows the parents of nameless /Fields entries; field-walk completeness checked before the datasets packet is read

* address review: the field walk's completeness is decided after every root; the subtree scan starts at the last dictionary of the parent chain

* address review: a skipped visit does not replace the reach a field was classified with
2026-11-11 18:16:31 -05:00
Dylan M. Taylor ee367a4a1c fix(xfa): bound the name and path bytes data nodes and queued instances copy (#6032)
* fix(xfa): bound the name and path bytes data nodes and queued instances copy

* review: bound the name bytes of a whole data path and report each cap separately

* address review: the queued-instance allowance counts path segment buffers and the dedup copy

* address review: the queued path's spare capacity is counted
2026-11-11 14:48:10 -05:00
Erkan DogruandFredApps f6c59c0b93 fix: integrate persistent AcroForm script workflows with native prompts and appearance writeback (#5699)
* AcroForm: integrate persistent timesheet script workflows

* AcroForm: address review caching, worker stacks and live metadata

* M6: address second review of AcroForm script workflows

* M6: handle top-level ASI boundaries and verify cyclic calculation results

* M6: bound script workers and isolate pending completions across edits

* M6: make form resets visible before subsequent script reads

* M6: include calculated dependents in reset comparison baselines

* M6: bound reset writeback work before native completion

* M6: charge expanded reset selections and field name bytes

* M6: bound string conversion bytes and charge reset widgets

* M6: preserve unread defaults and bound prompt text conversion

* M6: bound reset calls early and preserve calculated field identity

* AcroForm: address grouped calculations, field identity and widget ownership

* AcroForm: retire field instances and address native review edge cases

* AcroForm: route comparison Save As and Print to the source document

* M6: dispatch text widget mouse-up scripts

* M6: honor fit bounds for form button icons

* AcroForm: bound calculation work and preserve reset and save integrity

* Harden AcroForm script requests and worker recovery

* Keep form callbacks and focus consistent across edits

* AcroForm: preserve reset ordering and bound edit callbacks

* Fix reset appearance ordering and XFA focus after row removal

* Keep XFA focus indexes and stopped reset appearances consistent

* Document form script execution and reset helpers

* Keep script workers bounded and reject partial callback edits

* Keep form events available after a document script reaches VM limits

* Keep main's first-value Simple calculation and restore the calculateNow helper test

AFSimple_Calculate (JavaScript) and the native Simple calculation count each field's first
value again, as #5304 landed them; summing every selection of a multiple-selection list is
a separate behaviour change. Restores the document-helper calculateNow test and the
AFSimple_Calculate doc comment, and adds native and JavaScript multiple-selection cases.

* Patch the callback field snapshot in place instead of rebuilding it

Each field callback rebuilt all field states (3,129 on the benchmark form), and the
retained realm held the previous snapshot, so stamping instance tokens copied it again.
The runner now keeps its last snapshot and patches only the values and flags that
changed; ScriptSession::stamp_fields stamps it before dispatch, the worker copies only
when a token changes, and the realm drops the job's snapshot when the job ends (field
identity is checked against the cached keys instead).

* An oversized job script is that script's error, not a refused edit

Realm::run refused a script too long or too deep to run as an execution refusal, which
made the engine reject the whole edit (setting a 300 KiB calculation script failed). As on
main it is now a plain script error that keeps the value; the realm is not touched.

* Read a leading #! line as a comment in the chain scan; follow main's refusal and conditional limits in tests

The nesting guard from #5079 now checks brackets, prefixes and conditionals; the document
worker's preflight still bounds arrow-function and right-associative chains and skips a
leading #! line as the guard does. A refused script is an error, not a refused edit, so
the preflight test now checks the edit goes through with the error reported.

---------

Co-authored-by: FredApps <[email protected]>
2026-11-11 08:42:04 +01:00
Eric Kaden ea2e13370c M12: dynamic XFA forms tab in their template's traversal order (#4149) 2026-11-10 14:22:02 +07:00
Eric Kaden d873c0dd67 Merge upstream main into fix/xfa-check-box-click-scripts 2026-11-09 14:07:12 -05:00
Eric Kaden 7d75a632c2 Merge main into fix/xfa-date-display-picture 2026-11-09 12:00:14 -05:00
mtlcl410 6f11ea1581 Merge upstream/main into fix/xfa-script-relayout-full-refresh 2026-11-09 23:49:58 +08:00
Eric Kaden 7d3136ee08 Merge main into fix/xfa-ready-events 2026-11-09 10:40:48 -05:00
jonathanwxh-cell 8ab056b367 Merge upstream/main into fix/xfa-named-page-area-breaks-3910 2026-11-09 22:34:44 +08:00
bflatastic 5f860fb5ff Fit the landed changes together: the XFA split's break search gets its own function, keeping it under clippy's complexity limit 2026-11-09 21:06:46 +07:00
bflatastic 28585c01a5 Fit the landed changes together
- engine: the on_changes test's XfaRun literals set highlight; the script
  runner reads its template before borrowing the live form for to_js; has_event
  reads the paged live form, as the rest of the runner does, so focus scripts
  find a page-master copy by its own SOM path.
- js: property reads compare and copy the shared (Arc<str>) node text, and the
  property tests build XHost with its current signature.
- xfa: the Emitter test literal sets groups and used; a field split that is
  undone also restores the names handed out; rustfmt on a merged import.
- parity: drop the use/usehref gap from form.xfa-dynamic, as prototypes are now
  resolved before the template is parsed.
2026-11-09 18:46:50 +07:00
bflatastic 720a841981 Merge #5393: M12: a picture an XFA form links is drawn from the PDF's XFAImages name tree (#5392)
# Conflicts:
#	crates/xfa/src/fixtures.rs
#	crates/xfa/src/tests.rs
2026-11-09 18:40:50 +07:00
bflatastic 9147411e9c Merge #5370: M12: a flowed XFA subform in a table cell is as tall as its content (#5367)
# Conflicts:
#	crates/xfa/src/layout/measure.rs
#	crates/xfa/src/tests.rs
2026-11-09 18:40:22 +07:00
bflatastic 9e55f61de0 Merge #5369: M12: an XFA subformSet is transparent to layout, so its members sit where their container puts them (#5366)
# Conflicts:
#	crates/xfa/src/layout/measure.rs
#	crates/xfa/src/parse.rs
#	crates/xfa/src/tests.rs
2026-11-09 18:39:26 +07:00
Eric Kaden 55a0d6c459 Merge upstream main into fix/xfa-ready-events 2026-11-09 06:39:18 -05:00
bflatastic ab2d4382ff Merge #5368: M12: XFA master-page fields keep their own value on each page (#5365)
# Conflicts:
#	crates/engine/src/xfa.rs
#	crates/xfa/src/layout/pages.rs
#	crates/xfa/src/lib.rs
#	crates/xfa/src/script.rs
#	crates/xfa/src/tests.rs
2026-11-09 18:38:21 +07:00
bflatastic c7f1fc7540 Merge #5225: M12: XFA field names made up for repeated fields never take a name the template uses (#5224)
# Conflicts:
#	crates/xfa/src/layout/common.rs
#	crates/xfa/src/tests.rs
2026-11-09 18:36:41 +07:00
bflatastic 0575de68ff Merge #5153: M12: an XFA subform without a height is as tall as its content, flowed or positioned (#5152)
# Conflicts:
#	crates/xfa/src/tests.rs
2026-11-09 18:36:01 +07:00
bflatastic 629d211506 Merge #5124: M12: XFA table rows start at their minimum height, and a growable row group splits at a page break (form.xfa-dynamic)
# Conflicts:
#	crates/xfa/src/layout/flow.rs
#	crates/xfa/src/layout/measure.rs
#	crates/xfa/src/tests.rs
2026-11-09 18:35:21 +07:00