summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-10-09 15:22:48 +0000
committerJames Bursa <james@netsurf-browser.org>2003-10-09 15:22:48 +0000
commit65263651e3c8036a631270976a773f3d4497f474 (patch)
tree64a40c515273b5f8f16188917abaccd63d560fca
parentc673e138dc76600fd72a09428a7a36dc4ec390c3 (diff)
downloadnetsurf-65263651e3c8036a631270976a773f3d4497f474.tar.gz
netsurf-65263651e3c8036a631270976a773f3d4497f474.tar.bz2
[project @ 2003-10-09 15:22:48 by bursa]
Implement box_insert_sibling(). svn path=/import/netsurf/; revision=358
-rw-r--r--render/box.c23
-rw-r--r--render/box.h2
2 files changed, 22 insertions, 3 deletions
diff --git a/render/box.c b/render/box.c
index 9a9eb2def..77fc99f00 100644
--- a/render/box.c
+++ b/render/box.c
@@ -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,
@@ -179,6 +179,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
*/
diff --git a/render/box.h b/render/box.h
index 2a3b15633..76c9500c9 100644
--- a/render/box.h
+++ b/render/box.h
@@ -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);