diff options
author | bptato <nincsnevem662@gmail.com> | 2022-11-15 18:08:21 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-11-15 18:14:41 +0100 |
commit | e75f62b34f7c7f3127bcde0c4a12cbb785342dd9 (patch) | |
tree | edc76fb05202932b5931904f128b79d0a23def74 /src/layout | |
parent | 86d05a993463b49d2bd9cc6cb6a7af9b416f802a (diff) | |
download | chawan-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.nim | 6 |
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: |