r13714 vince - /trunk/netsurf/css/select.c

netsurf at semichrome.net netsurf at semichrome.net
Mon Mar 26 00:14:18 BST 2012


Author: vince
Date: Sun Mar 25 18:14:18 2012
New Revision: 13714

URL: http://source.netsurf-browser.org?rev=13714&view=rev
Log:
convert node_presentational_hint_float

Modified:
    trunk/netsurf/css/select.c

Modified: trunk/netsurf/css/select.c
URL: http://source.netsurf-browser.org/trunk/netsurf/css/select.c?rev=13714&r1=13713&r2=13714&view=diff
==============================================================================
--- trunk/netsurf/css/select.c (original)
+++ trunk/netsurf/css/select.c Sun Mar 25 18:14:18 2012
@@ -2675,34 +2675,44 @@
 					  dom_node *node, 
 					  css_hint *hint)
 {
-#ifdef FIXME
-		xmlChar *align = NULL;
-
-		/** \todo input[type=image][align=*] - $11.3.3 */
-		if (strcmp((const char *) n->name, "table") == 0 ||
-				strcmp((const char *) n->name, "applet") == 0 ||
-				strcmp((const char *) n->name, "embed") == 0 ||
-				strcmp((const char *) n->name, "iframe") == 0 ||
-				strcmp((const char *) n->name, "img") == 0 ||
-				strcmp((const char *) n->name, "object") == 0)
-			align = xmlGetProp(n, (const xmlChar *) "align");
-
-		if (align == NULL)
-			return CSS_PROPERTY_NOT_SET;
-
-		if (strcasecmp((const char *) align, "left") == 0) {
-			hint->status = CSS_FLOAT_LEFT;
-		} else if (strcasecmp((const char *) align, "right") == 0) {
-			hint->status = CSS_FLOAT_RIGHT;
-		} else {
-			xmlFree(align);
-			return CSS_PROPERTY_NOT_SET;
-		}
-
-		xmlFree(align);
-
+	dom_exception err;
+	dom_string *node_name = NULL;
+	dom_string *align;
+
+	err = dom_node_get_node_name(node, &node_name);
+	if ((err != DOM_NO_ERR) || (node_name == NULL)) {
+		return CSS_NOMEM;
+	}
+
+	/** \todo input[type=image][align=*] - $11.3.3 */
+	if (!dom_string_isequal(node_name, nscss_dom_string_applet) &&
+	    !dom_string_isequal(node_name, nscss_dom_string_embed) &&
+	    !dom_string_isequal(node_name, nscss_dom_string_iframe) &&
+	    !dom_string_isequal(node_name, nscss_dom_string_img) &&
+	    !dom_string_isequal(node_name, nscss_dom_string_object)) {
+		dom_string_unref(node_name);
+		return CSS_PROPERTY_NOT_SET;
+	}
+
+	dom_string_unref(node_name);
+
+	err = dom_element_get_attribute(node, nscss_dom_string_align, &align);
+	if ((err != DOM_NO_ERR) || (align == NULL)) {
+		return CSS_PROPERTY_NOT_SET;
+	}
+
+	if (dom_string_isequal(align, nscss_dom_string_left)) {
+		hint->status = CSS_FLOAT_LEFT;
+		dom_string_unref(align);
 		return CSS_OK;
-#endif
+	} else if (dom_string_isequal(align, nscss_dom_string_right)) {
+		hint->status = CSS_FLOAT_RIGHT;
+		dom_string_unref(align);
+		return CSS_OK;
+	}
+
+	dom_string_unref(align);
+
 	return CSS_PROPERTY_NOT_SET;
 }
 




More information about the netsurf-commits mailing list