refactor(html): aim the sheet's cell styling at the sheet's own cells - #686
Merged
Conversation
`table`, `td` and `td x-p` in the spreadsheet sheet named every element of their kind on the page, not the sheet's, so a table the document itself drew inside a cell would have taken the ruler's collapsed borders, fixed layout and cell padding. The font default stays sheet-wide on purpose: a shape anchored in a cell carries its text in spans of its own, and one that names no size would fall to the `font-size:0` a page gives every paragraph. Rendering is unchanged - htmlcmp compares 332 public and 1062 private outputs against main with no mismatch. Neither corpus has a table nested in a sheet, so this is what keeps one right when it turns up. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QVkpzsGS6YASMqm3NwmWib
andiwand
enabled auto-merge (squash)
August 11, 2026 19:09
andiwand
disabled auto-merge
August 11, 2026 19:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while auditing the stylesheets for the same pattern as #685.
Three rules in
spreadsheet_cssnamed every element of their kind on the page rather than the sheet's own, while every rule around them is.odr-sheet-scoped:A table the document itself drew inside a cell would have taken the ruler's collapsed borders, fixed layout and cell padding. Now the cell-geometry rules use child combinators from
.odr-sheet, and thetableproperties merge into the.odr-sheetrule that was already there.The font default deliberately does not become cell-only:
A sheet holds 98
td > div > x-p— text in a shape anchored in a cell. Those spans size the text themselves, and one that names no size falls back to thex-p{font-size:0}every page carries (which is there so an empty paragraph is exactly as tall as the empty<x-s>written for it indocument_element.cpp:331). Scoping the font to cells only would have rendered such text at zero. Descendant scoping is enough here anyway: all 713038x-pon a spreadsheet page are inside.odr-sheet, none outside.Verification
Rendered both sides of the whole public corpus in Chrome and compared pixels: all 228 pages identical, apart from
xls/file_example_XLS_5000.xls/sheet0.html, which shows the same 140-pixel difference at the same bounding box when the tree is compared against itself — nondeterministic sticky-header rendering, not this change.Correction to an earlier claim in this PR. I first verified with
htmlcmp, which reported all 332 + 1062 files matching. That result was empty:compare-htmlshort-circuits byte-identical files without rendering them, and this PR changes only CSS, so every html file was identical and nothing was ever rendered. CI's compare step has the same blind spot. See #685 for the same correction.No reference-output update needed. Neither corpus contains a table nested inside a sheet — checked all 1144 pages — so this is preventive: it keeps one styled correctly when it does turn up.
Independent of #685; both touch
frontend.cppbut different sheets.🤖 Generated with Claude Code