Repository navigation
Commit ea99b55
committed
Port PeachPDF's table fragmentation tests (Batch 4)
Ports PeachPDF.Tests/Integration/{RepeatedTableHeaderClipIntegrationTests,
RepeatingTableRelayoutTests,WholeTableRelocationTests,TableRowspanContinuationTests,
TableSpannedBandRepetitionTests,TableRepeatedGroupConditionsTests,
TableRowBreakValueTests,PageBreakTableKeepWithNextIntegrationTests,
BreakValueCascadeTests,StructuralCloneBreakValueBehaviourTests}.cs into
Source/Test/HtmlRenderer.IntegrationTest/Tables/, and revises the existing
PageBreakTableIntegrationTests.cs (an earlier ArthurHub#262 port, written before this
branch's own css-tables-3 6.1 row-preservation-by-default landed in 362dee9) to
match that table's now-current mechanics.
Two real, confirmed production bugs were found and fixed, not just documented:
1. CssBoxProperties.InheritStyle's "everything: true" branch (structural-clone
copying) never copied break-before/break-after/break-inside, so both of its
real callers - TableHeaderRepeat.CloneSubtree's repeated <thead> row clones,
and DomParser.CorrectBlockSplitBadBox's block-in-inline split - silently
produced auto/auto/auto clones regardless of what the source element
declared. Fixed by adding the three fields to that branch.
2. CssLayoutEngineTable.LayoutCells's repeated-header loop seeded its own
lastRepeatSlot from PageIndexOf(starty) - and for a border-collapse:collapse
table (GetVerticalSpacing() is -1, a deliberate one-pixel row/border overlap)
sitting flush at a page's own content top, starty lands one pixel below
PageIndexOf's slot boundary, flooring into the slot BEFORE the one the table
actually starts in. This made the loop see a spurious "transition" at the
very first body row, painting the header twice on the table's own first page
(confirmed empirically: two HEADERMARKER draws at nearly the same position)
while, in a combined effect, one repeat later in the document went missing.
Fixed with a new PageSlotOf helper that clamps to CssBox.ClientTop (immune to
the collapsed-border overlap) - scoped to this loop alone, not the row-shift
straddle check a few lines below, which reacts to the same misread with a
harmless 1px nudge two existing tests depend on (see PageSlotOf's own
remarks). CssLayoutEngineTablePageBreakTests.RepeatedThead_SinglePageBorder
CollapseTable_PhantomHeaderRepeatDueToNegativeSlotRounding, Ignored since
Batch 1 with this exact symptom already documented, is un-Ignored - it now
passes.
Ported/revised, with test counts:
- RepeatedTableHeaderClipIntegrationTests (3/3 port) - a repeated header's
overflow:hidden clip resolves correctly per-page by construction here (each
repeat is an independent, already-positioned CssBox clone, not PeachPDF's
shared-subtree-plus-proxy architecture); regression pins, not bug repros.
- RepeatingTableRelayoutTests (2/2 port, 4 cases) - a relocated card holding a
repeating-header table is genuinely relaid out, not translated; the table's
own RepeatedHeaderRows-reset-per-pass makes PeachPDF's excluding bug moot here.
- WholeTableRelocationTests (7/7 port) - adapted off PerformLayoutEpilogue onto
the real trigger, BlockFragmentation.RelocateIfNeeded, called from the block
child loop after a table finishes its own layout.
- TableRowspanContinuationTests (6 ported + 1 Ignored, down from 17) - PeachPDF's
TableRowCursor/PageBreakBottoms/ShellIn/box-decoration-break-edge machinery has
no counterpart; ported what's real here instead (ActualBottom extension on a
rowspan cell whose ending row is shifted, deterministically). Also surfaces an
unrelated, pre-existing InsertEmptyBoxes gap (a rowspan in a column past the
ending row's own last existing cell gets no placeholder there at all, matching
PeachPDF's own issue #522, not fixed here) - fixtures route around it.
- TableSpannedBandRepetitionTests (4 ported, down from 13, tfoot half dropped) -
BoxFragment.OverflowClip is always null here (no room-reservation/slicing
mechanism exists), so PeachPDF's strip/confinement assertions have nothing to
port onto; pins the real, already-documented "only the first band a lone tall
row overflows onto gets a repeat" limitation instead.
- TableRepeatedGroupConditionsTests (5 ported, down from 16, tfoot half and the
print-media-only UA-stylesheet tests dropped) - the quarter-of-page-height cap
(css-tables-3 6.2's second condition) is confirmed unimplemented; pinned as an
inverted, real test rather than force-fit.
- TableRowBreakValueTests (1 real + 4 Ignored) - CssLayoutEngineTable.cs never
reads BreakBefore/BreakAfter anywhere; forced row breaks don't exist.
- PageBreakTableIntegrationTests (revised in place) - un-Ignored
SingleRowTable_CrossingPageBoundary_IsMovedToNextPage with a corrected
assertion (row preservation shifts the straddling row's cells, never the
table's own outer Location - the original assertion checked the wrong
property); corrected the other two Ignore reasons to cite the real, current
gaps (freely-fragmentable-via-width carve-out; EnforceKeepWithNext reading the
table's own EffectiveTop, untouched by an internal row-shift) instead of a
BreakPage() method that no longer exists anywhere in the source.
- PageBreakTableKeepWithNextIntegrationTests (3 real + 2 Ignored, dropped the
3-way composition test) - PeachPDF's "Gap 1" does not reproduce here at all
(BlockFragmentation.EnforceKeepWithNext is unconditional, not table-specific);
"Gap 2"'s shape does, for a different, more fundamental reason (row
preservation moves cells, never the table's own box - same fact as above).
- BreakValueCascadeTests (9/9 port, adapted to hold break-inside:avoid fixed on
the source and vary before/after, since the print-media UA default doesn't
apply under this harness) and StructuralCloneBreakValueBehaviourTests (5/5
port) - characterize the InheritStyle fix's own real effect: correctly
carried now, but still inert for both clone sites (detached header clones
never reached by BlockFragmentation; the block-in-inline split's anonymous
wrapper still breaks the sibling chain a following box would read).
Full suite: HtmlRenderer.Test 2427 passed/128 skipped/0 failed (was 2426/129 -
one previously-Ignored test now passes), HtmlRenderer.IntegrationTest 323
passed/101 skipped/0 failed (was 275/95), HtmlRenderer.PdfSharp.Test 30
passed/0 skipped/0 failed (unchanged). Clean build across net8.0/
netstandard2.0/net462, 1 pre-existing warning (unrelated nullable-dereference).1 parent 11c35b3 commit ea99b55
14 files changed
Lines changed: 1800 additions & 58 deletions
File tree
- Source
- HtmlRenderer/Core/Dom
- Test
- HtmlRenderer.IntegrationTest/Tables
- HtmlRenderer.Test/Dom
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1922 | 1922 | | |
1923 | 1923 | | |
1924 | 1924 | | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
1925 | 1941 | | |
1926 | 1942 | | |
1927 | 1943 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
662 | | - | |
| 662 | + | |
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
| 667 | + | |
668 | 668 | | |
669 | 669 | | |
670 | 670 | | |
| |||
884 | 884 | | |
885 | 885 | | |
886 | 886 | | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
887 | 928 | | |
888 | 929 | | |
889 | 930 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
0 commit comments