RESOLVED FIXED 54636
Area element doesn't update region when dynamically altered
https://bugs.webkit.org/show_bug.cgi?id=54636
Summary Area element doesn't update region when dynamically altered
bz
Reported 2011-02-17 04:48:04 PST
If you create an image map with an area, and then you change the coordinates for that area after you have moved the mouse over it, then the area will not update to the new coordinates. In the following example, there is a single area to the left of the image. If you click on it, the area should move to the right, but it doesn't. <img ismap usemap="#map1" style="width:200; height:100"/> <map name="map1"> <area id="area1" shape="rect" coords="0,0,100,100" href="#" title="xx"/ onclick="document.getElementById ('area1').coords = '100,0,200,100'"> </map> I believe the bug lies in HTMLAreaElement.cpp in the mapMouseEvent() function. It only recreates the region for the area if the associated image size changes. If I resize the image as in the code below, then it works. <img id="image1" ismap usemap="#map1" style="width:200; height:100"/> <map name="map1"> <area id="area1" shape="rect" coords="0,0,100,100" href="#" title="xx"/ onclick="document.getElementById ('area1').coords = '100,0,200,100'; document.getElementById ('image1').style.width = 201"> </map> The code needs changing to recalculate the region when the shape type or coordinates of the area have changed since the last call. i.e. add a recalculate flag that gets set when either of these attributes change.
Attachments
Proposed patch (7.97 KB, patch)
2011-05-17 07:35 PDT, Andreas Kling
no flags
Xavi
Comment 1 2011-03-09 05:05:42 PST
I've also ran into this problem. Here's a page that reproduces this bug: http://xavi.co/static/image-map-test.html Also here's a link to a chromium bug reporting the same issue: http://code.google.com/p/chromium/issues/detail?id=34530
Andreas Kling
Comment 2 2011-05-17 07:35:55 PDT
Created attachment 93764 [details] Proposed patch
Kenneth Rohde Christiansen
Comment 3 2011-05-17 12:16:08 PDT
Comment on attachment 93764 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=93764&action=review > LayoutTests/fast/images/script-tests/imagemap-dynamic-area-updates.js:7 > +image.setAttribute('usemap', '#m'); So long since I have used this :-) > LayoutTests/fast/images/script-tests/imagemap-dynamic-area-updates.js:72 > +var successfullyParsed = true; Who sets this to false in case of failure? Is that handled by the wrapper?
Andreas Kling
Comment 4 2011-05-17 12:22:46 PDT
(In reply to comment #3) > > LayoutTests/fast/images/script-tests/imagemap-dynamic-area-updates.js:72 > > +var successfullyParsed = true; > > Who sets this to false in case of failure? Is that handled by the wrapper? Indeed! finishJSTest() in js-test-pre.js checks that successfullyParsed is true.
Andreas Kling
Comment 5 2011-05-17 12:26:20 PDT
Comment on attachment 93764 [details] Proposed patch Clearing flags on attachment: 93764 Committed r86695: <http://trac.webkit.org/changeset/86695>
Andreas Kling
Comment 6 2011-05-17 12:26:29 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.