From b177168e78703765c65e4ef24cd911083497af49 Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 4 Jun 2024 19:26:52 +0200 Subject: layout: minor cleanup --- src/layout/engine.nim | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/layout/engine.nim') diff --git a/src/layout/engine.nim b/src/layout/engine.nim index 4e6e9870..b40f15d4 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -1272,7 +1272,6 @@ type offset: Offset maxChildWidth: LayoutUnit totalFloatWidth: LayoutUnit # used for re-layouts - maxChildOverflowWidth: LayoutUnit space: AvailableSpace xminwidth: LayoutUnit prevParentBps: BlockPositionState @@ -1429,8 +1428,7 @@ proc addInlineBlock(ictx: var InlineContext; state: var InlineState; let marginBottom = bctx.marginTodo.sum() # If the highest float edge is higher than the box itself, set that as # the box height. - if bctx.maxFloatHeight > box.state.size.h + marginBottom: - box.state.size.h = bctx.maxFloatHeight - marginBottom + box.state.size.h = max(box.state.size.h, bctx.maxFloatHeight - marginBottom) box.state.offset.y = 0 # Apply the block box's properties to the atom itself. let iblock = InlineAtom( @@ -2069,8 +2067,7 @@ proc layoutFlexChild(lctx: LayoutContext; box: BlockBox; sizes: ResolvedSizes) = assert bctx.unpositionedFloats.len == 0 # If the highest float edge is higher than the box itself, set that as # the box height. - if bctx.maxFloatHeight > box.state.offset.y + box.state.size.h: - box.state.size.h = bctx.maxFloatHeight - box.state.offset.y + box.state.size.h = max(box.state.size.h, bctx.maxFloatHeight) type FlexWeightType = enum @@ -2254,8 +2251,8 @@ proc layoutRootBlock(lctx: LayoutContext; box: BlockBox; marginBottomOut = bctx.marginTodo.sum() # If the highest float edge is higher than the box itself, set that as # the box height. - if bctx.maxFloatHeight > box.state.size.h + marginBottomOut: - box.state.size.h = bctx.maxFloatHeight - marginBottomOut + box.state.size.h = max(box.state.size.h, bctx.maxFloatHeight - + marginBottomOut) proc initBlockPositionStates(state: var BlockState; bctx: var BlockContext; box: BlockBox) = -- cgit 1.4.1-2-gfad0