diff options
author | Richard Wilson <rjw@netsurf-browser.org> | 2005-04-28 01:17:52 +0000 |
---|---|---|
committer | Richard Wilson <rjw@netsurf-browser.org> | 2005-04-28 01:17:52 +0000 |
commit | 991b660eea8de7db74fbeba9d7bcd9dd036cb1b3 (patch) | |
tree | 403d6df5c5026948bbf7257cadf6b7299eb4c37a /render/box_construct.c | |
parent | a174282e087c709e0c9fb067006fac165e67bacc (diff) | |
download | netsurf-991b660eea8de7db74fbeba9d7bcd9dd036cb1b3.tar.gz netsurf-991b660eea8de7db74fbeba9d7bcd9dd036cb1b3.tar.bz2 |
[project @ 2005-04-28 01:17:52 by rjw]
Translate hspace/vspace to CSS margin values.
svn path=/import/netsurf/; revision=1692
Diffstat (limited to 'render/box_construct.c')
-rw-r--r-- | render/box_construct.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/render/box_construct.c b/render/box_construct.c index 5a25e6ab8..466d9b5f4 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -29,7 +29,7 @@ #ifdef riscos #include "netsurf/desktop/gui.h" #endif -#define NDEBUG +//#define NDEBUG #include "netsurf/utils/log.h" #include "netsurf/utils/messages.h" #include "netsurf/utils/talloc.h" @@ -790,6 +790,50 @@ struct css_style * box_get_style(struct content *c, } } + if ((strcmp((const char *) n->name, "img") == 0) || + (strcmp((const char *) n->name, "applet") == 0)) { + if ((s = (char *) xmlGetProp(n, + (const xmlChar *) "hspace"))) { + if (!strrchr(s, '%')) { /* % not implemented */ + int value = atoi(s); + if (0 <= value) { + style->margin[LEFT].margin = + CSS_MARGIN_LENGTH; + style->margin[LEFT].value.length.value = + value; + style->margin[LEFT].value.length.unit = + CSS_UNIT_PX; + style->margin[RIGHT].margin = + CSS_MARGIN_LENGTH; + style->margin[RIGHT].value.length.value = + value; + style->margin[RIGHT].value.length.unit = + CSS_UNIT_PX; + } + } + } + if ((s = (char *) xmlGetProp(n, + (const xmlChar *) "vspace"))) { + if (!strrchr(s, '%')) { /* % not implemented */ + int value = atoi(s); + if (0 <= value) { + style->margin[TOP].margin = + CSS_MARGIN_LENGTH; + style->margin[TOP].value.length.value = + value; + style->margin[TOP].value.length.unit = + CSS_UNIT_PX; + style->margin[BOTTOM].margin = + CSS_MARGIN_LENGTH; + style->margin[BOTTOM].value.length.value = + value; + style->margin[BOTTOM].value.length.unit = + CSS_UNIT_PX; + } + } + } + } + if ((s = (char *) xmlGetProp(n, (const xmlChar *) "style"))) { struct css_style *astyle; astyle = css_duplicate_style(&css_empty_style); |