From 1548c232caffc716d66b04c0bf8bd3dd9ecfe9aa Mon Sep 17 00:00:00 2001 From: James Bursa Date: Wed, 27 Aug 2003 20:09:57 +0000 Subject: [project @ 2003-08-27 20:09:57 by bursa] Fix negative dimensions, more gui cleanup. svn path=/import/netsurf/; revision=252 --- render/box.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'render/box.c') diff --git a/render/box.c b/render/box.c index f4b5e317a..0f9938f14 100644 --- a/render/box.c +++ b/render/box.c @@ -493,13 +493,16 @@ struct css_style * box_get_style(struct content ** stylesheet, } if ((s = (char *) xmlGetProp(n, (const xmlChar *) "height"))) { - if (strrchr(s, '%')) { + float value = atof(s); + if (value < 0) { + /* ignore negative values */ + } else if (strrchr(s, '%')) { /*the specification doesn't make clear what * percentage heights mean, so ignore them */ } else { - style->height.height = CSS_HEIGHT_LENGTH; - style->height.length.unit = CSS_UNIT_PX; - style->height.length.value = atof(s); + style->height.height = CSS_HEIGHT_LENGTH; + style->height.length.unit = CSS_UNIT_PX; + style->height.length.value = value; } xmlFree(s); } @@ -516,13 +519,16 @@ struct css_style * box_get_style(struct content ** stylesheet, } if ((s = (char *) xmlGetProp(n, (const xmlChar *) "width"))) { - if (strrchr(s, '%')) { + float value = atof(s); + if (value < 0) { + /* ignore negative values */ + } else if (strrchr(s, '%')) { style->width.width = CSS_WIDTH_PERCENT; - style->width.value.percent = atof(s); + style->width.value.percent = value; } else { style->width.width = CSS_WIDTH_LENGTH; style->width.value.length.unit = CSS_UNIT_PX; - style->width.value.length.value = atof(s); + style->width.value.length.value = value; } xmlFree(s); } -- cgit v1.2.3