Judge where a box goes across a line, and say what a property still cannot see - #16
Merged
Conversation
pdf.js emits no coordinate inside a line — an lr-tb container's children go in a flexbox div of class xfaLr, a table row's cells in one of class xfaRow — so intra-line placement has been unjudged in both directions since v0.5.0. This asks what a correct line must satisfy instead. Which line a box went on comes from the packing and which cells are one row from the tree, never from the coordinates being checked. The properties are asked twice: once of the packing in the container's own coordinates, where the room across the page is known exactly, and once of where the members came out on the paper, which is the only thing that sees lineX, the offsets of the containers above and the second route a line member alone on its line takes through the flowing chain. The census is reported beside the violations because a check that compared nothing reports no violation either. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pdf.js hands a line to CSS flexbox and emits no coordinate inside one, so this has been unjudged in both directions since v0.5.0. pdfium computes the answer — CalculateRowChildPosition walks a line assigning each item an x — and exports none of it: no entry point in public/ returns a layout item's rectangle, and pdfium's own suite asserts no coordinate anywhere. So the dump comes from a source file added to its embedder tests, built with pdf_enable_xfa; the recipe is in /Users/Shared/xfapdfium/probe. 559 of the 560 forms lay out, against pdf.js's 483. Leaves are compared, because both sides emit a rectangle for one and a container placed at the wrong x puts every leaf under it at the wrong x. The control — every leaf under neither a line nor a row — is carried beside the two populations, because a disagreement under a line means nothing on a form where x does not agree anywhere. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The blind spot is not blind any more: pdfium computes intra-line geometry, and it can be driven
Every release since v0.5.0 has carried the same sentence — the reference emits
no coordinate inside a line, so intra-line placement is unchecked in both
directions. This closes it, and the disagreement goes first.
pdfium can be driven, and the negative I expected is not the answer
Its unit tests pin nothing: no test file anywhere in the tree references
CXFA_ContentLayoutItem,GetAbsoluteRectorCFX_RectF, its one XFA layouttest (
cxfa_layoutitem_embeddertest.cpp) counts pages, and only 2 of the 116fixtures under
pixel/xfa_specificeven contain the stringlr-tb. Nothingthere is portable.
But
CalculateRowChildPosition(cxfa_contentlayoutprocessor.cpp:2028-2160)assigns every item on a line an x and accumulates its width, and
CXFA_ContentLayoutItem::GetAbsoluteRectadds the offsets above it. None of itis exported — no entry point in
public/returns a layout item's rectangle,and
FPDFAnnot_GetFormFieldAtPointreads the PDF's own AcroForm rather thanthe XFA layout — so the dump comes from a source file added to pdfium's
embedder tests, built with
pdf_enable_xfa. The probe is a nine-line walkaround
GetAbsoluteRect; the recipe is in/Users/Shared/xfapdfium/probe.It lays out 559 of the 560 corpus forms. pdf.js lays out 483. The one it
does not is
us-uscis__i-956h, which aborts it (SIGTRAP) and is also one ofthe 77 pdf.js cannot do.
What it says
Leaves, because both sides emit a rectangle for one and a container placed at
the wrong x puts every leaf under it at the wrong x. The control is carried
beside the two because a disagreement under a line means nothing on a form
where x does not agree anywhere: 461 of the 559 forms agree on x for every
control leaf.
The 68 row disagreements split cleanly on that. 64 are on
ca-cra__rc1-fill-11-25e, where 552 of 804 control leaves disagree too — x onthat form is not comparable at all and none of it is the row's. The other 4 are
on
fr-cerfa__cerfa_12818, whose control agrees entirely, and they are oneopen question: the row puts the cell
Boutonat 28.3465, which is wherepdfium puts it, and pdfium then places the positioned children two levels
inside it 3.6 pt further right than their written x. I have not found the line
that adds the 3.6 and will not name a cause without one.
Zero disagreements under a wrapping container, of either kind.
pdfium runs the form's scripts and measures text with real fonts; this package
does neither. So y (44.53% under a line, 76.53% under a row) and which sheet a
box landed on are informative rather than a verdict. X survives because a
positioned box's x is its written attribute and a line member's is arithmetic
over written widths.
The property checks, and their population
Asked anyway, because a judge that agrees can still be wrong in the same way
twice, and because they cover the rl-tb arm no form exercises.
Which line a box went on comes from the packing and which cells are one row
from the tree, never from the coordinates being checked. They are asked twice:
of the packing in the container's own coordinates, where the room across the
page is known exactly, and of where the members came out on the paper — which
is the only thing that sees
lineX, the offsets of the containers above, andthe second route a member alone on its line takes through the flowing chain.
Both are the same thing and neither is a placement fault. On
ca-cra__t777-fill-24eand-25e, the header row's first column is 33 pt andCell1holds a button field writtenw="12.7mm"— 36 pt. The cell after itbegins at 24 + 33 = 57, which is right; the field overruns by 3. pdfium
places it identically:
Cell1at x=24.0009 w=33.0000,Footnote5atx=24.0009 w=36.0000,
Cell2at 57.0009. The template overflows its owncolumn and both implementations reproduce it.
What is STILL not covered, in the same terms
property. Order is checked against DOCUMENT order, so a swap would be caught
— but the right boxes on the wrong LINE, each line well formed, would not.
Against pdfium that is covered where the leaves pair; where they do not it is
not.
rl-tbandrl-rowoccur zero times in 560 templates. The propertychecks carry the arm; nothing measures it.
hAligninside a line. pdfium bands a line into left, centre and rightgroups by each item's
hAlignand packs within the band; pdf.js mapshAligntoalignSelf, which in a row flexbox is the CROSS axis, so itmoves a box down rather than across. This package follows neither. Measured:
2 of 2 374 line children write an hAlign at all, both
center, both onus-uscis__g-1055. Named rather than changed, because no judge separates thetwo references there.
cursor; 0 of the 2 374 are hidden, so nothing measures that branch either.
emitted a key more than once, are dropped rather than guessed at. Under a
line that is 35 and 190 against 959 paired; under a row, 141 and 230 against
19 516.
The change to the package
Three lines:
Placeis now a wrapper overplaceForm, which hands back theplacer it worked in. Which LINE a box went on is not derivable from the boxes
afterwards, and reading it off the coordinates would be asking the answer to
grade itself.
Gate: 100% of statements,
go vet,gofmt -lempty against Go 1.27.1 viaGOTOOLCHAIN,-race, nine cross-compile targets,CGO_ENABLED=0,GOWORK=off. The whole corpus suite, both judges included, is green.🤖 Generated with Claude Code