diff options
author | bptato <nincsnevem662@gmail.com> | 2023-03-10 15:32:57 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-03-10 15:32:57 +0100 |
commit | 263c368458806d322c1ff6b46ed3b0f45afe0953 (patch) | |
tree | bfb7f2a22e00a2022d1ddfdce79c7c334d028daa /src/layout | |
parent | a8f42e46e83e28008a42cede0b4361b3ab0900dc (diff) | |
download | chawan-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.nim | 8 |
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) |