From 263c368458806d322c1ff6b46ed3b0f45afe0953 Mon Sep 17 00:00:00 2001 From: bptato Date: Fri, 10 Mar 2023 15:32:57 +0100 Subject: layout/engine: fix min-width doing the wrong thing It was being used the same way as max-width. Oops. --- src/layout/engine.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/layout') 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) -- cgit 1.4.1-2-gfad0