about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-05-13 19:53:46 +0200
committerbptato <nincsnevem662@gmail.com>2023-05-13 19:53:46 +0200
commit69f607d94130ca3269cffd3de24e2069fdab7b03 (patch)
tree898b84938fd89a72b9fe6eb1ca0b57202ef9a776 /src
parent24e908efc36c2dbdb824075425cb3d9bf8febdf4 (diff)
downloadchawan-69f607d94130ca3269cffd3de24e2069fdab7b03.tar.gz
layout: disregard negative underflow
Diffstat (limited to 'src')
-rw-r--r--src/layout/engine.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index db7a9854..d2aa09a9 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -393,7 +393,7 @@ proc resolveContentWidth(box: BlockBox, widthpx, availableWidth: int, isauto = f
         box.contentWidth = underflow
       else:
         box.margin_right += underflow
-    else:
+    elif underflow > 0:
       if not computed{"margin-left"}.auto and not computed{"margin-right"}.auto:
         box.margin_right += underflow
       elif not computed{"margin-left"}.auto and computed{"margin-right"}.auto:
@@ -429,6 +429,7 @@ proc resolveDimensions(box: BlockBox, availableWidth: int, availableHeight: Opti
     box.contentWidth = widthpx
     box.max_width = some(widthpx)
     box.min_width = some(widthpx)
+  eprint "resolve", computed{"width"}
   box.resolveContentWidth(widthpx, availableWidth, computed{"width"}.auto)
   if not computed{"max-width"}.auto:
     let max_width = computed{"max-width"}.px(viewport, availableWidth)