aboutsummaryrefslogtreecommitdiffstats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-12-30 19:32:42 +0100
committerbptato <nincsnevem662@gmail.com>2024-12-30 19:32:42 +0100
commit1e897b58ef26bca372777f431c9a837fb27085fd (patch)
treeaa6abcca4db0dd78917a0944dd80f71da1080c0f /src/css
parentbc3b11ebd3c2554f4f30e9afb4d46328c748e9be (diff)
downloadchawan-1e897b58ef26bca372777f431c9a837fb27085fd.tar.gz
layout: fix position: relative for right, bottom
They are relative to the box's actual position, not that of the parent: > For relatively positioned boxes, the offset is with respect to the > bottom edge of the box itself.
Diffstat (limited to 'src/css')
-rw-r--r--src/css/layout.nim6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim
index 66839327..6869ae21 100644
--- a/src/css/layout.nim
+++ b/src/css/layout.nim
@@ -1763,13 +1763,11 @@ proc positionRelative(lctx: LayoutContext; parent, box: BlockBox) =
if box.computed{"left"}.u != clAuto:
box.state.offset.x += positioned.left
elif box.computed{"right"}.u != clAuto:
- box.state.offset.x += parent.state.size.w - box.state.size.w -
- positioned.right
+ box.state.offset.x -= positioned.right
if box.computed{"top"}.u != clAuto:
box.state.offset.y += positioned.top
elif box.computed{"bottom"}.u != clAuto:
- box.state.offset.y += parent.state.size.h - box.state.size.h -
- positioned.bottom
+ box.state.offset.y -= positioned.bottom
# Note: caption is not included here
const RowGroupBox = {