r4606 takkaria - in /trunk/hubbub/src/treebuilder: in_body.c in_foreign_content.c treebuilder.c

netsurf at semichrome.net netsurf at semichrome.net
Fri Jul 11 17:19:02 BST 2008


Author: takkaria
Date: Fri Jul 11 11:19:02 2008
New Revision: 4606

URL: http://source.netsurf-browser.org?rev=4606&view=rev
Log:
Turn on basic MathML support.

Modified:
    trunk/hubbub/src/treebuilder/in_body.c
    trunk/hubbub/src/treebuilder/in_foreign_content.c
    trunk/hubbub/src/treebuilder/treebuilder.c

Modified: trunk/hubbub/src/treebuilder/in_body.c
URL: http://source.netsurf-browser.org/trunk/hubbub/src/treebuilder/in_body.c?rev=4606&r1=4605&r2=4606&view=diff
==============================================================================
--- trunk/hubbub/src/treebuilder/in_body.c (original)
+++ trunk/hubbub/src/treebuilder/in_body.c Fri Jul 11 11:19:02 2008
@@ -316,14 +316,19 @@
 	} else if (type == RP || type == RT) {
 		/** \todo ruby */
 	} else if (type == MATH) {
+		hubbub_tag tag = token->data.tag;
+
 		reconstruct_active_formatting_list(treebuilder);
-		/** \todo adjust foreign attributes */
-		/** \todo insert foreign element */
+		adjust_foreign_attributes(treebuilder, &tag);
+
+		tag.ns = HUBBUB_NS_MATHML;
+
 		if (token->data.tag.self_closing) {
-			/** \todo pop off the stack of open elements */
+			insert_element_no_push(treebuilder, &tag);
 			/** \todo ack sc flag */
 		} else {
-			/** \todo set to "in foreign content" */
+			insert_element(treebuilder, &tag);
+			treebuilder->context.mode = IN_FOREIGN_CONTENT;
 		}
 	} else if (type == CAPTION || type == COL || type == COLGROUP ||
 			type == FRAME || type == FRAMESET ||

Modified: trunk/hubbub/src/treebuilder/in_foreign_content.c
URL: http://source.netsurf-browser.org/trunk/hubbub/src/treebuilder/in_foreign_content.c?rev=4606&r1=4605&r2=4606&view=diff
==============================================================================
--- trunk/hubbub/src/treebuilder/in_foreign_content.c (original)
+++ trunk/hubbub/src/treebuilder/in_foreign_content.c Fri Jul 11 11:19:02 2008
@@ -47,6 +47,13 @@
 {
 	bool reprocess = false;
 
+	element_type type = element_type_from_name(treebuilder,
+			&token->data.tag.name);
+
+	element_type cur_node = current_node(treebuilder);
+	hubbub_ns cur_node_ns = current_node_ns(treebuilder);
+
+
 	switch (token->type) {
 	case HUBBUB_TOKEN_CHARACTER:
 		append_text(treebuilder, &token->data.character);
@@ -61,12 +68,6 @@
 		break;
 	case HUBBUB_TOKEN_START_TAG:
 	{
-		element_type type = element_type_from_name(treebuilder,
-				&token->data.tag.name);
-
-		element_type cur_node = current_node(treebuilder);
-		hubbub_ns cur_node_ns = current_node_ns(treebuilder);
-
 		if (cur_node_ns == HUBBUB_NS_HTML ||
 				(cur_node_ns == HUBBUB_NS_MATHML &&
 				(type != MGLYPH && type != MALIGNMARK) &&
@@ -133,6 +134,19 @@
 		/** \parse error */
 		break;
 	case HUBBUB_TOKEN_EOF:
+		while (cur_node_ns != HUBBUB_NS_HTML) {
+			void *node;
+			element_stack_pop(treebuilder, &cur_node_ns,
+					&cur_node, &node);
+			treebuilder->tree_handler->unref_node(
+					treebuilder->tree_handler->ctx,
+					node);
+			cur_node_ns = current_node_ns(treebuilder);
+		}
+
+		treebuilder->context.mode =
+				treebuilder->context.second_mode;
+
 		reprocess = true;
 		break;
 	}

Modified: trunk/hubbub/src/treebuilder/treebuilder.c
URL: http://source.netsurf-browser.org/trunk/hubbub/src/treebuilder/treebuilder.c?rev=4606&r1=4605&r2=4606&view=diff
==============================================================================
--- trunk/hubbub/src/treebuilder/treebuilder.c (original)
+++ trunk/hubbub/src/treebuilder/treebuilder.c Fri Jul 11 11:19:02 2008
@@ -38,7 +38,8 @@
 	{ "IMAGE", IMAGE },	{ "IMG", IMG },
 	{ "INPUT", INPUT },	{ "ISINDEX", ISINDEX },
 	{ "LI", LI },		{ "LINK", LINK },
-	{ "LISTING", LISTING },	{ "MENU", MENU },
+	{ "LISTING", LISTING },	{ "MATH", MATH },
+	{ "MENU", MENU },
 	{ "META", META },	{ "NOEMBED", NOEMBED },
 	{ "NOFRAMES", NOFRAMES },	{ "NOSCRIPT", NOSCRIPT },
 	{ "OL", OL },		{ "OPTGROUP", OPTGROUP },




More information about the netsurf-commits mailing list