Commit 6b0504b
committed
LibWeb: Rewrite table border conflict resolution with a push model
The previous implementation resolved collapsed borders per cell side by
collecting "conflicting edges" from neighboring cells, rows, row groups,
columns and the table with five collector functions, then running a
tournament over the candidates. This meant every shared edge was
resolved twice (once per adjacent cell), required fragile span
arithmetic to locate neighbors, and carried element kinds and
coordinates through an explicit tie-breaking comparison.
Replace it with a grid of shared border line segments: each boundary
between two grid slots is a single segment, so borders of adjacent
elements collapse by construction and no neighbor lookups are needed.
Table parts are applied in order of decreasing precedence (cells column
by column, then rows, row groups, columns, and lastly the table), and a
border only replaces the current winner of a segment when it is strictly
more specific per steps 1-3 of the border conflict resolution algorithm.
Ties therefore resolve towards the earlier-applied part, which
implements step 4 through application order alone. Per-cell winners are
then harvested from the segments covered by each cell's perimeter.
This also fixes the neighbor lookups for cells adjacent to spanning
cells: the old code computed the neighbor's origin using the current
cell's span, so borders of spanning neighbors were missed whenever the
spans differed. The two rebaselined tests now render the borders of
anonymous cells next to spanning cells consistently with their
siblings.1 parent 0270b7c commit 6b0504b
4 files changed
Lines changed: 206 additions & 399 deletions
File tree
- Libraries/LibWeb/Layout
- Tests/LibWeb/Layout/expected/table
0 commit comments