convert node_presentational_hint_float

svn path=/trunk/netsurf/; revision=13714
This commit is contained in:
Vincent Sanders 2012-03-25 23:14:18 +00:00
parent b9a2def970
commit 32f2b175fe
1 changed files with 32 additions and 22 deletions

View File

@ -2675,34 +2675,44 @@ node_presentational_hint_float(nscss_select_ctx *ctx,
dom_node *node, dom_node *node,
css_hint *hint) css_hint *hint)
{ {
#ifdef FIXME dom_exception err;
xmlChar *align = NULL; dom_string *node_name = NULL;
dom_string *align;
/** \todo input[type=image][align=*] - $11.3.3 */ err = dom_node_get_node_name(node, &node_name);
if (strcmp((const char *) n->name, "table") == 0 || if ((err != DOM_NO_ERR) || (node_name == NULL)) {
strcmp((const char *) n->name, "applet") == 0 || return CSS_NOMEM;
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) /** \todo input[type=image][align=*] - $11.3.3 */
return CSS_PROPERTY_NOT_SET; 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;
}
if (strcasecmp((const char *) align, "left") == 0) { dom_string_unref(node_name);
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); 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; 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; return CSS_PROPERTY_NOT_SET;
} }