diff options
author | bptato <nincsnevem662@gmail.com> | 2024-12-15 19:09:46 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-12-15 19:09:46 +0100 |
commit | 167f8f764974bfabbbf68a013218c90c9cdfac0b (patch) | |
tree | 284c56eb1f77b77a93ad6b99332bd3151bbc57f7 /src | |
parent | 14bdce675c0169e3643f5cf4f708c3721a9d29e2 (diff) | |
download | chawan-167f8f764974bfabbbf68a013218c90c9cdfac0b.tar.gz |
layout: do not trust specified table cell height
If the contents are larger than the specified cell height, then it is simply ignored.
Diffstat (limited to 'src')
-rw-r--r-- | src/css/layout.nim | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim index f32cba2c..3372d9da 100644 --- a/src/css/layout.nim +++ b/src/css/layout.nim @@ -1796,13 +1796,11 @@ proc layoutTableCell(lctx: LayoutContext; box: BlockBox; space: AvailableSpace) = var sizes = ResolvedSizes( padding: lctx.resolvePadding(space.w, box.computed), - space: space, + space: availableSpace(w = space.w, h = maxContent()), bounds: DefaultBounds ) if sizes.space.w.isDefinite(): sizes.space.w.u -= sizes.padding[dtHorizontal].sum() - if sizes.space.h.isDefinite(): - sizes.space.h.u -= sizes.padding[dtVertical].sum() box.state = BoxLayoutState() var bctx = BlockContext(lctx: lctx) bctx.layoutFlow(box, sizes) @@ -1812,6 +1810,9 @@ proc layoutTableCell(lctx: LayoutContext; box: BlockBox; # If the highest float edge is higher than the box itself, set that as # the box height. box.state.size.h = max(box.state.size.h, bctx.maxFloatHeight) + if space.h.t == scStretch: + box.state.size.h = max(box.state.size.h, space.h.u - + sizes.padding[dtVertical].sum()) # A table cell's minimum width overrides its width. box.state.size.w = max(box.state.size.w, box.state.xminwidth) |