about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/layout/renderdocument.nim9
-rw-r--r--test/layout/bottom-property-non-absolute.expected2
-rw-r--r--test/layout/bottom-property-non-absolute.html2
3 files changed, 9 insertions, 4 deletions
diff --git a/src/layout/renderdocument.nim b/src/layout/renderdocument.nim
index c247a7fe..0652e888 100644
--- a/src/layout/renderdocument.nim
+++ b/src/layout/renderdocument.nim
@@ -411,10 +411,11 @@ proc renderBlockBox(grid: var FlexibleGrid; state: var RenderState;
     if box == nil: # positioned marker
       discard state.absolutePos.pop()
       continue
-    if not box.computed{"left"}.auto or not box.computed{"right"}.auto:
-      offset.x = state.absolutePos[^1].x
-    if not box.computed{"top"}.auto or not box.computed{"bottom"}.auto:
-      offset.y = state.absolutePos[^1].y
+    if box.computed{"position"} == PositionAbsolute:
+      if not box.computed{"left"}.auto or not box.computed{"right"}.auto:
+        offset.x = state.absolutePos[^1].x
+      if not box.computed{"top"}.auto or not box.computed{"bottom"}.auto:
+        offset.y = state.absolutePos[^1].y
     offset += box.state.offset
     if box.computed{"position"} != PositionStatic:
       state.absolutePos.add(offset)
diff --git a/test/layout/bottom-property-non-absolute.expected b/test/layout/bottom-property-non-absolute.expected
new file mode 100644
index 00000000..dec2cbe1
--- /dev/null
+++ b/test/layout/bottom-property-non-absolute.expected
@@ -0,0 +1,2 @@
+test
+test
diff --git a/test/layout/bottom-property-non-absolute.html b/test/layout/bottom-property-non-absolute.html
new file mode 100644
index 00000000..817aa289
--- /dev/null
+++ b/test/layout/bottom-property-non-absolute.html
@@ -0,0 +1,2 @@
+<div>test<div>
+<div style="bottom: 0">test</div>