From 31c659a2ea8bf239569c8436e3b718786879df47 Mon Sep 17 00:00:00 2001 From: Adrian Lees Date: Wed, 20 Apr 2005 12:24:41 +0000 Subject: [project @ 2005-04-20 12:24:41 by adrianl] text import from global clipboard, other apps & files and additional keys for editing text in textareas svn path=/import/netsurf/; revision=1673 --- render/box.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'render/box.c') diff --git a/render/box.c b/render/box.c index 7e0df2483..f00b8aa1d 100644 --- a/render/box.c +++ b/render/box.c @@ -133,7 +133,35 @@ void box_insert_sibling(struct box *box, struct box *new_box) /** - * Free the a box tree recursively. + * Unlink a box from the box tree and then free it recursively. + * + * \param box box to unlink and free recursively. + */ + +void box_unlink_and_free(struct box *box) +{ + struct box *parent = box->parent; + struct box *next = box->next; + struct box *prev = box->prev; + + if (parent) { + if (parent->children == box) + parent->children = next; + if (parent->last == box) + parent->last = next ? next : prev; + } + + if (prev) + prev->next = next; + if (next) + next->prev = prev; + + box_free(box); +} + + +/** + * Free a box tree recursively. * * \param box box to free recursively * -- cgit v1.2.3