Import some extra tests for r179132
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Jan 2015 20:45:10 +0000 (20:45 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Jan 2015 20:45:10 +0000 (20:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140930

Reviewed by Sam Weinig.

Add some tests that were done from previous attempts at fixing
the bug.

* fast/dom/SelectorAPI/tag-case-insensitive-expected.txt: Added.
* fast/dom/SelectorAPI/tag-case-insensitive.html: Added.
* fast/dom/SelectorAPI/tag-case-sensitive-expected.txt: Added.
* fast/dom/SelectorAPI/tag-case-sensitive.xhtml: Added.
* svg/css/case-sensitive-tags-expected.txt: Added.
* svg/css/case-sensitive-tags.html: Added.
* svg/dom/tag-case-sensitive-svg-in-html-expected.txt: Added.
* svg/dom/tag-case-sensitive-svg-in-html.html: Added.
Those tests were created by Alexandru Chiculita for
https://bugs.webkit.org/show_bug.cgi?id=83438

The patch was rejected at the time due to the perf impact.
That has been solved since then by the CSS JIT.

* svg/css/foreignObject-case-styling-expected.html: Added.
* svg/css/foreignObject-case-styling.html: Added.
This test is from Boris Zbarsky when he reported
https://bugs.webkit.org/show_bug.cgi?id=79444.

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/SelectorAPI/tag-case-insensitive-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/SelectorAPI/tag-case-insensitive.html [new file with mode: 0644]
LayoutTests/fast/dom/SelectorAPI/tag-case-sensitive-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/SelectorAPI/tag-case-sensitive.xhtml [new file with mode: 0644]
LayoutTests/svg/css/case-sensitive-tags-expected.txt [new file with mode: 0644]
LayoutTests/svg/css/case-sensitive-tags.html [new file with mode: 0644]
LayoutTests/svg/css/foreignObject-case-styling-expected.html [new file with mode: 0644]
LayoutTests/svg/css/foreignObject-case-styling.html [new file with mode: 0644]
LayoutTests/svg/dom/tag-case-sensitive-svg-in-html-expected.txt [new file with mode: 0644]
LayoutTests/svg/dom/tag-case-sensitive-svg-in-html.html [new file with mode: 0644]

index 11cf362..5c749ec 100644 (file)
@@ -1,3 +1,32 @@
+2015-01-27  Benjamin Poulain  <benjamin@webkit.org>
+
+        Import some extra tests for r179132
+        https://bugs.webkit.org/show_bug.cgi?id=140930
+
+        Reviewed by Sam Weinig.
+
+        Add some tests that were done from previous attempts at fixing
+        the bug.
+
+        * fast/dom/SelectorAPI/tag-case-insensitive-expected.txt: Added.
+        * fast/dom/SelectorAPI/tag-case-insensitive.html: Added.
+        * fast/dom/SelectorAPI/tag-case-sensitive-expected.txt: Added.
+        * fast/dom/SelectorAPI/tag-case-sensitive.xhtml: Added.
+        * svg/css/case-sensitive-tags-expected.txt: Added.
+        * svg/css/case-sensitive-tags.html: Added.
+        * svg/dom/tag-case-sensitive-svg-in-html-expected.txt: Added.
+        * svg/dom/tag-case-sensitive-svg-in-html.html: Added.
+        Those tests were created by Alexandru Chiculita for
+        https://bugs.webkit.org/show_bug.cgi?id=83438
+
+        The patch was rejected at the time due to the perf impact.
+        That has been solved since then by the CSS JIT.
+
+        * svg/css/foreignObject-case-styling-expected.html: Added.
+        * svg/css/foreignObject-case-styling.html: Added.
+        This test is from Boris Zbarsky when he reported
+        https://bugs.webkit.org/show_bug.cgi?id=79444.
+
 2015-01-27  Daniel Bates  <dabates@apple.com>
 
         [iOS] Update test results and test expectations
diff --git a/LayoutTests/fast/dom/SelectorAPI/tag-case-insensitive-expected.txt b/LayoutTests/fast/dom/SelectorAPI/tag-case-insensitive-expected.txt
new file mode 100644 (file)
index 0000000..f1ad124
--- /dev/null
@@ -0,0 +1,47 @@
+PASS document.querySelector('SPAN') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('SPAN') is true
+PASS document.querySelector('SPAN > img') is document.getElementById('img1')
+PASS document.getElementById('img1').webkitMatchesSelector('SPAN > img') is true
+PASS document.querySelector('SPAN img') is document.getElementById('img1')
+PASS document.getElementById('img1').webkitMatchesSelector('SPAN img') is true
+PASS document.querySelector('div ul li SPAN') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('div ul li SPAN') is true
+PASS document.querySelector('div ul li textarea + SPAN') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('div ul li textarea + SPAN') is true
+PASS document.querySelector('div ul li span') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('div ul li span') is true
+PASS document.querySelector('div ul li spAn') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('div ul li spAn') is true
+PASS document.querySelector('DIV ul li span') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('DIV ul li span') is true
+PASS document.querySelector('div UL li span') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('div UL li span') is true
+PASS content.querySelector('span1') is null
+PASS content.querySelector('span#UPPER1') is null
+PASS document.querySelector('unknownTag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('unknownTag') is true
+PASS document.querySelector('div unknownTag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('div unknownTag') is true
+PASS document.querySelector('ul + unknownTag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('ul + unknownTag') is true
+PASS document.querySelector('DIV unknownTag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('DIV unknownTag') is true
+PASS document.querySelector('UL + unknownTag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('UL + unknownTag') is true
+PASS document.querySelector('unknowntag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('unknowntag') is true
+PASS document.querySelector('Unknowntag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('Unknowntag') is true
+PASS document.querySelector('div unknowntag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('div unknowntag') is true
+PASS document.querySelector('ul') is document.getElementById('ul1')
+PASS document.getElementById('ul1').webkitMatchesSelector('ul') is true
+PASS document.querySelector('UL') is document.getElementById('ul1')
+PASS document.getElementById('ul1').webkitMatchesSelector('UL') is true
+PASS content.querySelector('unknowntag1') is null
+PASS content.querySelector('ol') is null
+PASS content.querySelector('OL') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/SelectorAPI/tag-case-insensitive.html b/LayoutTests/fast/dom/SelectorAPI/tag-case-insensitive.html
new file mode 100644 (file)
index 0000000..8019eb6
--- /dev/null
@@ -0,0 +1,60 @@
+<!doctype html>
+<html>
+<head>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+    <!-- Testing that in HTML documents CSS selectors use case-insensitive tag name matching. -->
+    <div id="content">
+        <div style="display: none">
+            <ul id="ul1">
+                <li>
+                    <textarea id="textarea1"></textarea>
+                    <SPAN id="upper1">
+                        <img id="img1" />
+                    </SPAN>
+                </li>
+            </ul>
+            <unknownTag id="unknownTag1"></unknownTag>
+        </div>
+    </div>
+    <script>
+        var content = document.getElementById("content");
+        function checkMatchingSelector(selector, elementId) {
+            shouldBe("document.querySelector('" + selector + "')", "document.getElementById('" + elementId + "')");
+            shouldBeTrue("document.getElementById('" + elementId + "').webkitMatchesSelector('" + selector + "')");
+        }
+
+        function checkNonMatchingSelector(selector) {
+            shouldBeNull("content.querySelector('" + selector + "')");
+        }
+
+        checkMatchingSelector("SPAN", "upper1");
+        checkMatchingSelector("SPAN > img", "img1");
+        checkMatchingSelector("SPAN img", "img1");
+        checkMatchingSelector("div ul li SPAN", "upper1");
+        checkMatchingSelector("div ul li textarea + SPAN", "upper1");
+        checkMatchingSelector("div ul li span", "upper1");
+        checkMatchingSelector("div ul li spAn", "upper1");
+        checkMatchingSelector("DIV ul li span", "upper1");
+        checkMatchingSelector("div UL li span", "upper1");
+        checkNonMatchingSelector("span1");
+        checkNonMatchingSelector("span#UPPER1");
+
+        checkMatchingSelector("unknownTag", "unknownTag1");
+        checkMatchingSelector("div unknownTag", "unknownTag1");
+        checkMatchingSelector("ul + unknownTag", "unknownTag1");
+        checkMatchingSelector("DIV unknownTag", "unknownTag1");
+        checkMatchingSelector("UL + unknownTag", "unknownTag1");
+        checkMatchingSelector("unknowntag", "unknownTag1");
+        checkMatchingSelector("Unknowntag", "unknownTag1");
+        checkMatchingSelector("div unknowntag", "unknownTag1");
+        checkMatchingSelector("ul", "ul1");
+        checkMatchingSelector("UL", "ul1");
+        checkNonMatchingSelector("unknowntag1");
+        checkNonMatchingSelector("ol");
+        checkNonMatchingSelector("OL");
+    </script>
+    <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/SelectorAPI/tag-case-sensitive-expected.txt b/LayoutTests/fast/dom/SelectorAPI/tag-case-sensitive-expected.txt
new file mode 100644 (file)
index 0000000..66d2856
--- /dev/null
@@ -0,0 +1,24 @@
+PASS content.querySelector('div ul li SPAN') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('div ul li SPAN') is true
+PASS content.querySelector('div ul li textarea + SPAN') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('div ul li textarea + SPAN') is true
+PASS content.querySelector('div ul li span') is null
+PASS content.querySelector('div ul li spAn') is null
+PASS content.querySelector('DIV ul li span') is null
+PASS content.querySelector('div UL li span') is null
+PASS content.querySelector('unknownTag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('unknownTag') is true
+PASS content.querySelector('div unknownTag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('div unknownTag') is true
+PASS content.querySelector('ul + unknownTag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('ul + unknownTag') is true
+PASS content.querySelector('DIV unknownTag') is null
+PASS content.querySelector('UL + unknownTag') is null
+PASS content.querySelector('unknownTag1') is null
+PASS content.querySelector('unknowntag') is null
+PASS content.querySelector('Unknowntag') is null
+PASS content.querySelector('div unknowntag') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/SelectorAPI/tag-case-sensitive.xhtml b/LayoutTests/fast/dom/SelectorAPI/tag-case-sensitive.xhtml
new file mode 100644 (file)
index 0000000..8925588
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html 
+     PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN"
+     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+    <!-- Testing that in XHTML documents CSS selectors use case-sensitive tag name matching. -->
+    <div id="content">
+        <div style="display: none">
+            <ul>
+                <li>
+                    <textarea id="textarea1"></textarea>
+                    <SPAN id="upper1"></SPAN>
+                </li>
+            </ul>
+            <unknownTag id="unknownTag1"></unknownTag>
+        </div>
+    </div>
+    <script>
+    <![CDATA[ 
+        var content = document.getElementById("content");
+        function checkMatchingSelector(selector, elementId) {
+            shouldBe("content.querySelector('" + selector + "')", "document.getElementById('" + elementId + "')");
+            shouldBeTrue("document.getElementById('" + elementId + "').webkitMatchesSelector('" + selector + "')");
+        }
+
+        function checkNonMatchingSelector(selector) {
+            shouldBeNull("content.querySelector('" + selector + "')");
+        }
+
+        checkMatchingSelector("div ul li SPAN", "upper1");
+        checkMatchingSelector("div ul li textarea + SPAN", "upper1");
+        checkNonMatchingSelector("div ul li span");
+        checkNonMatchingSelector("div ul li spAn");
+        checkNonMatchingSelector("DIV ul li span");
+        checkNonMatchingSelector("div UL li span");
+
+        checkMatchingSelector("unknownTag", "unknownTag1");
+        checkMatchingSelector("div unknownTag", "unknownTag1");
+        checkMatchingSelector("ul + unknownTag", "unknownTag1");
+        checkNonMatchingSelector("DIV unknownTag");
+        checkNonMatchingSelector("UL + unknownTag");
+        checkNonMatchingSelector("unknownTag1");
+        checkNonMatchingSelector("unknowntag");
+        checkNonMatchingSelector("Unknowntag");
+        checkNonMatchingSelector("div unknowntag");
+    ]]> 
+    </script>
+    <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/css/case-sensitive-tags-expected.txt b/LayoutTests/svg/css/case-sensitive-tags-expected.txt
new file mode 100644 (file)
index 0000000..58b6756
--- /dev/null
@@ -0,0 +1,22 @@
+PASS window.getComputedStyle(document.getElementById("div1")).color is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("div2")).color is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("div3")).color is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("fo1")).color is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("fo2")).color is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("fo3")).color is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("fo4")).color is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("circle1")).fill is "#008000"
+PASS window.getComputedStyle(document.getElementById("circle2")).fill is "#008000"
+PASS window.getComputedStyle(document.getElementById("circle3")).fill is "#008000"
+PASS window.getComputedStyle(document.getElementById("stop1")).stopColor is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("stop2")).stopColor is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("stop3")).stopColor is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("stop4")).stopColor is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("stop5")).stopColor is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("stop6")).stopColor is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("stop7")).stopColor is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(document.getElementById("stop8")).stopColor is "rgb(0, 128, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/css/case-sensitive-tags.html b/LayoutTests/svg/css/case-sensitive-tags.html
new file mode 100644 (file)
index 0000000..8d8c717
--- /dev/null
@@ -0,0 +1,191 @@
+
+<!doctype html>
+<html>
+    <head>
+        <style>
+            @namespace svg "http://www.w3.org/2000/svg";
+
+            .red-color {
+                color: red;
+            }
+
+            .green-color {
+                color: green;
+            }
+
+            .red-fill {
+                fill: red;
+            }
+
+            .green-fill {
+                fill: green;
+            }
+
+            .red-stop-color {
+                stop-color: red;
+            }
+
+            .green-stop-color {
+                stop-color: green;
+            }
+
+            .group0 div:nth-of-type(1),
+            .group0 DIV:nth-of-type(2),
+            .group0 Div:nth-of-type(3),
+            .group1 foreignObject:nth-of-type(3) {
+                color: green;
+            }
+
+            .group1 foreignobject:nth-of-type(1),
+            .group1 FOREIGNOBJECT:nth-of-type(2),
+            .group1 ForeignObject:nth-of-type(4)
+            { 
+                color: red;
+            }
+
+            .group2 circle:nth-of-type(1)
+            { 
+                fill: green;
+            }
+
+            .group2 CIRCLE:nth-of-type(2),
+            .group2 Circle:nth-of-type(3) {
+                /* Matching any of these selectors is bad as SVG should use case-sensitive matching. */
+                fill: red;
+            }
+
+            .group3 linearGradient:nth-of-type(3) stop {
+                stop-color: green;
+            }
+
+            .group3 lineargradient:nth-of-type(1) stop,
+            .group3 LINEARGRADIENT:nth-of-type(2) stop,
+            .group3 LinearGradient:nth-of-type(4) stop
+            {
+                /* Matching any of these selectors is bad as SVG should use case-sensitive matching. */
+                stop-color: red;
+            }
+
+            .group4 svg|linearGradient:nth-of-type(3) stop {
+                stop-color: green;
+            }
+
+            .group4 svg|lineargradient:nth-of-type(1) stop,
+            .group4 svg|LINEARGRADIENT:nth-of-type(2) stop,
+            .group4 svg|LinearGradient:nth-of-type(4) stop
+            {
+                /* Matching any of these selectors is bad as SVG should use case-sensitive matching. */
+                stop-color: red;
+            }
+        </style>
+        <script src="../../resources/js-test-pre.js"></script>
+    </head>
+    <body>
+        <div id="container">
+            <div class="group0">
+                <div id="div1" class="red-color">HTML element matched using lower case selector.</div>
+                <div id="div2" class="red-color">HTML element matched using upper case selector.</div>
+                <div id="div3" class="red-color">HTML element matched using mixed case selector.</div>
+            </div>
+
+            <svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="900" width="800">
+                <g class="group1" transform="translate(0, 10)">
+                    <foreignObject id="fo1" class="green-color" y="0" width="100%" height="20">
+                        SVG foreign object is NOT matched using lower case selector.
+                    </foreignObject>
+                    <foreignObject id="fo2" class="green-color" y="40" width="100%" height="20">
+                        SVG foreign object is NOT matched using upper case selector.
+                    </foreignObject>
+                    <foreignObject id="fo3" class="red-color" y="80" width="100%" height="20">
+                        SVG foreign object is matched using canonical form selector.
+                    </foreignObject>
+                    <foreignObject id="fo4" class="green-color" y="120" width="100%" height="20">
+                        SVG foreign object is NOT matched using mixed case selector.
+                    </foreignObject>
+                </g>
+
+                <g class="group2" transform="translate(25, 190)">
+                    <line x1="-25" y1="-30" x2="100%" y2="-30" stroke-width="2" stroke="gray"></line>
+
+                    <circle id="circle1" class="red-fill" cy="0" r="20" stroke="black" stroke-width="2" />
+                    <text x="50" y="0">Circle SVG element is matched using lower case / canonical form selector</text>
+
+                    <circle id="circle2" class="green-fill" cy="60" r="20" stroke="black" stroke-width="2" />
+                    <text x="50" y="60">Circle SVG element is NOT matched using upper case selector</text>
+
+                    <circle id="circle3" class="green-fill" cy="120" r="20" stroke="black" stroke-width="2" />
+                    <text x="50" y="120">Circle SVG element is NOT matched using mixed case selector</text>
+                </g>
+
+                <g class="group3" transform="translate(25, 370)">
+                    <line x1="-25" y1="-30" x2="100%" y2="-30" stroke-width="2" stroke="gray"></line>
+
+                    <linearGradient id="Gradient1">
+                        <stop id="stop1" offset="0%" class="green-stop-color" />
+                    </linearGradient>
+                    <circle cy="0" r="20" stroke="black" stroke-width="2" fill="url(#Gradient1)" />
+                    <text x="50" y="0">SVG LinearGradient fill element is NOT matched using lower case selector</text>
+
+                    <linearGradient id="Gradient2">
+                        <stop id="stop2" offset="0%" class="green-stop-color" />
+                    </linearGradient>
+                    <circle cy="60" r="20" stroke="black" stroke-width="2" fill="url(#Gradient2)" />
+                    <text x="50" y="60">SVG LinearGradient fill element is NOT matched using upper case selector</text>
+
+                    <linearGradient id="Gradient3">
+                        <stop id="stop3" offset="0%" class="red-stop-color" />
+                    </linearGradient>
+                    <circle cy="120" r="20" stroke="black" stroke-width="2" fill="url(#Gradient3)" />
+                    <text x="50" y="120">SVG LinearGradient fill element is matched using canonical form selector</text>
+
+                    <linearGradient id="Gradient4">
+                        <stop id="stop4" offset="0%" class="green-stop-color" />
+                    </linearGradient>
+                    <circle cy="180" r="20" stroke="black" stroke-width="2" fill="url(#Gradient4)" />
+                    <text x="50" y="180">SVG LinearGradient fill element is NOT matched using mixed case selector</text>
+                </g>
+
+                <g class="group4" transform="translate(25, 610)">
+                    <line x1="-25" y1="-30" x2="100%" y2="-30" stroke-width="2" stroke="gray"></line>
+
+                    <linearGradient id="Gradient5">
+                        <stop id="stop5" offset="0%" class="green-stop-color" />
+                    </linearGradient>
+                    <circle cy="0" r="20" stroke="black" stroke-width="2" fill="url(#Gradient5)" />
+                    <text x="50" y="0">SVG LinearGradient fill element is NOT matched using lower case selector + svg namespace</text>
+
+                    <linearGradient id="Gradient6">
+                        <stop id="stop6" offset="0%" class="green-stop-color" />
+                    </linearGradient>
+                    <circle cy="60" r="20" stroke="black" stroke-width="2" fill="url(#Gradient6)" />
+                    <text x="50" y="60">SVG LinearGradient fill element is NOT matched using upper case selector + svg namespace</text>
+
+                    <linearGradient id="Gradient7">
+                        <stop id="stop7" offset="0%" class="red-stop-color" />
+                    </linearGradient>
+                    <circle cy="120" r="20" stroke="black" stroke-width="2" fill="url(#Gradient7)" />
+                    <text x="50" y="120">SVG LinearGradient fill element is matched using canonical form selector + svg namespace</text>
+
+                    <linearGradient id="Gradient8">
+                        <stop id="stop8" offset="0%" class="green-stop-color" />
+                    </linearGradient>
+                    <circle cy="180" r="20" stroke="black" stroke-width="2" fill="url(#Gradient8)" />
+                    <text x="50" y="180">SVG LinearGradient fill element is NOT matched using mixed case selector + svg namespace</text>
+                </g>
+            </svg>
+        </div>
+        <script>
+            function checkStyle(prefix, count, property, value) {
+                for (var i = 1; i <= count; ++i)
+                    shouldBe("window.getComputedStyle(document.getElementById(\"" + prefix + i + "\"))." + property, "\"" + value + "\"");
+            }
+            checkStyle("div", 3, "color", "rgb(0, 128, 0)");
+            checkStyle("fo", 4, "color", "rgb(0, 128, 0)");
+            checkStyle("circle", 3, "fill", "#008000");
+            checkStyle("stop", 8, "stopColor", "rgb(0, 128, 0)");
+
+            document.getElementById("container").style.display = "none";
+        </script>
+        <script src="../../resources/js-test-post.js"></script>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/svg/css/foreignObject-case-styling-expected.html b/LayoutTests/svg/css/foreignObject-case-styling-expected.html
new file mode 100644 (file)
index 0000000..faa5b2e
--- /dev/null
@@ -0,0 +1,10 @@
+<!doctype html>
+<p>This test the styling of elements in foreignObject. WebKit uses to fail this because it was unable to match &lt;foreignObject&gt; due the uppercase 'O'</p>
+<p>If test suceed, both words should be green.</p>
+<svg width="500" height="100">
+  <foreignObject width="500" height="100">
+    <span style="color:green">Green</span>
+    <SPAN style="color:green">Green</SPAN>
+  </foreignObject>
+</svg>
+
diff --git a/LayoutTests/svg/css/foreignObject-case-styling.html b/LayoutTests/svg/css/foreignObject-case-styling.html
new file mode 100644 (file)
index 0000000..13c150d
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype html>
+<style>
+  span { color: red; }
+  foreignObject span { color: blue; }
+  foreignObject SPAN { color: green; }
+</style>
+<p>This test the styling of elements in foreignObject. WebKit uses to fail this because it was unable to match &lt;foreignObject&gt; due the uppercase 'O'</p>
+<p>If test suceed, both words should be green.</p>
+<svg width="500" height="100">
+  <foreignObject width="500" height="100">
+    <span>Green</span>
+    <SPAN>Green</SPAN>
+  </foreignObject>
+</svg>
+
diff --git a/LayoutTests/svg/dom/tag-case-sensitive-svg-in-html-expected.txt b/LayoutTests/svg/dom/tag-case-sensitive-svg-in-html-expected.txt
new file mode 100644 (file)
index 0000000..2726fa5
--- /dev/null
@@ -0,0 +1,35 @@
+PASS content.querySelector('SPAN') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('SPAN') is true
+PASS content.querySelector('div ul li SPAN') is document.getElementById('upper1')
+PASS document.getElementById('upper1').webkitMatchesSelector('div ul li SPAN') is true
+PASS content.querySelector('unknownTag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('unknownTag') is true
+PASS content.querySelector('unknowntag') is document.getElementById('unknownTag1')
+PASS document.getElementById('unknownTag1').webkitMatchesSelector('unknowntag') is true
+PASS content.querySelector('g') is document.getElementById('group1')
+PASS document.getElementById('group1').webkitMatchesSelector('g') is true
+PASS content.querySelector('G') is null
+PASS content.querySelector('textPath') is document.getElementById('textPath1')
+PASS document.getElementById('textPath1').webkitMatchesSelector('textPath') is true
+PASS content.querySelector('svg textPath') is document.getElementById('textPath1')
+PASS document.getElementById('textPath1').webkitMatchesSelector('svg textPath') is true
+PASS content.querySelector('textpath') is null
+PASS content.querySelector('TextPath') is null
+PASS content.querySelector('foreignObject') is document.getElementById('foreignObject1')
+PASS document.getElementById('foreignObject1').webkitMatchesSelector('foreignObject') is true
+PASS content.querySelector('svg foreignObject') is document.getElementById('foreignObject1')
+PASS document.getElementById('foreignObject1').webkitMatchesSelector('svg foreignObject') is true
+PASS content.querySelector('foreignobject') is null
+PASS content.querySelector('ForeignObject') is null
+PASS content.querySelector('textPath + foreignObject') is document.getElementById('foreignObject1')
+PASS document.getElementById('foreignObject1').webkitMatchesSelector('textPath + foreignObject') is true
+PASS content.querySelector('svg textPath + foreignObject') is document.getElementById('foreignObject1')
+PASS document.getElementById('foreignObject1').webkitMatchesSelector('svg textPath + foreignObject') is true
+PASS content.querySelector('textPath + foreignobject') is null
+PASS content.querySelector('textPath + ForeignObject') is null
+PASS content.querySelector('textpath + foreignObject') is null
+PASS content.querySelector('TextPath + foreignObject') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dom/tag-case-sensitive-svg-in-html.html b/LayoutTests/svg/dom/tag-case-sensitive-svg-in-html.html
new file mode 100644 (file)
index 0000000..e61a670
--- /dev/null
@@ -0,0 +1,63 @@
+<!doctype html>
+<html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+    <!-- Testing that in SVG tags inside HTML documents match using case-insensitive mode. -->
+    <div id="content">
+        <div style="display: none">
+            <ul>
+                <li>
+                    <SPAN id="upper1"></SPAN>
+                    <svg xmlns="http://www.w3.org/2000/svg">
+                        <g id="group1"></g>
+                        <textPath id="textPath1"></textPath>
+                        <foreignObject id="foreignObject1"></foreignObject>
+                    </svg>
+                </li>
+            </ul>
+            <unknownTag id="unknownTag1"></unknownTag>
+        </div>
+    </div>
+    <script>
+        var content = document.getElementById("content");
+        function checkMatchingSelector(selector, elementId) {
+            shouldBe("content.querySelector('" + selector + "')", "document.getElementById('" + elementId + "')");
+            shouldBeTrue("document.getElementById('" + elementId + "').webkitMatchesSelector('" + selector + "')");
+        }
+
+        function checkNonMatchingSelector(selector) {
+            shouldBeNull("content.querySelector('" + selector + "')");
+        }
+
+        // Checking that tag name selectors still work on HTML elements when SVG is around.
+        checkMatchingSelector("SPAN", "upper1");
+        checkMatchingSelector("div ul li SPAN", "upper1");
+        checkMatchingSelector("unknownTag", "unknownTag1");
+        checkMatchingSelector("unknowntag", "unknownTag1");
+
+        checkMatchingSelector("g", "group1");
+        checkNonMatchingSelector("G");
+
+        checkMatchingSelector("textPath", "textPath1");
+        checkMatchingSelector("svg textPath", "textPath1");
+        checkNonMatchingSelector("textpath");
+        checkNonMatchingSelector("TextPath");
+
+        checkMatchingSelector("foreignObject", "foreignObject1");
+        checkMatchingSelector("svg foreignObject", "foreignObject1");
+        checkNonMatchingSelector("foreignobject");
+        checkNonMatchingSelector("ForeignObject");
+
+        checkMatchingSelector("textPath + foreignObject", "foreignObject1");
+        checkMatchingSelector("svg textPath + foreignObject", "foreignObject1");
+        checkNonMatchingSelector("textPath + foreignobject");
+        checkNonMatchingSelector("textPath + ForeignObject");
+        checkNonMatchingSelector("textpath + foreignObject");
+        checkNonMatchingSelector("TextPath + foreignObject");
+    </script>
+    <script src="../../resources/js-test-post.js"></script>
+</body>
+</html>