Commit Graph
6827 Commits
Author SHA1 Message Date
KenM76andClaude Opus 5.5 cb317560fe M12: PRC reader: answer review (#1297)
- Schema programs draw on one step allowance per reading pass:
  MAX_SCHEMA_STEPS (2^22) moves into the BitReader's budget next to the
  decoded-element allowance, and the tree walk carries both from reader
  to reader. A per-call ceiling let a cheap entity repeated many times
  run ~2^22 steps each.
- The vertex-colour pre-check charges the minimum encoding (one full
  colour, then one reuse bit each), so a run of reused colours may end a
  section.
- placements() reports unreadable globals when an entity reference, not
  only an item, names a reference coordinate system.
- chunks_exact -> as_chunks for clippy 1.99 (chunks_exact_to_as_chunks).

Tests: programs_on_one_stream_share_the_step_allowance,
one_step_allowance_covers_the_whole_walk,
reused_vertex_colours_may_be_the_last_data,
unreadable_globals_are_an_error_when_a_reference_names_a_coordinate_system;
each fails with its fix reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 14:38:13 -05:00
alehelandClaude Opus 5.5 12e17a1f64 refactor(ui): crop mode's hit is a hit test of its own
Crop mode owns every press on its page, the controls beside its frame included (0595d4d39).
`PageHits::at` made that hit itself. A `Hit` comes from a module's hit test, named `hit` or
`…_hit`, so the cursor, the tip and the press agree, and the Page presses guard holds the page
modules to it. The picture module's `crop_hit` makes it now, and `PageHits::at` asks it first,
as before. No change in behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 20:38:09 +01:00
KenM76andClaude Opus 5.5 5eb484c235 M12: PRC reader: a test for each input guard (#1297)
Disabling each input guard in turn left several with no failing test.
Each now has one that pins the guard's own refusal, not a later error:

- a zero Huffman code-length width, and a zero code length;
- a boolean array longer than the data, refused before any bit is read;
- a character array count past the data;
- no file structures, or more than MAX_FILE_STRUCTURES;
- a schema entry count past the data;
- normal angles wider than 16 bits;
- more texture sets than a face may carry (now by message);
- representation sets nested past the ceiling (and at it, accepted);
- a prototype chain past the ceiling;
- the element allowance, at each place it is charged: an entity's
  counted array, uncompressed character and short arrays, a schema
  program, and across one walk's readers (walk_within takes the
  allowance so a test can set it; an allowance that fits one file
  structure does not fit two).

Each fails with its guard disabled (the texture-set one by aborting on
the allocation the guard prevents).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 13:52:20 -05:00
vangel76andClaude Sonnet 5.5 bd569b81af Merge upstream/main into feat/redact-mark-regex
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 19:47:42 +01:00
vangel76andClaude Sonnet 5.5 330ca712ae Merge upstream/main into feat/optimize-target-bytes
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 19:44:30 +01:00
vangel76andClaude Sonnet 5.5 b108d9da8b Merge upstream/main into feat/recent-reveal-5452
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 19:42:29 +01:00
KenM76andClaude Opus 5.5 56578a6006 M3: test what moves an OCR edit on top: clipped, two images, form (#3973)
Review asked for text under and above a scan (already pinned), an image
clipped away entirely, two images, and a form holding the image. The
clipped case fails when the hit test uses the image's box instead of
its visible box; the negative cases fail when any later XObject counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 13:42:16 -05:00
KenM76andClaude Opus 5.5 d69d5cc832 Merge origin/main into fix/ocr-edit-under-scan
Conflicts: images.rs (main folded image_transform_scope into
image_scopes; kept only painted_over) and text/interp.rs (gs arm now
reads params via dict_in_place, then records the soft-mask anchor).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 13:36:38 -05:00
Grzegorz MartensandClaude Opus 5.5 3cb2a39dc3 M8: the redact README says a refused remove_hidden has changed the document
The README said apply "refuses and changes nothing" and that remove_hidden
takes the dictionaries out "the same way", which reads as if a refused
remove_hidden changed nothing too. It has changed the document by then
(a_refused_removal_of_hidden_information_doesnt_say_nothing_changed: the
comment goes before the refusal), as its doc says, so a caller passes a copy it
can drop. Raised by CodeRabbit on #5698.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-02 19:31:14 +01:00
vangel76andClaude Sonnet 5.5 72db15ac6c Merge upstream/main into feat/crop-toolbar-5330
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 19:28:21 +01:00
KenM76andClaude Opus 5.5 a7cc7586d1 M12: PRC reader: cap decoded array elements per reading pass (#1297)
The inflation cap bounds bytes, but one bit can decode to a 4-8 byte
element, so a 512 MiB section could ask for about 16 GiB. Every array
count is now charged against MAX_DECODED_ELEMENTS (2^24), shared by
all readers of one tree walk; over the allowance is TooManyElements.
Huffman pre-sizing is capped at 1024.

decoded_elements_are_charged_against_one_allowance fails with the
charge in BitReader::take_elements removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 13:27:05 -05:00
KenM76andClaude Opus 5.5 e93e8d50ba fix(edit): keep a soft mask anchored when the edit is lifted over the scan (#3973)
A soft mask is placed by the CTM in force when its `gs` runs (ISO 32000-2
11.6.5.2). The paragraph lifted over the scan re-selects the graphics state
after its own `cm`, so a mask selected before a translation landed
translated with it and could hide the new text. A re-emitted state that
carries a dictionary /SMask now records its anchor CTM and is selected
there: `cm` to the anchor, `gs`, `cm` back.

The test edits the same paragraph with and without a mask and requires the
same ink; it fails with the re-anchoring disabled (the mask lands 100 pt
right and the text vanishes). Both rewrite paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 13:15:43 -05:00
Grzegorz MartensandClaude Opus 5.5 4826ca6ebc M8: an image stored again past the allowance has a test of its own again
Since b1f221611 the dictionary is read within the allowance too, so the test
that gave unshare no allowance was refused reading the dictionary, before the
image was decoded: turning the image's refusal into "can't be read" left every
test green (Claims review of 5bef9b0e7). The test now also gives exactly what
reading the dictionary costs, so the image is what is refused.

The same review: the README lists the other images that can't be stored
again (more than one component, no size) and names ImageBudget::decode, not
Document::decoded_image_within, which #5569 made private;
SharedJbig2Budget's doc and remove_hidden's comment name the dictionaries read
to know copies too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-02 19:10:17 +01:00
KenM76andClaude Opus 5.5 ee12dc684c Merge origin/main into perf/png-predictor-bytes
main took vendor patches 29-34; the PNG predictor patch is now 35.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 13:01:22 -05:00
Grzegorz MartensandClaude Opus 5.5 5bef9b0e71 M8: the redact README says dictionaries are decoded within the allowance too
Since b1f221611 the dictionaries read to know copies of them are decoded
through the run's ImageBudget, every filter stage paid, as the images stored
again are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-02 18:32:18 +01:00
Grzegorz MartensandClaude Opus 5.5 b1f2216115 M8: a dictionary pays the image allowance for every stage of its filters
content(), which reads each JBIG2 dictionary to know copies of it, charged the
run budget for what its filters made at the end, a unit for each 4 KiB. That
says nothing of the work: three Flates can inflate a 204-byte stream to
32 MiB, a 1-bit TIFF predictor run over all of it, and ASCIIHex skip it as
white space to nothing. The Resources review of f802198f4 measured 1.33 s for
one unit, apply returning Ok after 26.6 s with 20 of them in 11 KB, about 50 to
70 minutes a MB, never refused; remove_hidden and Optimize's discard too.

It now decodes through the run's ImageBudget (decode_filters), which pays for
what every stage reads and makes, as the images stored again already are. Past
it the run is refused with ImagesPastAllowance, which remove_hidden gives as
SharedJbig2Budget. The run budget still counts the decoded size.

a_dictionary_pays_for_every_stage_of_its_filters: two Flates of a MiB of zero
bytes under ASCIIHex spend one unit of the run and more than a MiB of the
allowance; with a MiB of allowance content() and unshare are refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-02 18:27:00 +01:00
KenM76andClaude Opus 5.5 c566ca6144 M12: PRC reader: tree markups and views read past (#1297)
CAD 3D files carrying PMI failed model_tree() and placements() with
"tree markups (PMI) is not supported": the tree section has no length
prefix, so MarkupData and views had to be parsed to be skipped.

Now read past, not modelled (new tree/markup.rs):
- MarkupData [WD 7.3.10.4]: markup linked items (204), leaders (503),
  markups (502), annotation items/sets/references (504-506); sets
  nest under the MAX_DEPTH ceiling.
- Views (501) [WD 7.7.3], with their annotation plane (SURF_Plane 86),
  optional scene parameters, and from 8137 their flags, linked items
  and filters.
- Scene lights (731-734) and clipping planes, so
  SceneDisplayParameters no longer refuses them.
ReferenceData and ReferenceOnPRCBase are shared readers now, and skip
their schema-added fields.

Field orders the working draft leaves open follow prc-rs's format
description (MIT); each such reader carries a `prc-rs:` marker.

Tests: one synthetic test per entity kind (each reads to a sentinel
and every truncation errors), nesting ceiling, wrong annotation type,
and a tree with markups and views on a part and an occurrence that
still places its mesh. Each shown failing with its reader reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 12:26:44 -05:00
KenM76andClaude Opus 5.5 c571b13469 M12: PRC reader: product tree and styles (#1297)
Walk the PRC product tree into placed, coloured tessellations.

- PrcFile::placements / placements_with(StyleAlpha, EntityOverrides):
  every drawable tessellation reached from the model file's roots, placed
  by its occurrence path's locations and then the representation item's
  local coordinate systems (a 4x4 Matrix) [WD 7.3.10.1, 7.6.3.2].
- Colours: styles and materials from the file structure globals, the
  father/son inheritance bits [WD 7.2.4.2], style transparency combined
  with material alpha by StyleAlpha, per-face styles and topology
  references via Placement::triangle_colours. A prototype's part is
  coloured by its own structure's styles. A colour index counts the colour
  array's doubles (pdf-issues #816).
- Occurrences' entity references: colour, hide or relocate the entity
  they name, in the occurrence's subtree, everywhere, or not at all.
- PrcFile::model_tree: the assembly tree as a model-tree panel lists it,
  with name sources, visibility and each node's placement range.
- TriangleMesh::transformed applies a Matrix: positions, cofactor-mapped
  normals, winding flipped under a mirror.

Never panics: occurrence and prototype cycles are Malformed; depth 64,
2^20 visits, MAX_PLACEMENTS and a face-override ceiling bound the walk;
counts are checked against the remaining data before allocating.
Markups, views, scene lights and clipping planes are Unsupported;
textures are read past.

Field orders the working draft leaves open follow prc-rs (MIT); each is
marked `// prc-rs:`, as are the step-1 container, Double and schema
choices that did.

Adapted from pdfcer (MIT, same author), crates/pdfcer-3d/src/tree and
vec3.rs at 0c9742b5936232af89cd707138ef149dc1f4a660.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 12:26:44 -05:00
KenM76andClaude Opus 5.5 7f30266790 M12: PRC reader: tessellation and arrays (#1297)
Read the tessellation section of a PRC file structure:
FileStructure::tessellations() returns each entity as a Tessellation.

- TESS_3D becomes a TriangleMesh: positions, triangles from the
  triangle/fan/strip blocks (one-normal and textured variants included),
  one triangle range per face, stored normals and texture coordinates
  with per-corner indices, and per-triangle line-attribute styles.
- TESS_3D_Wire becomes polylines (closing and continuous flags); vertex
  colours are read past, sized by points (closing point included).
- TESS_Markup is read past.
- TESS_3D_Compressed is read field by field to its end so the entities
  after it decode; its triangles are not rebuilt (later step).
- The compressed Character/Short/Integer/Indice arrays and the Huffman
  container they use (WD 11.6-11.9, 12.2) live in arrays.rs; the base
  fields every entity shares (attributes, name, user data) in entity.rs.

Never-panic hardening beyond the source this is adapted from:
- Huffman symbol width must be 1..=16; the leaf table and element count
  are bounded by the payload before anything is allocated.
- A face may carry at most 8 texture-coordinate sets (an unbounded
  count allocated per set and padded per triangle).
- Every count is checked against the remaining bits; indice sums and
  deltas use checked arithmetic.

A few reading choices (Huffman bit order and code-length width, indice
running sums, 64-bit attribute order, three version gates, the
is_segment_color bit, the compressed field order) follow prc-rs (MIT);
each is marked `// prc-rs:` in the source.

Tests are synthetic, written with the crate's test bit writer. Each
fix was reverted and its test seen failing (17 reversions).

Adapted from pdfcer (MIT, same author), pdfcer-3d at
0c9742b5936232af89cd707138ef149dc1f4a660.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 12:26:43 -05:00
KenM76andClaude Opus 5.5 ab552430a7 M12: PRC reader: the Double code table from prc-rs (MIT) (#1297)
Every PRC Double decodes through a fixed 2077-row prefix-code table
(working draft 11.17.2). The rows come from prc-rs src/double.rs at
287b671bb5b31b05efb5ec1b98f7c359b9e4dd7d under its MIT licence, whose
notice stays in the file header; ATTRIBUTION.toml records it.

The table is a complete prefix code, so the empty-table stub test is
replaced by a truncation test. The exponent lookup masks the 11 exponent
bits, because the last exponent row's upper word is 0x7ff80000.

Revert proof: with the table emptied, eight Double tests fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 12:26:43 -05:00
KenM76andClaude Opus 5.5 83b230ae73 M12: PRC reader crate: container, bit primitives, schema (#1297)
New standalone L0 crate pdfcraft-prc: the PRC container walk (file
header, file-structure descriptions, per-section zlib inflation under a
512 MiB ceiling), the bit-level primitives of the compressed sections,
and the schema interpreter a newer producer uses to describe fields it
added (step and nesting ceilings).

The Double prefix-code table is not in this commit: Double reads
return UnknownDoubleCode, and the tests that need the table are
ignored with that reason.

Adapted from pdfcer (MIT, same author), crates/pdfcer-3d at
0c9742b5936232af89cd707138ef149dc1f4a660.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-11-02 12:26:43 -05:00
Grzegorz MartensandClaude Opus 5.5 f802198f4a M8: tests for what mutants found unchecked in clearing
Mutation testing of the PR against main left three mutants of image.rs alive:
the ICCBased arm of components deleted (an ICC image is then removed whole),
and data_elsewhere made false or inverted (a cleared copy then drops, or keeps,
/FFilter and /FDecodeParms whatever /F says).

an_icc_based_image_is_cleared_in_place_through_any_references clears an image
of one component and of three, its profile direct and through a reference to
a reference, and checks the samples. a_cleared_copy_keeps_parameters_for_data_
in_another_file_only_with_one checks a /F string, direct or by reference,
keeps them, and a null /F, a reference to null or to no object, or none, drops
them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-02 18:10:06 +01:00
mtlcl410andClaude Opus 5.5 28d9209efe Merge storytold/pdfcraft main into fix/stroke-degenerate-and-dash
Conflicts:
- vendor/README.md (hayro-interpret row): kept main's row (which adds
  patch (73)) and inserted this PR's (61) entries in numeric position in
  both the Patches and Test columns; (61) is unused on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-03 01:03:09 +08:00
mtlcl410andClaude Opus 5.5 0fb943866e Merge storytold/pdfcraft main into fix/indexed-short-lookup
Conflicts:
- vendor/README.md: kept main's hayro-interpret row and inserted this
  branch's (60) entries in numeric position in both columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-03 01:00:29 +08:00
mtlcl410andClaude Opus 5.5 a42c009071 Merge storytold/pdfcraft main into fix/zero-area-fill-and-clip
Conflicts:
- vendor/README.md (hayro-interpret row): kept main's row (which adds
  patch (73)) and inserted this PR's (65) entries in numeric position in
  both the Patches and Test columns; (65) is unused on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-03 00:59:26 +08:00
Claude eea69b4ac6 M4: the selection-bar test anchors at the selection's left edge and checks the whole bar (#5658)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GbuSKAS2k5248LGFEapMUR
2026-11-02 16:59:17 +00:00
FredApps 168a3cb91e Merge pull request #5740 from Combiler01/fix/panel-resize-scrollbar-5730
fix(ui): prevent panel resize handle collision with scrollbar (#5730)
2026-11-02 17:47:35 +01:00
Grzegorz MartensandClaude Opus 5.5 4073e85305 M8: merge main; images stored without a dictionary spend the image allowance
Main (#5569) decodes every image through cos's ImageBudget, which counts the
JBIG2 decoder's own work and the globals it reads, through main's own
restore_shared_jbig2 and image::without_globals for the images that share a
redacted image's /JBIG2Globals too. This branch replaces both with
globals::unshare, so the merge keeps unshare and drops them.

without_dictionary now decodes through ImageBudget::decode instead of
Document::decoded_image_within, which main made private. That closes the gap
the PR noted: the decoder's own work (up to hayro-jbig2's 2^30 steps an image)
was charged one unit of the run budget. apply passes its run's allowance, what
clearing left of it, as main's restore did. Past it apply is refused with
ImagesPastAllowance, as main's restore was. remove_hidden gives unshare an
allowance of its own (sanitize::unshare_unmarked), and past it is refused with
SharedJbig2Budget: "redact fewer pages at a time" means nothing there, and
Optimize's discard runs it too. SharedJbig2Budget's text now says finding and
storing again.

Tests: main's allowance test runs on unshare, with ImageBudget::with_work(0)
refused as ImagesPastAllowance, through unshare_unmarked as SharedJbig2Budget,
and u64::MAX storing one image. Test helpers decode through ImageBudget, since
Document::decoded_image is no longer public.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-02 17:42:02 +01:00
FredApps 8f1441a3f2 fix(ui): keep pane resize edges right of the border, off the page scrollbar (#5730)
The centred 4 pt strip still covered the right 3 pt of the page's
scrollbar beside a right-docked pane. Register the host's resize edge
again from the border rightwards, on the host's own layer, and leave an
inert edge inert. The test now hovers and drags both scrollbars beside a
right-docked Tools pane (CodeRabbit) and checks the width is unchanged.
2026-11-02 16:59:26 +01:00
mtlcl410andClaude Opus 5.5 2d67bd4cbf Merge storytold/pdfcraft main into fix/checkbox-kid-on-states
No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 23:50:55 +08:00
mtlcl410andClaude Opus 5.5 6d3b7b3034 M6: test that a check box's reported options fill back to the kid they name
`form_fill` with each option `form_fields` reports ticks the kid of that on state, also where
the other kid's `/Opt` export is that on state (ISO 32000-2 §12.7.5.2.3, Table 230).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 23:50:50 +08:00
Grzegorz MartensandClaude Opus 5.5 251d761d6b M8: an image is charged the dictionaries it names
A review of ecf028965 measured that decoding an image undoes the filters
of each dictionary it names again when cos doesn't hold their bytes (20
images naming a 32 MiB dictionary: 1.2 s at 2 units each). content()
now remembers what each dictionary decoded to, or its limit when it
couldn't, and an image is charged that before it is decoded.

Names gathered from many entries are held as a set as they are read, so
a million entries naming one chain hold it once. The claim that each
object is fetched once a run for each way it is read says its exception:
a /JBIG2Globals chain named part way is followed again from there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-02 16:44:21 +01:00
mtlcl410andClaude Opus 5.5 47cba60da5 Merge storytold/pdfcraft main into fix/redact-metadata-2448
Conflicts:
- crates/redact/src/lib.rs: main added the run's ImageBudget to Applying
  and Scope::new; kept both sides (the removed-text fields and the image
  budget), with main's refused-images check before the destructuring.
- crates/redact/src/tests.rs (auto-merged): this PR's two tests that build
  a Scope or an Applying now pass main's ImageBudget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 23:38:50 +08:00
mtlcl410andClaude Opus 5.5 0c6860e258 M8: the redact README lists the per-document collection limit (#2448)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 23:36:53 +08:00
mtlcl410andClaude Opus 5.5 dcef0aebff M8: bound the removed text kept for the metadata check per document (#2448)
The run and byte limits were per page, and a glyph's /ToUnicode text can
be 256 UTF-16 units, so a short content stream could keep gigabytes of
removed text across pages. The document now keeps at most 16 MiB; past
that the rest is not kept and the metadata check fails closed, as for any
other text it couldn't keep (CodeRabbit's retained concern on #2539).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 23:36:21 +08:00
mtlcl410andClaude Opus 5.5 478438298a M2: the View auto state is hayro-interpret patch (76), as main has its own (67)
Main's knockout-group patch now uses (67) in vendor/hayro-interpret, so
this branch's patch takes the next number free on main and in the open
reply-appearance patch (75): (76) in vendor/README.md's two columns and in
every `PdfCraft patch` comment of the View auto state (interpret/mod.rs,
ocg.rs, render's inspect/resources.rs). No code change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 23:30:11 +08:00
mtlcl410andClaude Opus 5.5 8a15b999d3 Merge storytold/pdfcraft main into fix/ocg-auto-state-view
Conflicts:
- crates/render/src/raster.rs (RenderConfig): main added `jbig2_work`
  next to this branch's `for_print`; both fields are kept.
- vendor/README.md (hayro-interpret row): kept main's row (patches up to
  (74), including its new (73)) and put this branch's (67) entries back
  in their place in both columns. Main's code now uses (67) for its
  knockout-group patch, so the next commit renumbers this branch's patch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 23:29:54 +08:00
FredApps 1997b8ed94 Merge remote-tracking branch 'origin/main' into pr5740 2026-11-02 16:29:14 +01:00
Claude 2379fb70db Search: a test that a scroll by hand lets the find step's match go (#3530)
After a find step, a wheel scroll and then a ⌘-wheel zoom anchor on the
pointer, not back on the old match (FredApps on #4139).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GbuSKAS2k5248LGFEapMUR
2026-11-02 15:02:08 +00:00
Grzegorz MartensandClaude Opus 5.5 ecf0289652 M8: the run budget counts what it missed
A review of fee25bfe4 found three costs the budget didn't count:

- A /JBIG2Globals reference in parameters given directly was fetched
  again for every entry of every stream (2,000 entries, 53 KB: 40 s, two
  thousand units of four million). What a reference leads to is now
  remembered for the run under it, and a chain met part way takes what
  is known from there.
- A /Filter name was kept whatever it was, so a 32 MiB name referred to
  nine times was held nine times and copied for each image (725 MiB from
  2.8 KB). Only a name a decoder knows is kept; any other is no filter,
  and a name longer than any decoder's isn't looked at.
- A decode that failed spent nothing, so a dictionary one byte past its
  limit escaped the budget. A failure now costs as much as it was allowed
  to decode: a dictionary MAX_JBIG2_GLOBALS, an image its allowance.

The README says what the budget counts, and that past it the redaction
is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-11-02 15:53:50 +01:00
mtlcl410andClaude Opus 5.5 fcd72a3d6a Merge storytold/pdfcraft main into feat/xfa-property-objects
Conflicts:
- crates/xfa/src/parse.rs: main added quarter_turns before parse_common
  (and rotate in its body); this branch gave parse_common a warnings
  parameter for the property trees. Kept quarter_turns and the branch's
  signature; the body holds both props and rotate.
- crates/xfa/src/tests.rs: both sides added tests at the end of the file
  (this branch's packet-size test; main's rotated-draw tests). Kept both.
- parity/acrobat-features.toml (form.xfa-dynamic): main put the
  rotated-draw test at the front of the evidence and a sentence at the
  front of the notes; kept this branch's lines with main's additions
  prepended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:32:31 +08:00
mtlcl410andClaude Opus 5.5 9d3226ea49 Merge storytold/pdfcraft main into feat/xfa-usehref-prototypes
Conflicts:
- parity/acrobat-features.toml (form.xfa-dynamic): main added the
  rotated-draw test to the front of the evidence and a sentence to the
  front of the notes; this branch appended the prototype tests to the
  evidence and put "prototypes first: ..." into the layout sentence of
  the notes. Kept both on main's lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:31:28 +08:00
mtlcl410andClaude Opus 5.5 07c8f52963 Merge storytold/pdfcraft main into fix/xfa-repeat-more-than-50
Conflicts:
- crates/xfa/src/layout/measure.rs (positioned width and height): this
  branch measures each child under its own SOM index (size_at with
  sibs.at(i)); main reads the extent through standing_box so a turned
  draw counts as the box it stands in. Kept both: size_at for the size,
  standing_box(w, h).right() / .bottom() for the extent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:24:29 +08:00
mtlcl410andClaude Opus 5.5 dbe2580f0e Merge storytold/pdfcraft main into fix/xfa-subformset-transparent
Conflicts:
- crates/xfa/src/tests.rs: both sides appended tests at the end of the
  file; kept this branch's subformSet tests and main's draw/anchor
  tests, closing the branch's last test before main's block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:22:55 +08:00
mtlcl410andClaude Opus 5.5 fb12804fe0 Merge storytold/pdfcraft main into fix/xfa-page-master-som-index
Conflicts:
- crates/engine/src/tests.rs: both sides appended tests at the end of
  the file; kept this branch's page-master tests and main's page and
  image edit tests, closing the branch's last test before main's block.
- crates/xfa/src/tests.rs: the same, with main's draw/anchor tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:22:35 +08:00
mtlcl410andClaude Opus 5.5 fb168ada0a Merge storytold/pdfcraft main into fix/xfa-images-name-tree
Conflicts:
- crates/xfa/src/tests.rs: both sides added tests at the end of the file
  (this branch's XFAImages name-tree tests; main's rotated-draw tests).
  Kept both, closing the branch's last test before main's helpers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:22:28 +08:00
mtlcl410andClaude Opus 5.5 08e0878eab Merge storytold/pdfcraft main into fix/xfa-unique-field-names
Conflicts:
- crates/xfa/src/tests.rs: both sides appended tests at the end of the
  file; kept this branch's unique-name tests and main's draw/anchor
  tests, closing the branch's last test before main's block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:22:07 +08:00
mtlcl410andClaude Opus 5.5 b83ccf0eca Merge storytold/pdfcraft main into fix/symbolic-truetype-glyph-names-3962
Conflicts:
- vendor/README.md (hayro-interpret row): kept main's row, including its
  new (73) and the extended (11)/(31) notes, and re-inserted this PR's (53)
  entries (unused on main) in numeric position in both columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:22:04 +08:00
mtlcl410andClaude Opus 5.5 30ec469bec Merge storytold/pdfcraft main into fix/xfa-subform-minh
Conflicts:
- crates/xfa/src/tests.rs: both sides appended tests at the end of the
  file; kept this branch's row minH test and main's draw/anchor tests,
  closing the branch's test before main's block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:21:47 +08:00
mtlcl410andClaude Opus 5.5 e1e76dbdf5 Merge storytold/pdfcraft main into feat/viewer-preferences-on-open
- crates/ui-egui/src/canvas.rs (apply_frame_requests): main passes the leftmost page edge to quick_bar; this branch hides the quick bar when the document hides its toolbars. Kept both: the branch's HideToolbar condition with main's page_left call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP
2026-11-02 22:21:37 +08:00