about summary refs log tree commit diff stats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-15 18:08:21 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-15 18:14:41 +0100
commite75f62b34f7c7f3127bcde0c4a12cbb785342dd9 (patch)
treeedc76fb05202932b5931904f128b79d0a23def74 /src/layout
parent86d05a993463b49d2bd9cc6cb6a7af9b416f802a (diff)
downloadchawan-e75f62b34f7c7f3127bcde0c4a12cbb785342dd9.tar.gz
Fix incorrect fit-to-shrink heuristics
No guarantees that it's correct now...
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index b5365184..faf1b44c 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -439,7 +439,10 @@ proc positionInlines(bctx: BlockBox) =
   bctx.width += bctx.padding_right
 
   if bctx.computed{"width"}.auto:
-    bctx.width = min(bctx.width, bctx.compwidth)
+    if bctx.shrink:
+      bctx.width = min(bctx.width, bctx.compwidth)
+    else:
+      bctx.width = max(bctx.width, bctx.compwidth)
   else:
     bctx.width = bctx.compwidth
 
@@ -707,6 +710,7 @@ proc buildBlock(box: BlockBoxBuilder, parent: BlockBox): BlockBox =
 # Establish a new flow-root context and build a block box.
 proc buildRootBlock(box: BlockBoxBuilder, viewport: Viewport): BlockBox =
   result = viewport.newBlockBox(box)
+  result.shrink = false
   if box.inlinelayout:
     result.buildInlineLayout(box.children)
   else: