LayoutTests:
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Feb 2007 18:07:26 +0000 (18:07 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Feb 2007 18:07:26 +0000 (18:07 +0000)
        Reviewed by Darin

        - test for Imagemap not clickable in www.toptenbooks.net/
        http://bugs.webkit.org/show_bug.cgi?id=12738

        * fast/images/imagemap-case-expected.checksum: Added.
        * fast/images/imagemap-case-expected.png: Added.
        * fast/images/imagemap-case-expected.txt: Added.
        * fast/images/imagemap-case.html: Added.

WebCore:

        Reviewed by Darin.

        - fixed Imagemap not clickable in www.toptenbooks.net/
        http://bugs.webkit.org/show_bug.cgi?id=12738

        Make imagemap names case insensitive in HTML mode

        * dom/Document.cpp:
        (WebCore::Document::getImageMap):
        * html/HTMLMapElement.cpp:
        (WebCore::HTMLMapElement::parseMappedAttribute):

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

LayoutTests/ChangeLog
LayoutTests/fast/images/imagemap-case-expected.checksum [new file with mode: 0644]
LayoutTests/fast/images/imagemap-case-expected.png [new file with mode: 0644]
LayoutTests/fast/images/imagemap-case-expected.txt [new file with mode: 0644]
LayoutTests/fast/images/imagemap-case.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/dom/Document.cpp
WebCore/html/HTMLMapElement.cpp

index 8c41f98..3fd9fed 100644 (file)
@@ -1,3 +1,15 @@
+2007-02-12  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Darin
+
+        - test for Imagemap not clickable in www.toptenbooks.net/
+        http://bugs.webkit.org/show_bug.cgi?id=12738
+
+        * fast/images/imagemap-case-expected.checksum: Added.
+        * fast/images/imagemap-case-expected.png: Added.
+        * fast/images/imagemap-case-expected.txt: Added.
+        * fast/images/imagemap-case.html: Added.
+
 2007-02-12  Geoffrey Garen  <ggaren@apple.com>
 
         Updated results for this failing test. It looks like Maciej generated
diff --git a/LayoutTests/fast/images/imagemap-case-expected.checksum b/LayoutTests/fast/images/imagemap-case-expected.checksum
new file mode 100644 (file)
index 0000000..6076f85
--- /dev/null
@@ -0,0 +1 @@
+87d28385a653b61d6cc49ed03c8b47bb
\ No newline at end of file
diff --git a/LayoutTests/fast/images/imagemap-case-expected.png b/LayoutTests/fast/images/imagemap-case-expected.png
new file mode 100644 (file)
index 0000000..714c82f
Binary files /dev/null and b/LayoutTests/fast/images/imagemap-case-expected.png differ
diff --git a/LayoutTests/fast/images/imagemap-case-expected.txt b/LayoutTests/fast/images/imagemap-case-expected.txt
new file mode 100644 (file)
index 0000000..217c224
--- /dev/null
@@ -0,0 +1,26 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x268
+  RenderBlock {HTML} at (0,0) size 800x268
+    RenderBody {BODY} at (8,8) size 784x252
+      RenderBlock (anonymous) at (0,0) size 784x216
+        RenderInline {MAP} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderImage {IMG} at (0,0) size 104x104 [border: (2px solid #000000)]
+        RenderText {#text} at (104,90) size 4x18
+          text run at (104,90) width 4: " "
+        RenderBR {BR} at (0,0) size 0x0
+        RenderInline {MAP} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderImage {IMG} at (0,108) size 104x104 [border: (2px solid #000000)]
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {DIV} at (0,216) size 784x18
+        RenderText {#text} at (0,0) size 47x18
+          text run at (0,0) width 47: "success"
+      RenderBlock {DIV} at (0,234) size 784x18
+        RenderText {#text} at (0,0) size 47x18
+          text run at (0,0) width 47: "success"
diff --git a/LayoutTests/fast/images/imagemap-case.html b/LayoutTests/fast/images/imagemap-case.html
new file mode 100644 (file)
index 0000000..c47d372
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<map name="navMap">
+<area shape=rect coords="0,0,100,100" href onclick="document.getElementById('res1').innerHTML = 'success';return false;"> 
+</map>
+<img border=2 width=100 height=100 usemap=#navmap ismap>
+
+<br>
+
+<map name="navmap2">
+<area shape=rect coords="0,0,100,100" href onclick="document.getElementById('res2').innerHTML = 'success';return false;"> 
+</map>
+<img border=2 width=100 height=100 usemap=#navMap2 ismap>
+
+<div id=res1></div>
+<div id=res2></div>
+
+<script>
+    if (window.eventSender) {
+        eventSender.mouseMoveTo(50, 50);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+        eventSender.mouseMoveTo(50, 150);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    }    
+</script>
index 3e48484..b4e6f95 100644 (file)
@@ -1,3 +1,17 @@
+2007-02-12  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Darin.
+
+        - fixed Imagemap not clickable in www.toptenbooks.net/
+        http://bugs.webkit.org/show_bug.cgi?id=12738
+        
+        Make imagemap names case insensitive in HTML mode
+
+        * dom/Document.cpp:
+        (WebCore::Document::getImageMap):
+        * html/HTMLMapElement.cpp:
+        (WebCore::HTMLMapElement::parseMappedAttribute):
+
 2007-02-12  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Antti.
index 50e2076..178fc93 100644 (file)
@@ -2481,8 +2481,9 @@ HTMLMapElement *Document::getImageMap(const String& URL) const
     if (URL.isNull())
         return 0;
     int hashPos = URL.find('#');
-    AtomicString name = (hashPos < 0 ? URL : URL.substring(hashPos + 1)).impl();
-    return m_imageMapsByName.get(name.impl());
+    String name = (hashPos < 0 ? URL : URL.substring(hashPos + 1)).impl();
+    AtomicString mapName = hMode == XHtml ? name : name.lower();
+    return m_imageMapsByName.get(mapName.impl());
 }
 
 void Document::setDecoder(TextResourceDecoder *decoder)
index 0a3cf18..befe533 100644 (file)
@@ -86,12 +86,10 @@ void HTMLMapElement::parseMappedAttribute(MappedAttribute* attr)
                 return;
         }
         doc->removeImageMap(this);
-        m_name = attr->value();
-        if (m_name[0] == '#') {
-            String mapName(m_name.domString().copy());
+        String mapName = attr->value();
+        if (mapName[0] == '#')
             mapName.remove(0, 1);
-            m_name = mapName;
-        }
+        m_name = doc->htmlMode() == Document::XHtml ? mapName : mapName.lower();
         doc->addImageMap(this);
     } else
         HTMLElement::parseMappedAttribute(attr);