2011-05-17  Andreas Kling  <kling@webkit.org>

        Reviewed by Kenneth Rohde Christiansen.

        Area element doesn't update region when dynamically altered.
        https://bugs.webkit.org/show_bug.cgi?id=54636

        * fast/images/imagemap-dynamic-area-updates-expected.txt: Added.
        * fast/images/imagemap-dynamic-area-updates.html: Added.
        * fast/images/script-tests/imagemap-dynamic-area-updates.js: Added.
        (setArea):
        (checkForArea):
2011-05-17  Andreas Kling  <kling@webkit.org>

        Reviewed by Kenneth Rohde Christiansen.

        Area element doesn't update region when dynamically altered.
        https://bugs.webkit.org/show_bug.cgi?id=54636

        Recompute the clickable region after the "shape" or "coords" attribute
        of an area element is changed.

        Test: fast/images/imagemap-dynamic-area-updates.html

        * html/HTMLAreaElement.cpp:
        (WebCore::HTMLAreaElement::parseMappedAttribute):
        (WebCore::HTMLAreaElement::invalidateCachedRegion):
        * html/HTMLAreaElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86695 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/html/HTMLAreaElement.cpp b/Source/WebCore/html/HTMLAreaElement.cpp
index 4cb2748..70cc1cb 100644
--- a/Source/WebCore/html/HTMLAreaElement.cpp
+++ b/Source/WebCore/html/HTMLAreaElement.cpp
@@ -63,14 +63,21 @@
             m_shape = Poly;
         else if (equalIgnoringCase(attr->value(), "rect"))
             m_shape = Rect;
+        invalidateCachedRegion();
     } else if (attr->name() == coordsAttr) {
         m_coords = newCoordsArray(attr->value().string(), m_coordsLen);
+        invalidateCachedRegion();
     } else if (attr->name() == altAttr || attr->name() == accesskeyAttr) {
         // Do nothing.
     } else
         HTMLAnchorElement::parseMappedAttribute(attr);
 }
 
+void HTMLAreaElement::invalidateCachedRegion()
+{
+    m_lastSize = IntSize(-1, -1);
+}
+
 bool HTMLAreaElement::mapMouseEvent(int x, int y, const IntSize& size, HitTestResult& result)
 {
     if (m_lastSize != size) {