diff options
author | James Bursa <james@netsurf-browser.org> | 2003-08-27 20:09:57 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2003-08-27 20:09:57 +0000 |
commit | 1548c232caffc716d66b04c0bf8bd3dd9ecfe9aa (patch) | |
tree | 301762d4e8760f221f7b5e339885d520df0fc9e0 /render | |
parent | fd5b6d0c80155ac8e1a0c77936f9875ec6a30198 (diff) | |
download | netsurf-1548c232caffc716d66b04c0bf8bd3dd9ecfe9aa.tar.gz netsurf-1548c232caffc716d66b04c0bf8bd3dd9ecfe9aa.tar.bz2 |
[project @ 2003-08-27 20:09:57 by bursa]
Fix negative dimensions, more gui cleanup.
svn path=/import/netsurf/; revision=252
Diffstat (limited to 'render')
-rw-r--r-- | render/box.c | 20 |
1 files changed, 13 insertions, 7 deletions
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); } |