Diff
Modified: trunk/LayoutTests/ChangeLog (209809 => 209810)
--- trunk/LayoutTests/ChangeLog 2016-12-14 17:28:16 UTC (rev 209809)
+++ trunk/LayoutTests/ChangeLog 2016-12-14 17:37:24 UTC (rev 209810)
@@ -1,3 +1,30 @@
+2016-12-14 Chris Dumez <[email protected]>
+
+ 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.
+
2016-12-14 Dave Hyatt <[email protected]>
[CSS Parser] Remove WebkitCSSTransformValue
Modified: trunk/LayoutTests/fast/images/image-map-multiple.html (209809 => 209810)
--- 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)
@@ -69,7 +69,7 @@
</script>
<body _onload_="runTest()">
-<map name="mapName"><area shape=rect coords="0,0,100,100" _onclick_="setResult('1')"></map>
+<map name="mapname"><area shape=rect coords="0,0,100,100" _onclick_="setResult('1')"></map>
<map name="mapname"><area shape=rect coords="0,0,100,100" _onclick_="setResult('2')"></map>
<map name="mapname"><area shape=rect coords="0,0,100,100" _onclick_="setResult('3')"></map>
<img src="" border=20 width=100 height=100 usemap="" ismap _onclick_="setResult('img')">
Added: trunk/LayoutTests/fast/images/image-usemap-parsing-expected.txt (0 => 209810)
--- 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)
@@ -0,0 +1,36 @@
+
+Tests that usemap attribute parsing logic.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+usemap=""
+PASS areaWasClicked is true
+
+usemap=""
+PASS areaWasClicked is false
+
+usemap=""
+PASS areaWasClicked is false
+
+usemap=""
+PASS areaWasClicked is true
+
+usemap=""
+PASS areaWasClicked is false
+
+usemap=""
+PASS areaWasClicked is false
+
+usemap=""
+PASS areaWasClicked is false
+
+usemap=#
+PASS areaWasClicked is false
+
+usemap=
"" areaWasClicked is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/images/image-usemap-parsing.html (0 => 209810)
--- 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)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<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=""
+</body>
+</html>
Deleted: trunk/LayoutTests/fast/images/imagemap-case.html (209809 => 209810)
--- 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)
@@ -1,28 +0,0 @@
-<!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="" 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="" 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>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (209809 => 209810)
--- 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)
@@ -1,3 +1,14 @@
+2016-12-14 Chris Dumez <[email protected]>
+
+ 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:
+
2016-12-14 Youenn Fablet <[email protected]>
Test infrastructure should allow to filter out text output before doing a comparison with the baseline
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/usemap-casing-expected.txt (209809 => 209810)
--- 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)
@@ -1,8 +1,8 @@
PASS Image with usemap of #sanityCheck should match the area with map named sanityCheck
-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="" usemap="" 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="" usemap="" 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="" usemap="" width... but got Element node <area shape="rect" coords="0,0,300,300"></area>
+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
FAIL Image with usemap of #åωk should not match any of the areas null is not an object (evaluating 'element.parentElement')
FAIL Image with usemap of #blah1 should not match any of the areas null is not an object (evaluating 'element.parentElement')
FAIL Image with usemap of #tÉdz5アパートFi should not match any of the areas null is not an object (evaluating 'element.parentElement')
Deleted: trunk/LayoutTests/platform/efl/fast/images/imagemap-case-expected.png
(Binary files differ)
Deleted: trunk/LayoutTests/platform/efl/fast/images/imagemap-case-expected.txt (209809 => 209810)
--- 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)
@@ -1,26 +0,0 @@
-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"
Deleted: trunk/LayoutTests/platform/gtk/fast/images/imagemap-case-expected.png
(Binary files differ)
Deleted: trunk/LayoutTests/platform/gtk/fast/images/imagemap-case-expected.txt (209809 => 209810)
--- 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)
@@ -1,26 +0,0 @@
-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"
Deleted: trunk/LayoutTests/platform/ios-simulator/fast/images/imagemap-case-expected.txt (209809 => 209810)
--- 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)
@@ -1,26 +0,0 @@
-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"
Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (209809 => 209810)
--- 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)
@@ -1777,6 +1777,7 @@
fast/loader/location-hash-user-gesture.html [ Skip ]
imported/blink/editing/selection/selectstart-event-crash.html [ Skip ]
fast/dom/Window/post-message-user-action.html [ Skip ]
+fast/images/image-usemap-parsing.html [ Skip ]
fast/shadow-dom/click-on-slotted-anchor-with-hover.html [ Skip ]
fast/shadow-dom/click-text-inside-linked-slot.html [ Skip ]
fast/shadow-dom/fullscreen-in-shadow-fullscreenElement.html
Deleted: trunk/LayoutTests/platform/mac/fast/images/imagemap-case-expected.png
(Binary files differ)
Deleted: trunk/LayoutTests/platform/mac/fast/images/imagemap-case-expected.txt (209809 => 209810)
--- 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)
@@ -1,26 +0,0 @@
-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"
Deleted: trunk/LayoutTests/platform/win/fast/images/imagemap-case-expected.txt (209809 => 209810)
--- 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)
@@ -1,26 +0,0 @@
-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"
Modified: trunk/Source/WebCore/ChangeLog (209809 => 209810)
--- 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)
@@ -1,3 +1,45 @@
+2016-12-14 Chris Dumez <[email protected]>
+
+ 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:
+
2016-12-14 Ryan Haddad <[email protected]>
Attempt to fix the Windows build after r209805.
Modified: trunk/Source/WebCore/dom/Document.cpp (209809 => 209810)
--- 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)
@@ -749,19 +749,19 @@
m_elementsByAccessKey.clear();
}
-void Document::addImageElementByCaseFoldedUsemap(const AtomicStringImpl& name, HTMLImageElement& element)
+void Document::addImageElementByUsemap(const AtomicStringImpl& name, HTMLImageElement& element)
{
return m_imagesByUsemap.add(name, element, *this);
}
-void Document::removeImageElementByCaseFoldedUsemap(const AtomicStringImpl& name, HTMLImageElement& element)
+void Document::removeImageElementByUsemap(const AtomicStringImpl& name, HTMLImageElement& element)
{
return m_imagesByUsemap.remove(name, element);
}
-HTMLImageElement* Document::imageElementByCaseFoldedUsemap(const AtomicStringImpl& name) const
+HTMLImageElement* Document::imageElementByUsemap(const AtomicStringImpl& name) const
{
- return m_imagesByUsemap.getElementByCaseFoldedUsemap(name, *this);
+ return m_imagesByUsemap.getElementByUsemap(name, *this);
}
ExceptionOr<SelectorQuery&> Document::selectorQueryForString(const String& selectorString)
Modified: trunk/Source/WebCore/dom/Document.h (209809 => 209810)
--- 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)
@@ -343,9 +343,9 @@
Element* getElementByAccessKey(const String& key);
void invalidateAccessKeyMap();
- void addImageElementByCaseFoldedUsemap(const AtomicStringImpl&, HTMLImageElement&);
- void removeImageElementByCaseFoldedUsemap(const AtomicStringImpl&, HTMLImageElement&);
- HTMLImageElement* imageElementByCaseFoldedUsemap(const AtomicStringImpl&) const;
+ void addImageElementByUsemap(const AtomicStringImpl&, HTMLImageElement&);
+ void removeImageElementByUsemap(const AtomicStringImpl&, HTMLImageElement&);
+ HTMLImageElement* imageElementByUsemap(const AtomicStringImpl&) const;
ExceptionOr<SelectorQuery&> selectorQueryForString(const String&);
void clearSelectorQueryCache();
Modified: trunk/Source/WebCore/dom/DocumentOrderedMap.cpp (209809 => 209810)
--- 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)
@@ -149,18 +149,11 @@
}));
}
-HTMLMapElement* DocumentOrderedMap::getElementByCaseFoldedMapName(const AtomicStringImpl& key, const TreeScope& scope) const
+HTMLImageElement* DocumentOrderedMap::getElementByUsemap(const AtomicStringImpl& key, const TreeScope& scope) const
{
- 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
-{
return downcast<HTMLImageElement>(get(key, scope, [] (const AtomicStringImpl& key, const Element& element) {
// FIXME: HTML5 specification says we should match both image and object elements.
- return is<HTMLImageElement>(element) && downcast<HTMLImageElement>(element).matchesCaseFoldedUsemap(key);
+ return is<HTMLImageElement>(element) && downcast<HTMLImageElement>(element).matchesUsemap(key);
}));
}
Modified: trunk/Source/WebCore/dom/DocumentOrderedMap.h (209809 => 209810)
--- 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)
@@ -58,8 +58,7 @@
Element* getElementById(const AtomicStringImpl&, const TreeScope&) const;
Element* getElementByName(const AtomicStringImpl&, const TreeScope&) const;
HTMLMapElement* getElementByMapName(const AtomicStringImpl&, const TreeScope&) const;
- HTMLMapElement* getElementByCaseFoldedMapName(const AtomicStringImpl&, const TreeScope&) const;
- HTMLImageElement* getElementByCaseFoldedUsemap(const AtomicStringImpl&, const TreeScope&) const;
+ HTMLImageElement* getElementByUsemap(const AtomicStringImpl&, const TreeScope&) const;
HTMLLabelElement* getElementByLabelForAttribute(const AtomicStringImpl&, const TreeScope&) const;
Element* getElementByWindowNamedItem(const AtomicStringImpl&, const TreeScope&) const;
Element* getElementByDocumentNamedItem(const AtomicStringImpl&, const TreeScope&) const;
Modified: trunk/Source/WebCore/dom/TreeScope.cpp (209809 => 209810)
--- 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)
@@ -248,8 +248,6 @@
String name = url.substring(hashPosition + 1);
if (name.isEmpty())
return nullptr;
- if (m_rootNode.document().isHTMLDocument())
- return m_imageMapsByName->getElementByCaseFoldedMapName(*AtomicString(name.foldCase()).impl(), *this);
return m_imageMapsByName->getElementByMapName(*AtomicString(name).impl(), *this);
}
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (209809 => 209810)
--- 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)
@@ -206,20 +206,13 @@
} else if (name == srcAttr || name == srcsetAttr || name == sizesAttr)
selectImageSource();
else if (name == usemapAttr) {
- if (inDocument() && !m_caseFoldedUsemap.isNull())
- document().removeImageElementByCaseFoldedUsemap(*m_caseFoldedUsemap.impl(), *this);
+ if (inDocument() && !m_parsedUsemap.isNull())
+ document().removeImageElementByUsemap(*m_parsedUsemap.impl(), *this);
- // 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;
+ m_parsedUsemap = parseHTMLHashNameReference(value);
- if (inDocument() && !m_caseFoldedUsemap.isNull())
- document().addImageElementByCaseFoldedUsemap(*m_caseFoldedUsemap.impl(), *this);
+ if (inDocument() && !m_parsedUsemap.isNull())
+ document().addImageElementByUsemap(*m_parsedUsemap.impl(), *this);
} else if (name == compositeAttr) {
// FIXME: images don't support blend modes in their compositing attribute.
BlendMode blendOp = BlendModeNormal;
@@ -322,8 +315,8 @@
// in callbacks back to this node.
Node::InsertionNotificationRequest insertNotificationRequest = HTMLElement::insertedInto(insertionPoint);
- if (insertionPoint.inDocument() && !m_caseFoldedUsemap.isNull())
- document().addImageElementByCaseFoldedUsemap(*m_caseFoldedUsemap.impl(), *this);
+ if (insertionPoint.inDocument() && !m_parsedUsemap.isNull())
+ document().addImageElementByUsemap(*m_parsedUsemap.impl(), *this);
if (is<HTMLPictureElement>(parentNode())) {
setPictureElement(&downcast<HTMLPictureElement>(*parentNode()));
@@ -343,8 +336,8 @@
if (m_form)
m_form->removeImgElement(this);
- if (insertionPoint.inDocument() && !m_caseFoldedUsemap.isNull())
- document().removeImageElementByCaseFoldedUsemap(*m_caseFoldedUsemap.impl(), *this);
+ if (insertionPoint.inDocument() && !m_parsedUsemap.isNull())
+ document().removeImageElementByUsemap(*m_parsedUsemap.impl(), *this);
if (is<HTMLPictureElement>(parentNode()))
setPictureElement(nullptr);
@@ -482,10 +475,9 @@
return HTMLElement::completeURLsInAttributeValue(base, attribute);
}
-bool HTMLImageElement::matchesCaseFoldedUsemap(const AtomicStringImpl& name) const
+bool HTMLImageElement::matchesUsemap(const AtomicStringImpl& name) const
{
- ASSERT(String(&const_cast<AtomicStringImpl&>(name)).foldCase().impl() == &name);
- return m_caseFoldedUsemap.impl() == &name;
+ return m_parsedUsemap.impl() == &name;
}
const AtomicString& HTMLImageElement::alt() const
Modified: trunk/Source/WebCore/html/HTMLImageElement.h (209809 => 209810)
--- 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)
@@ -60,7 +60,7 @@
void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); }
- bool matchesCaseFoldedUsemap(const AtomicStringImpl&) const;
+ bool matchesUsemap(const AtomicStringImpl&) const;
WEBCORE_EXPORT const AtomicString& alt() const;
@@ -137,7 +137,7 @@
CompositeOperator m_compositeOperator;
AtomicString m_bestFitImageURL;
AtomicString m_currentSrc;
- AtomicString m_caseFoldedUsemap;
+ AtomicString m_parsedUsemap;
float m_imageDevicePixelRatio;
bool m_experimentalImageMenuEnabled;
bool m_hadNameBeforeAttributeChanged { false }; // FIXME: We only need this because parseAttribute() can't see the old value.
Modified: trunk/Source/WebCore/html/HTMLMapElement.cpp (209809 => 209810)
--- 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)
@@ -79,7 +79,7 @@
{
if (m_name.isEmpty())
return nullptr;
- return document().imageElementByCaseFoldedUsemap(*AtomicString(m_name.string().foldCase()).impl());
+ return document().imageElementByUsemap(*m_name.impl());
}
void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -99,7 +99,7 @@
String mapName = value;
if (mapName[0] == '#')
mapName = mapName.substring(1);
- m_name = document().isHTMLDocument() ? mapName.foldCase() : mapName;
+ m_name = mapName;
if (inDocument())
treeScope().addImageMap(*this);
Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (209809 => 209810)
--- 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)
@@ -455,4 +455,13 @@
return parseHTTPRefreshInternal(start, start + input.length(), delay, url);
}
+// 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();
}
+
+}
Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.h (209809 => 209810)
--- 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)
@@ -84,6 +84,8 @@
bool threadSafeMatch(const QualifiedName&, const QualifiedName&);
+AtomicString parseHTMLHashNameReference(StringView);
+
// Inline implementations of some of the functions declared above.
template<typename CharacterType> inline bool isHTMLSpace(CharacterType character)