[project @ 2005-04-28 01:17:52 by rjw]

Translate hspace/vspace to CSS margin values.

svn path=/import/netsurf/; revision=1692
This commit is contained in:
Richard Wilson 2005-04-28 01:17:52 +00:00
parent a174282e08
commit 991b660eea

View File

@ -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);