diff options
author | bptato <nincsnevem662@gmail.com> | 2023-05-13 19:53:46 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-05-13 19:53:46 +0200 |
commit | 69f607d94130ca3269cffd3de24e2069fdab7b03 (patch) | |
tree | 898b84938fd89a72b9fe6eb1ca0b57202ef9a776 /src/layout | |
parent | 24e908efc36c2dbdb824075425cb3d9bf8febdf4 (diff) | |
download | chawan-69f607d94130ca3269cffd3de24e2069fdab7b03.tar.gz |
layout: disregard negative underflow
Diffstat (limited to 'src/layout')
-rw-r--r-- | src/layout/engine.nim | 3 |
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) |