about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-12-30 19:05:08 +0100
committerbptato <nincsnevem662@gmail.com>2024-12-30 19:05:08 +0100
commitde759debe31d67776a7a70d3d4dc41a89591cdfc (patch)
treebd9c35446ad0b0e9e5b607097165bbfda8f0ab34
parent9bcb5285a871c80ca3f018f25a05dab2cc95325d (diff)
downloadchawan-de759debe31d67776a7a70d3d4dc41a89591cdfc.tar.gz
layout: fix an overflow bug
-rw-r--r--src/css/layout.nim4
-rw-r--r--test/layout/overflow-auto-still-sets-intrinisc-min-height.expected9
-rw-r--r--test/layout/overflow-auto-still-sets-intrinisc-min-height.html17
3 files changed, 29 insertions, 1 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim
index c62d14a9..66839327 100644
--- a/src/css/layout.nim
+++ b/src/css/layout.nim
@@ -1244,12 +1244,14 @@ proc applyIntr(box: BlockBox; sizes: ResolvedSizes; intr: Size) =
       box.state.intr[dim] = intr[dim].minClamp(sizes.bounds.mi[dim])
     else:
       # We do not have a scroll bar, so do the next best thing: expand the
-      # box to the size its contents want.
+      # box to the size its contents want.  (Or the specified size, if
+      # it's greater.)
       #TODO intrinsic minimum size isn't really guaranteed to equal the
       # desired scroll size. Also, it's possible that a parent box clamps
       # the height of this box; in that case, the parent box's
       # width/height should be clamped to the inner scroll width/height
       # instead.
+      box.state.intr[dim] = max(intr[dim], sizes.bounds.mi[dim].start)
       box.state.size[dim] = max(box.state.size[dim], intr[dim])
 
 proc applyBaseline(box: BlockBox) =
diff --git a/test/layout/overflow-auto-still-sets-intrinisc-min-height.expected b/test/layout/overflow-auto-still-sets-intrinisc-min-height.expected
new file mode 100644
index 00000000..efae2da0
--- /dev/null
+++ b/test/layout/overflow-auto-still-sets-intrinisc-min-height.expected
@@ -0,0 +1,9 @@
+
+test
+test
+test
+test
+test
+test
+
+footer footer footer footer
diff --git a/test/layout/overflow-auto-still-sets-intrinisc-min-height.html b/test/layout/overflow-auto-still-sets-intrinisc-min-height.html
new file mode 100644
index 00000000..1b0636c5
--- /dev/null
+++ b/test/layout/overflow-auto-still-sets-intrinisc-min-height.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<div style="height: 2em; display: flex; flex-direction: column">
+<div>
+<div style="overflow: auto; height: 2ch">
+<pre>
+test
+test
+test
+test
+test
+test
+</pre>
+</div>
+</div>
+<div>
+
+footer footer footer footer