about summary refs log tree commit diff stats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-03-10 15:32:57 +0100
committerbptato <nincsnevem662@gmail.com>2023-03-10 15:32:57 +0100
commit263c368458806d322c1ff6b46ed3b0f45afe0953 (patch)
treebfb7f2a22e00a2022d1ddfdce79c7c334d028daa /src/layout
parenta8f42e46e83e28008a42cede0b4361b3ab0900dc (diff)
downloadchawan-263c368458806d322c1ff6b46ed3b0f45afe0953.tar.gz
layout/engine: fix min-width doing the wrong thing
It was being used the same way as max-width. Oops.
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 02e7398e..e79cd105 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -422,7 +422,7 @@ proc resolveDimensions(box: BlockBox, availableWidth: int, availableHeight: Opti
       box.resolveContentWidth(availableWidth)
   if not computed{"min-width"}.auto:
     let minWidth = computed{"min-width"}.px(viewport, availableWidth)
-    if minWidth < box.contentWidth:
+    if minWidth > box.contentWidth:
       box.contentWidth = minWidth
       box.resolveContentWidth(availableWidth)
 
@@ -536,8 +536,8 @@ proc newFlowRootBox(viewport: Viewport, builder: BoxBuilder, parentWidth: int, p
   new(result)
   result.viewport = viewport
   result.computed = builder.computed
-  result.resolveDimensions(parentWidth, parentHeight, maxContentWidth)
   result.node = builder.node
+  result.resolveDimensions(parentWidth, parentHeight, maxContentWidth)
   result.shrink = result.isShrink(nil, shrink)
 
 proc newBlockBox(parent: BlockBox, builder: BoxBuilder): BlockBox =
@@ -549,8 +549,8 @@ proc newBlockBox(parent: BlockBox, builder: BoxBuilder): BlockBox =
     some(parent.maxContentWidth)
   else:
     none(int)
-  result.resolveDimensions(parent.contentWidth, parent.contentHeight, maxContentWidth)
   result.node = builder.node
+  result.resolveDimensions(parent.contentWidth, parent.contentHeight, maxContentWidth)
 
 proc newListItem(parent: BlockBox, builder: ListItemBoxBuilder): ListItemBox =
   new(result)
@@ -561,8 +561,8 @@ proc newListItem(parent: BlockBox, builder: ListItemBoxBuilder): ListItemBox =
     some(parent.maxContentWidth)
   else:
     none(int)
-  result.resolveDimensions(parent.contentWidth, parent.contentHeight, maxContentWidth)
   result.node = builder.node
+  result.resolveDimensions(parent.contentWidth, parent.contentHeight, maxContentWidth)
 
 proc newInlineBlock(viewport: Viewport, builder: BoxBuilder, parentWidth: int, parentHeight = none(int)): InlineBlockBox =
   new(result)