Mercurial > dillo_port1.3
changeset 1623:44025cca807b
make drawing image map shapes work when <img> precedes <map>
http://lists.auriga.wearlab.de/pipermail/dillo-dev/2010-March/007406.html
Johannes wrote the code, and I (corvid) added some big comments of the sort
alluded to in that thread.
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> |
---|---|
date | Sun, 21 Mar 2010 03:14:39 +0000 |
parents | 5fafc795ebbd |
children | d7761a69d274 |
files | dw/image.hh src/html.cc |
diffstat | 2 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/dw/image.hh Sat Mar 20 01:55:00 2010 +0000 +++ b/dw/image.hh Sun Mar 21 03:14:39 2010 +0000 @@ -159,6 +159,13 @@ void setIsMap (); void setUseMap (ImageMapsList *list, Object *key); + + /* This is a hack for the perhaps frivolous feature of drawing image map + * shapes when there is no image to display. If the map is defined after + * an image using an image map, and the actual image data has not been + * loaded, tell the image to redraw. + */ + void forceMapRedraw () { if (mapKey && ! buffer) queueDraw (); }; }; } // namespace dw
--- a/src/html.cc Sat Mar 20 01:55:00 2010 +0000 +++ b/src/html.cc Sun Mar 21 03:14:39 2010 +0000 @@ -2199,6 +2199,17 @@ */ static void Html_tag_close_map(DilloHtml *html, int TagIdx) { + /* This is a hack for the perhaps frivolous feature of drawing image map + * shapes when there is no image to display. If this map is defined after + * an image that has not been loaded (img != NULL), tell the image to + * redraw. (It will only do so if it uses a map.) + */ + for (int i = 0; i < html->images->size(); i++) { + DilloImage *img = html->images->get(i)->image; + + if (img) + ((dw::Image*) img->dw)->forceMapRedraw(); + } html->InFlags &= ~IN_MAP; }