about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-26 01:49:13 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-26 01:49:13 +0100
commit7a04d25fea9720bba9812d6912e8258c06ae2f80 (patch)
treeaab04156982ef5e7cd2f92b85fecd7c953194e2f
parent62491fab5e6034f97b8ce71f1eb8454fd2adca29 (diff)
downloadchawan-7a04d25fea9720bba9812d6912e8258c06ae2f80.tar.gz
layout: also round line height for painting backgrounds
it's pointless to do otherwise, and results in inconsistencies between
line positioning and background coloring.
-rw-r--r--src/layout/engine.nim5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 8a56f110..48284408 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -436,9 +436,6 @@ proc verticalAlignLine(ictx: var InlineContext) =
     ictx.currentLine.minHeight = max(ictx.currentLine.minHeight,
       atom.offset.y - offsety + atom.size.h)
 
-  # Set the line height that will be used for painting to new top edge + old
-  # bottom edge, and set the baseline.
-  ictx.currentLine.line.height = max(bottomEdge + marginTop, lineheight)
   ictx.currentLine.baseline = baseline
   #TODO this does not really work with rounding :/
   ictx.currentLine.baseline += ictx.currentLine.paddingTop
@@ -453,6 +450,8 @@ proc verticalAlignLine(ictx: var InlineContext) =
   # we would swallow hard line breaks with <br>.)
   if lineheight >= ch and ictx.currentLine.size.h < ch:
     ictx.currentLine.size.h = ch
+  # Set the line height to size.h.
+  ictx.currentLine.line.height = ictx.currentLine.size.h
 
 proc putAtom(state: var LineBoxState; atom: InlineAtom;
     iastate: InlineAtomState; fragment: InlineFragment) =