summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-12 20:01:51 (GMT)
committer Rupinder Singh Khokhar <rsk1coder99@gmail.com>2014-08-01 16:14:33 (GMT)
commitcc0119cafe9c29bfb42573d65a2012dce8628c76 (patch)
tree15d459b3700b357bf3d6c7ea542798d124dc5b90
parent26173b8ca58d8ef19ba4f3d4c61e7e9803204ae5 (diff)
downloadlibhubbub-cc0119cafe9c29bfb42573d65a2012dce8628c76.tar.gz
libhubbub-cc0119cafe9c29bfb42573d65a2012dce8628c76.tar.bz2
Fixed dd/dt/li start tag handler once again. Also fixed resting of insertion mode. Also fixed some things in after_after_frameset state
-rw-r--r--src/treebuilder/after_after_frameset.c17
-rw-r--r--src/treebuilder/in_body.c10
-rw-r--r--src/treebuilder/treebuilder.c34
-rw-r--r--test/data/tree-construction/INDEX2
4 files changed, 46 insertions, 17 deletions
diff --git a/src/treebuilder/after_after_frameset.c b/src/treebuilder/after_after_frameset.c
index f068714..e9d1176 100644
--- a/src/treebuilder/after_after_frameset.c
+++ b/src/treebuilder/after_after_frameset.c
@@ -25,23 +25,28 @@ hubbub_error handle_after_after_frameset(hubbub_treebuilder *treebuilder,
const hubbub_token *token)
{
hubbub_error err = HUBBUB_OK;
-
switch (token->type) {
case HUBBUB_TOKEN_CHARACTER:
- err = process_characters_expect_whitespace(treebuilder,
- token, true);
- if (err == HUBBUB_REPROCESS)
- treebuilder->context.mode = IN_FRAMESET;
+ {
+ const uint8_t *data = token->data.character.ptr;
+ uint8_t c = data[0];
+ if (c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == '\f') {
+ err = handle_in_body(treebuilder, token);
+ }
+
+ }
break;
case HUBBUB_TOKEN_COMMENT:
err = process_comment_append(treebuilder, token,
treebuilder->context.document);
break;
case HUBBUB_TOKEN_END_TAG:
- case HUBBUB_TOKEN_DOCTYPE:
/** \todo parse error */
/* ignore token */
break;
+ case HUBBUB_TOKEN_DOCTYPE:
+ err = handle_in_body(treebuilder, token);
+ break;
case HUBBUB_TOKEN_START_TAG:
{
element_type type = element_type_from_name(treebuilder,
diff --git a/src/treebuilder/in_body.c b/src/treebuilder/in_body.c
index f5fdc89..d684702 100644
--- a/src/treebuilder/in_body.c
+++ b/src/treebuilder/in_body.c
@@ -785,8 +785,7 @@ hubbub_error process_dd_dt_li_in_body(hubbub_treebuilder *treebuilder,
(ntype == DD || ntype == DT)))
break;
- if (!is_formatting_element(ntype) &&
- !is_phrasing_element(ntype) &&
+ if (is_special_element(ntype) &&
ntype != ADDRESS &&
ntype != DIV &&
ntype != P)
@@ -794,10 +793,11 @@ hubbub_error process_dd_dt_li_in_body(hubbub_treebuilder *treebuilder,
}
/* If we found one, then pop all nodes up to and including it */
- if (stack[node].type == LI || stack[node].type == DD ||
- stack[node].type == DT) {
+ if((stack[node].type == LI && type == LI) ||
+ ((stack[node].type == DT || stack[node].type == DD) &&
+ (type == DD || type == DT))) {
- close_implied_end_tags(treebuilder, type);
+ close_implied_end_tags(treebuilder, stack[node].type);
/* Check that we're only popping one node
* and emit a parse error if not */
if (treebuilder->context.current_node > node) {
diff --git a/src/treebuilder/treebuilder.c b/src/treebuilder/treebuilder.c
index a965c5a..568a589 100644
--- a/src/treebuilder/treebuilder.c
+++ b/src/treebuilder/treebuilder.c
@@ -966,8 +966,21 @@ void reset_insertion_mode(hubbub_treebuilder *treebuilder)
switch (stack[node].type) {
case SELECT:
+ {
/* fragment case */
- break;
+ uint32_t ancestor;
+ for(ancestor = node - 1; ancestor > 0; ancestor --) {
+ if(stack[node].type == TEMPLATE) {
+ break;
+ }
+ if(stack[node].type == TABLE) {
+ treebuilder->context.mode = IN_CELL;
+ return;
+ }
+ }
+ treebuilder->context.mode = IN_SELECT;
+ return;
+ }
case TD:
case TH:
treebuilder->context.mode = IN_CELL;
@@ -985,26 +998,37 @@ void reset_insertion_mode(hubbub_treebuilder *treebuilder)
return;
case COLGROUP:
/* fragment case */
- break;
+ treebuilder->context.mode = IN_COLUMN_GROUP;
+ return;
case TABLE:
treebuilder->context.mode = IN_TABLE;
return;
case HEAD:
/* fragment case */
- break;
+ treebuilder->context.mode = IN_HEAD;
+ return;
case BODY:
treebuilder->context.mode = IN_BODY;
return;
case FRAMESET:
/* fragment case */
- break;
+ treebuilder->context.mode = IN_FRAMESET;
+ return;
case HTML:
+ {
/* fragment case */
- break;
+ if(treebuilder->context.head_element == NULL) {
+ treebuilder->context.mode = BEFORE_HEAD;
+ } else {
+ treebuilder->context.mode = AFTER_HEAD;
+ }
+ }
+ return;
default:
break;
}
}
+ return;
}
/**
diff --git a/test/data/tree-construction/INDEX b/test/data/tree-construction/INDEX
index c93217f..45126b7 100644
--- a/test/data/tree-construction/INDEX
+++ b/test/data/tree-construction/INDEX
@@ -54,5 +54,5 @@ tests8.dat html5lib treebuilder tests
tests9.dat html5lib treebuilder tests
tests_innerHTML_1.dat html5lib treebuilder tests
tricky01.dat html5lib treebuilder tests
-#webkit01.dat NA
+webkit01.dat html5lib treebuilder tests
webkit02.dat html5lib treebuilder tests