[project @ 2003-10-09 15:22:48 by bursa]

Implement box_insert_sibling().

svn path=/import/netsurf/; revision=358
This commit is contained in:
James Bursa 2003-10-09 15:22:48 +00:00
parent c673e138dc
commit 65263651e3
2 changed files with 22 additions and 3 deletions

View File

@ -44,7 +44,6 @@ struct result {
int convert_children; /* children should be converted */
};
static void box_add_child(struct box * parent, struct box * child);
static struct box * convert_xml_to_box(xmlNode * n, struct content *content,
struct css_style * parent_style,
struct css_selector ** selector, unsigned int depth,
@ -119,7 +118,7 @@ static const struct element_entry element_table[] = {
/**
* add a child to a box tree node
* Add a child to a box tree node.
*/
void box_add_child(struct box * parent, struct box * child)
@ -136,8 +135,9 @@ void box_add_child(struct box * parent, struct box * child)
child->parent = parent;
}
/**
* create a box tree node
* Create a box tree node.
*/
struct box * box_create(struct css_style * style,
@ -178,6 +178,23 @@ struct box * box_create(struct css_style * style,
}
/**
* Insert a new box as a sibling to a box in a tree.
*/
void box_insert_sibling(struct box *box, struct box *new_box)
{
new_box->parent = box->parent;
new_box->prev = box;
new_box->next = box->next;
box->next = new_box;
if (new_box->next)
new_box->next->prev = new_box;
else if (new_box->parent)
new_box->parent->last = new_box;
}
/**
* make a box tree with style data from an xml tree
*/

View File

@ -177,6 +177,8 @@ void xml_to_box(xmlNode *n, struct content *c);
void box_dump(struct box * box, unsigned int depth);
struct box * box_create(struct css_style * style,
char *href, char *title);
void box_add_child(struct box * parent, struct box * child);
void box_insert_sibling(struct box *box, struct box *new_box);
void box_free(struct box *box);
void box_coords(struct box *box, unsigned long *x, unsigned long *y);