about summary refs log tree commit diff stats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-18 19:34:49 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-18 19:36:07 +0200
commit1fc146069f0a66f82f236e65f1fd12fc50b92ce2 (patch)
tree7c91186ca9d0c28daf28c5b75708c265ea90407e /src/layout
parent6b59f74118b276c5fcf9a0b4b5c91a78b3bc8ced (diff)
downloadchawan-1fc146069f0a66f82f236e65f1fd12fc50b92ce2.tar.gz
layout: fix maxFloatHeight check
Including our own position is a mistake, since the BFC starts from the
inner box.
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index ae996bdb..ca3c9c5e 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -1472,8 +1472,8 @@ 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.offset.y + box.size.h + marginBottom:
-    box.size.h = bctx.maxFloatHeight - box.offset.y - marginBottom
+  if bctx.maxFloatHeight > box.size.h + marginBottom:
+    box.size.h = bctx.maxFloatHeight - marginBottom
   box.offset.y = 0
   # Apply the block box's properties to the atom itself.
   let iblock = InlineAtom(
@@ -1625,7 +1625,7 @@ proc positionRelative(parent, box: BlockBox) =
   if not box.computed{"top"}.auto:
     box.offset.y += box.positioned.top
   elif not box.computed{"bottom"}.auto:
-    box.offset.y -= parent.size.h - box.positioned.bottom - box.size.h
+    box.offset.y += parent.size.h - box.positioned.bottom - box.size.h
 
 const ProperTableChild = RowGroupBox + {
   DisplayTableRow, DisplayTableColumn, DisplayTableColumnGroup,
@@ -2371,8 +2371,8 @@ proc layoutRootBlock(lctx: LayoutState; builder: BoxBuilder;
   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.offset.y + box.size.h + marginBottomOut:
-    box.size.h = bctx.maxFloatHeight - box.offset.y - marginBottomOut
+  if bctx.maxFloatHeight > box.size.h + marginBottomOut:
+    box.size.h = bctx.maxFloatHeight - marginBottomOut
   return box
 
 proc initBlockPositionStates(state: var BlockState; bctx: var BlockContext;