Commit Graph
97 Commits
Author SHA1 Message Date
aiongg bcbd9cbf4e Merge PR #4287: M12: XFA text is measured at its standard-14 font's own widths
parity/acrobat-features.toml: form.xfa-dynamic evidence: both sides' entries; notes: PR's metrics sentence replaces 'metrics are approximate' on top of main's text (word-level merge).
2026-10-24 06:22:55 +00:00
aiongg c0687edbbe Merge PR #3552: M12: a date typed by another of an XFA field's edit patterns is kept in its first 2026-10-24 06:22:01 +00:00
aiongg 1fd37592d4 Merge PR #3401: M12: laying out a dynamic XFA form takes off the usage rights it voids
parity/acrobat-features.toml: form.xfa-dynamic evidence list: both sides' entries; notes: both sides' insertions (word-level merge).
2026-10-24 06:22:01 +00:00
aiongg 4fedfe7e8c Merge PR #2648: fix(xfa): skip PDF fallback scripts while XFA layout is active
crates/engine/src/js.rs: kept main's DocInfo.xfa field and multi-line layout, added the PR's xfa_active gate on doc_scripts.
2026-10-24 06:21:20 +00:00
a047c6ba09 chore: resolve SonarCloud maintainability issues (#4356)
* chore: resolve SonarCloud maintainability issues

* fix(packaging): use verify_sha256 helper function

* style: cargo fmt

* fix: restore wildcard imports and fix method-reference type errors

Revert the glob-import expansions (they missed SomIndices and left unused
imports), revert char::is_ascii_digit where the iterator yields char by
value, and pass the content slice to prune_doomed_xobjects as &[Vec<u8>].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep XObject decodability check without binding content in interp

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Dylan Taylor <dylan@craftmaker.dev>
2026-10-23 23:28:18 -04:00
Eric Kaden 441d9005e3 M12: XFA text is measured at its standard-14 font's own widths 2026-10-23 14:08:42 -04:00
Eric Kaden 91df3c01a8 Merge remote-tracking branch 'upstream/main' into fix/xfa-edit-picture-alternatives
# Conflicts:
#	crates/xfa/src/tests.rs
2026-10-22 21:54:56 -04:00
Dylan M. Taylor d31a96f46f Merge pull request #4121 from aiongg/fix/coderabbit-c1-js-xfa
fix(js, xfa): bound the text and work that form scripts and XFA data can multiply
2026-10-22 21:39:08 -04:00
aiongg 1e2ac1d85a fix(xfa): copy embedded field values out only as far as the text budget
The text layout cut each embedded value to the bytes its block had left, but
the resolver cloned the whole value first. With a byte or two left and a
value starting with a multibyte character, every later run cloned the full
value and kept none of it. The resolver is given the bytes left and returns
only a prefix that fits.
2026-10-22 20:21:21 +00:00
aiongg 668d8f777e fix(xfa): every drawn subform instance spends the layout budget
A positioned root draws its children instead of flowing them, so nested
repeating subforms under it multiplied their instances without spending
the measurement budget that flowed instances spend. Drawing a subform
instance spends it too.
2026-10-22 20:08:33 +00:00
aiongg ee33337627 fix(xfa): bound the name bytes of data nodes a write creates
Writing a value at a high index creates every missing sibling before it,
each with its own copy of the name. The node budget counted siblings but not
their names, so a long name with a high index made thousands of copies of
it. The write's budget also counts the bytes of the names it creates; a
path past it is skipped with the existing warning.
2026-10-22 17:22:50 +00:00
aiongg bac0e610db fix(xfa): bound the bytes a data import copies out of its file
Converting an imported data file copied each element's and attribute's
resolved namespace URI, so a long namespace declared once on the root was
copied into every element that inherits it; only the node count was
limited. The import counts the names, namespaces, attributes and text it
copies against a byte budget of four times the file-size limit, and refuses
the file as too large past it.
2026-10-22 17:22:50 +00:00
aiongg a07ad60d52 fix(xfa): queue each added data instance once per pass
write_data_ops expanded every instance-count op into one queued node per
instance, then deduplicated the pass. A script adding rows one at a time
asks for one more instance each time, so n rows queued about n*n/2 nodes
before the deduplication. Each op queues only the instances the pass has
not queued yet, and a budget bounds the instances queued across passes
that removals separate, with a warning past it.
2026-10-22 17:22:50 +00:00
aiongg 1dbfa25100 fix(xfa): bound the script text the live form's events hold
Every instance of a repeated subform records its own copy of each script,
and only the number of events was capped. A long script inside nested
repeating subforms was copied once per instance before any script ran. The
events hold at most as much script text as the XFA packets may; past that
the live form is marked truncated, as it is past the event cap.
2026-10-22 17:22:50 +00:00
aiongg 3412437191 fix(xfa): bound the embedded field text one text block expands
Rich text resolved every embedded-field reference to a fresh copy of the
field's value, so a template repeating one reference to a long value many
times laid out a copy per reference. One text block expands at most as many
bytes of embedded values as a text of its own may hold; past that the
values are cut.
2026-10-22 17:22:50 +00:00
aiongg 17f5d80f44 fix(xfa): break a long word in linear time
Text layout broke a word wider than its line by measuring the whole growing
piece after every character, and counting its characters again each time.
A long unbroken word in a wide box with a small font made that quadratic.
The piece's advance is kept as a running sum of character widths instead.
2026-10-22 17:22:50 +00:00
PerchAnton c5279baf35 M6 PR #2648: retain active-XFA script isolation with current main 2026-10-22 20:21:39 +03:00
aiongg 306627ee77 fix(xfa): read a packet stream the XFA array lists again only once
The packet reader decoded the stream of every /XFA array entry and
charged only the decoded output to its 64 MB budget, so one stream that
decodes to almost nothing (Flate over hex whitespace), listed many
times, repeated a large decode for free. A stream reference already
read is skipped.
2026-10-22 17:08:55 +00:00
aiongg 2e1c029fa8 fix(xfa): every flowed subform instance spends the layout budget
Nested repeating subforms multiplied their instances (up to 50 per level
over 64 levels), and an empty instance neither measured nor placed
anything, so it spent none of the measurement or item budgets. Each
instance now counts as a measurement, and layout stops with TooLarge
once the budget is spent.
2026-10-22 17:08:54 +00:00
Eric Kaden c9fa6a7627 M12: a date pattern whose date the first can't keep gives way to a later one 2026-10-22 09:01:48 -04:00
Eric Kaden 9dab857ca3 M12: only date clauses are other ways to type a date, and a date is rewritten only into a first pattern that keeps it 2026-10-22 08:48:21 -04:00
Eric Kaden 4d22d2b74a M12: doc comments on the picture-alternatives tests 2026-10-22 03:17:40 -04:00
Eric Kaden b00ab835a6 Merge remote-tracking branch 'upstream/main' into fix/xfa-edit-picture-alternatives
# Conflicts:
#	crates/engine/src/tests.rs
#	crates/xfa/src/tests.rs
2026-10-22 03:17:29 -04:00
Eric Kaden de6dba001b Merge remote-tracking branch 'upstream/main' into fix/xfa-layout-drops-usage-rights
# Conflicts:
#	parity/acrobat-features.toml
2026-10-22 03:15:22 -04:00
aiongg f84eeaed7a Integration: a non-interactive XFA field is measured at the width it is drawn (#3515 × #3521)
#3515 measures a growing non-interactive field at its text's scale but
with a widget's 4pt of padding, while the layout draws its text without
it. Once #3521 fits lines by their ink, the narrower measuring width
wrapped to one more line than the drawn text, leaving a blank line
below it. The measurement leaves out the padding the draw doesn't have.
2026-10-22 04:15:17 +00:00
aiongg 4b85c697f9 Merge PR #3521: M12: a space at the end of a line doesn't count when fitting XFA text
crates/xfa/src/tests.rs: union of #1648's TIFF orientation test and #3521's tests.
2026-10-22 01:49:27 +00:00
aiongg b2b42c89db Merge PR #2993: Render month and weekday names in XFA date patterns
crates/xfa/src/data.rs: #2993's month and weekday helpers and date_tokens doc, with date_tokens kept pub(crate) for #3782's formatted_value and #3397's data pictures.
2026-10-22 01:49:20 +00:00
aiongg da7f592cd0 Merge PR #1648: XFA: decode BMP and TIFF pictures
crates/xfa/src/tests.rs: union of fixture imports (tiny_bmp, tiny_tiff).
parity/acrobat-features.toml: form.xfa and the XFA image entry: evidence lists unioned, notes take both sides' insertions.
2026-10-22 01:49:05 +00:00
aiongg 88c21daaed Merge PR #2615: fix(xfa): enforce maxLength on rich-text fields
ROADMAP.md, docs/roadmap.md: all status lines and progress-log lines kept; M12 row takes both 'Done since' insertions.
parity/acrobat-features.toml: form.xfa evidence lists unioned, notes take both sides' insertions.
2026-10-22 01:48:32 +00:00
aiongg 9865f27d8c Merge PR #2619: fix(xfa): run click scripts for every repeated print button
ROADMAP.md, docs/roadmap.md: both status lines and progress-log lines kept; M12 row takes both 'Done since' insertions.
crates/automation/tests/automation.rs, crates/xfa/src/fixtures.rs: union of #2624's and #2619's tests and fixtures.
parity/acrobat-features.toml: form.xfa evidence lists unioned, notes take both sides' insertions.
2026-10-22 01:48:18 +00:00
aiongg a0a9e3370e Merge PR #3408: M12: an XFA script that fails partway keeps what it changed before the error
crates/engine/src/tests.rs: union of #2624's tests and #3408's test.
parity/acrobat-features.toml: form.xfa evidence lists unioned, notes take both sides' insertions.
2026-10-22 01:47:22 +00:00
aiongg 3ba586fe31 Merge PR #2624: fix(xfa): reflow growable multiline fields after filling
crates/xfa/src/script.rs: template_field and named_in moved to crate::data in #3397; field_grows_with_text calls crate::data::template_field.
parity/acrobat-features.toml: form.xfa evidence lists unioned, notes take both sides' insertions.
2026-10-22 01:46:50 +00:00
aiongg be69bfadf9 Merge PR #3515: M12: XFA text honors its horizontal font scale
crates/xfa/src/layout.rs: both sides added doc comments to value_height, caption_reserve, field_height, unique_name and draw_field; kept HEAD's, with #3542's natural_width.
2026-10-22 01:46:14 +00:00
aiongg 8031d345d4 Merge PR #3542: M12: XFA labels and buttons without a size grow to their content
crates/xfa/src/layout.rs: both sides added a draw_field doc comment; kept #3542's (the more complete one).
2026-10-22 01:46:05 +00:00
aiongg dbc2647f48 Merge PR #3397: M12: XFA dates are written and read in the field's data picture
crates/engine/src/tests.rs: union of #3180's new test and #3397's doc comment on the next test.
crates/xfa/src/layout.rs: kept #3782's formatted_value (it calls date_pattern, now built on date_letters) and button_action doc.
crates/xfa/src/parse.rs: parse_field doc comment from #3397 (names the data picture).
crates/xfa/src/script.rs: field() doc from #3582 with #3397's "as scripts read it".
crates/xfa/src/tests.rs: union of fixture imports and of the new tests; one doc comment each for the date-conversion and data-fill tests.
2026-10-22 01:45:58 +00:00
aiongg 0bf197f07b Merge PR #3582: M12: showing an XFA subform leaves its unnamed hidden objects hidden
crates/xfa/src/script.rs: both sides added doc comments to the same functions; kept #3582's (they describe its presence(name, ...) signature).
2026-10-22 01:45:16 +00:00
aiongg 9cb8f52294 Merge PR #3782: M6: XFA formattedValue shows a date in the field's display picture 2026-10-22 01:44:53 +00:00
aiongg 5d7b9a98b3 Merge PR #3192: fix(forms): an XFA form whose config forbids dynamic rendering is static (#3180) 2026-10-22 01:44:51 +00:00
Eric Kaden 526d87d85c M6: formattedValue formats only a value of the ISO date's own shape
2026-1-2 isn't an ISO date and stands as it is. A test also pins that
parentheses hold a picture's locale (date(en_US){YYYYMMDD} formats) and
that a clause without braces has no pattern.
2026-10-21 00:09:00 -04:00
Eric Kaden 21b6267129 M6: a display picture with month or weekday names leaves formattedValue raw
date{DD MMM YYYY} and date{EEE …} have parts formatted_value can't show
yet, so it gives the raw value instead of text like 20 mmm 2026.
2026-10-20 23:57:14 -04:00
Eric Kaden 6a8ea287aa M6: doc comments on the functions the formattedValue change touches 2026-10-20 23:37:21 -04:00
Eric Kaden c0a513eed8 M12: scripts read a date in its data picture as the ISO date
A date the field's data picture writes as 20261018 reaches scripts as
2026-10-18, the rawValue another viewer gives them, so a script that
checks String(rawValue).length == 10 works (DA Form 31's 10b TO).
Doc comments on the functions this branch touches.
2026-10-20 23:33:23 -04:00
Eric Kaden 7176ebde94 M6: XFA formattedValue shows a date in the field's display picture
Fields keep their <format><picture>. A date display picture turns the
ISO value into its pattern for scripts' formattedValue (JavaScript and
FormCalc), so date arithmetic on formattedValue works as forms expect.
Once a script sets the value, formattedValue gives that value. Number
and text display pictures still give the raw value.
2026-10-20 23:29:08 -04:00
Eric Kaden 572e01a71d M12: the wrapping test checks the text stays within its room 2026-10-20 09:39:32 -04:00
Eric Kaden f9daeeb1fa M12: doc comments for the functions around this change 2026-10-20 09:25:19 -04:00
Eric Kaden 15eef03efc M12: doc comments for the functions around this change 2026-10-20 09:24:47 -04:00
Eric Kaden ee91673162 M12: doc comments for the functions around this change 2026-10-20 09:21:31 -04:00
Eric Kaden ec14687c6d M12: a draw without text or a width keeps the width it has room for 2026-10-20 09:20:55 -04:00
Eric Kaden a3b942021f M12: doc comments, and words keeps its own 2026-10-19 23:46:56 -04:00
Eric Kaden 5cd7e816b9 M12: doc comments for the functions this change touches 2026-10-19 23:46:16 -04:00