summaryrefslogtreecommitdiff
path: root/render/layout.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-06-26 22:24:42 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-06-26 22:24:42 +0000
commit61dc91e0c553ef6c1e7bf3e4061fdbbbfa28fad4 (patch)
tree8eb7488219e5e02ade78f44344801e21d8c808df /render/layout.c
parent50a8bae10f4786a04613030994fdb60b70be3043 (diff)
downloadnetsurf-61dc91e0c553ef6c1e7bf3e4061fdbbbfa28fad4.tar.gz
netsurf-61dc91e0c553ef6c1e7bf3e4061fdbbbfa28fad4.tar.bz2
Relative positioning for absolutely positioned boxes
svn path=/trunk/netsurf/; revision=2653
Diffstat (limited to 'render/layout.c')
-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;
+ }
+ }
+ }
}