mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-19 02:26:48 +00:00
5aae9dbae25e1e68731e42acfe08e2bd4f5b42a3
6549
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5aae9dbae2 |
Keep the part of an email address before an apostrophe when redacting
## What this changes Email redaction no longer drops the part of an address before an apostrophe. The email scanner's `local` closure in `crates/redact/src/patterns.rs` did not accept an apostrophe in the local part. It treated `'` as a boundary and started the match after it, so for `o'brien@example.com` only `brien@example.com` matched. Search and Redact share that span, so the leading `o'` stayed visible. The local part may now contain an apostrophe, but a match cannot start on one. `o'brien@example.com` and `'john'@example.com` are now matched as `o'brien@example.com` and `john'@example.com`. A quote around an address (`'john@example.com'`) stays outside the match. No linked issue. Found while testing `crates/redact/src/patterns.rs:216` (email, `local` closure). ## How you verified it - [ ] `cargo fmt --check` - [ ] 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) - Regression test `patterns::tests::email_local_part_may_contain_an_apostrophe` covers all three cases. It fails on `main` without the fix and passes with it (`cargo test -p pdfcraft-redact email_local_part_may_contain_an_apostrophe`). - `cargo xtask ci` passes. ## Never-crash - [ ] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests, unless it is provably infallible with a comment saying why - [ ] 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 - [ ] No `unsafe` - [ ] Any crash this fixes has a small synthetic regression test ## Provenance - [ ] No asset from an Adobe product, and no Adobe icon recreated, traced or imitated - [ ] No font files committed here (they live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts)) - [ ] No GPL/AGPL code copied in (MuPDF, Ghostscript, Poppler, veraPDF and DSS may only be run as external oracle processes) - [ ] Behaviour comes from the specification or black-box observation, not from reading another implementation's source - [ ] Every new asset has an `ATTRIBUTION.toml` entry and `cargo xtask assets` passes ## Security - [ ] `--root` confinement still holds on every path, including ones reached by nested tool dispatch - [ ] MCP and the UI control channel stay opt-in, loopback-only and token-authenticated - [ ] No new outbound network access ## Parity and reach - [ ] `parity/acrobat-features.toml` updated in this PR, with `notes` saying what is still missing - [ ] Reachable headlessly through an `automation` tool where that applies, so agents can drive it and not just the UI - [ ] Docs updated if this changes a documented behaviour (`docs/`, crate README) ## Anything a reviewer should look at first - A quote right before the local part, as in `'john'@example.com`, stays outside the match, so that leading quote stays visible after Redact. Matching it would also pick up the quote around quoted addresses. This is a deliberate restraint. - The domain scan and the other patterns are unchanged. 🤖 Generated with AI by [ApolloOffice](https://github.com/Silvertree2010/ApolloOffice), see the Co-Authored-By trailers for the models |
||
|
|
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. |
||
|
|
0c39992c99 |
Print: make a long printer list easier to browse and search (#4399)
**Update on 2026-11-03 (`db57e7de`).** Merged main `ecdd1e65` and preserved both sets of parity evidence. The picker now uses the public `ComboBox::show_ui` response to track the open menu and clear its search when it closes. All 30 print UI tests passed locally on macOS arm64, including the three printer-picker regressions. Formatting and `cargo xtask parity` passed. [CI](https://github.com/storytold/pdfcraft/actions/runs/41673448570) and [SonarCloud](https://github.com/storytold/pdfcraft/actions/runs/41673448592) track this commit. ## What this changes Fixes #4399. The printer picker opens a wider, taller menu with a name filter. Long device names wrap, while Search and Save as PDF stay visible as the device list scrolls. Search ignores case, trims surrounding spaces and keeps the current destination until a row is chosen. Reopening clears the filter and brings the selected device into view. The large-fleet test now checks that the selected row is between Search and Save as PDF after reopening, without manually scrolling at that point. This catches a broken automatic reveal instead of hiding it with a test-side scroll. ## How you verified it - At `d14aed41`, the [hosted gate](https://github.com/storytold/pdfcraft/actions/runs/40305529036/job/121513571419) passes: 5,194 tests, 21 skipped. All three `printer_picker` tests explicitly pass, including the new reopening visibility assertion. Formatting, strict Clippy, layers, assets, parity and wasm checks pass in that gate. - CodeRabbit's refreshed documentation check passes at 100%; both remaining test helpers are documented. - The three original UI regressions failed against the original production module. They cover a 120-device fleet, Unicode/case matching, selection, reopening, no matches, long names and a 1024×768 window. A separate earlier before/after check caught an initially clipped Save as PDF row by physically clicking it. - Earlier macOS validation inspected headless captures and exercised the real Print dialog through its control channel. Those are earlier-run results, not a new native macOS run on this head. - The current local Windows Cargo 1.95 run cannot resolve the pinned craft-menu manifest and does not reach the UI tests. Runtime validation of this latest test update is the hosted gate above; no local test pass is claimed. ## Safety, provenance and reach - [x] No new panicking shortcuts, unsafe code or input-derived indexing. - [x] No new assets, fonts or dependencies. - [x] Existing printer discovery, properties and print submission paths are used. - [x] Automation remains available through `printers`, `printer_options` and `doc_print`; UI controls remain opt-in. - [x] Printer-selection parity evidence and M10 progress notes are updated. ## Limits of verification Physical printing was not tested. Keyboard injection into the earlier background native macOS window did not enter text; filter typing and selection were verified through egui_kittest. AI assistance: implementation, tests and validation used Codex. |
||
|
|
cc0edc29d1 |
fix(edit): preserve source fonts in mixed-script paragraphs
## Follow-up after #6806 The main mixed-script font change landed in #6806. This PR covers the remaining case where the source font lacks only a variation selector (U+FE00–U+FE0F). A visible letter now selects the fallback face. The regression compares implicit and explicit fallback in two source fonts, including character spacing, alignment, and save/reopen. Verified locally on macOS arm64 with the CI-pinned craft-fonts input: `cargo test --locked -p pdfcraft-edit` and `cargo test --locked -p pdfcraft-automation --test it mixed_script` passed, as did formatting, scoped Clippy, the layer and asset checks, and the UI WebAssembly build. <!-- evening-module-refresh-20261027:start --> **Latest compatibility update (2026-10-27):** [ |
||
|
|
d4da4b94bb |
M5.1: structural round-trip, property and never-crash tests for crates/annot (tests only)
## What this adds
Structural round-trip, property and never-crash evidence for `crates/annot`, which had no `tests/` directory — every prior test checked an in-memory object and never crossed the writer. 50 new tests take the crate from 42 to **92 passing / 0 failed**, with nothing ignored and no existing test weakened:
- `tests/round_trip.rs` (25) — annotations survive save and reopen across all three writer paths: geometry, contents text, flag bits, opacity, identifying names, pop-up back-references, link targets/URIs/dash structure, per-page order and ownership.
- `tests/properties.rs` (10) — proptest invariants over generated geometry, opacity and flags.
- `tests/malformed.rs` (15) — damaged input must never panic; each case documents the *measured* behaviour as defined degradation, not endorsed output.
- `tests/support/{bytes.rs,fixture.rs}` — a raw-byte reader and PDF skeletons, so claims can be made about the saved file rather than only about parsed objects.
`proptest = { workspace = true }` as a dev-dependency (same declaration as `cos`; style differs from the dotted form in crypt/filters). proptest 1.11.0 is already locked in the workspace, so `Cargo.lock` gains one edge and no new package.
**No product code is changed.** This pins current behaviour, including three questionable behaviours it surfaced (below), and leaves every fix to a follow-up.
## Appearance is deliberately out of scope
Nothing here asserts what an appearance stream draws, so this stays clear of #2345, #2137, #2066, #1775 and #1513 (all open, all rewriting appearance generation). Structural fidelity — where a mark sits, what it says, which rules apply — is behaviour none of them intends to alter.
## Evidence quality: mutation-tested, with credit split honestly
Ten single-site guard/arithmetic/key-rename mutants were run against `crates/annot/src/lib.rs` by two independent reviewers plus the author. All ten were caught, and they split **five and five**:
- Killed by pre-existing inline tests in `crates/annot/src/tests.rs` as well: `lib.rs:857` inverted, `:1030` inverted (six inline tests), `:1930` inverted, `:2161` tie-break swapped, `:1241` `/Parent` renamed.
- Killed **only** by tests added here: `:1030` clamp deleted, `:857` clamp deleted, opacity clamp removed at `:1024`, colour clamp in `rgb()` removed at `:824`, and a clamp introduced on the read path at `:2238`.
`lib.rs:857` and `:1030` appear on both sides deliberately — inverting either trips inline tests, deleting them trips nothing outside this branch. Confusing those two mutation families is easy enough to produce a false refutation, so the distinction is recorded in `round_trip.rs` rather than left to whoever re-runs them. A build failure was never counted as a kill in any pass. The mutants were run at `crates/annot/src/lib.rs` as of base `99941daa`. Main has since split that file into modules (`5ce4d244`); the anchor statements are byte-identical at their new homes (the `/Parent` site apart, locals renamed), but main also grew the inline suite from 42 to 74 tests — so the five-and-five split describes the base tree, and the battery was not re-run at the merge head `3122ebad`.
## Three defects found while writing this — reported, not fixed
1. **Large finite numbers are written unvalidated and become unreadable downstream.** The only style guard on the create path (`lib.rs:1018`) is `!finite(&style.color) || !style.opacity.is_finite() || !style.width.is_finite()`; the `abs() < 1e7` cap inside `finite()` (`:827-829`) applies to **colour alone**, so `width` carries no magnitude limit at all. Measured: `width = 1e9` and `1e299` are accepted and written verbatim to `/BS /W`. qpdf (`pikepdf.Job(["--check", …])`, pikepdf 9.11 / libqpdf 12.2) exits **3** — its *warning* status, printed with "operation succeeded with warnings" (0 = clean and silent here) — reporting `overflow/underflow converting <301 digits> to 64-bit integer`, and `/Annots[0]` resolves to `null` (still null after a qpdf re-save) while `pikepdf.open()` reports success. Our own `repair_log()` stays empty, which conflicts with CLAUDE.md's "never silently drop or repair data".
2. **Fill colour is accepted on create and refused on edit.** Create never screens `fill` (it is clamped component-wise by `rgb()` at `:823-825`), while `set_fill` refuses the identical value with `Invalid("invalid fill colour")` at `:2010`. Pinned by `malformed::the_same_huge_fill_is_accepted_on_create_and_refused_on_edit`.
3. **One unparseable token in a page's `/Annots` loses the whole page, silently.** For `[4 0 R notanumber]`, `page_refs()` returns `Ok([])` with `/Pages` still showing the page — so the page object itself fails to parse, every annotation on it disappears, and `repair_log()` records nothing. qpdf keeps the page and warns: `(object 3 0, offset 191): unknown token while reading object; treating as string`.
Anchors in this section read against `crates/annot/src/lib.rs` at base `99941daa`; main has since split that file (`5ce4d244`). The same code at merge head `3122ebad`: `:1018` → `create.rs:416`, `:827-829` → `create.rs:17-19`, `:823-825` → `create.rs:13-15`, `:2010` → `modify.rs:626-627`. All three described behaviours re-verified unchanged at this head.
These need a policy decision rather than a patch, so they are described here and will be filed as separate issues; nothing in this PR fixes them.
## CI status and base note
This branch was opened at `afa8e18` (then current `main`) and rebased onto `99941da`. Two jobs were red on the original base — `test (ubuntu-latest)`, `test (windows-latest)` and the FreeBSD job, all failing in `crates/automation/tests/automation.rs` at `:354` (`signing_with_translated_labels_through_tools`, which passed a 7-character password against an 8-character minimum) and at `:359` (`a_save_that_does_not_reopen_leaves_the_file_as_it_was`), `173 passed; 2 failed`. Those were upstream failures reproduced on that commit's own CI run (**38703572296**, plus the FreeBSD run **38703573428**) in a crate this change never touches; they have since been fixed on `main` by #2420 (the signing password now meets the minimum) and #2484 (save/search regression expectations updated), which is why `main`'s latest CI run is green and why this branch was rebased. The rebase is a no-op for our code: `crates/annot/src/lib.rs` at both commits is byte-identical (`fb491e19…`), so every line number cited below still resolves as written.
Since then `main` was merged in (`dc943eeb`, merge commit `3122ebad`) to clear the FreeBSD job per the CI triage on this PR: the `files_and_quit_from_the_operating_system` race was fixed on main by `12fcc641` (#2812). The merge probe was clean (zero conflicts; `Cargo.lock` the only overlapping path). Main split `crates/annot/src/lib.rs` into modules and reshaped `set_style` to take a `StyleChange`; the merge commit carries three tests-only adaptations (two `SaveOptions` literals gain `drop_unlinked: false`, the writer's default; one `set_style` call re-shaped; citations re-derived to the new file layout). No crate source diverges from main's: `git diff --stat upstream/main HEAD -- crates/annot/src/` is empty. Inline-suite counts at this head: 74 (main grew it from 42); the 42 → 92 figures above describe base `99941daa`. proptest on main's lock is now 1.12.0; one edge added, no new package.
## Where the proof stops
- The first CI run on this branch was at our original base and showed the inherited failures described above; results cited here are local macOS runs (we have no Poppler locally, so qpdf cross-checks ran through pikepdf in a workspace virtualenv).
- The probe PDFs used for qpdf measurements are **not** committed, because AGENTS.md §1 requires an `ATTRIBUTION.toml` entry per sample document — so CI cannot re-measure them. Each measurement carries a regenerate recipe and sha256 in the test comments (`malformed.rs`).
- All oracle figures are tied to one machine's build: pikepdf 9.11 over libqpdf 12.2 (`__libqpdf_version__`; the Job API rejects `--version`, so no raw qpdf version string). Poppler comparisons would need CI, as `pdftoppm` is unavailable locally.
- Mutation evidence covers single-site guard/arithmetic/key-rename mutants only — no multi-site, data-flow or off-by-one classes were attempted.
- We did not measure what any viewer displays to a user after these failures; the listed-but-null entry was observed, not rendered behaviour.
## Question for maintainers
CLAUDE.md asks new tests to be registered in `ROADMAP.md` and `parity/acrobat-features.toml`, but several open PRs above are editing both files right now, so we left them untouched to avoid collisions. Tell us where you would like these registered and we will add the lines here, or open a follow-up.
Credit: `contributors/people.toml` deliberately carries no new entry in this PR — ours is already queued on #2073.
|
||
|
|
3516508589 |
Edit text: space between paragraphs
## What this changes `edit.line-paragraph-spacing` was partial: line spacing existed, the space between paragraphs did not. Now a line break in the edited text starts a paragraph, and the paragraphs are set apart: - `BlockStyle.paragraph_spacing: Option<f64>` (points, beyond the line spacing). `rewrite_block` splits the text at line breaks, wraps and justifies each paragraph on its own (the last line of each paragraph is never stretched), and steps down by the line spacing plus the gap before a paragraph's first line; underlines follow. `None` is half the font size when the text has several paragraphs, so a plain Enter already reads as a paragraph; a non-finite value is refused. - The row-model rewrite (`text_regions`) keeps the rows a line break started apart from wrapped ones: the gap goes before those, and a row the page already had sits where it was, shifted by the spacing added above it. - Format text panel: a Paragraph spacing field (points) next to the line spacing; the tool `text_edit` takes `paragraph_spacing`. - Rows for the two labels in all 21 languages; `parity/acrobat-features.toml` `edit.line-paragraph-spacing` → shipped (notes: space before and after as separate values are still missing). ## How you verified it Re-run on 2026-10-15 after merging `main` into the branch ( |
||
|
|
4f9d93c173 |
fix(ui): Edit ▸ Copy and Paste are enabled for selected comments (#7123)
Fixes #7123 ## What this changes With a drawn annotation (or any comment) selected, Edit ▸ Copy is now enabled, and Edit ▸ Paste is enabled once comments have been copied, matching ⌘C / ⌘V. **Root cause.** `run_menu_command` already sends the clipboard items as their keys (`menus.rs:561`: Copy pushes `Event::Copy`, Paste requests a paste), and `clipboard_keys` handles those by copying the selected comments when no text is selected and by pasting copied XFDF onto the canvas. Only the enabled state was out of sync. `menu_state` enabled Copy for selected text, a picked image, Edit-a-PDF objects or Organize, and Paste only for objects or pages, so both stayed greyed out with a comment selected. **Fix.** There are two new arms in `menu_state` (`crates/ui-egui/src/menus.rs`), placed after the existing image, object and page arms so those still take precedence: - Copy follows `comment.copy` when a comment is selected and no text is. Selected text is what ⌘C copies first, so it is left to the existing text rule. - Paste follows `comment.paste` when the comment clipboard holds something, outside Organize and Prepare Form, where the canvas does not take pastes. ## How you verified it - [x] `cargo fmt --check` - [x] clippy with `-D warnings` on `pdfcraft-ui-egui` (the only warning is in vendored `hayro-interpret`, which was already there) - [x] tests pass on `pdfcraft-ui-egui`, except for failures that also happen on `main` on my machine (Windows, MSVC): `comments::the_selection_bar_stays_inside_the_pages_area` fails every time, and `print::printing_landscape_sheets_tells_cups_to_turn_them` and `print::each_printer_keeps_what_it_last_printed_with_across_a_restart` fail some runs and not others **Test.** `comments::edit_copy_and_paste_are_enabled_for_a_selected_comment` draws a square, selects it, and checks that Edit ▸ Copy is enabled. It then runs Edit ▸ Copy through `run_menu_command` and checks that the comment was copied and that Paste is now enabled. Finally it deselects the comment and checks that Copy is greyed out again. It fails on `main` (`Edit ▸ Copy is enabled with a comment selected`) and passes with the fix. ## Never-crash - [x] No new `unwrap`/`expect`/`panic!` outside tests, no indexing, no `unsafe` ## Anything a reviewer should look at first - **Paste is enabled from app state, without reading the clipboard.** After copying a comment, if another app later puts plain text on the system clipboard, Edit ▸ Paste looks enabled but pastes nothing, as ⌘V already does in that case. I did not read the clipboard just to draw the menu (see #6169 / #6379). - **Copy follows `comment.copy`, which needs only an open document.** So Edit ▸ Copy is now enabled for a selected comment on a document that forbids copying. The same was already true of ⌘C and Edit ▸ Copy comments, so this is not a new way to copy. Whether copy-restricted documents should block copying comments at all is a separate question, and this PR leaves it alone. - **The command palette is unchanged.** `edit.copy` run from the palette (`command_enabled` / `execute`) still covers only text; this PR fixes the menus the issue reports. |
||
|
|
4448ee940b |
fix(ui): mirror the macOS title bar when the traffic lights are on the right (RTL system languages)
## What this changes On macOS with a **right-to-left system language** (Arabic, Hebrew, Persian, …) AppKit lays the traffic lights out from the **right** end of the title bar. That happens even though PdfCraft has no right-to-left localization, and whatever PdfCraft's own interface language is (I checked 0.8.0 in English on an Arabic system: same result). The integrated tab strip (#789 / #1055) always kept its clearance on the left. So: - the lights covered the **theme** and **keyboard-shortcuts** buttons and crowded **Discord**, so they couldn't be clicked; - Home sat beside an empty 70 pt gap where the lights would have been. Before (0.8.0, Arabic system language): | | Strip | |---|---| | Expected left-to-right design | `[● ● ●] [Home] [tabs…] [+ Open] ……… [Discord] [?] [theme]` | | 0.8.0, RTL system | `[ 70 pt gap ] [Home] [+ Open] ……… [Discord] [?][theme] under [● ● ●]` | | This PR, RTL system | `[theme] [?] [Discord] ……… [Open +] [tabs…] [Home] [● ● ●]` | The fix: 1. **Ask the window which side the lights are on** instead of guessing from a language: `NSWindow.windowTitlebarLayoutDirection`, which Apple documents for apps that use `titlebarAppearsTransparent` and put controls under the title bar ("the layout direction may be RTL even in applications that do not have a RTL language localization"). Safe `objc2-app-kit` calls only (same approach as `drag_pointer.rs`), on the main thread, cached in `PdfCraftApp::titlebar_lights_right` once a window has answered. The new features (`NSApplication`, `NSResponder`, `NSWindow`, `NSUserInterfaceLayout`) are already in the tree through winit/rfd, except the empty `NSUserInterfaceLayout` feature. 2. **Mirror the strip** when they are on the right, so the existing design holds with the lights at the other end: Home beside the lights, the tabs reading from the right (the first tab beside Home), then Open; Discord, shortcuts and theme at the far end, in mirrored order. The scroll arrows keep their visual sides. - egui's `ScrollArea` only scrolls content that grows to the right, so mirrored, the tabs keep a left-to-right scroll area inside a box exactly their width (`tabs_shown_width`), set beside Home. - Tab dragging (#1537) reads the slots in reading order with x flipped (`reading_order`), so `drop_index` and `drop_marker` serve both directions unchanged. - The Combine files tab block moved into `combine_tab()` (unchanged behaviour) so it can be drawn first when mirrored and still read last. Left-to-right systems, Windows, Linux (including the GNOME header bar) and the web are unchanged: everything new hangs off `mirrored`, which is only true on macOS with the integrated title bar and lights on the right. ## How you verified it - [x] `cargo fmt --check` - [x] `cargo clippy -p pdfcraft-ui-egui --all-targets -- -D warnings`: clean. With Rust 1.95, `main` itself trips `clippy::collapsible_match` in `crates/edit/src/images.rs` and `clippy::nonminimal_bool` in `crates/ui-egui/src/compare_ui.rs`, files this PR doesn't touch, so the run allowed those two lints; a separate pass with them as warnings finds them only there. - [x] `cargo test -p pdfcraft-ui-egui --no-fail-fast`: 2,911 passed, 0 failed, after the rebase on `main` (`d749fd80`, 2026-11-12) on Windows 11; `pdfcraft-cli` + `pdfcraft`: 198 passed. The rebase moved the mirrored drag into `main`'s new `tab_drag`, which split view's strips share: the main strip passes `mirrored`, the second pane's strip does not. The macOS tests below run only on macOS; on Windows I ran them with the macOS gate lifted locally (not committed): they pass, and with the scrolling fix switched off its test fails. - [x] `cargo xtask layers` and `cargo xtask assets` New tests (macOS, `crates/ui-egui/tests/ui.rs`): - `the_integrated_title_bar_mirrors_with_traffic_lights_at_the_right`: everything stays in the 28 pt band and clear of the lights; Home is beside the lights, the tabs read from the right, then Open; theme, shortcuts and Discord are at the far left in mirrored order. - `dragging_a_tab_in_the_mirrored_title_bar_follows_its_reading_order`: dragging left moves a tab later in the order, and dragging right moves it earlier. Unit tests in `chrome.rs`: `mirrored_tabs_drop_in_their_reading_order`, `shown_tabs_take_their_capped_widths_and_the_gaps`. **Seen failing before the fix:** with mirroring switched off, both UI tests fail. With only the x-flip removed, the drag test fails and the layout test passes, so each test pins its own part. Checked by eye on macOS with an Arabic system language: the real app (dev build, portable mode, three sample PDFs) shows `[theme][?][Discord] … [فتح +][third][second][first][Home][● ● ●]`, with nothing under the lights. ## Never-crash - [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests - [x] No indexing with input-derived positions (the tab loop indexes `app.views` with indices from `0..len`, as before) - [x] No `unsafe`: the AppKit calls are safe methods in `objc2-app-kit` 0.3; `MainThreadMarker::new()` returns `None` off the main thread, and a missing window returns `None` (then the strip stays as it was and asks again next frame) - [x] No crash fixed here ## Provenance - [x] No asset from an Adobe product - [x] No font files - [x] No GPL/AGPL code - [x] Behaviour from Apple's public AppKit documentation and black-box observation of PdfCraft itself - [x] No new assets ## Security - [x] `--root` confinement untouched - [x] MCP and the control channel untouched - [x] No network access ## Parity and reach - [ ] `parity/`: not applicable (a layout fix, not a feature) - [ ] `automation` tool: not applicable (window chrome) - [x] Docs: no documented behaviour changes ## Anything a reviewer should look at first - **Mirroring follows the lights, not the interface language.** The rest of the app isn't mirrored for RTL languages, so mirroring only the title bar could look like a partial RTL mode. But the title bar's order is anchored to the lights (Home beside them is the #789 design), and AppKit picks their side from the system language, not ours. Tying it to `windowTitlebarLayoutDirection` also covers an English UI on an Arabic system. - **Overflowing tabs when mirrored:** the scroll area still starts at offset 0, its left end, which holds the last tabs. The active tab is scrolled into view on every change (as before), so it's always visible, but at startup with many tabs the first ones (beside Home) may start out of view. Starting it scrolled to the right end would need the content width before the first frame; I left that out to keep this small. Happy to add it. - **A flaky test I saw locally:** `files_and_quit_from_the_operating_system` failed 3 times in ~40 full `--test ui` runs while the machine was also building and running the app, then 0/20 on a quiet machine, both with and without this change. It opens a file on the open worker and waits a fixed 4 frames, so it looks timing-sensitive under load rather than related to this change. - Also adds my own entry to `contributors/people.toml` (separate commit, `sync_github_name = true`). |
||
|
|
9db6c9d95c |
fix(xfdf): bound field text, look up names, guard tab cells, protect fields (#5937)
* fix(xfdf): bound field text, look up names, guard tab cells, protect fields XFDF import built every full field name from its parent's with no total; it is held to 64 MiB of names and values. FDF field arrays charge each decoded value before keeping it instead of after decoding all of them. merge_csv, XFDF field export and apply_values looked names up by linear scan per field; they use maps, keeping first-match behaviour. Tab-delimited export guards formula-like cells with a leading ' as CSV does, and import takes it off. A same-name comment import no longer replaces a widget whose subtype is a reference or whose /FT is inherited from its parent, existing annotations are borrowed instead of deep-copied per import, and an imported redaction mark's /Rect is grown to hold its /QuadPoints so nothing is removed outside its review outline. * address review: follow /Parent 64 levels in is_field |
||
|
|
df3f58d8b8 |
Set Page Boxes crops the margin you type on UserUnit pages (#7445)
* Convert Set Page Boxes margins by the page UserUnit The dialog's margins are physical (pt, in, mm, cm) but were written as user-space units, so a UserUnit 2 page cropped twice the requested margin. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Say that page_set_box margins are user-space units Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Print readiness reads page boxes in points; Set Page Boxes batch keeps its wording Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
c4e174675e |
Bookmarks from text styles open at the heading top on turned pages (#7443)
* Style bookmarks go to the displayed heading top on turned pages Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Read and join style-bookmark headings in displayed order on turned pages Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Read page rotations once per document for style bookmarks Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Test style bookmarks on cropped turned pages and after save and reopen Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
7895411b03 |
fix(forms): name detected check boxes from the nearer neighbouring label (#2943) (#2953)
* fix(forms): name detected check boxes from the nearer neighbouring label (#2943) * M6: bound rectangle work during form detection (#2953) Limit drawn and existing rectangle candidates before pairwise comb and checkbox work, preserve every widget overlap exclusion, and avoid cubic default-name lookup. Document partial proposals on unusually complex pages. Verified: 143 forms unit tests, strict forms clippy, wasm check, layers, assets, and format. The count-based regression fails when the pre-comb cap is removed. * Bound existing-widget overlap work during field detection Index every existing widget spatially and cap aggregate query work, rejecting unchecked proposals if adversarial geometry exhausts the budget. Retain exclusions beyond the proposal/label budget. Add synthetic 100k-widget, inverted-geometry and linear-equivalence regressions. The original linear scan fails the new work-bound negative control. All 147 forms tests, strict Clippy, formatting, wasm, layers and assets checks pass. --------- Co-authored-by: skylar taylor-barrick <hi@skylar.cc> |
||
|
|
2251a75cc8 |
fix(render): resolve TrueType glyphs across Unicode/UCS-4 cmaps, post v2.0 aliases, and truncated FontFlags (#2159) (#2980)
* fix(render): resolve accented TrueType glyphs across Symbolic flags, Unicode cmaps, post v2.0, and ToUnicode (#2159, #2426) * fix(render): separate TrueType glyph selection from extraction (#2980) Restore the existing Symbolic and CFF mapping paths. Keep name-derived Unicode cmap lookup, post-name aliases, known flag bits, and explicit .notdef handling. Replace disputed expectations with synthetic glyph/extraction regressions; the original PDFs in #2159 and #2426 remain unavailable and unverified. * fix(render): check exact post v2.0 glyph name before suffix-stripped cmap lookup (#2980) * fix(render): prefer exact post v2.0 name for multi-codepoint AGL glyph names (#2980) * style: format vendor true_type.rs * fix(render): keep TrueType vendor patch in upstream style Restore unchanged upstream formatting around the glyph-mapping fix and use upstream-default formatting for its new helpers. Preserve the upstream glyph_name_to_text extraction fallback and every existing functional change. Validated workspace cargo fmt, git diff --check, and byte-identical rustfmt canonical output before and after this formatting-only change. The eight TrueType integration tests passed on the prior head in hosted CI; fresh CI will validate this follow-up. Local recompilation and optional negative controls were not attempted because build storage is exhausted. |
||
|
|
bd0a21c2de |
M3: full screen fills the screen or keeps the page display, and Esc closes the find bar before leaving (#576, #4273, #5302) (#5325)
Full screen can fill the screen edge to edge, fixing the fake full screen in #379, or keep the normal page display, via a preference. The forms bar is hidden in full screen. Up-arrow and wheel no longer jump back a page, and Esc closes one thing at a time (the find bar before leaving full screen). Bundles #576, #4273 and #5302. |
||
|
|
8ad5f0d029 |
deny: ignore RUSTSEC-2026-0543, chrono unmaintained (#7647) (#7649)
RUSTSEC-2026-0543 marks every chrono version unmaintained and has no release to move to. It fails cargo deny on every gate run. It is a maintenance notice, not a vulnerability. Add the advisory to [advisories].ignore in deny.toml with justification, the same way other unmaintained advisories are handled. Replacing chrono is not a fix for this repository alone: house rules require time to go through chrono, and craft-libs depend on it. Revisit the ignore when a successor is chosen in craft-contrib. Fixes #7647 |
||
|
|
271e479c53 |
Merge pull request #7591 from storytold/dot/pdf-shared-markdown-20261117
Export: use shared extracted-text Markdown writer with exact output parity |
||
|
|
2959b7050f | Fix canonical ordering of pinned XML lock entries | ||
|
|
a49949388b |
fix(test): allow the unused mut on Windows in the private test folders (#7595)
#5923 made the pptx LibreOffice test and the staging tests build their folders with a DirBuilder that only Unix sets a mode on. On Windows the binding is never changed, so -D warnings stops the build with unused_mut and main's Windows gate is red. |
||
|
|
4d64115874 | export: pin extracted-text writer to merged shared prerequisite | ||
|
|
9892160ed6 | fix(platform): confine staging names; private temp dirs for tests and macOS signing (#5923) | ||
|
|
f8197e29ca | fix(fonts): a CMap's codespace ranges are at most four bytes and listed once (#6075) | ||
|
|
0bb5fcca94 | fix(fonts): the licence policy reads name-table records one at a time within a total allowance (#7044) | ||
|
|
b3f6d485ba | docs: prefer shared craft-libs implementations (#7527) | ||
|
|
35a1d33857 | sign: use shared CMS SignedData signing writer (#7584) | ||
|
|
46234dd471 | export: map PDF layout through shared extracted-text Markdown writer | ||
|
|
efd265563e |
Merge pull request #7330 from MMexicann/patch-8
docs(prc-render): name the current craft-prc parser dependency |
||
|
|
412e6963b5 |
Merge pull request #7529 from storytold/onee/778-pdf-content-facade
refactor(content): re-export craft_pdf::cos::content |
||
|
|
3d43364928 |
fix(crypt): write RC4 fixtures through the legacy entry points
Pinning craft-pdf to the #1852 merge SHA also picked up d74e60b2, which makes create() and set_encryption() refuse RC4-40 and RC4-128. Tests, helpers and the protect example that still write those schemes now use create_legacy and set_encryption_legacy. Edit::Protect does the same when the chosen algorithm is legacy, so a file that must stay readable by a reader without AES can still be written. |
||
|
|
99ef606491 |
refactor(content): point the facade at craft-pdf #1852
Pin craft-pdf to 8e03cd016d42032b867fef6bad86bc69bf2c1920 and re-export craft_pdf::cos::content. Other craft-libs pins stay on e2dc681a3. |
||
|
|
f9aca964b1 |
refactor(content): re-export craft_pdf::cos::content
The parser, serializer and matrices now live in craft-pdf (craft-libs#1852, pin 8e03cd016d42032b867fef6bad86bc69bf2c1920). pdfcraft-content becomes a facade, like pdfcraft-cos. The unit tests moved with the implementation; hayro_sign_tokens stays here. Other craft-libs pins are unchanged. |
||
|
|
207a50ef13 |
Merge pull request #7344 from MMexicann/patch-20
test(create): fail explicitly for invalid one-bit RGB fixtures |
||
|
|
9d061a7668 |
Merge pull request #3762 from AdrianTM/feat/comments-panel-shortcut
Ctrl+M opens the Comments panel (#3741) |
||
|
|
f8d8aef6e4 | M5: preserve macOS Minimize alongside Ctrl+M Comments (#3741) | ||
|
|
2ace804522 |
M5: test Ctrl+M as Windows and Linux send it (#3741)
Real Ctrl events carry both ctrl and command, so a Cmd+Ctrl+M binding, which the registry tries first, would also match them. The test now sends that shape on Windows instead of the command modifier alone. |
||
|
|
fdf9350045 |
Ctrl+M opens the Comments panel (#3741)
Bind comment.list to Ctrl+M (Cmd+M on macOS). The command opens the panel rather than toggling it, so pressing it with the panel already open keeps it open. The binding comes from the command registry, so the View menu, the palette and Help > Keyboard shortcuts show it. |
||
|
|
75a6ce50c3 |
Merge pull request #7377 from gmrmad1/docs/roadmap-2026-11-15
docs: bring ROADMAP.md and parity assessment current through 2026-11-15 |
||
|
|
90d847ce17 |
Select the current query when refocusing search fields (#4533)
* Search field receives a focus request * Find keeps an IME composition when the find field already has the keyboard Selecting the query on Find made the next IME update replace the whole query when the field was composing: egui replaces the selected range, and only egui can end a composition from inside the field. The query is now selected only when the field takes the keyboard from elsewhere, in one helper for the find bar and the Search panel. * Test that the Search panel keeps an IME composition when asked for the keyboard again * A repeated Find selects the query while the field has the keyboard `owns_ime_events` is only `has_focus` on the pinned egui, so a second Find while the find field (or the Search panel field) still had the keyboard kept the caret and typing appended to the old query. Follow the IME composition from the field's own events and cursor instead: a non-empty pre-edit starts it, a commit or empty pre-edit ends it, and any other edit, click or loss of focus ends it too. Only a live composition keeps the selection; every other Find selects all of the query. Tests: a repeated Find with the keyboard still in the field, for both fields, and a Find after a committed composition. --------- Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com> |
||
|
|
799fdd14b9 |
bs: Bosnian language support (#5445)
* Add Bosnian (bs) to the interface languages bs.tsv: Bosnian (Latin script, Ijekavian) catalog covering every key of PdfCraft's other catalogs, its wording shared with storytold/craft-i18n locales/bs/ and the strings craft-i18n lacks translated new. Every bs-* locale selects it; counts use one/few/other. Locale and plural tests, localization docs and an attribution entry (AI-assisted, not yet reviewed by a native speaker). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * Bosnian: date-format language, English picker name, word-count ellipsis Preferences > Date format offers exactly the interface languages, so Bosnian gets its month and day names there; the picker falls back to "Bosnian" when no face can draw the native name; Word Count keeps the command label's trailing ellipsis. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * bs: wording from the craft-i18n catalog review The Bosnian catalog review (storytold/craft-i18n#72) asked for one word per concept; this catalog follows: pan is "pomjeranje" (not "pomicanje"), a spreadsheet is "proračunska tabela", Greek & Cyrillic reads "Grčko pismo i ćirilica". Placeholders and ellipses are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * bs: take the catalog from craft-i18n, keep only PdfCraft's code PdfCraft now reads its translations from storytold/craft-i18n (#6055), and this PR's Bosnian rows are there (storytold/craft-i18n#141, in the pinned commit), so crates/ui-egui/src/i18n/bs.tsv goes. What stays is PdfCraft's part, redone against the new registry: the bs row in LANGUAGES, "Bosnian" as its English picker name, Bosnian date names, locale, persistence and one/few/other plural tests (Bosnian follows the Russian rule in the legacy rule table), and the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * docs: Bosnian revision row in the revision history; language totals The 2026-11-04 Bosnian row had landed in the key-languages table instead of the revision history; it is now the history's first row. The summary counts 21 other languages, 35 catalogs plus English, 36 in Preferences, as LANGUAGES lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * Docs: list bs as a ui.set / ui.state language value --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
923dd9f593 |
Merge pull request #7449 from storytold/extract/shared-export-base64
export: replace local Base64 encoder with existing craft-mime |
||
|
|
a0bc1b3477 |
Revert "xfa: avoid rescanning prototype-only child lists"
This reverts commit
|
||
|
|
1c7b507a24 |
Merge pull request #7475 from storytold/extract/shared-signature-verification
sign: replace local signature verification with existing craft-pkcs7 |
||
|
|
e191b0ea69 |
M3: select text across pages (view.text-select)
Allow a text selection to run across pages, keeping main's same-page table-row selection (head_x) and the JavaScript link click dispatch from #2081. |
||
|
|
42c0ba8679 |
M2: a JPX image on a rotated page draws instead of crashing (#3884) (#5438)
* M2: a JPX image on a rotated page draws instead of crashing (#3884)
The decode-size hint `image_draw_size` hands hayro-jpeg2000 mapped the
image's corners (w, 0) and (0, h) as points, so it took in the
translation. On a /Rotate 90 page (Acrobat Paper Capture scans) one
corner lands on the device origin, the hint gets a side of 0, and
hayro-jpeg2000 0.3.5 divides the image size by it: "renderer crashed on
page N: attempt to divide by zero" on every rotated JPX page.
The hint now comes from the transform's linear part (the axis lengths
the preview tiny-image check already used, now computed once), and each
side is at least 1. As a side effect, translated JPX images no longer get
an overestimated hint, so they can decode at a reduced resolution level
when drawn small, which is what the hint is for.
Regression test: a 1x1 JPX image filling a 40x40 page at /Rotate 0, 90,
180 and 270, rendered at 0.5x, 1x and 1.5x. It fails before the fix
(/Rotate 90 at 0.5x: attempt to divide by zero) and passes after.
Supersedes the guard in #1883 and does not depend on the hayro-jpeg2000
bump in #2309; both are open and conflicting with main.
Fixes #3884
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C19EMwwBCMSkqew7KepPV2
* M2: decode an offset JPX image area at full size (#3884 review)
hayro-jpeg2000 0.3.5 places a reduced resolution's samples using the
image area's reference-grid offset (XOsiz, YOsiz) unscaled. When a size
hint skips a level, an offset image either loses rows (offset 7, 7: no
reduced row is copied) or is sliced past a reduced row and panics
(offset 7, 0: "range start index 3 out of range for slice of length 2"
at decode.rs:486). The accurate hint from the previous commit makes
reduced decoding more common, so this matters more now.
filter::jpx::decode now passes the hint only when both offsets are 0,
read from the SIZ segment of a raw codestream or a JP2 jp2c box;
codestreams without an offset keep reduced decoding.
Tests: jpx_size_hint_is_dropped_only_for_an_offset_image_area fails
before the fix (the panic above, and 2x2 instead of 4x4 for the other
offsets) and passes after; the (0, 0) case pins that reduced decoding
is kept. image_area_offset_reads_raw_codestreams_and_jp2_files covers
raw, JP2 and truncated inputs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C19EMwwBCMSkqew7KepPV2
* M2: pin invalid /Rotate values in the rotated JPX test (#3884 review)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C19EMwwBCMSkqew7KepPV2
* M2: restore the /UserUnit test's rotations (#3884 review)
|
||
|
|
5410dc1cfc | xfa: avoid rescanning prototype-only child lists | ||
|
|
a11ea7ad85 |
Merge pull request #7450 from storytold/refactor/shared-srgb-v2
preflight: use shared ICC v2 sRGB output-intent bytes |
||
|
|
073644e09c | sign: delegate public-key verification to existing craft-pkcs7 | ||
|
|
e14ed45a4d | Pin ICC v2 generator to merged shared revision | ||
|
|
17fc47b692 |
Merge pull request #7447 from storytold/dot/pdf-shared-der
sign: replace local BER/DER codec with existing craft-pkcs7 |
||
|
|
1b86ace58d |
fix(render): cap a JPEG 2000 codestream's SIZ size at 2^28 pixels (#5086)
## What this changes A JPEG 2000 image is now refused when its codestream's SIZ marker declares more than 2^28 pixels, the same cap `image_size_ok` applies to `/Width` x `/Height`. The check runs in `vendor/hayro-syntax/src/filter/jpx.rs` on the header read at full resolution, before `Image::decode` (which makes the infallible allocation), and fails the same way as other undecodable images. It uses the full-resolution size because a `target_resolution` shrinks the reported `width()`/`height()` but each tile's coefficient buffers are still allocated at full size (review on this PR); the header is then re-read at the target resolution only when one is set. Logged as hayro-syntax patch (36) in `vendor/README.md` (main has since taken 29-35). Fixes #5078 ## How you verified it `cargo fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean on `pdfcraft-render` (which compiles the vendored hayro-syntax). Regression tests in `jpx.rs`'s `tests` module, adopted from the reviewers' patches: - `a_codestream_over_the_pixel_cap_is_refused` (croquete1): a `/Width 1 /Height 1` image whose single-tile codestream declares 65536 x 65536 (2^32 pixels) returns `None` from `jpx::decode`, with and without a 1x1 target resolution (the target case has four decomposition levels, so the target really shrinks the reported size to 4096 x 4096, under the cap); the same builder at 1x1 decodes, so the `None` is the cap, not a parse error. - `jpx_size_guard_uses_full_resolution_before_target_resolution` (Harrison-Booth): `decode` delegates to `decode_with_pixel_limit`, so a 1024-pixel limit can show that a 64x64 image with four decomposition levels, which a 1x1 target decodes under 1024 pixels, is still refused at that target. The first version used `PALETTE_JP2`, which a target can't shrink (its JP2 palette makes hayro-jpeg2000 drop the target, and it has no decomposition levels), so it passed with the check measuring the target size; the current one was seen failing at that assertion with the header read at the target resolution before the check, and passing with the fix. The vendored crates are excluded from the workspace, so CI's `cargo test --workspace` doesn't run these unit tests. They were run on a copy of `vendor/hayro-syntax` (with the vendored `hayro-jbig2` patched in): `cargo test --lib filter::jpx`, 12 passed. - [x] `cargo fmt --check` - [x] clippy with `-D warnings` on the crates I changed - [x] tests pass on the crates I changed ## Anything a reviewer should look at first - `Image::new` only parses the header (croquete1 measured the 65536 x 65536 single-tile case at about 0 ms), so the cap runs before any coefficient buffer is allocated. - `u64::from(width) * u64::from(height)` can't overflow (two u32 values). Component and tile counts aren't bounded here; that's a separate allocation path, outside #5078. - `MAX_PIXELS` is a local constant. The shared `MAX_IMAGE_PIXELS` lives in `hayro`, which hayro-syntax can't depend on. - rustfmt wasn't run over `jpx.rs` (the vendored crate is outside the workspace, and the workspace config would reformat older blocks). The new lines are formatted by hand. |
||
|
|
10727c520b |
fix(web): open document links with noopener and send COOP same-origin (#5091)
## What this changes On the web build, `PdfCraftApp::open_url` now opens links with `window.open(url, "_blank", "noopener,noreferrer")` via `web-sys`, instead of `egui::OpenUrl::new_tab`. eframe opens new tabs without features, which gave the opened page a `window.opener` handle it could use to navigate the PdfCraft tab. Every app-level open goes through `open_url`: document links, button URI actions, `app.launchURL`, help links and the releases page. Desktop builds are unchanged. The web packaging now sends `Cross-Origin-Opener-Policy: same-origin`: `_headers`, `.htaccess`, and the nginx example in `packaging/web/README.md` (`HOSTING.md`), whose old "doesn't need COOP" note is rewritten. Fixes #5084 ## How you verified it `cargo fmt --check` and `cargo clippy --all-targets -- -D warnings` are clean on `pdfcraft-ui-egui`, including the review fixes. Tests not run yet; CI runs them. `cargo check -p pdfcraft-ui-egui --target wasm32-unknown-unknown` passes too, with no warnings in `links.rs`. - [x] `cargo fmt --check` - [x] clippy with `-D warnings` on the crates I changed - [ ] tests pass on the crates I changed ## Anything a reviewer should look at first - COOP `same-origin` has no effect inside an iframe, so the `postMessage` embedding bridge is unaffected. A page on another origin that opens PdfCraft with `window.open` does lose its window handle. Nothing in the repo does that. - Not covered: `dialogs/credits.rs` uses `ui.hyperlink_to` for fixed GitHub URLs, which on the web may open in the PdfCraft tab itself. |