diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-10 23:23:23 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-10 23:28:02 +0100 |
commit | b787ab592f582fc4e6c9feb7dbec2820aa2f2c7b (patch) | |
tree | 2894707e6306f20099ce1e0c0e4dd473ca2b17bc /src/layout | |
parent | 866eef2fddfe5e02911a9783ca8b0d788f09241a (diff) | |
download | chawan-b787ab592f582fc4e6c9feb7dbec2820aa2f2c7b.tar.gz |
layout: do not resolve floats if grandparent position is resolved
Instead, position them at the end of their block's layout pass. Without this, they could be positioned too early, as the grandparent's position being resolved does not guarantee that the parent's position has already been resolved as well. (Unlike the comment suggests, flushMargins is not appropriate there.)
Diffstat (limited to 'src/layout')
-rw-r--r-- | src/layout/engine.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim index 3b153b36..92a1e251 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -2210,7 +2210,7 @@ proc layoutBlockChildren(state: var BlockState, bctx: var BlockContext, # * if our saved marginTarget and bctx's marginTarget no longer point # to the same object, that means our (or an ancestor's) offset has # been resolved, i.e. we can position floats already. - if state.isParentResolved(bctx): + if bctx.marginTarget != state.initialMarginTarget: # y offset resolved bctx.positionFloat(child, state.space, bctx.parentBps.offset) else: @@ -2311,7 +2311,7 @@ proc buildBlockLayout(bctx: var BlockContext, box: BlockBox, # be passed onto the next box. Set marginTarget to nil, so that if we # (or one of our ancestors) was still set as a marginTarget, it no # longer is. - #TODO we might need flushMargin & positionFloats here + bctx.positionFloats() bctx.marginTarget = nil # Reset parentBps to the previous node. bctx.parentBps = state.prevParentBps |