diff --git a/crates/obscura-render/src/style.rs b/crates/obscura-render/src/style.rs index 139cd05..a2f6e69 100644 --- a/crates/obscura-render/src/style.rs +++ b/crates/obscura-render/src/style.rs @@ -2859,6 +2859,33 @@ mod tests { assert!(invalid.internal_flex_container); } + #[test] + fn table_ua_geometry_and_border_collapse_parse() { + let table = compute_style("table", None); + assert_eq!(table.box_sizing, crate::BoxSizing::BorderBox); + assert_eq!(table.border_spacing, Some((2.0, 2.0))); + assert_eq!(table.border_collapse, Some(false)); + + let cell = compute_style("td", None); + assert_eq!( + cell.padding, + Edges { + top: 1.0, + right: 1.0, + bottom: 1.0, + left: 1.0, + } + ); + assert_eq!(cell.vertical_align, None); + + let collapsed = compute_style( + "table", + Some("border-spacing:8px; border-collapse:collapse"), + ); + assert_eq!(collapsed.border_spacing, Some((8.0, 8.0))); + assert_eq!(collapsed.border_collapse, Some(true)); + } + #[test] fn item_self_alignment_parses_and_resets() { let aligned = compute_style( diff --git a/render-repros/checks.json b/render-repros/checks.json index 6bbb9cb..518fad8 100644 --- a/render-repros/checks.json +++ b/render-repros/checks.json @@ -209,6 +209,21 @@ "tables": [ {"name": "content-box fixed cell column", "color": "#ffcc99", "width": 208} ], + "table-track-geometry": [ + {"name": "separate spacing reserves the outer table edges", "color": "#ffcc99", "x": 2, "y": 2, "width": 208, "height": 23}, + {"name": "auto column receives max-content width", "color": "#74c0fc", "x": 212, "y": 2, "width": 54, "height": 23}, + {"name": "percentage column resolves against track space", "color": "#69db7c", "x": 2, "y": 52, "width": 197, "height": 20}, + {"name": "auto column absorbs definite-table surplus", "color": "#f783ac", "x": 201, "y": 52, "width": 197, "height": 20}, + {"name": "cellpadding zero overrides the UA cell padding", "color": "#9775fa", "x": 0, "y": 100, "width": 40, "height": 18}, + {"name": "cellpadding keeps adjacent tracks contiguous", "color": "#ffa94d", "x": 40, "y": 100, "width": 50, "height": 18}, + {"name": "author cell padding wins over cellpadding", "color": "#22b8cf", "x": 0, "y": 140, "width": 46, "height": 24}, + {"name": "collapsed table suppresses declared spacing", "color": "#e64980", "x": 0, "y": 190, "width": 40, "height": 20}, + {"name": "collapsed tracks share an edge", "color": "#15aabf", "x": 40, "y": 190, "width": 50, "height": 20}, + {"name": "row-group default vertically centers cell content", "color": "#5f3dc4", "x": 0, "y": 260, "width": 20, "height": 20}, + {"name": "row vertical-align inherits into its cells", "color": "#f08c00", "x": 100, "y": 280, "width": 20, "height": 20}, + {"name": "cell vertical-align overrides the row default", "color": "#2b8a3e", "x": 200, "y": 240, "width": 20, "height": 20}, + {"name": "UA cell padding is one pixel on every edge", "color": "#1971c2", "x": 2, "y": 332, "width": 12, "height": 12} + ], "text-align-flex-items": [ {"name": "text alignment does not shrink a flex item", "color": "#087f5b", "x": 20, "y": 20, "width": 360, "height": 80}, {"name": "inherited text alignment centers inline content", "color": "#c2255c", "x": 150, "y": 100, "width": 100, "height": 20} diff --git a/render-repros/table-track-geometry.html b/render-repros/table-track-geometry.html new file mode 100644 index 0000000..4c4d3e3 --- /dev/null +++ b/render-repros/table-track-geometry.html @@ -0,0 +1,99 @@ + + + + + table track geometry + + + + + + +
fixed 200auto col
second row same colx
+ + + +
+ + + + + + +
+ + + +
+ + + + + + +
+ + + +
+ + +
+ + +
+ + + +
+ +