summaryrefslogtreecommitdiff
path: root/render/box.c
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2006-06-21 02:51:00 +0000
committerJames Bursa <james@netsurf-browser.org>2006-06-21 02:51:00 +0000
commit878ef9883edbdff8b73cd95d099a59783d807e6b (patch)
tree8d2b312bfbb4b9aefd14e34d84ca5deda3e27d87 /render/box.c
parent9eb3efff78d311a386ce783224d5e7bd6b88a5b1 (diff)
downloadnetsurf-878ef9883edbdff8b73cd95d099a59783d807e6b.tar.gz
netsurf-878ef9883edbdff8b73cd95d099a59783d807e6b.tar.bz2
Changes to struct box for absolute positioning.
svn path=/trunk/netsurf/; revision=2640
Diffstat (limited to 'render/box.c')
-rw-r--r--render/box.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/render/box.c b/render/box.c
index 22ccdd8e3..684a4da92 100644
--- a/render/box.c
+++ b/render/box.c
@@ -84,6 +84,7 @@ struct box * box_create(struct css_style *style,
box->inline_end = NULL;
box->float_children = NULL;
box->next_float = NULL;
+ box->absolute_children = NULL;
box->col = NULL;
box->gadget = NULL;
box->usemap = NULL;
@@ -122,6 +123,30 @@ void box_add_child(struct box *parent, struct box *child)
/**
+ * Add an absolutely positioned child to a box tree node.
+ *
+ * \param parent box giving birth
+ * \param child box to link as last child of parent
+ */
+
+void box_add_absolute_child(struct box *parent, struct box *child)
+{
+ assert(parent);
+ assert(child);
+
+ if (parent->absolute_children != 0) { /* has children already */
+ child->next = parent->absolute_children;
+ parent->absolute_children->prev = child;
+ } else { /* this is the first child */
+ child->next = 0;
+ }
+
+ parent->absolute_children = child;
+ child->parent = parent;
+}
+
+
+/**
* Insert a new box as a sibling to a box in a tree.
*
* \param box box already in tree
@@ -186,6 +211,11 @@ void box_free(struct box *box)
next = child->next;
box_free(child);
}
+
+ for (child = box->absolute_children; child; child = next) {
+ next = child->next;
+ box_free(child);
+ }
/* last this box */
box_free_box(box);
@@ -557,4 +587,11 @@ void box_dump(struct box *box, unsigned int depth)
for (c = box->fallback; c; c = c->next)
box_dump(c, depth + 1);
}
+ if (box->absolute_children) {
+ for (i = 0; i != depth; i++)
+ fprintf(stderr, " ");
+ fprintf(stderr, "absolute_children:\n");
+ for (c = box->absolute_children; c; c = c->next)
+ box_dump(c, depth + 1);
+ }
}