Skip to content

fix(style-engine): table style base shading as wholeTable layer (SD-3035)#3657

Closed
tupizz wants to merge 1 commit into
mainfrom
tadeu/sd-3035-table-styles
Closed

fix(style-engine): table style base shading as wholeTable layer (SD-3035)#3657
tupizz wants to merge 1 commit into
mainfrom
tadeu/sd-3035-table-styles

Conversation

@tupizz
Copy link
Copy Markdown
Contributor

@tupizz tupizz commented Jun 5, 2026

Summary

A table style's base-level w:tcPr shading (e.g. fill F2F2F2) is the wholeTable conditional layer per ECMA-376 17.7.6: Word paints it on every cell of a table that references the style. SuperDoc's cascade only read tableStyleProperties[region] and never the style definition's base-level tableCellProperties, so style-only cell fills were dropped and such tables rendered with no background.

The fix collects the base-level tableCellProperties into the wholeTable chain while walking the basedOn hierarchy. Ordering preserved: explicit wholeTable region entries beat the base level within one definition, leaf styles beat ancestors, bands and conditional regions sit above wholeTable, inline cell shading wins over everything.

Linear: SD-3035

Verification

  • Fixture gates (SD-3035 mutation set): tblStyle_applied, style_plus_direct_border_overrides, style_plus_width_interactions now paint F2F2F2 on all six cells each, matching Word render pixel values exactly.
  • Regression locks: first_row_styling and banded_rows_or_columns render byte-identical fills before and after (bands mask wholeTable, as in Word).
  • 4 new unit tests (base-level resolution, basedOn precedence, explicit-region precedence, inline wins).
  • Suites: style-engine 146, painter-dom 1242, super-editor 16136 passing.
  • Layout corpus compare: 476 docs, zero changes.

Notes

Part of the SD-3035 plan. The plan's banding-gate step was dropped after pixel-probing Word's renders proved the four "spurious band" verdicts were misreads: Word paints the same band fills SuperDoc does, so the existing banding behavior is correct and untouched.

A table style's base-level <w:tcPr> (e.g. <w:shd w:fill="F2F2F2"/>) is the
wholeTable conditional layer per ECMA-376 17.7.6: Word paints it on every
cell of a table referencing the style. The translator stores it on the
style definition's own tableCellProperties, a sibling of
tableStyleProperties, but resolveConditionalProps only read
tableStyleProperties[region], so style-only cell fills were dropped and
such tables rendered with no background.

Collect the base-level tableCellProperties into the wholeTable chain while
walking the basedOn hierarchy, ordered so an explicit
tableStyleProperties.wholeTable entry still wins within one definition, a
leaf style's base props beat any ancestor's, and inline cell shading wins
over everything.

Verified against the SD-3035 mutation fixtures: tblStyle_applied,
style_plus_direct_border_overrides, and style_plus_width_interactions now
paint F2F2F2 on all cells, matching Word's render pixel values. Banding
and conditional-region fixtures (first/last row/column, banded rows or
columns) are byte-identical before and after, since bands and regions sit
above wholeTable in the cascade. Layout corpus compare: 476 docs, zero
changes.
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 5, 2026

SD-3035

@tupizz
Copy link
Copy Markdown
Contributor Author

tupizz commented Jun 5, 2026

Superseded by #3658, which carries this commit unchanged alongside the SD-3308 double-border fix.

@tupizz tupizz closed this Jun 5, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants