summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/layout.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/render/layout.c b/render/layout.c
index 391f884b5..6875bce61 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -2318,6 +2318,7 @@ void layout_position_relative(struct box *root)
if (!root)
return;
+ /* Normal children */
for (box = root->children; box; box = box->next) {
int x, y;
@@ -2349,6 +2350,39 @@ void layout_position_relative(struct box *root)
}
}
}
+
+ /* Absolute children */
+ for (box = root->absolute_children; box; box = box->next) {
+ int x, y;
+
+ if (box->type == BOX_TEXT)
+ continue;
+
+ /* recurse first */
+ layout_position_relative(box);
+
+ /* Ignore things we're not interested in. */
+ if (!box->style || (box->style &&
+ box->style->position != CSS_POSITION_RELATIVE))
+ continue;
+
+ layout_compute_relative_offset(box, &x, &y);
+
+ box->x += x;
+ box->y += y;
+
+ /* Handle INLINEs - their "children" are in fact
+ * the sibling boxes between the INLINE and
+ * INLINE_END boxes */
+ if (box->type == BOX_INLINE && box->inline_end) {
+ struct box *b;
+ for (b = box->next; b && b != box->inline_end;
+ b = b->next) {
+ b->x += x;
+ b->y += y;
+ }
+ }
+ }
}