summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-07-05 19:02:53 (GMT)
committer Vincent Sanders <vince@netsurf-browser.org>2012-07-05 19:02:53 (GMT)
commit24cadf35148075ab5300ac406a2c87c8496dc0d5 (patch)
treecdbb2a2ea23d5e458b9a714d9f2c096a8a5d6dd3
parentc65586bb921f0b7dbad818a057507609d59d4821 (diff)
downloadlibhubbub-24cadf35148075ab5300ac406a2c87c8496dc0d5.tar.gz
libhubbub-24cadf35148075ab5300ac406a2c87c8496dc0d5.tar.bz2
Add Script complete callback
-rw-r--r--include/hubbub/tree.h10
-rw-r--r--src/treebuilder/generic_rcdata.c2
-rw-r--r--src/treebuilder/internal.h1
-rw-r--r--src/treebuilder/treebuilder.c16
4 files changed, 28 insertions, 1 deletions
diff --git a/include/hubbub/tree.h b/include/hubbub/tree.h
index 545f5b1..48f6b5a 100644
--- a/include/hubbub/tree.h
+++ b/include/hubbub/tree.h
@@ -259,6 +259,15 @@ typedef hubbub_error (*hubbub_tree_encoding_change)(void *ctx,
const char *encname);
/**
+ * Complete script processing
+ *
+ * \param ctx Client's context
+ * \param script The script
+ * \return HUBBUB_OK on success, appropriate error otherwise.
+ */
+typedef hubbub_error (*hubbub_tree_complete_script)(void *ctx, void *script);
+
+/**
* Hubbub tree handler
*/
typedef struct hubbub_tree_handler {
@@ -279,6 +288,7 @@ typedef struct hubbub_tree_handler {
hubbub_tree_add_attributes add_attributes; /**< Add attributes */
hubbub_tree_set_quirks_mode set_quirks_mode; /**< Set quirks mode */
hubbub_tree_encoding_change encoding_change; /**< Change encoding */
+ hubbub_tree_complete_script complete_script; /**< Script Complete */
void *ctx; /**< Context pointer */
} hubbub_tree_handler;
diff --git a/src/treebuilder/generic_rcdata.c b/src/treebuilder/generic_rcdata.c
index 6991dce..29da1c5 100644
--- a/src/treebuilder/generic_rcdata.c
+++ b/src/treebuilder/generic_rcdata.c
@@ -63,7 +63,7 @@ hubbub_error handle_generic_rcdata(hubbub_treebuilder *treebuilder,
}
if (type == SCRIPT) {
- /** \todo script processing and execution */
+ err = complete_script(treebuilder);
}
done = true;
diff --git a/src/treebuilder/internal.h b/src/treebuilder/internal.h
index bc2fb9d..503168f 100644
--- a/src/treebuilder/internal.h
+++ b/src/treebuilder/internal.h
@@ -154,6 +154,7 @@ void close_implied_end_tags(hubbub_treebuilder *treebuilder,
void reset_insertion_mode(hubbub_treebuilder *treebuilder);
hubbub_error append_text(hubbub_treebuilder *treebuilder,
const hubbub_string *string);
+hubbub_error complete_script(hubbub_treebuilder *treebuilder);
element_type element_type_from_name(hubbub_treebuilder *treebuilder,
const hubbub_string *tag_name);
diff --git a/src/treebuilder/treebuilder.c b/src/treebuilder/treebuilder.c
index 0e7372a..10433b4 100644
--- a/src/treebuilder/treebuilder.c
+++ b/src/treebuilder/treebuilder.c
@@ -925,6 +925,22 @@ void reset_insertion_mode(hubbub_treebuilder *treebuilder)
}
/**
+ * Script processing and execution
+ *
+ * \param treebuilder The treebuilder instance
+ * \return HUBBUB_OK on success, appropriate error otherwise
+ */
+hubbub_error complete_script(hubbub_treebuilder *treebuilder)
+{
+ hubbub_error error = HUBBUB_OK;
+ error = treebuilder->tree_handler->complete_script(
+ treebuilder->tree_handler->ctx,
+ treebuilder->context.element_stack[
+ treebuilder->context.current_node].node);
+ return error;
+}
+
+/**
* Append text to the current node, inserting into the last child of the
* current node, iff it's a Text node.
*