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

netsurf at semichrome.net netsurf at semichrome.net
Sun Mar 25 17:38:17 BST 2012


Author: vince
Date: Sun Mar 25 11:38:17 2012
New Revision: 13699

URL: http://source.netsurf-browser.org?rev=13699&view=rev
Log:
two more presentational hints

Modified:
    trunk/netsurf/css/select.c

Modified: trunk/netsurf/css/select.c
URL: http://source.netsurf-browser.org/trunk/netsurf/css/select.c?rev=13699&r1=13698&r2=13699&view=diff
==============================================================================
--- trunk/netsurf/css/select.c (original)
+++ trunk/netsurf/css/select.c Sun Mar 25 11:38:17 2012
@@ -2679,26 +2679,35 @@
 					  dom_node *node, 
 					  css_hint *hint)
 {
-#ifdef FIXME
-	xmlChar *align = NULL;
-
-	if (strcmp((const char *) n->name, "caption") == 0)
-		align = xmlGetProp(n, (const xmlChar *) "align");
-
-	if (align == NULL)
+	dom_exception err;
+	dom_string *node_name = NULL;
+	dom_string *align = NULL;
+
+	err = dom_node_get_node_name(node, &node_name);
+	if ((err != DOM_NO_ERR) || (node_name == NULL)) {
 		return CSS_PROPERTY_NOT_SET;
-
-	if (strcasecmp((const char *) align, "bottom") == 0) {
+	}
+
+	if (!dom_string_caseless_isequal(node_name, nscss_dom_string_caption)) {
+		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_caseless_isequal(align, nscss_dom_string_bottom)) {
 		hint->status = CSS_CAPTION_SIDE_BOTTOM;
-	} else {
-		xmlFree(align);
-		return CSS_PROPERTY_NOT_SET;
-	}
-
-	xmlFree(align);
-
-	return CSS_OK;
-#endif
+		dom_string_unref(align);
+		return CSS_OK;
+	}
+
+	dom_string_unref(align);
+
 	return CSS_PROPERTY_NOT_SET;
 }
 
@@ -2707,23 +2716,23 @@
 					  dom_node *node, 
 					  css_hint *hint)
 {
-#ifdef FIXME
-	xmlChar *bgcol = xmlGetProp(n, (const xmlChar *) "bgcolor");
-	if (bgcol == NULL)
+	dom_exception err;
+	dom_string *bgcolor;
+
+	err = dom_element_get_attribute(node, nscss_dom_string_bgcolor, &bgcolor);
+	if ((err != DOM_NO_ERR) || (bgcolor == NULL)) {
 		return CSS_PROPERTY_NOT_SET;
-
-	if (nscss_parse_colour((const char *) bgcol,
+	}
+
+	if (nscss_parse_colour((const char *)dom_string_data(bgcolor),
 			       &hint->data.color)) {
 		hint->status = CSS_BACKGROUND_COLOR_COLOR;
-	} else {
-		xmlFree(bgcol);
-		return CSS_PROPERTY_NOT_SET;
-	}
-
-	xmlFree(bgcol);
-
-	return CSS_OK;
-#endif
+		dom_string_unref(bgcolor);
+		return CSS_OK;
+	}
+
+	dom_string_unref(bgcolor);
+
 	return CSS_PROPERTY_NOT_SET;
 }
 




More information about the netsurf-commits mailing list