diff options
author | bptato <nincsnevem662@gmail.com> | 2024-12-30 19:32:42 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-12-30 19:32:42 +0100 |
commit | 1e897b58ef26bca372777f431c9a837fb27085fd (patch) | |
tree | aa6abcca4db0dd78917a0944dd80f71da1080c0f /src | |
parent | bc3b11ebd3c2554f4f30e9afb4d46328c748e9be (diff) | |
download | chawan-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')
-rw-r--r-- | src/css/layout.nim | 6 |
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 = { |