nigig-org/crates/apps/pdf/pdf-document/src
andodeki c1d1e67f3a
Some checks failed
repo hygiene / hygiene (push) Has been cancelled
PDF engine / engine (push) Has been cancelled
PDF engine / makepad-integration (push) Has been cancelled
PDF engine / fuzz (push) Has been cancelled
feat(pdf): shadings — the sh operator was parsed and thrown away
ADR 0028, the first of Phase 7's eight bullets.

content.rs contained `PdfOp::Shading(_name) => {}`. The operator was lexed,
given its own variant, matched during interpretation, and discarded. A page
whose background is a gradient rendered as nothing.

Nothing caught it for the usual reason: a blank region is a legal thing for
a page to contain, so "drew nothing" and "drew what was asked" are
indistinguishable without an assertion naming the expected colour. The
golden corpus had no shading page, so there was nothing to be wrong.

Two of the three pieces already existed — function.rs evaluates the colour
function and colorspace.rs converts it to RGB. What was missing was the
geometry between them.

Sampling rather than a gradient primitive: a PDF shading is defined by an
arbitrary function, possibly a sampled table or a PostScript program, and
neither reduces to a stop list without loss. A device with a native
gradient can still recognise the two-stop case from the samples.

"No colour here" is None, not black. Black is a colour a shading can
legitimately produce, so returning it for "outside an unextended shading"
would paint a rectangle the author never asked for and the caller could not
tell the two apart.

Types 1-5 exact. Coons and tensor patches are flattened to their corners,
which loses the curvature, and is_approximate says so rather than leaving a
caller to assume fidelity. An unknown type is refused by number: a mesh
drawn as a flat fill is a plausible-looking wrong answer.

paint_shading is a new trait method, so the compiler found every
implementor. The Makepad renderer records the request in pending_shadings,
mirroring pending_xobjects — it cannot resolve a /Shading resource because
it does not own the page dictionary, and recording the request is what
stops the operator vanishing a second time. That holds even for types we
refuse, so a host can warn the user.

Four mutations, all killed. The first — discarding sh again — fails three
tests.

Stated plainly and left unticked: the mesh path is written but NOT
exercised by any real stream. shading.rs is at 68% and the uncovered part
is exactly parse_mesh and triangulate. Mesh support should be treated as
unproven, not working: the code runs and produces triangles, and nothing
yet demonstrates they are the right triangles. That is the position
image.rs was in before ADR 0016 found the JPEG decoder was a stub.

The Phase 7 status line is a table from the start this time — one row per
spec bullet, seven of them saying "not started". Per ADR 0021, written
before the work rather than after it.

pdf: 1321 passed (was 1291). pdf-ui: 1366. Coverage 87.60%, floors met.
2026-08-18 17:30:39 +00:00
..
annotation_edit.rs feat(pdf): implement annotation editing (Phase 8) 2026-07-28 17:12:40 +00:00
annotations.rs feat(pdf): internal links that actually go somewhere 2026-08-16 19:34:01 +00:00
appearance.rs feat(pdf): complete Phase 3 document model with real form state 2026-07-27 15:49:46 +00:00
catalog.rs feat(pdf): document creation — outlines, forms, attachments, font subsetting 2026-08-16 21:02:19 +00:00
catalog_edit.rs feat(pdf): outline, page label and struct-tree editing — Phase 5 complete 2026-08-17 12:26:29 +00:00
compact.rs feat(pdf): redaction and object compaction — and three reader defects 2026-08-17 12:20:25 +00:00
destinations.rs feat(pdf): internal links that actually go somewhere 2026-08-16 19:34:01 +00:00
document.rs feat(pdf): redaction and object compaction — and three reader defects 2026-08-17 12:20:25 +00:00
flatten.rs feat(pdf): flatten annotations and form fields into page content 2026-08-17 12:03:59 +00:00
form.rs feat(pdf): AcroForm actions and validation; JavaScript refused, not run 2026-07-31 22:41:50 +00:00
form_actions.rs feat(pdf): AcroForm actions and validation; JavaScript refused, not run 2026-07-31 22:41:50 +00:00
lib.rs feat(pdf): signing and verification — Valid becomes reachable, with a policy 2026-08-18 09:45:01 +00:00
page.rs feat(pdf): shadings — the sh operator was parsed and thrown away 2026-08-18 17:30:39 +00:00
page_ops.rs feat(pdf): page operations — insert, reorder, duplicate, delete, import 2026-08-17 10:38:55 +00:00
reconcile.rs feat(pdf): close the last three Phase 4 items — reconciliation, CFF, cmap 2026-08-17 09:31:41 +00:00
redact.rs feat(pdf): redaction and object compaction — and three reader defects 2026-08-17 12:20:25 +00:00
save.rs fix(pdf): fuzz every target, and close two ADR 0004 gaps 2026-07-31 18:34:25 +00:00
sign.rs test(pdf): close the two real coverage gaps in the signing module 2026-08-18 17:08:11 +00:00
signature.rs feat(pdf): read signatures, and fix a third ObjRef-destroying resolve 2026-07-31 20:02:29 +00:00
structure.rs feat(pdf): tagged structure tree, and the BMC bug that turned red green 2026-07-31 22:19:45 +00:00
type3.rs test(pdf): assert what a file declares is delivered, and floor the coverage 2026-08-16 19:04:57 +00:00