Fix for bug 5298, shape=default not supported for image maps. Implement
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Sep 2006 21:31:59 +0000 (21:31 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Sep 2006 21:31:59 +0000 (21:31 +0000)
        support for it.

        Reviewed by timo

        * html/HTMLAreaElement.cpp:
        (WebCore::HTMLAreaElement::getRegion):
        * html/HTMLMapElement.cpp:
        (WebCore::HTMLMapElement::mapMouseEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16451 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/html/HTMLAreaElement.cpp
WebCore/html/HTMLMapElement.cpp

index 357a8afc49df9a1395690b104a76559a4089159d..1c80509dad7fd91a111120001880768ef9ace214 100644 (file)
@@ -1,3 +1,15 @@
+2006-09-19  David Hyatt  <hyatt@apple.com>
+
+        Fix for bug 5298, shape=default not supported for image maps.  Implement
+        support for it.
+
+        Reviewed by timo
+
+        * html/HTMLAreaElement.cpp:
+        (WebCore::HTMLAreaElement::getRegion):
+        * html/HTMLMapElement.cpp:
+        (WebCore::HTMLMapElement::mapMouseEvent):
+
 2006-09-19  Adam Roben  <aroben@apple.com>
 
         Reviewed by Adele.
 2006-09-19  Adam Roben  <aroben@apple.com>
 
         Reviewed by Adele.
index 2c7f2717bd982bb8dd72d5d71983c1c56196e39a..05ffa1106c675b524d688499c426373340156af1 100644 (file)
@@ -94,9 +94,9 @@ IntRect HTMLAreaElement::getRect(RenderObject* obj) const
 
 Path HTMLAreaElement::getRegion(const IntSize& size) const
 {
 
 Path HTMLAreaElement::getRegion(const IntSize& size) const
 {
-    if (!m_coords)
+    if (!m_coords && m_shape != Default)
         return Path();
         return Path();
-        
+
     int width = size.width();
     int height = size.height();
 
     int width = size.width();
     int height = size.height();
 
index 93dc0cce8d971d89bd0f273415da2eed7e1a7a5c..69717026927ddf84470e761f64b91a17ee27b782 100644 (file)
@@ -52,12 +52,24 @@ bool HTMLMapElement::checkDTD(const Node* newChild)
 
 bool HTMLMapElement::mapMouseEvent(int x, int y, const IntSize& size, RenderObject::NodeInfo& info)
 {
 
 bool HTMLMapElement::mapMouseEvent(int x, int y, const IntSize& size, RenderObject::NodeInfo& info)
 {
+    HTMLAreaElement* defaultArea = 0;
     Node *node = this;
     Node *node = this;
-    while ((node = node->traverseNextNode(this)))
-        if (node->hasTagName(areaTag))
-            if (static_cast<HTMLAreaElement*>(node)->mapMouseEvent(x, y, size, info))
+    while ((node = node->traverseNextNode(this))) {
+        if (node->hasTagName(areaTag)) {
+            HTMLAreaElement* areaElt = static_cast<HTMLAreaElement*>(node);
+            if (areaElt->isDefault()) {
+                if (!defaultArea)
+                    defaultArea = areaElt;
+            } else if (areaElt->mapMouseEvent(x, y, size, info))
                 return true;
                 return true;
-    return false;
+        }
+    }
+    
+    if (defaultArea) {
+        info.setInnerNode(defaultArea);
+        info.setURLElement(defaultArea);
+    }
+    return defaultArea;
 }
 
 void HTMLMapElement::parseMappedAttribute(MappedAttribute* attr)
 }
 
 void HTMLMapElement::parseMappedAttribute(MappedAttribute* attr)