about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-10-05 19:46:20 +0200
committerbptato <nincsnevem662@gmail.com>2024-10-05 20:11:09 +0200
commit954cef984a70c6e81ec9921a7a9c6982b9ff66e0 (patch)
treecb0baac7aa844ef5a38a6c730cd5d053bb77db9a /src
parent1f6314978683e71abd09b8d028934705119f9633 (diff)
downloadchawan-954cef984a70c6e81ec9921a7a9c6982b9ff66e0.tar.gz
layout: fix floats overriding margin/padding
Diffstat (limited to 'src')
-rw-r--r--src/layout/engine.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 89cfeab3..2fef28de 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -568,8 +568,9 @@ proc initLine(ictx: var InlineContext) =
           left = ex.offset.x + ex.size.w
         else:
           right = ex.offset.x
-    ictx.lbstate.size.w = left - bfcOffset.x
-    ictx.lbstate.availableWidth = right - bfcOffset.x
+    ictx.lbstate.size.w = max(left - bfcOffset.x, 0)
+    ictx.lbstate.availableWidth = min(right - bfcOffset.x,
+      ictx.lbstate.availableWidth)
 
 proc finishLine(ictx: var InlineContext; state: var InlineState; wrap: bool;
     force = false) =