<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209810] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209810">209810</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-12-14 09:37:24 -0800 (Wed, 14 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove Unicode case-insensitive matching for usemap=""
https://bugs.webkit.org/show_bug.cgi?id=163894
Reviewed by Antti Koivisto.
LayoutTests/imported/w3c:
Rebaseline W3C test now that more checks are passing.
* web-platform-tests/html/semantics/embedded-content/the-img-element/usemap-casing-expected.txt:
Source/WebCore:
Remove Unicode case-insensitive matching for usemap="" as this no longer
matches the specification [1] or Firefox. Also align our parsing logic for
the usemap attribute to match the specification [2].
This simplifies the code a bit, is more efficient and the compatibility
risk should be low based on Firefox's behavior and Chome's usage data.
[1] https://github.com/whatwg/html/commit/6acdb2122298d2bb7bb839c0a61b4e1f9b0f9bc9
[2] https://html.spec.whatwg.org/#rules-for-parsing-a-hash-name-reference
Test: fast/images/image-usemap-parsing.html
* dom/Document.cpp:
(WebCore::Document::addImageElementByUsemap):
(WebCore::Document::removeImageElementByUsemap):
(WebCore::Document::imageElementByUsemap):
* dom/Document.h:
* dom/DocumentOrderedMap.cpp:
(WebCore::DocumentOrderedMap::getElementByUsemap):
* dom/DocumentOrderedMap.h:
* dom/TreeScope.cpp:
(WebCore::TreeScope::getImageMap):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseAttribute):
(WebCore::HTMLImageElement::insertedInto):
(WebCore::HTMLImageElement::removedFrom):
(WebCore::HTMLImageElement::matchesUsemap):
* html/HTMLImageElement.h:
* html/HTMLMapElement.cpp:
(WebCore::HTMLMapElement::imageElement):
(WebCore::HTMLMapElement::parseAttribute):
* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseHTMLHashNameReference):
* html/parser/HTMLParserIdioms.h:
LayoutTests:
* fast/images/image-map-multiple.html:
Fix case of the usemap.
* fast/images/image-usemap-parsing-expected.txt: Added.
* fast/images/image-usemap-parsing.html: Added.
Add layout test coverage.
* fast/images/imagemap-case.html: Removed.
* platform/efl/fast/images/imagemap-case-expected.png: Removed.
* platform/efl/fast/images/imagemap-case-expected.txt: Removed.
* platform/gtk/fast/images/imagemap-case-expected.png: Removed.
* platform/gtk/fast/images/imagemap-case-expected.txt: Removed.
* platform/ios-simulator-wk2/fast/images/imagemap-case-expected.txt: Removed.
* platform/ios-simulator/fast/images/imagemap-case-expected.txt: Removed.
* platform/mac/fast/images/imagemap-case-expected.png: Removed.
* platform/mac/fast/images/imagemap-case-expected.txt: Removed.
* platform/win/fast/images/imagemap-case-expected.txt: Removed.
Drop outdated pixel test case. Case sensitivity is now covered by
the new fast/images/image-usemap-parsing.html test.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastimagesimagemapmultiplehtml">trunk/LayoutTests/fast/images/image-map-multiple.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsembeddedcontenttheimgelementusemapcasingexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/usemap-casing-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk2TestExpectations">trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomDocumentOrderedMapcpp">trunk/Source/WebCore/dom/DocumentOrderedMap.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentOrderedMaph">trunk/Source/WebCore/dom/DocumentOrderedMap.h</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopecpp">trunk/Source/WebCore/dom/TreeScope.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLImageElementcpp">trunk/Source/WebCore/html/HTMLImageElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLImageElementh">trunk/Source/WebCore/html/HTMLImageElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMapElementcpp">trunk/Source/WebCore/html/HTMLMapElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLParserIdiomscpp">trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLParserIdiomsh">trunk/Source/WebCore/html/parser/HTMLParserIdioms.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesimageusemapparsingexpectedtxt">trunk/LayoutTests/fast/images/image-usemap-parsing-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastimagesimageusemapparsinghtml">trunk/LayoutTests/fast/images/image-usemap-parsing.html</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesimagemapcasehtml">trunk/LayoutTests/fast/images/imagemap-case.html</a></li>
<li><a href="#trunkLayoutTestsplatformeflfastimagesimagemapcaseexpectedpng">trunk/LayoutTests/platform/efl/fast/images/imagemap-case-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformeflfastimagesimagemapcaseexpectedtxt">trunk/LayoutTests/platform/efl/fast/images/imagemap-case-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformgtkfastimagesimagemapcaseexpectedpng">trunk/LayoutTests/platform/gtk/fast/images/imagemap-case-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformgtkfastimagesimagemapcaseexpectedtxt">trunk/LayoutTests/platform/gtk/fast/images/imagemap-case-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorfastimagesimagemapcaseexpectedtxt">trunk/LayoutTests/platform/ios-simulator/fast/images/imagemap-case-expected.txt</a></li>
<li>trunk/LayoutTests/platform/ios-simulator-wk2/fast/images/</li>
<li><a href="#trunkLayoutTestsplatformmacfastimagesimagemapcaseexpectedpng">trunk/LayoutTests/platform/mac/fast/images/imagemap-case-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastimagesimagemapcaseexpectedtxt">trunk/LayoutTests/platform/mac/fast/images/imagemap-case-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformwinfastimagesimagemapcaseexpectedtxt">trunk/LayoutTests/platform/win/fast/images/imagemap-case-expected.txt</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/ChangeLog        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2016-12-14 Chris Dumez <cdumez@apple.com>
+
+ Remove Unicode case-insensitive matching for usemap=""
+ https://bugs.webkit.org/show_bug.cgi?id=163894
+
+ Reviewed by Antti Koivisto.
+
+ * fast/images/image-map-multiple.html:
+ Fix case of the usemap.
+
+ * fast/images/image-usemap-parsing-expected.txt: Added.
+ * fast/images/image-usemap-parsing.html: Added.
+ Add layout test coverage.
+
+ * fast/images/imagemap-case.html: Removed.
+ * platform/efl/fast/images/imagemap-case-expected.png: Removed.
+ * platform/efl/fast/images/imagemap-case-expected.txt: Removed.
+ * platform/gtk/fast/images/imagemap-case-expected.png: Removed.
+ * platform/gtk/fast/images/imagemap-case-expected.txt: Removed.
+ * platform/ios-simulator-wk2/fast/images/imagemap-case-expected.txt: Removed.
+ * platform/ios-simulator/fast/images/imagemap-case-expected.txt: Removed.
+ * platform/mac/fast/images/imagemap-case-expected.png: Removed.
+ * platform/mac/fast/images/imagemap-case-expected.txt: Removed.
+ * platform/win/fast/images/imagemap-case-expected.txt: Removed.
+ Drop outdated pixel test case. Case sensitivity is now covered by
+ the new fast/images/image-usemap-parsing.html test.
+
</ins><span class="cx"> 2016-12-14 Dave Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> [CSS Parser] Remove WebkitCSSTransformValue
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagemapmultiplehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/images/image-map-multiple.html (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-map-multiple.html        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/fast/images/image-map-multiple.html        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">
</span><span class="cx"> </script>
</span><span class="cx"> <body onload="runTest()">
</span><del>-<map name="mapName"><area shape=rect coords="0,0,100,100" onclick="setResult('1')"></map>
</del><ins>+<map name="mapname"><area shape=rect coords="0,0,100,100" onclick="setResult('1')"></map>
</ins><span class="cx"> <map name="mapname"><area shape=rect coords="0,0,100,100" onclick="setResult('2')"></map>
</span><span class="cx"> <map name="mapname"><area shape=rect coords="0,0,100,100" onclick="setResult('3')"></map>
</span><span class="cx"> <img src="resources/green.jpg" border=20 width=100 height=100 usemap="#mapname" ismap onclick="setResult('img')">
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesimageusemapparsingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-usemap-parsing-expected.txt (0 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-usemap-parsing-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/images/image-usemap-parsing-expected.txt        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+
+Tests that usemap attribute parsing logic.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+usemap=#navmap
+PASS areaWasClicked is true
+
+usemap=navmap
+PASS areaWasClicked is false
+
+usemap=#navMap
+PASS areaWasClicked is false
+
+usemap=foo#navmap
+PASS areaWasClicked is true
+
+usemap=foo#navmap2
+PASS areaWasClicked is false
+
+usemap=navmap#
+PASS areaWasClicked is false
+
+usemap=navmap#bar
+PASS areaWasClicked is false
+
+usemap=#
+PASS areaWasClicked is false
+
+usemap=
+PASS areaWasClicked is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesimageusemapparsinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-usemap-parsing.html (0 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-usemap-parsing.html         (rev 0)
+++ trunk/LayoutTests/fast/images/image-usemap-parsing.html        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../resources/js-test-pre.js"></script>
+<map name="navmap">
+<area id="testArea" shape=rect coords="0,0,100,100" href="#">
+</map>
+<img id="testImage" border=2 width=100 height=100 ismap>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description("Tests that usemap attribute parsing logic.");
+
+var areaWasClicked = false;
+document.getElementById("testArea").onclick = function() {
+ areaWasClicked = true;
+};
+
+function testUsemapAttribute(usemap, shouldMatch)
+{
+ debug("usemap=" + usemap);
+ document.getElementById("testImage").setAttribute("usemap", usemap);
+
+ areaWasClicked = false;
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(50, 50);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ shouldBe("areaWasClicked", "" + shouldMatch);
+ debug("");
+}
+
+testUsemapAttribute("#navmap", true);
+testUsemapAttribute("navmap", false);
+testUsemapAttribute("#navMap", false);
+testUsemapAttribute("foo#navmap", true);
+testUsemapAttribute("foo#navmap2", false);
+testUsemapAttribute("navmap#", false);
+testUsemapAttribute("navmap#bar", false);
+testUsemapAttribute("#", false);
+testUsemapAttribute("", false);
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagemapcasehtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/images/imagemap-case.html (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/imagemap-case.html        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/fast/images/imagemap-case.html        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,28 +0,0 @@
</span><del>-<!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>
</del></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-12-14 Chris Dumez <cdumez@apple.com>
+
+ Remove Unicode case-insensitive matching for usemap=""
+ https://bugs.webkit.org/show_bug.cgi?id=163894
+
+ Reviewed by Antti Koivisto.
+
+ Rebaseline W3C test now that more checks are passing.
+
+ * web-platform-tests/html/semantics/embedded-content/the-img-element/usemap-casing-expected.txt:
+
</ins><span class="cx"> 2016-12-14 Youenn Fablet <youenn@apple.com>
</span><span class="cx">
</span><span class="cx"> Test infrastructure should allow to filter out text output before doing a comparison with the baseline
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsembeddedcontenttheimgelementusemapcasingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/usemap-casing-expected.txt (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/usemap-casing-expected.txt        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/usemap-casing-expected.txt        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><span class="cx">
</span><span class="cx"> PASS Image with usemap of #sanityCheck should match the area with map named sanityCheck
</span><del>-FAIL Image with usemap of #sImPlE should not match any of the areas assert_equals: The element retrieved must be the image, not an area; used <map> with name "simple" expected Element node <img src="/images/threecolors.png" usemap="#sImPlE" width... but got Element node <area shape="rect" coords="0,0,300,300"></area>
-FAIL Image with usemap of #paSSfield-killroyß should not match any of the areas assert_equals: The element retrieved must be the image, not an area; used <map> with name "passfield-killroyß" expected Element node <img src="/images/threecolors.png" usemap="#paSSfield-kil... but got Element node <area shape="rect" coords="0,0,300,300"></area>
-FAIL Image with usemap of #глупый should not match any of the areas assert_equals: The element retrieved must be the image, not an area; used <map> with name "ГЛУПЫЙ" expected Element node <img src="/images/threecolors.png" usemap="#глупый" width... but got Element node <area shape="rect" coords="0,0,300,300"></area>
</del><ins>+PASS Image with usemap of #sImPlE should not match any of the areas
+PASS Image with usemap of #paSSfield-killroyß should not match any of the areas
+PASS Image with usemap of #глупый should not match any of the areas
</ins><span class="cx"> FAIL Image with usemap of #åωk should not match any of the areas null is not an object (evaluating 'element.parentElement')
</span><span class="cx"> FAIL Image with usemap of #blah1 should not match any of the areas null is not an object (evaluating 'element.parentElement')
</span><span class="cx"> FAIL Image with usemap of #tÉdz5アパートFi should not match any of the areas null is not an object (evaluating 'element.parentElement')
</span></span></pre></div>
<a id="trunkLayoutTestsplatformeflfastimagesimagemapcaseexpectedpng"></a>
<div class="binary"><h4>Deleted: trunk/LayoutTests/platform/efl/fast/images/imagemap-case-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformeflfastimagesimagemapcaseexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/efl/fast/images/imagemap-case-expected.txt (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/fast/images/imagemap-case-expected.txt        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/platform/efl/fast/images/imagemap-case-expected.txt        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-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 4x17
- 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 47x17
- text run at (0,0) width 47: "success"
- RenderBlock {DIV} at (0,234) size 784x18
- RenderText {#text} at (0,0) size 47x17
- text run at (0,0) width 47: "success"
</del></span></pre></div>
<a id="trunkLayoutTestsplatformgtkfastimagesimagemapcaseexpectedpng"></a>
<div class="binary"><h4>Deleted: trunk/LayoutTests/platform/gtk/fast/images/imagemap-case-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkfastimagesimagemapcaseexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/gtk/fast/images/imagemap-case-expected.txt (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/fast/images/imagemap-case-expected.txt        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/platform/gtk/fast/images/imagemap-case-expected.txt        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x264
- RenderBlock {HTML} at (0,0) size 800x264
- RenderBody {BODY} at (8,8) size 784x248
- RenderBlock (anonymous) at (0,0) size 784x214
- 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 4x17
- 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,107) size 104x104 [border: (2px solid #000000)]
- RenderText {#text} at (0,0) size 0x0
- RenderBlock {DIV} at (0,214) size 784x17
- RenderText {#text} at (0,0) size 47x17
- text run at (0,0) width 47: "success"
- RenderBlock {DIV} at (0,231) size 784x17
- RenderText {#text} at (0,0) size 47x17
- text run at (0,0) width 47: "success"
</del></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorfastimagesimagemapcaseexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/ios-simulator/fast/images/imagemap-case-expected.txt (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/fast/images/imagemap-case-expected.txt        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/platform/ios-simulator/fast/images/imagemap-case-expected.txt        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x274
- RenderBlock {HTML} at (0,0) size 800x274
- RenderBody {BODY} at (8,8) size 784x258
- RenderBlock (anonymous) at (0,0) size 784x218
- 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,89) size 4x19
- text run at (104,89) 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,109) size 104x104 [border: (2px solid #000000)]
- RenderText {#text} at (0,0) size 0x0
- RenderBlock {DIV} at (0,218) size 784x20
- RenderText {#text} at (0,0) size 48x19
- text run at (0,0) width 48: "success"
- RenderBlock {DIV} at (0,238) size 784x20
- RenderText {#text} at (0,0) size 48x19
- text run at (0,0) width 48: "success"
</del></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1777,6 +1777,7 @@
</span><span class="cx"> fast/loader/location-hash-user-gesture.html [ Skip ]
</span><span class="cx"> imported/blink/editing/selection/selectstart-event-crash.html [ Skip ]
</span><span class="cx"> fast/dom/Window/post-message-user-action.html [ Skip ]
</span><ins>+fast/images/image-usemap-parsing.html [ Skip ]
</ins><span class="cx"> fast/shadow-dom/click-on-slotted-anchor-with-hover.html [ Skip ]
</span><span class="cx"> fast/shadow-dom/click-text-inside-linked-slot.html [ Skip ]
</span><span class="cx"> fast/shadow-dom/fullscreen-in-shadow-fullscreenElement.html
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastimagesimagemapcaseexpectedpng"></a>
<div class="binary"><h4>Deleted: trunk/LayoutTests/platform/mac/fast/images/imagemap-case-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastimagesimagemapcaseexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/mac/fast/images/imagemap-case-expected.txt (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/images/imagemap-case-expected.txt        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/platform/mac/fast/images/imagemap-case-expected.txt        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-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 48x18
- text run at (0,0) width 48: "success"
- RenderBlock {DIV} at (0,234) size 784x18
- RenderText {#text} at (0,0) size 48x18
- text run at (0,0) width 48: "success"
</del></span></pre></div>
<a id="trunkLayoutTestsplatformwinfastimagesimagemapcaseexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/win/fast/images/imagemap-case-expected.txt (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/fast/images/imagemap-case-expected.txt        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/platform/win/fast/images/imagemap-case-expected.txt        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-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"
</del></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/ChangeLog        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2016-12-14 Chris Dumez <cdumez@apple.com>
+
+ Remove Unicode case-insensitive matching for usemap=""
+ https://bugs.webkit.org/show_bug.cgi?id=163894
+
+ Reviewed by Antti Koivisto.
+
+ Remove Unicode case-insensitive matching for usemap="" as this no longer
+ matches the specification [1] or Firefox. Also align our parsing logic for
+ the usemap attribute to match the specification [2].
+
+ This simplifies the code a bit, is more efficient and the compatibility
+ risk should be low based on Firefox's behavior and Chome's usage data.
+
+ [1] https://github.com/whatwg/html/commit/6acdb2122298d2bb7bb839c0a61b4e1f9b0f9bc9
+ [2] https://html.spec.whatwg.org/#rules-for-parsing-a-hash-name-reference
+
+ Test: fast/images/image-usemap-parsing.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::addImageElementByUsemap):
+ (WebCore::Document::removeImageElementByUsemap):
+ (WebCore::Document::imageElementByUsemap):
+ * dom/Document.h:
+ * dom/DocumentOrderedMap.cpp:
+ (WebCore::DocumentOrderedMap::getElementByUsemap):
+ * dom/DocumentOrderedMap.h:
+ * dom/TreeScope.cpp:
+ (WebCore::TreeScope::getImageMap):
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::parseAttribute):
+ (WebCore::HTMLImageElement::insertedInto):
+ (WebCore::HTMLImageElement::removedFrom):
+ (WebCore::HTMLImageElement::matchesUsemap):
+ * html/HTMLImageElement.h:
+ * html/HTMLMapElement.cpp:
+ (WebCore::HTMLMapElement::imageElement):
+ (WebCore::HTMLMapElement::parseAttribute):
+ * html/parser/HTMLParserIdioms.cpp:
+ (WebCore::parseHTMLHashNameReference):
+ * html/parser/HTMLParserIdioms.h:
+
</ins><span class="cx"> 2016-12-14 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Attempt to fix the Windows build after r209805.
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -749,19 +749,19 @@
</span><span class="cx"> m_elementsByAccessKey.clear();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Document::addImageElementByCaseFoldedUsemap(const AtomicStringImpl& name, HTMLImageElement& element)
</del><ins>+void Document::addImageElementByUsemap(const AtomicStringImpl& name, HTMLImageElement& element)
</ins><span class="cx"> {
</span><span class="cx"> return m_imagesByUsemap.add(name, element, *this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Document::removeImageElementByCaseFoldedUsemap(const AtomicStringImpl& name, HTMLImageElement& element)
</del><ins>+void Document::removeImageElementByUsemap(const AtomicStringImpl& name, HTMLImageElement& element)
</ins><span class="cx"> {
</span><span class="cx"> return m_imagesByUsemap.remove(name, element);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-HTMLImageElement* Document::imageElementByCaseFoldedUsemap(const AtomicStringImpl& name) const
</del><ins>+HTMLImageElement* Document::imageElementByUsemap(const AtomicStringImpl& name) const
</ins><span class="cx"> {
</span><del>- return m_imagesByUsemap.getElementByCaseFoldedUsemap(name, *this);
</del><ins>+ return m_imagesByUsemap.getElementByUsemap(name, *this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ExceptionOr<SelectorQuery&> Document::selectorQueryForString(const String& selectorString)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/dom/Document.h        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -343,9 +343,9 @@
</span><span class="cx"> Element* getElementByAccessKey(const String& key);
</span><span class="cx"> void invalidateAccessKeyMap();
</span><span class="cx">
</span><del>- void addImageElementByCaseFoldedUsemap(const AtomicStringImpl&, HTMLImageElement&);
- void removeImageElementByCaseFoldedUsemap(const AtomicStringImpl&, HTMLImageElement&);
- HTMLImageElement* imageElementByCaseFoldedUsemap(const AtomicStringImpl&) const;
</del><ins>+ void addImageElementByUsemap(const AtomicStringImpl&, HTMLImageElement&);
+ void removeImageElementByUsemap(const AtomicStringImpl&, HTMLImageElement&);
+ HTMLImageElement* imageElementByUsemap(const AtomicStringImpl&) const;
</ins><span class="cx">
</span><span class="cx"> ExceptionOr<SelectorQuery&> selectorQueryForString(const String&);
</span><span class="cx"> void clearSelectorQueryCache();
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentOrderedMapcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DocumentOrderedMap.cpp (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DocumentOrderedMap.cpp        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/dom/DocumentOrderedMap.cpp        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -149,18 +149,11 @@
</span><span class="cx"> }));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-HTMLMapElement* DocumentOrderedMap::getElementByCaseFoldedMapName(const AtomicStringImpl& key, const TreeScope& scope) const
</del><ins>+HTMLImageElement* DocumentOrderedMap::getElementByUsemap(const AtomicStringImpl& key, const TreeScope& scope) const
</ins><span class="cx"> {
</span><del>- return downcast<HTMLMapElement>(get(key, scope, [] (const AtomicStringImpl& key, const Element& element) {
- return is<HTMLMapElement>(element) && equal(downcast<HTMLMapElement>(element).getName().string().foldCase().impl(), &key);
- }));
-}
-
-HTMLImageElement* DocumentOrderedMap::getElementByCaseFoldedUsemap(const AtomicStringImpl& key, const TreeScope& scope) const
-{
</del><span class="cx"> return downcast<HTMLImageElement>(get(key, scope, [] (const AtomicStringImpl& key, const Element& element) {
</span><span class="cx"> // FIXME: HTML5 specification says we should match both image and object elements.
</span><del>- return is<HTMLImageElement>(element) && downcast<HTMLImageElement>(element).matchesCaseFoldedUsemap(key);
</del><ins>+ return is<HTMLImageElement>(element) && downcast<HTMLImageElement>(element).matchesUsemap(key);
</ins><span class="cx"> }));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentOrderedMaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DocumentOrderedMap.h (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DocumentOrderedMap.h        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/dom/DocumentOrderedMap.h        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -58,8 +58,7 @@
</span><span class="cx"> Element* getElementById(const AtomicStringImpl&, const TreeScope&) const;
</span><span class="cx"> Element* getElementByName(const AtomicStringImpl&, const TreeScope&) const;
</span><span class="cx"> HTMLMapElement* getElementByMapName(const AtomicStringImpl&, const TreeScope&) const;
</span><del>- HTMLMapElement* getElementByCaseFoldedMapName(const AtomicStringImpl&, const TreeScope&) const;
- HTMLImageElement* getElementByCaseFoldedUsemap(const AtomicStringImpl&, const TreeScope&) const;
</del><ins>+ HTMLImageElement* getElementByUsemap(const AtomicStringImpl&, const TreeScope&) const;
</ins><span class="cx"> HTMLLabelElement* getElementByLabelForAttribute(const AtomicStringImpl&, const TreeScope&) const;
</span><span class="cx"> Element* getElementByWindowNamedItem(const AtomicStringImpl&, const TreeScope&) const;
</span><span class="cx"> Element* getElementByDocumentNamedItem(const AtomicStringImpl&, const TreeScope&) const;
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.cpp (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.cpp        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/dom/TreeScope.cpp        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -248,8 +248,6 @@
</span><span class="cx"> String name = url.substring(hashPosition + 1);
</span><span class="cx"> if (name.isEmpty())
</span><span class="cx"> return nullptr;
</span><del>- if (m_rootNode.document().isHTMLDocument())
- return m_imageMapsByName->getElementByCaseFoldedMapName(*AtomicString(name.foldCase()).impl(), *this);
</del><span class="cx"> return m_imageMapsByName->getElementByMapName(*AtomicString(name).impl(), *this);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLImageElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLImageElement.cpp        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -206,20 +206,13 @@
</span><span class="cx"> } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr)
</span><span class="cx"> selectImageSource();
</span><span class="cx"> else if (name == usemapAttr) {
</span><del>- if (inDocument() && !m_caseFoldedUsemap.isNull())
- document().removeImageElementByCaseFoldedUsemap(*m_caseFoldedUsemap.impl(), *this);
</del><ins>+ if (inDocument() && !m_parsedUsemap.isNull())
+ document().removeImageElementByUsemap(*m_parsedUsemap.impl(), *this);
</ins><span class="cx">
</span><del>- // The HTMLImageElement's useMap() value includes the '#' symbol at the beginning, which has to be stripped off.
- // FIXME: We should check that the first character is '#'.
- // FIXME: HTML specification says we should strip any leading string before '#'.
- // FIXME: HTML specification says we should ignore usemap attributes without '#'.
- if (value.length() > 1)
- m_caseFoldedUsemap = value.string().substring(1).foldCase();
- else
- m_caseFoldedUsemap = nullAtom;
</del><ins>+ m_parsedUsemap = parseHTMLHashNameReference(value);
</ins><span class="cx">
</span><del>- if (inDocument() && !m_caseFoldedUsemap.isNull())
- document().addImageElementByCaseFoldedUsemap(*m_caseFoldedUsemap.impl(), *this);
</del><ins>+ if (inDocument() && !m_parsedUsemap.isNull())
+ document().addImageElementByUsemap(*m_parsedUsemap.impl(), *this);
</ins><span class="cx"> } else if (name == compositeAttr) {
</span><span class="cx"> // FIXME: images don't support blend modes in their compositing attribute.
</span><span class="cx"> BlendMode blendOp = BlendModeNormal;
</span><span class="lines">@@ -322,8 +315,8 @@
</span><span class="cx"> // in callbacks back to this node.
</span><span class="cx"> Node::InsertionNotificationRequest insertNotificationRequest = HTMLElement::insertedInto(insertionPoint);
</span><span class="cx">
</span><del>- if (insertionPoint.inDocument() && !m_caseFoldedUsemap.isNull())
- document().addImageElementByCaseFoldedUsemap(*m_caseFoldedUsemap.impl(), *this);
</del><ins>+ if (insertionPoint.inDocument() && !m_parsedUsemap.isNull())
+ document().addImageElementByUsemap(*m_parsedUsemap.impl(), *this);
</ins><span class="cx">
</span><span class="cx"> if (is<HTMLPictureElement>(parentNode())) {
</span><span class="cx"> setPictureElement(&downcast<HTMLPictureElement>(*parentNode()));
</span><span class="lines">@@ -343,8 +336,8 @@
</span><span class="cx"> if (m_form)
</span><span class="cx"> m_form->removeImgElement(this);
</span><span class="cx">
</span><del>- if (insertionPoint.inDocument() && !m_caseFoldedUsemap.isNull())
- document().removeImageElementByCaseFoldedUsemap(*m_caseFoldedUsemap.impl(), *this);
</del><ins>+ if (insertionPoint.inDocument() && !m_parsedUsemap.isNull())
+ document().removeImageElementByUsemap(*m_parsedUsemap.impl(), *this);
</ins><span class="cx">
</span><span class="cx"> if (is<HTMLPictureElement>(parentNode()))
</span><span class="cx"> setPictureElement(nullptr);
</span><span class="lines">@@ -482,10 +475,9 @@
</span><span class="cx"> return HTMLElement::completeURLsInAttributeValue(base, attribute);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool HTMLImageElement::matchesCaseFoldedUsemap(const AtomicStringImpl& name) const
</del><ins>+bool HTMLImageElement::matchesUsemap(const AtomicStringImpl& name) const
</ins><span class="cx"> {
</span><del>- ASSERT(String(&const_cast<AtomicStringImpl&>(name)).foldCase().impl() == &name);
- return m_caseFoldedUsemap.impl() == &name;
</del><ins>+ return m_parsedUsemap.impl() == &name;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const AtomicString& HTMLImageElement::alt() const
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLImageElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLImageElement.h (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLImageElement.h        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/html/HTMLImageElement.h        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">
</span><span class="cx"> void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); }
</span><span class="cx">
</span><del>- bool matchesCaseFoldedUsemap(const AtomicStringImpl&) const;
</del><ins>+ bool matchesUsemap(const AtomicStringImpl&) const;
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT const AtomicString& alt() const;
</span><span class="cx">
</span><span class="lines">@@ -137,7 +137,7 @@
</span><span class="cx"> CompositeOperator m_compositeOperator;
</span><span class="cx"> AtomicString m_bestFitImageURL;
</span><span class="cx"> AtomicString m_currentSrc;
</span><del>- AtomicString m_caseFoldedUsemap;
</del><ins>+ AtomicString m_parsedUsemap;
</ins><span class="cx"> float m_imageDevicePixelRatio;
</span><span class="cx"> bool m_experimentalImageMenuEnabled;
</span><span class="cx"> bool m_hadNameBeforeAttributeChanged { false }; // FIXME: We only need this because parseAttribute() can't see the old value.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMapElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMapElement.cpp (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMapElement.cpp        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/html/HTMLMapElement.cpp        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> {
</span><span class="cx"> if (m_name.isEmpty())
</span><span class="cx"> return nullptr;
</span><del>- return document().imageElementByCaseFoldedUsemap(*AtomicString(m_name.string().foldCase()).impl());
</del><ins>+ return document().imageElementByUsemap(*m_name.impl());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx"> String mapName = value;
</span><span class="cx"> if (mapName[0] == '#')
</span><span class="cx"> mapName = mapName.substring(1);
</span><del>- m_name = document().isHTMLDocument() ? mapName.foldCase() : mapName;
</del><ins>+ m_name = mapName;
</ins><span class="cx"> if (inDocument())
</span><span class="cx"> treeScope().addImageMap(*this);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLParserIdiomscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -455,4 +455,13 @@
</span><span class="cx"> return parseHTTPRefreshInternal(start, start + input.length(), delay, url);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// https://html.spec.whatwg.org/#rules-for-parsing-a-hash-name-reference
+AtomicString parseHTMLHashNameReference(StringView usemap)
+{
+ size_t numberSignIndex = usemap.find('#');
+ if (numberSignIndex == notFound)
+ return nullAtom;
+ return usemap.substring(numberSignIndex + 1).toAtomicString();
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLParserIdiomsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.h (209809 => 209810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.h        2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.h        2016-12-14 17:37:24 UTC (rev 209810)
</span><span class="lines">@@ -84,6 +84,8 @@
</span><span class="cx">
</span><span class="cx"> bool threadSafeMatch(const QualifiedName&, const QualifiedName&);
</span><span class="cx">
</span><ins>+AtomicString parseHTMLHashNameReference(StringView);
+
</ins><span class="cx"> // Inline implementations of some of the functions declared above.
</span><span class="cx">
</span><span class="cx"> template<typename CharacterType> inline bool isHTMLSpace(CharacterType character)
</span></span></pre>
</div>
</div>
</body>
</html>