From 48e4666fee8e1f1f2c213217ac1a93050a4421bd Mon Sep 17 00:00:00 2001 From: James Bursa Date: Tue, 7 Jan 2003 23:24:43 +0000 Subject: [project @ 2003-01-07 23:24:43 by bursa] Minor attribute handling changes. svn path=/import/netsurf/; revision=90 --- render/box.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/render/box.c b/render/box.c index f209d9586..e5515e12e 100644 --- a/render/box.c +++ b/render/box.c @@ -1,5 +1,5 @@ /** - * $Id: box.c,v 1.30 2003/01/07 23:15:23 bursa Exp $ + * $Id: box.c,v 1.31 2003/01/07 23:24:43 bursa Exp $ */ #include @@ -421,18 +421,21 @@ struct css_style * box_get_style(struct css_stylesheet * stylesheet, struct css_ unsigned int r, g, b; if (s[0] == '#' && sscanf(s + 1, "%2x%2x%2x", &r, &g, &b) == 3) style->background_color = (b << 16) | (g << 8) | r; + free(s); } if ((s = (char *) xmlGetProp(n, (const xmlChar *) "clear"))) { if (stricmp(s, "all") == 0) style->clear = CSS_CLEAR_BOTH; else if (stricmp(s, "left") == 0) style->clear = CSS_CLEAR_LEFT; else if (stricmp(s, "right") == 0) style->clear = CSS_CLEAR_RIGHT; + free(s); } if ((s = (char *) xmlGetProp(n, (const xmlChar *) "color"))) { unsigned int r, g, b; if (s[0] == '#' && sscanf(s + 1, "%2x%2x%2x", &r, &g, &b) == 3) style->color = (b << 16) | (g << 8) | r; + free(s); } if ((s = (char *) xmlGetProp(n, (const xmlChar *) "height"))) { @@ -442,6 +445,15 @@ struct css_style * box_get_style(struct css_stylesheet * stylesheet, struct css_ free(s); } + if (strcmp((const char *) n->name, "body") == 0) { + if ((s = (char *) xmlGetProp(n, (const xmlChar *) "text"))) { + unsigned int r, g, b; + if (s[0] == '#' && sscanf(s + 1, "%2x%2x%2x", &r, &g, &b) == 3) + style->color = (b << 16) | (g << 8) | r; + free(s); + } + } + if ((s = (char *) xmlGetProp(n, (const xmlChar *) "width"))) { if (strrchr(s, '%')) { style->width.width = CSS_WIDTH_PERCENT; -- cgit v1.2.3