aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-11-01 18:47:22 +0100
committerbptato <nincsnevem662@gmail.com>2024-11-01 18:50:29 +0100
commit5a974748ca5284019990b77df9cd022fa869457e (patch)
tree4d4801a428a6518ec7083e3bd2a0c3831857d597 /src
parent27777165ac20e604da1a714212ebc4c1f235bb15 (diff)
downloadchawan-5a974748ca5284019990b77df9cd022fa869457e.tar.gz
layout: fix yet another inline float bug
you can't just set the BFC offset to your own offset when the BFC's origin is your inner offset. (in block layout, this is addressed by initBlockPositionStates & co, but we don't call that for inline because the offset is already resolved there anyway. so this is a special case)
Diffstat (limited to 'src')
-rw-r--r--src/layout/engine.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 6de88844..9f176437 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -1382,7 +1382,10 @@ proc positionFloats(bctx: var BlockContext) =
bctx.unpositionedFloats.setLen(0)
proc layoutInline(bctx: var BlockContext; box: BlockBox; sizes: ResolvedSizes) =
- let bfcOffset = bctx.bfcOffset + box.state.offset
+ let bfcOffset = if bctx.parentBps != nil:
+ bctx.parentBps.offset + box.state.offset
+ else: # this block establishes a new BFC.
+ offset(0, 0)
var ictx = bctx.initInlineContext(sizes.space, bfcOffset, sizes.padding,
box.computed)
ictx.initLine()