aboutsummaryrefslogtreecommitdiffstats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-07-22 22:03:25 +0200
committerbptato <nincsnevem662@gmail.com>2022-07-22 22:03:25 +0200
commitc7f25b2fe470849e028f9502d3da0851f149f065 (patch)
treeb4ccb4716d2882f9ff35a5a6ed205856b37c3ad0 /src/layout
parent6f7bcc54ab03bc31be309352c73fd8d8153f9c91 (diff)
downloadchawan-c7f25b2fe470849e028f9502d3da0851f149f065.tar.gz
Fix inline block width calculation
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 0a89c338..7b56d00b 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -466,9 +466,12 @@ proc buildInlineBlock(builder: InlineBlockBoxBuilder, parent: InlineContext, par
let pwidth = builder.computed{"width"}
if pwidth.auto:
# Half-baked shrink-to-fit
- result.bctx.width = min(max(result.bctx.width, parent.maxwidth), preferred.compwidth)
+ # Currently the misery that is determining content width is deferred to the
+ # inline layouting algorithm, which doesn't work that great but that's what
+ # we have.
+ result.bctx.width = min(parentWidth, result.bctx.width)
else:
- result.bctx.width = preferred.compwidth
+ result.bctx.width = pwidth.px(parent.viewport, parentWidth)
# Apply the block box's properties to the atom itself.
result.width = result.bctx.width