From 1718e2a7c1852a1bc3722d1a42a18b7a6ab2d879 Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 15 Dec 2024 20:54:47 +0100 Subject: layout: set table intrinsic min width to specified width --- src/css/layout.nim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/css') 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] -- cgit