Skip to content

feat(painter-dom): implement w:bidiVisual RTL table rendering (SD-2278)#2556

Merged
caio-pizzol merged 5 commits intomainfrom
caio/sd-2278-implement-wbidivisual-rtl-table-rendering-full-ecma-376-1741
Mar 25, 2026
Merged

feat(painter-dom): implement w:bidiVisual RTL table rendering (SD-2278)#2556
caio-pizzol merged 5 commits intomainfrom
caio/sd-2278-implement-wbidivisual-rtl-table-rendering-full-ecma-376-1741

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol commented Mar 25, 2026

Detect tableProperties.rightToLeft from w:bidiVisual and render tables with visually reversed column order:

  • Set dir="rtl" + direction: rtl on table fragment container
  • Mirror cell X positions so first logical column appears on the right
  • Swap resolved border left↔right in CSS output for correct visual edges
  • Swap cell padding left↔right per Part 4 §14.3.3–14.3.8
  • Handle cell spacing and colspan in mirrored layout
  • Mirror ghost cell positions for cross-page rowspan continuations

Fixes SD-2278

…76 §17.4.1)

Detect `tableProperties.rightToLeft` from `w:bidiVisual` and render
tables with visually reversed column order:

- Set `dir="rtl"` + `direction: rtl` on table fragment container
- Mirror cell X positions so first logical column appears on the right
- Swap resolved border left↔right in CSS output for correct visual edges
- Swap cell padding left↔right per Part 4 §14.3.3–14.3.8
- Handle cell spacing and colspan in mirrored layout
- Mirror ghost cell positions for cross-page rowspan continuations

Fixes SD-2278
@linear
Copy link
Copy Markdown

linear Bot commented Mar 25, 2026

…mirroring

- border-utils: tests for swapTableBordersLR and swapCellBordersLR
- renderTableRow: tests for RTL x-position mirroring with asymmetric widths,
  isRtl passthrough to renderTableCell, and border left↔right swap
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18ae3b9102

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/layout-engine/painters/dom/src/table/renderTableFragment.ts Outdated
Comment thread packages/layout-engine/painters/dom/src/table/border-utils.ts
Comment thread packages/layout-engine/painters/dom/src/table/renderTableFragment.ts Outdated
@caio-pizzol caio-pizzol changed the title feat(painter-dom): implement w:bidiVisual RTL table rendering (SD-2278) feat(painter-dom): implement w:bidiVisual RTL table rendering Mar 25, 2026
@caio-pizzol caio-pizzol changed the title feat(painter-dom): implement w:bidiVisual RTL table rendering feat(painter-dom): implement w:bidiVisual RTL table rendering (SD-2278) Mar 25, 2026
- Remove dir="rtl" from table container — w:bidiVisual only affects cell
  layout order, not paragraph text direction. Cell reversal is handled
  by X mirroring already. Setting dir on the container would flip bidi
  behavior for LTR/neutral content inside cells.
- Fix ghost cell spacing mismatch — ghostX was computed without cell
  spacing but totalWidth included it, causing misaligned continuation
  cells in RTL tables with non-zero cellSpacing.
…tables

For tables with borderCollapse=separate and cellSpacing, the container
paints outer table borders directly. Swap left↔right for RTL tables
so the container border matches the mirrored cell layout.
- renderTableCell: RTL padding swap with asymmetric left/right values
- renderTableRow: RTL mirroring with non-zero cellSpacing + colspan
- renderTableFragment: ghost cell RTL x-position mirroring for rowspan
  continuations, isRtl propagation to body rows
@caio-pizzol caio-pizzol enabled auto-merge (squash) March 25, 2026 14:35
@caio-pizzol caio-pizzol self-assigned this Mar 25, 2026
@caio-pizzol caio-pizzol merged commit b9010a4 into main Mar 25, 2026
41 checks passed
@caio-pizzol caio-pizzol deleted the caio/sd-2278-implement-wbidivisual-rtl-table-rendering-full-ecma-376-1741 branch March 25, 2026 14:50
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 25, 2026

🎉 This PR is included in vscode-ext v1.1.0-next.6

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 25, 2026

🎉 This PR is included in superdoc v1.24.0-next.7

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 25, 2026

🎉 This PR is included in superdoc-cli v0.5.0-next.7

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 25, 2026

🎉 This PR is included in superdoc-sdk v1.3.0-next.7

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

🎉 This PR is included in esign v2.2.0-next.3

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

🎉 This PR is included in template-builder v1.3.0-next.2

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

🎉 This PR is included in superdoc v1.24.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 31, 2026

🎉 This PR is included in superdoc-cli v0.5.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Apr 2, 2026

🎉 This PR is included in superdoc-sdk v1.3.0

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Apr 2, 2026

🎉 This PR is included in vscode-ext v2.2.0

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.

1 participant