<!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>[162083] 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/162083">162083</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-15 11:01:44 -0800 (Wed, 15 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[SVG] Accept HTML and MathML namespaces as valid requiredExtensions
https://bugs.webkit.org/show_bug.cgi?id=88188

Patch by Frédéric Wang &lt;fred.wang@free.fr&gt; on 2014-01-15
Reviewed by Chris Fleizach.

Source/WebCore:

When HTML and MathML are used as foreign objects of an SVG image, it is
important for Web authors to be able to specify a fallback content for
SVG-only readers or browsers without MathML support. We rely on the
requiredExtensions for that purpose and we use the XHTML/MathML
namespaces as suggested in SVG Tiny 1.2 and implemented in Gecko.

Tests: svg/custom/conditional-processing-1.svg
       svg/custom/conditional-processing-2.html
       svg/dom/SVGTests.html

* svg/SVGSwitchElement.cpp: Remove an incorrect FIXME comment and replace it with a reference to bug 74749.
(WebCore::SVGSwitchElement::childShouldCreateRenderer):
* svg/SVGTests.cpp: Check if the list of required extensions contains only the XHTML/MathML namespaces.
(WebCore::SVGTests::hasExtension):
(WebCore::SVGTests::isValid):

LayoutTests:

conditional-processing-1 verifies that indeed a renderer object is only
created for the first &quot;valid&quot; SVG element of a &lt;switch&gt;, contrary to
what an incorrect FIXME comment said. conditional-processing-2 verifies
that the &lt;switch&gt; takes into account XHTML and MathML namespaces in the
requiredExtensions attribute to decide which SVG element is &quot;valid&quot;.
SVGTests.html verifies the SVGTests interface of SVG DOM: three
SVGStringList attributes (already tested in svg/dom/SVGStringList.html)
and the hasExtension() function.

* svg/custom/conditional-processing-1-expected.svg: Added.
* svg/custom/conditional-processing-1.svg: Added.
* svg/custom/conditional-processing-2-expected.html: Added.
* svg/custom/conditional-processing-2.html: Added.
* svg/dom/SVGTests-expected.txt: Added.
* svg/dom/SVGTests.html: Added.
* svg/dom/script-tests/SVGTests.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoresvgSVGSwitchElementcpp">trunk/Source/WebCore/svg/SVGSwitchElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGTestscpp">trunk/Source/WebCore/svg/SVGTests.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestssvgcustomconditionalprocessing1expectedsvg">trunk/LayoutTests/svg/custom/conditional-processing-1-expected.svg</a></li>
<li><a href="#trunkLayoutTestssvgcustomconditionalprocessing1svg">trunk/LayoutTests/svg/custom/conditional-processing-1.svg</a></li>
<li><a href="#trunkLayoutTestssvgcustomconditionalprocessing2expectedhtml">trunk/LayoutTests/svg/custom/conditional-processing-2-expected.html</a></li>
<li><a href="#trunkLayoutTestssvgcustomconditionalprocessing2html">trunk/LayoutTests/svg/custom/conditional-processing-2.html</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGTestsexpectedtxt">trunk/LayoutTests/svg/dom/SVGTests-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGTestshtml">trunk/LayoutTests/svg/dom/SVGTests.html</a></li>
<li><a href="#trunkLayoutTestssvgdomscripttestsSVGTestsjs">trunk/LayoutTests/svg/dom/script-tests/SVGTests.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (162082 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-15 19:00:47 UTC (rev 162082)
+++ trunk/LayoutTests/ChangeLog        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-01-15  Frédéric Wang  &lt;fred.wang@free.fr&gt;
+
+        [SVG] Accept HTML and MathML namespaces as valid requiredExtensions
+        https://bugs.webkit.org/show_bug.cgi?id=88188
+
+        Reviewed by Chris Fleizach.
+
+        conditional-processing-1 verifies that indeed a renderer object is only
+        created for the first &quot;valid&quot; SVG element of a &lt;switch&gt;, contrary to
+        what an incorrect FIXME comment said. conditional-processing-2 verifies
+        that the &lt;switch&gt; takes into account XHTML and MathML namespaces in the
+        requiredExtensions attribute to decide which SVG element is &quot;valid&quot;.
+        SVGTests.html verifies the SVGTests interface of SVG DOM: three
+        SVGStringList attributes (already tested in svg/dom/SVGStringList.html)
+        and the hasExtension() function.
+
+        * svg/custom/conditional-processing-1-expected.svg: Added.
+        * svg/custom/conditional-processing-1.svg: Added.
+        * svg/custom/conditional-processing-2-expected.html: Added.
+        * svg/custom/conditional-processing-2.html: Added.
+        * svg/dom/SVGTests-expected.txt: Added.
+        * svg/dom/SVGTests.html: Added.
+        * svg/dom/script-tests/SVGTests.js: Added.
+
</ins><span class="cx"> 2014-01-15  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: Merge layout test from Mac and GTK checking accessibility roles
</span></span></pre></div>
<a id="trunkLayoutTestssvgcustomconditionalprocessing1expectedsvg"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/conditional-processing-1-expected.svg (0 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/conditional-processing-1-expected.svg                                (rev 0)
+++ trunk/LayoutTests/svg/custom/conditional-processing-1-expected.svg        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot;?&gt;
+&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;100%&quot; height=&quot;100%&quot;&gt;
+  &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;green&quot;/&gt;
+&lt;/svg&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestssvgcustomconditionalprocessing1svg"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/conditional-processing-1.svg (0 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/conditional-processing-1.svg                                (rev 0)
+++ trunk/LayoutTests/svg/custom/conditional-processing-1.svg        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot;?&gt;
+&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;100%&quot; height=&quot;100%&quot;&gt;
+  &lt;switch&gt;
+    &lt;!-- This test passes if a renderer is only created for the first valid SVG child. --&gt;
+    &lt;span xmlns=&quot;http://www.w3.org/1999/xhtml&quot; style=&quot;display: inline-block; width: 100px; height: 100px; background: red&quot;/&gt;
+    &lt;mspace xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; width=&quot;100px&quot; height=&quot;100px&quot; mathbackground=&quot;red&quot;/&gt;
+    &lt;foreignObject requiredExtensions=&quot;unknownExtension&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;
+       &lt;span xmlns=&quot;http://www.w3.org/1999/xhtml&quot; style=&quot;display: inline-block; width: 100px; height: 100px; background: red&quot;/&gt;
+    &lt;/foreignObject&gt;
+    &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;green&quot;/&gt;
+    &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot;/&gt;
+    &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot;/&gt;
+    &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot;/&gt;
+    &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot;/&gt;
+  &lt;/switch&gt;
+&lt;/svg&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestssvgcustomconditionalprocessing2expectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/conditional-processing-2-expected.html (0 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/conditional-processing-2-expected.html                                (rev 0)
+++ trunk/LayoutTests/svg/custom/conditional-processing-2-expected.html        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;requiredExtensions&lt;/title&gt;
+    &lt;meta charset=&quot;utf-8&quot;/&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;p&gt;This test passes if four green squares are displayed:&lt;/p&gt;
+
+    &lt;svg width=&quot;100px&quot; height=&quot;100px&quot;&gt;
+      &lt;foreignObject height=&quot;100&quot; width=&quot;100&quot;&gt;
+        &lt;span style=&quot;display: inline-block; width: 100px; height: 100px; background: green&quot;&gt;&lt;/span&gt;
+      &lt;/foreignObject&gt;
+    &lt;/svg&gt;
+
+    &lt;svg width=&quot;100px&quot; height=&quot;100px&quot;&gt;
+      &lt;foreignObject requiredExtensions=&quot;http://www.w3.org/1998/Math/MathML&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;
+        &lt;math&gt;
+          &lt;mspace width=&quot;100px&quot; height=&quot;100px&quot; mathbackground=&quot;green&quot;/&gt;
+        &lt;/math&gt;
+      &lt;/foreignObject&gt;
+    &lt;/svg&gt;
+
+    &lt;svg width=&quot;100px&quot; height=&quot;100px&quot;&gt;
+      &lt;foreignObject requiredExtensions=&quot;http://www.w3.org/1998/Math/MathML http://www.w3.org/1999/xhtml&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;
+        &lt;span style=&quot;display: inline-block; width: 100px; height: 100px;&quot;&gt;
+          &lt;math&gt;
+            &lt;mspace width=&quot;100px&quot; height=&quot;100px&quot; mathbackground=&quot;green&quot;/&gt;
+          &lt;/math&gt;
+        &lt;/span&gt;
+      &lt;/foreignObject&gt;
+    &lt;/svg&gt;
+
+    &lt;!-- This tests an unknown required extension. --&gt;
+    &lt;svg width=&quot;100px&quot; height=&quot;100px&quot;&gt;
+      &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;green&quot;/&gt;
+    &lt;/svg&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestssvgcustomconditionalprocessing2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/conditional-processing-2.html (0 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/conditional-processing-2.html                                (rev 0)
+++ trunk/LayoutTests/svg/custom/conditional-processing-2.html        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;requiredExtensions&lt;/title&gt;
+    &lt;meta charset=&quot;utf-8&quot;/&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;!-- The following elements contain foreignObject with a list of required extensions. We should only display it when the list contains MathML or XHTML namespaces. --&gt;
+
+    &lt;p&gt;This test passes if four green squares are displayed:&lt;/p&gt;
+
+    &lt;!-- This tests a required XHTML extension. --&gt;
+    &lt;svg width=&quot;100px&quot; height=&quot;100px&quot;&gt;
+      &lt;switch&gt;
+        &lt;foreignObject requiredExtensions=&quot;http://www.w3.org/1999/xhtml&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;
+          &lt;span style=&quot;display: inline-block; width: 100px; height: 100px; background: green&quot;&gt;&lt;/span&gt;
+        &lt;/foreignObject&gt;
+        &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot;/&gt;
+      &lt;/switch&gt;
+    &lt;/svg&gt;
+
+    &lt;!-- This tests a required MathML extension. --&gt;
+    &lt;svg width=&quot;100px&quot; height=&quot;100px&quot;&gt;
+      &lt;switch&gt;
+        &lt;foreignObject requiredExtensions=&quot;http://www.w3.org/1998/Math/MathML&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;
+          &lt;math&gt;
+            &lt;mspace width=&quot;100px&quot; height=&quot;100px&quot; mathbackground=&quot;green&quot;/&gt;
+          &lt;/math&gt;
+        &lt;/foreignObject&gt;
+        &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot;/&gt;
+      &lt;/switch&gt;
+    &lt;/svg&gt;
+
+    &lt;!-- This tests required XHTML and MathML extensions. --&gt;
+    &lt;svg width=&quot;100px&quot; height=&quot;100px&quot;&gt;
+      &lt;switch&gt;
+        &lt;foreignObject requiredExtensions=&quot;http://www.w3.org/1998/Math/MathML http://www.w3.org/1999/xhtml&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;
+          &lt;span style=&quot;display: inline-block; width: 100px; height: 100px;&quot;&gt;
+            &lt;math&gt;
+              &lt;mspace width=&quot;100px&quot; height=&quot;100px&quot; mathbackground=&quot;green&quot;/&gt;
+            &lt;/math&gt;
+          &lt;/span&gt;
+        &lt;/foreignObject&gt;
+        &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot;/&gt;
+      &lt;/switch&gt;
+    &lt;/svg&gt;
+
+    &lt;!-- This tests an unknown required extension. --&gt;
+    &lt;svg width=&quot;100px&quot; height=&quot;100px&quot;&gt;
+      &lt;switch&gt;
+        &lt;foreignObject requiredExtensions=&quot;http://www.w3.org/1998/Math/MathML http://www.w3.org/1999/xhtml unknownExtension&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;
+          &lt;span style=&quot;display: inline-block; width: 100px; height: 100px; background: red&quot;&gt;&lt;/span&gt;
+        &lt;/foreignObject&gt;
+        &lt;rect width=&quot;100&quot; height=&quot;100&quot; fill=&quot;green&quot;/&gt;
+      &lt;/switch&gt;
+    &lt;/svg&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGTestsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/dom/SVGTests-expected.txt (0 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGTests-expected.txt                                (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGTests-expected.txt        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+This test checks the SVGTests API
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+
+Check the requiredFeatures, requiredExtensions and systemLanguage attributes
+PASS foreignObject.requiredFeatures instanceof SVGStringList is true
+PASS foreignObject.requiredExtensions instanceof SVGStringList is true
+PASS foreignObject.systemLanguage instanceof SVGStringList is true
+
+Check the hasExtension function
+PASS foreignObject.hasExtension('http://www.w3.org/1998/Math/MathML') is true
+PASS foreignObject.hasExtension('http://www.w3.org/1999/xhtml') is true
+PASS foreignObject.hasExtension('') is false
+PASS foreignObject.hasExtension('unknownExtension') is false
+PASS foreignObject.hasExtension('HTTP://WWW.W3.ORG/1999/XHTML') is false
+PASS foreignObject.hasExtension('http://www.w3.org/1998/Math/MathML http://www.w3.org/1999/xhtml') is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGTestshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/dom/SVGTests.html (0 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGTests.html                                (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGTests.html        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script src=&quot;script-tests/SVGTests.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestssvgdomscripttestsSVGTestsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/dom/script-tests/SVGTests.js (0 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/script-tests/SVGTests.js                                (rev 0)
+++ trunk/LayoutTests/svg/dom/script-tests/SVGTests.js        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+description(&quot;This test checks the SVGTests API&quot;);
+
+var svgElement = document.createElementNS(&quot;http://www.w3.org/2000/svg&quot;, &quot;svg&quot;);
+var foreignObject = document.createElementNS(&quot;http://www.w3.org/2000/svg&quot;, &quot;foreignObject&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;Check the requiredFeatures, requiredExtensions and systemLanguage attributes&quot;);
+shouldBeTrue(&quot;foreignObject.requiredFeatures instanceof SVGStringList&quot;);
+shouldBeTrue(&quot;foreignObject.requiredExtensions instanceof SVGStringList&quot;);
+shouldBeTrue(&quot;foreignObject.systemLanguage instanceof SVGStringList&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;Check the hasExtension function&quot;);
+shouldBeTrue(&quot;foreignObject.hasExtension('http://www.w3.org/1998/Math/MathML')&quot;);
+shouldBeTrue(&quot;foreignObject.hasExtension('http://www.w3.org/1999/xhtml')&quot;);
+shouldBeFalse(&quot;foreignObject.hasExtension('')&quot;);
+shouldBeFalse(&quot;foreignObject.hasExtension('unknownExtension')&quot;);
+shouldBeFalse(&quot;foreignObject.hasExtension('HTTP://WWW.W3.ORG/1999/XHTML')&quot;);
+shouldBeFalse(&quot;foreignObject.hasExtension('http://www.w3.org/1998/Math/MathML http://www.w3.org/1999/xhtml')&quot;);
+
+successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162082 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-15 19:00:47 UTC (rev 162082)
+++ trunk/Source/WebCore/ChangeLog        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-01-15  Frédéric Wang  &lt;fred.wang@free.fr&gt;
+
+        [SVG] Accept HTML and MathML namespaces as valid requiredExtensions
+        https://bugs.webkit.org/show_bug.cgi?id=88188
+
+        Reviewed by Chris Fleizach.
+
+        When HTML and MathML are used as foreign objects of an SVG image, it is
+        important for Web authors to be able to specify a fallback content for
+        SVG-only readers or browsers without MathML support. We rely on the
+        requiredExtensions for that purpose and we use the XHTML/MathML
+        namespaces as suggested in SVG Tiny 1.2 and implemented in Gecko.
+
+        Tests: svg/custom/conditional-processing-1.svg
+               svg/custom/conditional-processing-2.html
+               svg/dom/SVGTests.html
+
+        * svg/SVGSwitchElement.cpp: Remove an incorrect FIXME comment and replace it with a reference to bug 74749.
+        (WebCore::SVGSwitchElement::childShouldCreateRenderer):
+        * svg/SVGTests.cpp: Check if the list of required extensions contains only the XHTML/MathML namespaces.
+        (WebCore::SVGTests::hasExtension):
+        (WebCore::SVGTests::isValid):
+
</ins><span class="cx"> 2014-01-15  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r162066.
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGSwitchElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGSwitchElement.cpp (162082 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGSwitchElement.cpp        2014-01-15 19:00:47 UTC (rev 162082)
+++ trunk/Source/WebCore/svg/SVGSwitchElement.cpp        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -51,8 +51,8 @@
</span><span class="cx"> 
</span><span class="cx"> bool SVGSwitchElement::childShouldCreateRenderer(const Node&amp; child) const
</span><span class="cx"> {
</span><del>-    // FIXME: This function does not do what the comment below implies it does.
-    // It will create a renderer for any valid SVG element children, not just the first one.
</del><ins>+    // We create a renderer for the first valid SVG element child.
+    // FIXME: The renderer must be updated after dynamic change of the requiredFeatures, requiredExtensions and systemLanguage attributes (https://bugs.webkit.org/show_bug.cgi?id=74749).
</ins><span class="cx">     for (auto&amp; element : childrenOfType&lt;SVGElement&gt;(*this)) {
</span><span class="cx">         if (!element.isValid())
</span><span class="cx">             continue;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGTestscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGTests.cpp (162082 => 162083)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGTests.cpp        2014-01-15 19:00:47 UTC (rev 162082)
+++ trunk/Source/WebCore/svg/SVGTests.cpp        2014-01-15 19:01:44 UTC (rev 162083)
</span><span class="lines">@@ -25,11 +25,16 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Attribute.h&quot;
</span><span class="cx"> #include &quot;DOMImplementation.h&quot;
</span><ins>+#include &quot;HTMLNames.h&quot;
</ins><span class="cx"> #include &quot;Language.h&quot;
</span><span class="cx"> #include &quot;SVGElement.h&quot;
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><span class="cx"> #include &quot;SVGStringList.h&quot;
</span><span class="cx"> 
</span><ins>+#if ENABLE(MATHML)
+#include &quot;MathMLNames.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> // Define custom non-animated property 'requiredFeatures'.
</span><span class="lines">@@ -95,30 +100,32 @@
</span><span class="cx">     return map;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SVGTests::hasExtension(const String&amp;) const
</del><ins>+bool SVGTests::hasExtension(const String&amp; extension) const
</ins><span class="cx"> {
</span><del>-    // FIXME: Implement me!
-    return false;
</del><ins>+    // We recognize XHTML and MathML, as implemented in Gecko and suggested in the SVG Tiny recommendation (http://www.w3.org/TR/SVG11/struct.html#RequiredExtensionsAttribute).
+#if ENABLE(MATHML)
+    return extension == HTMLNames::xhtmlNamespaceURI || extension == MathMLNames::mathmlNamespaceURI;
+#else
+    return extension == HTMLNames::xhtmlNamespaceURI;
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SVGTests::isValid() const
</span><span class="cx"> {
</span><del>-    unsigned featuresSize = m_requiredFeatures.value.size();
-    for (unsigned i = 0; i &lt; featuresSize; ++i) {
-        String value = m_requiredFeatures.value.at(i);
-        if (value.isEmpty() || !DOMImplementation::hasFeature(value, String()))
</del><ins>+    for (auto&amp; feature : m_requiredFeatures.value) {
+        if (feature.isEmpty() || !DOMImplementation::hasFeature(feature, String()))
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    unsigned systemLanguageSize = m_systemLanguage.value.size();
-    for (unsigned i = 0; i &lt; systemLanguageSize; ++i) {
-        String value = m_systemLanguage.value.at(i);
-        if (value != defaultLanguage().substring(0, 2))
</del><ins>+    for (auto&amp; language : m_systemLanguage.value) {
+        if (language != defaultLanguage().substring(0, 2))
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!m_requiredExtensions.value.isEmpty())
-        return false;
</del><ins>+    for (auto&amp; extension : m_requiredExtensions.value) {
+        if (!hasExtension(extension))
+            return false;
+    }
</ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>