about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-19 23:58:43 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-20 00:00:31 +0200
commit503925d2c91e967d51354e322daec4feb62e7ff7 (patch)
treeec54cb6a735178ad0991569f19f4cc1d6596852d
parent485fff96292f737879c92973ca3c06755f95ffdf (diff)
downloadchawan-503925d2c91e967d51354e322daec4feb62e7ff7.tar.gz
layout: fix a list style positioning bug
If we are going to move out the child's offset, then we must also tell
the child where it starts so it can behave correctly when it encounters
exclusions.
-rw-r--r--src/layout/engine.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 3cfaf10f..aafa703d 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -1364,7 +1364,7 @@ proc layoutListItem(bctx: var BlockContext; box: BlockBox;
     let innerBox = BlockBox(
       computed: builder.content.computed,
       node: builder.node,
-      offset: Offset(x: sizes.margin.left),
+      offset: box.offset,
       margin: sizes.margin
     )
     bctx.layoutFlow(innerBox, builder.content, sizes)
@@ -1388,7 +1388,7 @@ proc layoutListItem(bctx: var BlockContext; box: BlockBox;
     box.firstBaseline = innerBox.firstBaseline
     box.size = innerBox.size
     # move innerBox margin & offset to outer box
-    box.offset += innerBox.offset
+    box.offset = innerBox.offset
     box.margin = innerBox.margin
     innerBox.offset = Offset()
     innerBox.margin = RelativeRect()