diff options
| -rw-r--r-- | src/css/layout.nim | 3 | ||||
| -rw-r--r-- | test/layout/table-width-sets-intrinsic-min-width.expected | 4 | ||||
| -rw-r--r-- | test/layout/table-width-sets-intrinsic-min-width.html | 14 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim index 3372d9da..1539e5c1 100644 --- a/src/css/layout.nim +++ b/src/css/layout.nim @@ -2191,6 +2191,8 @@ proc layoutCaption(tctx: TableContext; parent, box: BlockBox) = # cell's width to min_width, then re-do the distribution. proc layoutTable(tctx: var TableContext; table: BlockBox; sizes: ResolvedSizes) = + if tctx.space.w.t == scStretch: + table.state.xminwidth = tctx.space.w.u let lctx = tctx.lctx if table.computed{"border-collapse"} != BorderCollapseCollapse: let spc = table.computed{"border-spacing"} @@ -2216,6 +2218,7 @@ proc layoutTableWrapper(bctx: BlockContext; box: BlockBox; box.state.size = table.state.size box.state.baseline = table.state.size.h box.state.firstBaseline = table.state.size.h + box.state.xminwidth = table.state.xminwidth if box.children.len > 1: # do it here, so that caption's box can stretch to our width let caption = box.children[1] diff --git a/test/layout/table-width-sets-intrinsic-min-width.expected b/test/layout/table-width-sets-intrinsic-min-width.expected new file mode 100644 index 00000000..9703304a --- /dev/null +++ b/test/layout/table-width-sets-intrinsic-min-width.expected @@ -0,0 +1,4 @@ + 2222 + 1111 1111 1111 1111 2222 + 2222 + 2222 diff --git a/test/layout/table-width-sets-intrinsic-min-width.html b/test/layout/table-width-sets-intrinsic-min-width.html new file mode 100644 index 00000000..12258cf0 --- /dev/null +++ b/test/layout/table-width-sets-intrinsic-min-width.html @@ -0,0 +1,14 @@ +<table width=200> +<tr> +<td width=10%> +<table width=200> +<tr> +<td> +1111 1111 1111 1111 +</table> +</td> +<td> +<table> +<tr> +<td width=100%> +2222 2222 2222 2222 |