Treat unitless CSS values as pixels (fix 1527056)

svn path=/trunk/netsurf/; revision=2851
This commit is contained in:
Richard Wilson 2006-08-15 19:20:36 +00:00
parent 844e6de6a9
commit 8852cdd109
1 changed files with 9 additions and 4 deletions

View File

@ -622,12 +622,17 @@ int parse_length(struct css_length * const length,
length->value = 0;
return 0;
}
if (v->type != CSS_NODE_DIMENSION)
if ((v->type != CSS_NODE_DIMENSION) && (v->type != CSS_NODE_NUMBER))
return 1;
num_length = strspn(v->data, "0123456789+-.");
u = css_unit_parse(v->data + num_length, v->data_length - num_length);
if (u == CSS_UNIT_UNKNOWN)
return 1;
if (v->type == CSS_NODE_DIMENSION)
u = css_unit_parse(v->data + num_length, v->data_length - num_length);
if (u == CSS_UNIT_UNKNOWN) {
return 1;
}
} else {
u = CSS_UNIT_PX;
}
value = atof(v->data);
if (non_negative && value < 0)
return 1;