about summary refs log tree commit diff stats
path: root/src/layout/engine.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-06-04 19:26:52 +0200
committerbptato <nincsnevem662@gmail.com>2024-06-04 19:35:15 +0200
commitb177168e78703765c65e4ef24cd911083497af49 (patch)
tree32b0b8d6d4b95b1dba666e777d7aeba4c5986e93 /src/layout/engine.nim
parentf081b787090045bb23c4de7bb4d866e963484b7f (diff)
downloadchawan-b177168e78703765c65e4ef24cd911083497af49.tar.gz
layout: minor cleanup
Diffstat (limited to 'src/layout/engine.nim')
-rw-r--r--src/layout/engine.nim11
1 files changed, 4 insertions, 7 deletions
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) =