summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-07-09 14:00:46 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-07-09 14:00:46 +0000
commit5ad8c7894aaa67c8f89088f5796f525c61ac3961 (patch)
treea5023bee3de1db84f2925022762ad519086826dc
parente41fdee01fd65331df1de32dccd1f1048b29d891 (diff)
downloadlibhubbub-5ad8c7894aaa67c8f89088f5796f525c61ac3961.tar.gz
libhubbub-5ad8c7894aaa67c8f89088f5796f525c61ac3961.tar.bz2
Fixes for in_cell and adoption agency
svn path=/trunk/hubbub/; revision=4540
-rw-r--r--src/treebuilder/in_body.c22
-rw-r--r--src/treebuilder/in_cell.c2
2 files changed, 13 insertions, 11 deletions
diff --git a/src/treebuilder/in_body.c b/src/treebuilder/in_body.c
index e61a581..ae19af8 100644
--- a/src/treebuilder/in_body.c
+++ b/src/treebuilder/in_body.c
@@ -94,7 +94,7 @@ static void aa_reparent_node(hubbub_treebuilder *treebuilder, void *node,
void *new_parent);
static void aa_find_bookmark_location_reparenting_misnested(
hubbub_treebuilder *treebuilder,
- uint32_t formatting_element, uint32_t furthest_block,
+ uint32_t formatting_element, uint32_t *furthest_block,
bookmark *bookmark, uint32_t *last_node);
static void aa_remove_element_stack_item(hubbub_treebuilder *treebuilder,
uint32_t index, uint32_t limit);
@@ -1336,7 +1336,7 @@ void process_0presentational_in_body(hubbub_treebuilder *treebuilder,
uint32_t last_node;
aa_find_bookmark_location_reparenting_misnested(treebuilder,
- formatting_element, furthest_block,
+ formatting_element, &furthest_block,
&bookmark, &last_node);
/* 8 */
@@ -1596,20 +1596,21 @@ void aa_reparent_node(hubbub_treebuilder *treebuilder, void *node,
*
* \param treebuilder The treebuilder instance
* \param formatting_element The stack index of the formatting element
- * \param furthest_block Index of furthest block in element stack
+ * \param furthest_block Pointer to index of furthest block in element
+ * stack (updated on exit)
* \param bookmark Pointer to bookmark (pre-initialised)
* \param last_node Pointer to location to receive index of last node
*/
void aa_find_bookmark_location_reparenting_misnested(
hubbub_treebuilder *treebuilder,
- uint32_t formatting_element, uint32_t furthest_block,
+ uint32_t formatting_element, uint32_t *furthest_block,
bookmark *bookmark, uint32_t *last_node)
{
element_context *stack = treebuilder->context.element_stack;
- uint32_t node, last;
+ uint32_t node, last, fb;
formatting_list_entry *node_entry;
- node = last = furthest_block;
+ node = last = fb = *furthest_block;
while (true) {
/* i */
@@ -1618,7 +1619,7 @@ void aa_find_bookmark_location_reparenting_misnested(
/* ii */
for (node_entry = treebuilder->context.formatting_list_end;
node_entry != NULL;
- node_entry = node_entry->next) {
+ node_entry = node_entry->prev) {
if (node_entry->stack_index == node)
break;
}
@@ -1630,7 +1631,7 @@ void aa_find_bookmark_location_reparenting_misnested(
/* Update furthest block index and the last node index,
* as these are always below node in the stack */
- furthest_block--;
+ fb--;
last--;
/* Fixup the current_node index */
@@ -1645,8 +1646,8 @@ void aa_find_bookmark_location_reparenting_misnested(
break;
/* iv */
- if (last == furthest_block) {
- bookmark->prev = node_entry->prev;
+ if (last == fb) {
+ bookmark->prev = node_entry;
bookmark->next = node_entry->next;
}
@@ -1671,6 +1672,7 @@ void aa_find_bookmark_location_reparenting_misnested(
/* viii */
}
+ *furthest_block = fb;
*last_node = last;
}
diff --git a/src/treebuilder/in_cell.c b/src/treebuilder/in_cell.c
index 68a4f28..bb8391f 100644
--- a/src/treebuilder/in_cell.c
+++ b/src/treebuilder/in_cell.c
@@ -91,7 +91,7 @@ bool handle_in_cell(hubbub_treebuilder *treebuilder, const hubbub_token *token)
element_type type = element_type_from_name(treebuilder,
&token->data.tag.name);
- if (type == TH || TD) {
+ if (type == TH || type == TD) {
if (element_in_scope(treebuilder, type, true)) {
hubbub_ns ns;
element_type otype = UNKNOWN;