Repository navigation
feat(layout,paint): implement border-collapse - #439
Merged
Merged
Conversation
Wikipedia's .wikitable class (used 88 times on, e.g., "List of countries by population") sets an identical border on both the <table> and every cell; under this engine's always-separate model the table's own border painted as an extra stroke outside the outermost cells', roughly doubling the visible perimeter versus a real browser's merged collapsed line. Adds css.Style.BorderCollapse (parsed, inherited) and Box.SuppressOwnBorder, set by layout.table once a collapsed table has a real cell and read by paint's generic border step. Scoped to the table-vs-outermost-cell conflict only, not the full CSS 2.1 border-conflict-resolution algorithm. Co-Authored-By: Claude Sonnet 5 <[email protected]>
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.
Summary
Implements
border-collapse.Closes #438.
Wikipedia's
.wikitableclass (used 88 times on, e.g., "List of countries by population") sets an identical border on both the<table>element and every cell:Under this engine's previously always-
separatemodel, the table's own border box painted as an extra stroke outside the outermost cells' own border — roughly doubling the visible perimeter thickness versus a real browser's single merged collapsed line. A prior survey had concludedborder-collapsewas "a likely genuine no-op," but that was based on pkg.go.dev's rule, which sets no border at all on the<table>element, so there was nothing to double against there. Wikitable's case is different and genuinely visible.css.Style.BorderCollapse bool, parsed fromborder-collapse: collapse|separate, inherited per spec alongsideBorderSpacingH/V.layout.tableforcesborder-spacingto 0 when collapsed, regardless of what's declared (CSS 2.1: spacing has no effect once collapsed).Box.SuppressOwnBorder, set on a collapsed table's own box once it has at least one real cell, read bypaint's generic border step.Test plan
css/parse_test.go:TestApplyBorderCollapse(mirrorsTestApplyBorderSpacing's own shape: initial value, explicit set, invalid value no-op, default inheritance, explicitinherit).layout/bordercollapse_test.go: border-spacing forced to 0 when collapsed;SuppressOwnBorderset only once a real cell exists (never on an empty table, never underseparate).paint/paint_test.go:TestPaintTableSuppressesOwnBorderWhenCollapsed— the actual pixel-level defect. The corner pixel only the table's own border stroke reaches is red underseparate, white undercollapse, while the cell's own border pixel stays red either way.BorderCollapse/SuppressOwnBorderundefined).go build/go vet/gofmt -l/go test ./.../govulncheck ./...clean.css99.5%,layout100.0%,paint100.0% coverage (all at their floors).webengine_nojs webengine_nonet webengine_fontsextbuild-tag lane builds and vets clean.🤖 Generated with Claude Code