From 55e2831909647877596f11d43dbf829bed148cdf Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 21 Aug 2008 18:00:32 +0000 Subject: [PATCH] Ignore height/width attributes on elements where they are not permitted. svn path=/trunk/netsurf/; revision=5162 --- render/box_construct.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/render/box_construct.c b/render/box_construct.c index 62705cfbf..f65270e9c 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -910,7 +910,13 @@ struct css_style * box_get_style(struct content *c, } if (!author->height && (s = (char *) xmlGetProp(n, - (const xmlChar *) "height"))) { + (const xmlChar *) "height")) && + ((strcmp((const char *) n->name, "iframe") == 0) || + (strcmp((const char *) n->name, "td") == 0) || + (strcmp((const char *) n->name, "th") == 0) || + (strcmp((const char *) n->name, "img") == 0) || + (strcmp((const char *) n->name, "object") == 0) || + (strcmp((const char *) n->name, "applet") == 0))) { float value = isdigit(s[0]) ? atof(s) : -1; if (value <= 0 || strlen(s) == 0) { /* ignore negative values and height="" */ @@ -985,7 +991,15 @@ struct css_style * box_get_style(struct content *c, } if (!author->width && (s = (char *) xmlGetProp(n, - (const xmlChar *) "width"))) { + (const xmlChar *) "width")) && + ((strcmp((const char *) n->name, "hr") == 0) || + (strcmp((const char *) n->name, "iframe") == 0) || + (strcmp((const char *) n->name, "img") == 0) || + (strcmp((const char *) n->name, "object") == 0) || + (strcmp((const char *) n->name, "table") == 0) || + (strcmp((const char *) n->name, "td") == 0) || + (strcmp((const char *) n->name, "th") == 0) || + (strcmp((const char *) n->name, "applet") == 0))) { float value = isdigit(s[0]) ? atof(s) : -1; if (value < 0 || strlen(s) == 0) { /* ignore negative values and width="" */