Changes to struct box for absolute positioning.
svn path=/trunk/netsurf/; revision=2640
This commit is contained in:
parent
9eb3efff78
commit
878ef9883e
37
render/box.c
37
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;
|
||||
|
@ -121,6 +122,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.
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue