summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/box.c37
-rw-r--r--render/box.h5
2 files changed, 42 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);
+ }
}
diff --git a/render/box.h b/render/box.h
index 5a82830db..ce439381b 100644
--- a/render/box.h
+++ b/render/box.h
@@ -193,6 +193,10 @@ struct box {
/** Next sibling float box. */
struct box *next_float;
+ /** First absolutely positioned child box, or 0. Absolutely positioned
+ * boxes are linked by next / prev and do not appear under children. */
+ struct box *absolute_children;
+
struct column *col; /**< Array of table column data for TABLE only. */
/** Form control data, or 0 if not a form control. */
@@ -259,6 +263,7 @@ struct box * box_create(struct css_style *style,
char *href, const char *target, char *title,
char *id, void *context);
void box_add_child(struct box *parent, struct box *child);
+void box_add_absolute_child(struct box *parent, struct box *child);
void box_insert_sibling(struct box *box, struct box *new_box);
void box_unlink_and_free(struct box *box);
void box_free(struct box *box);