diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2004-03-26 22:16:31 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2004-03-26 22:16:31 +0000 |
commit | 4b38a2d61a0d46485c885529a054a5bacb014c1d (patch) | |
tree | 0cce5903ac586fb7f90e14055df3872f7057c1c8 /render/box.c | |
parent | 83b08353412d136d02266206dc2ec025477f70c3 (diff) | |
download | netsurf-4b38a2d61a0d46485c885529a054a5bacb014c1d.tar.gz netsurf-4b38a2d61a0d46485c885529a054a5bacb014c1d.tar.bz2 |
[project @ 2004-03-26 22:16:31 by jmb]
Imagemap support
svn path=/import/netsurf/; revision=671
Diffstat (limited to 'render/box.c')
-rw-r--r-- | render/box.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/render/box.c b/render/box.c index d694481a1..015af7411 100644 --- a/render/box.c +++ b/render/box.c @@ -190,6 +190,7 @@ struct box * box_create(struct css_style * style, box->col = 0; box->font = 0; box->gadget = 0; + box->usemap = 0; box->object = 0; #ifdef WITH_PLUGIN box->object_params = 0; @@ -771,7 +772,7 @@ struct result box_image(xmlNode *n, struct status *status, struct css_style *style) { struct box *box; - char *s, *url, *s1; + char *s, *url, *s1, *map; xmlChar *s2; box = box_create(style, status->href, status->title, @@ -789,6 +790,17 @@ struct result box_image(xmlNode *n, struct status *status, if (!(s = (char *) xmlGetProp(n, (const xmlChar *) "src"))) return (struct result) {box, 0}; + /* imagemap associated with this image */ + if ((map = xmlGetProp(n, (const xmlChar *) "usemap"))) { + if (map[0] == '#') { + box->usemap = xstrdup(map+1); + } + else { + box->usemap = xstrdup(map); + } + xmlFree(map); + } + /* remove leading and trailing whitespace */ s1 = strip(s); @@ -1764,6 +1776,8 @@ void box_free_box(struct box *box) free(box->style); } + if (box->usemap) + free(box->usemap); free(box->text); /* TODO: free object_params */ } @@ -1779,7 +1793,7 @@ struct result box_object(xmlNode *n, struct status *status, struct box *box; struct object_params *po; struct plugin_params* pp; - char *s, *url = NULL; + char *s, *url = NULL, *map; xmlNode *c; box = box_create(style, status->href, 0, @@ -1808,6 +1822,17 @@ struct result box_object(xmlNode *n, struct status *status, xmlFree(s); } + /* imagemap associated with this object */ + if ((map = xmlGetProp(n, (const xmlChar *) "usemap"))) { + if (map[0] == '#') { + box->usemap = xstrdup(map+1); + } + else { + box->usemap = xstrdup(map); + } + xmlFree(map); + } + /* object type */ if ((s = (char *) xmlGetProp(n, (const xmlChar *) "type"))) { |