aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/css/layout.nim7
-rw-r--r--test/layout/table-intrinsic-height-overrides-specified-height.expected2
-rw-r--r--test/layout/table-intrinsic-height-overrides-specified-height.html8
3 files changed, 14 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)
diff --git a/test/layout/table-intrinsic-height-overrides-specified-height.expected b/test/layout/table-intrinsic-height-overrides-specified-height.expected
new file mode 100644
index 00000000..b6a17be1
--- /dev/null
+++ b/test/layout/table-intrinsic-height-overrides-specified-height.expected
@@ -0,0 +1,2 @@
+ test
+ test
diff --git a/test/layout/table-intrinsic-height-overrides-specified-height.html b/test/layout/table-intrinsic-height-overrides-specified-height.html
new file mode 100644
index 00000000..24992c6a
--- /dev/null
+++ b/test/layout/table-intrinsic-height-overrides-specified-height.html
@@ -0,0 +1,8 @@
+<table>
+<tr>
+<td height=1>
+test
+</tr>
+<tr>
+<td>
+test