Commit 8a1aec0
html: one document-global row counter instead of one per table
bb_html gave each <table> its own row counter starting at 0, separate
from the flow-block counter. That made y ambiguous across structural
boundaries: an <h2> after a table got the same y as a row inside it, so
ordering a document by (y, x) interleaved the two.
Measured against Chromium's rendered geometry (Playwright + TreeWalker
+ Range.getClientRects), that single collision caused 23 of 24
reading-order inversions. Sharing one counter:
Spearman rho 0.9552 -> 0.9996
inversions 24/465 (5.2%) -> 1/465 (0.2%)
row grouping 30/50 (60%) -> 30/30 (100%)
Table geometry was already exact and stays so: 30/30 row grouping and
40/40 column alignment among table cells, before and after.
The residual single inversion is the flex two-column block, which
renders side by side and which the grid places on separate rows. Layout
resolves that, not the DOM, so no static walk can capture it - recorded
as an inherent limit rather than a defect.
A nested table is seeded from its enclosing cell's row and does not
write back to the document counter, so it cannot disturb the outer
numbering. An empty table emits no <tr> and costs no rows.
experiments/html_grid_diagnose.py is now a pass/fail regression gate on
the counter staying global.
Verified no regression elsewhere: pdf 107, xlsx 54, xls 68, docx 35,
and the 470-file xls corpus gate unchanged at 0 UNEXPECTED-FAIL with
2339 formulas matched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent eed1148 commit 8a1aec0
2 files changed
Lines changed: 40 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| |||
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
99 | | - | |
| 102 | + | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
105 | 113 | | |
106 | 114 | | |
107 | 115 | | |
| |||
117 | 125 | | |
118 | 126 | | |
119 | 127 | | |
120 | | - | |
| 128 | + | |
| 129 | + | |
121 | 130 | | |
122 | 131 | | |
123 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
77 | 88 | | |
78 | 89 | | |
79 | 90 | | |
80 | 91 | | |
81 | 92 | | |
82 | 93 | | |
83 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
84 | 97 | | |
85 | 98 | | |
86 | 99 | | |
| |||
94 | 107 | | |
95 | 108 | | |
96 | 109 | | |
97 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
98 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
99 | 120 | | |
100 | 121 | | |
101 | 122 | | |
| |||
0 commit comments