Skip to content

Offset table row backgrounds and collapsed borders by table border/padding - #638

Open
nicoburns wants to merge 2 commits into
mainfrom
devin/1786153128-table-paint-offsets
Open

Offset table row backgrounds and collapsed borders by table border/padding#638
nicoburns wants to merge 2 commits into
mainfrom
devin/1786153128-table-paint-offsets

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

Fixes misaligned table painting visible on https://blitz.is/status/wpt/css/CSS2/floats: white first-column cell backgrounds didn't line up with rows and the coloured <tr> backgrounds bled through the collapsed-border gutters.

Table cells are laid out inside the table's content box (offset by the table-level border/padding that build_table_context synthesizes — in border-collapse: collapse mode the table border is set to the cell border width), but draw_table_row_backgrounds and draw_table_borders painted their rects starting at the border-box origin (0, 0). Every row-background rect and inner gutter fill was therefore shifted up/left by one border width relative to the cells:

before: row k bg at   y = Σ sizes/gutters            (misses border.top)
after:  row k bg at   y = border.top + padding.top + Σ sizes/gutters

Both functions now resolve table.style.border/padding (via ResolveOrZero) and offset all rects by them. The outer borders in draw_table_borders are also now drawn from the table's own resolved border widths spanning the full border-box (previously they used the first cell's border width and only spanned inner_width/inner_height, leaving the corners uncovered and sitting one border width too high/left on the bottom/right edges).

Verified against the live page and a minimal repro: row backgrounds, cell backgrounds, and collapsed borders now align.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/65672de3b7ef45f88c8a46c16e1ac8b2
Requested by: @nicoburns

WPT results

3 newly passing, 0 newly failing (net +3).

Full diff (3 changed tests)
+ Fail => Pass css/CSS2/tables/border-collapse-dynamic-table-003.xht
+ Fail => Pass css/CSS2/visufx/overflow-applies-to-001.xht
+ Fail => Pass css/css-backgrounds/ttwf-reftest-borderRadius.html

Generated by the WPT workflow.

@nicoburns nicoburns self-assigned this Aug 8, 2026
@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant