about summary refs log tree commit diff stats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-18 17:11:12 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-18 17:11:12 +0200
commit6b59f74118b276c5fcf9a0b4b5c91a78b3bc8ced (patch)
tree708b8a3b1342fad61be1a7e33b9c0add243f28e2 /src/layout
parentb0b42add82cb6ad1ee2fa2d207d1068a7cde3413 (diff)
downloadchawan-6b59f74118b276c5fcf9a0b4b5c91a78b3bc8ced.tar.gz
layout: reuse box.positioned in positionAbsolute
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 97317444..ae996bdb 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -1605,16 +1605,16 @@ proc positionAbsolute(lctx: LayoutState; box: BlockBox; margin: RelativeRect) =
   let parentWidth = applySizeConstraint(lctx.attrs.width_px, last.w)
   let parentHeight = applySizeConstraint(lctx.attrs.height_px, last.h)
   if not left.auto:
-    box.offset.x = left.px(lctx, parentWidth)
+    box.offset.x = box.positioned.left
     box.offset.x += margin.left
   elif not right.auto:
-    box.offset.x = parentWidth - right.px(lctx, parentWidth) - box.size.w
+    box.offset.x = parentWidth - box.positioned.right - box.size.w
     box.offset.x -= margin.right
   if not top.auto:
-    box.offset.y = top.px(lctx, parentHeight)
+    box.offset.y = box.positioned.top
     box.offset.y += margin.top
   elif not bottom.auto:
-    box.offset.y = parentHeight - bottom.px(lctx, parentHeight) - box.size.h
+    box.offset.y = parentHeight - box.positioned.bottom - box.size.h
     box.offset.y -= margin.bottom
 
 proc positionRelative(parent, box: BlockBox) =