about summary refs log tree commit diff stats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-05-14 14:23:18 +0200
committerbptato <nincsnevem662@gmail.com>2023-05-14 14:23:18 +0200
commit951d587f7edf3544d30ba039530a1d19b7e9db78 (patch)
tree647bb267c5cb90ac2d24d38bfd7935e603166357 /src/layout
parent755c1b7ece20de688c3f103f11b71055f6a4c727 (diff)
downloadchawan-951d587f7edf3544d30ba039530a1d19b7e9db78.tar.gz
min-height, max-height fixes
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index f46190e8..19937d92 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -453,20 +453,20 @@ proc resolveDimensions(box: BlockBox, availableWidth: int, availableHeight: Opti
   if not computed{"max-height"}.auto:
     if computed{"max-height"}.unit != UNIT_PERC:
       let maxHeight = computed{"max-height"}.px(viewport)
-      if box.contentHeight.isNone or maxHeight > box.contentHeight.get:
+      if box.contentHeight.isSome and maxHeight < box.contentHeight.get:
         box.contentHeight = some(maxHeight)
     elif availableHeight.isSome:
       let maxHeight = computed{"max-height"}.px(viewport, availableHeight.get)
-      if box.contentHeight.isNone or maxHeight > box.contentHeight.get:
+      if box.contentHeight.isSome and maxHeight < box.contentHeight.get:
         box.contentHeight = some(maxHeight)
   if not computed{"min-height"}.auto:
     if computed{"min-height"}.unit != UNIT_PERC:
       let minHeight = computed{"min-height"}.px(viewport)
-      if minHeight < box.contentHeight.get(0):
+      if minHeight > box.contentHeight.get(0):
         box.contentHeight = some(minHeight)
     elif availableHeight.isSome:
       let minHeight = computed{"min-height"}.px(viewport, availableHeight.get)
-      if minHeight < box.contentHeight.get(0):
+      if minHeight > box.contentHeight.get(0):
         box.contentHeight = some(minHeight)
   # if no max content width is supplied, just use regular content width.
   box.maxContentWidth = maxContentWidth.get(box.contentWidth)