aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-22 02:45:31 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-22 02:51:43 +0100
commit91d1e18d42a63d355095cf20bbd1767ecd2393fc (patch)
tree816806bc53558cda22be370d2a2cb9f5016436e6 /src
parent66ab7eac3898ba5b350a913627eefacb1ad2b1db (diff)
downloadchawan-91d1e18d42a63d355095cf20bbd1767ecd2393fc.tar.gz
layout: do not apply error correction to first line
The first line is already ignored in the calculations, but it was still being re-positioned in positionAtoms, which made lines overlap in some cases.
Diffstat (limited to 'src')
-rw-r--r--src/layout/engine.nim9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 967435b1..170e6443 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -1446,12 +1446,11 @@ proc positionAtoms(ictx: var InlineContext) =
ictx.errorY / H
else:
0
- var i = 1
- for line in ictx.lines:
+ for i in 1 ..< ictx.lines.len:
let erry0 = erry * i
- for atom in line.atoms:
- atom.offset.y += line.offsety - erry0
- inc i
+ let offsety = ictx.lines[i].offsety
+ for atom in ictx.lines[i].atoms:
+ atom.offset.y += offsety - erry0
proc layoutRootInline(bctx: var BlockContext, inlines: seq[BoxBuilder],
space: AvailableSpace, computed: CSSComputedValues, offset,