summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-04 03:27:10 (GMT)
committer Rupinder Singh Khokhar <rsk1coder99@gmail.com>2014-08-01 16:14:31 (GMT)
commitea324e5503e4a076d6aef68ce281e28a7ab06a32 (patch)
tree6bea3df388ccb12e2953045ab79e2b51d006281a
parent57abb7e471669e31e851743763774ddd6b7fafb4 (diff)
downloadlibhubbub-ea324e5503e4a076d6aef68ce281e28a7ab06a32.tar.gz
libhubbub-ea324e5503e4a076d6aef68ce281e28a7ab06a32.tar.bz2
Fixing some steps in table insertion mode, handling input tags
-rw-r--r--src/treebuilder/in_body.c22
-rw-r--r--src/treebuilder/in_table.c15
2 files changed, 32 insertions, 5 deletions
diff --git a/src/treebuilder/in_body.c b/src/treebuilder/in_body.c
index c9d1780..69ec3d6 100644
--- a/src/treebuilder/in_body.c
+++ b/src/treebuilder/in_body.c
@@ -12,6 +12,7 @@
#include "treebuilder/internal.h"
#include "treebuilder/treebuilder.h"
#include "utils/utils.h"
+#include "utils/string.h"
#undef DEBUG_IN_BODY
@@ -337,8 +338,27 @@ hubbub_error process_start_tag(hubbub_treebuilder *treebuilder,
return err;
err = insert_element(treebuilder, &token->data.tag, false);
- if (err == HUBBUB_OK)
+ if (err != HUBBUB_OK)
+ return err;
+
+ size_t i;
+ bool found = 0;
+
+ for (i = 0; i < token->data.tag.n_attributes; i++) {
+ hubbub_attribute *attr = &token->data.tag.attributes[i];
+
+ if (hubbub_string_match_ci(attr->name.ptr, attr->name.len,
+ (uint8_t *) "type", SLEN("type")) &&
+ hubbub_string_match_ci(attr->value.ptr, attr->value.len,
+ (uint8_t *) "hidden", SLEN("hidden"))) {
+ found = 1;
+ break;
+ }
+ }
+
+ if(!found) {
treebuilder->context.frameset_ok = false;
+ }
} else if (type == HR) {
err = process_hr_in_body(treebuilder, token);
} else if (type == IMAGE) {
diff --git a/src/treebuilder/in_table.c b/src/treebuilder/in_table.c
index d86a908..908d5ad 100644
--- a/src/treebuilder/in_table.c
+++ b/src/treebuilder/in_table.c
@@ -51,13 +51,17 @@ static inline hubbub_error process_input_in_table(
for (i = 0; i < token->data.tag.n_attributes; i++) {
hubbub_attribute *attr = &token->data.tag.attributes[i];
- if (!hubbub_string_match_ci(attr->value.ptr, attr->value.len,
- (uint8_t *) "hidden", SLEN("hidden"))) {
+ if (!(hubbub_string_match_ci(attr->name.ptr, attr->name.len,
+ (uint8_t *) "type", SLEN("type")) &&
+ hubbub_string_match_ci(attr->value.ptr, attr->value.len,
+ (uint8_t *) "hidden", SLEN("hidden")))) {
continue;
}
/** \todo parse error */
- err = insert_element(treebuilder, &token->data.tag, true);
+ err = insert_element(treebuilder, &token->data.tag, false);
+ break;
+ /** \todo ack sc */
}
return err;
@@ -192,7 +196,10 @@ hubbub_error handle_in_table(hubbub_treebuilder *treebuilder,
treebuilder->context.mode = IN_TABLE_BODY;
} else if (type == TABLE) {
/** \todo parse error */
-
+ if(!element_in_scope(treebuilder, TABLE, TABLE_SCOPE)) {
+ /** \todo parse error */
+ break;
+ }
/* This should match "</table>" handling */
element_stack_pop_until(treebuilder, TABLE);