Fix up border-{trbl}-style hint
svn path=/trunk/netsurf/; revision=13710
This commit is contained in:
parent
56ae7b5955
commit
bfc619a8dc
|
@ -92,6 +92,7 @@ dom_string *nscss_dom_string_background;
|
|||
dom_string *nscss_dom_string_baseline;
|
||||
dom_string *nscss_dom_string_bgcolor;
|
||||
dom_string *nscss_dom_string_body;
|
||||
dom_string *nscss_dom_string_border;
|
||||
dom_string *nscss_dom_string_bordercolor;
|
||||
dom_string *nscss_dom_string_bottom;
|
||||
dom_string *nscss_dom_string_caption;
|
||||
|
@ -846,6 +847,7 @@ static void nscss_fini(void)
|
|||
CSS_DOM_STRING_UNREF(baseline);
|
||||
CSS_DOM_STRING_UNREF(bgcolor);
|
||||
CSS_DOM_STRING_UNREF(body);
|
||||
CSS_DOM_STRING_UNREF(border);
|
||||
CSS_DOM_STRING_UNREF(bordercolor);
|
||||
CSS_DOM_STRING_UNREF(bottom);
|
||||
CSS_DOM_STRING_UNREF(caption);
|
||||
|
@ -956,6 +958,7 @@ nserror nscss_init(void)
|
|||
CSS_DOM_STRING_INTERN(baseline);
|
||||
CSS_DOM_STRING_INTERN(bgcolor);
|
||||
CSS_DOM_STRING_INTERN(body);
|
||||
CSS_DOM_STRING_INTERN(border);
|
||||
CSS_DOM_STRING_INTERN(bordercolor);
|
||||
CSS_DOM_STRING_INTERN(bottom);
|
||||
CSS_DOM_STRING_INTERN(caption);
|
||||
|
|
|
@ -33,6 +33,7 @@ extern struct dom_string *nscss_dom_string_background;
|
|||
extern struct dom_string *nscss_dom_string_baseline;
|
||||
extern struct dom_string *nscss_dom_string_bgcolor;
|
||||
extern struct dom_string *nscss_dom_string_body;
|
||||
extern struct dom_string *nscss_dom_string_border;
|
||||
extern struct dom_string *nscss_dom_string_bordercolor;
|
||||
extern struct dom_string *nscss_dom_string_bottom;
|
||||
extern struct dom_string *nscss_dom_string_caption;
|
||||
|
|
85
css/select.c
85
css/select.c
|
@ -2386,36 +2386,75 @@ node_presentational_hint_border_trbl_style(nscss_select_ctx *ctx,
|
|||
dom_node *node,
|
||||
css_hint *hint)
|
||||
{
|
||||
#ifdef FIXME
|
||||
dom_string *name;
|
||||
dom_exception exc;
|
||||
|
||||
bool is_table_cell = false;
|
||||
exc = dom_node_get_node_name(node, &name);
|
||||
if (exc != DOM_NO_ERR)
|
||||
return CSS_BADPARM;
|
||||
|
||||
if (strcmp((const char *) n->name, "td") == 0 ||
|
||||
strcmp((const char *) n->name, "th") == 0) {
|
||||
is_table_cell = true;
|
||||
/* Find table */
|
||||
for (n = n->parent; n != NULL &&
|
||||
n->type == XML_ELEMENT_NODE;
|
||||
n = n->parent) {
|
||||
if (strcmp((const char *) n->name, "table") ==
|
||||
0)
|
||||
break;
|
||||
if (dom_string_isequal(name, nscss_dom_string_td) ||
|
||||
dom_string_isequal(name, nscss_dom_string_th)) {
|
||||
css_qname qs;
|
||||
dom_node *tablenode = NULL;
|
||||
qs.ns = NULL;
|
||||
|
||||
exc = dom_string_intern(nscss_dom_string_table, &qs.name);
|
||||
if (exc != DOM_NO_ERR) {
|
||||
dom_string_unref(name);
|
||||
return CSS_BADPARM;
|
||||
}
|
||||
|
||||
if (n == NULL)
|
||||
if (named_ancestor_node(ctx, node, &qs,
|
||||
(void **)&tablenode) != CSS_OK) {
|
||||
/* Didn't find, or had error */
|
||||
lwc_string_unref(qs.name);
|
||||
dom_string_unref(name);
|
||||
return CSS_PROPERTY_NOT_SET;
|
||||
}
|
||||
|
||||
lwc_string_unref(qs.name);
|
||||
|
||||
if (tablenode != NULL) {
|
||||
bool has_border = false;
|
||||
|
||||
exc = dom_element_has_attribute(tablenode,
|
||||
nscss_dom_string_border,
|
||||
&has_border);
|
||||
if (exc != DOM_NO_ERR) {
|
||||
dom_string_unref(name);
|
||||
return CSS_BADPARM;
|
||||
}
|
||||
|
||||
if (has_border) {
|
||||
hint->status = CSS_BORDER_STYLE_INSET;
|
||||
dom_string_unref(name);
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
/* No need to unref tablenode, named_ancestor_node does not
|
||||
* return a reffed node to the CSS
|
||||
*/
|
||||
} else if (dom_string_isequal(name, nscss_dom_string_table)) {
|
||||
bool has_border = false;
|
||||
|
||||
exc = dom_element_has_attribute(node,
|
||||
nscss_dom_string_border,
|
||||
&has_border);
|
||||
if (exc != DOM_NO_ERR) {
|
||||
dom_string_unref(name);
|
||||
return CSS_BADPARM;
|
||||
}
|
||||
|
||||
if (has_border) {
|
||||
hint->status = CSS_BORDER_STYLE_OUTSET;
|
||||
dom_string_unref(name);
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp((const char *) n->name, "table") == 0 &&
|
||||
xmlHasProp(n,
|
||||
(const xmlChar *) "border") != NULL) {
|
||||
if (is_table_cell)
|
||||
hint->status = CSS_BORDER_STYLE_INSET;
|
||||
else
|
||||
hint->status = CSS_BORDER_STYLE_OUTSET;
|
||||
return CSS_OK;
|
||||
}
|
||||
#endif
|
||||
dom_string_unref(name);
|
||||
|
||||
return CSS_PROPERTY_NOT_SET;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue