about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/layout/engine.nim2
-rw-r--r--test/layout/fit-content-max-width-child.expected2
-rw-r--r--test/layout/fit-content-max-width-child.html5
3 files changed, 8 insertions, 1 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index b40f15d4..e8f8a02b 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -899,7 +899,7 @@ proc resolveContentWidth(sizes: var ResolvedSizes; widthpx: LayoutUnit;
   let total = widthpx + sizes.margin[dtHorizontal].sum() +
     sizes.padding[dtHorizontal].sum()
   let underflow = parentWidth.u - total
-  if isauto or sizes.space.w.t == scFitContent:
+  if isauto:
     if underflow >= 0:
       sizes.space.w = SizeConstraint(t: sizes.space.w.t, u: underflow)
     else:
diff --git a/test/layout/fit-content-max-width-child.expected b/test/layout/fit-content-max-width-child.expected
new file mode 100644
index 00000000..2d6235b7
--- /dev/null
+++ b/test/layout/fit-content-max-width-child.expected
@@ -0,0 +1,2 @@
+testing testing testing testing testing testing testing testing
+testing testing
diff --git a/test/layout/fit-content-max-width-child.html b/test/layout/fit-content-max-width-child.html
new file mode 100644
index 00000000..c2d77ad1
--- /dev/null
+++ b/test/layout/fit-content-max-width-child.html
@@ -0,0 +1,5 @@
+<div style="display: inline-block">
+<div style="max-width: 70ch">
+testing testing testing testing testing testing testing testing testing testing
+</div>
+</div>