<!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>[169228] branches/safari-537.77-branch</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/169228">169228</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2014-05-22 16:50:34 -0700 (Thu, 22 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/168915">r168915</a>. <rdar://problem/16975506></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari53777branchLayoutTestsChangeLog">branches/safari-537.77-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari53777branchSourceWebCoreChangeLog">branches/safari-537.77-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGFEImageElementcpp">branches/safari-537.77-branch/Source/WebCore/svg/SVGFEImageElement.cpp</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGFEImageElementh">branches/safari-537.77-branch/Source/WebCore/svg/SVGFEImageElement.h</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGMPathElementcpp">branches/safari-537.77-branch/Source/WebCore/svg/SVGMPathElement.cpp</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGMPathElementh">branches/safari-537.77-branch/Source/WebCore/svg/SVGMPathElement.h</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGTRefElementcpp">branches/safari-537.77-branch/Source/WebCore/svg/SVGTRefElement.cpp</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGTRefElementh">branches/safari-537.77-branch/Source/WebCore/svg/SVGTRefElement.h</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGTextPathElementcpp">branches/safari-537.77-branch/Source/WebCore/svg/SVGTextPathElement.cpp</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGTextPathElementh">branches/safari-537.77-branch/Source/WebCore/svg/SVGTextPathElement.h</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGUseElementcpp">branches/safari-537.77-branch/Source/WebCore/svg/SVGUseElement.cpp</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvgSVGUseElementh">branches/safari-537.77-branch/Source/WebCore/svg/SVGUseElement.h</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvganimationSVGSMILElementcpp">branches/safari-537.77-branch/Source/WebCore/svg/animation/SVGSMILElement.cpp</a></li>
<li><a href="#branchessafari53777branchSourceWebCoresvganimationSVGSMILElementh">branches/safari-537.77-branch/Source/WebCore/svg/animation/SVGSMILElement.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparentanimateelementexpectedtxt">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-animate-element-expected.txt</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparentanimateelementhtml">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-animate-element.html</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparentfeimageelementexpectedtxt">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-feimage-element-expected.txt</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparentfeimageelementhtml">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-feimage-element.html</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparentmpathelementexpectedtxt">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-mpath-element-expected.txt</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparentmpathelementhtml">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-mpath-element.html</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparenttextpathelementexpectedtxt">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-textpath-element-expected.txt</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparenttextpathelementhtml">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-textpath-element.html</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparenttrefelementexpectedtxt">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-tref-element-expected.txt</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparenttrefelementhtml">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-tref-element.html</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparentuseelementexpectedtxt">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-use-element-expected.txt</a></li>
<li><a href="#branchessafari53777branchLayoutTestssvgcustomreparentuseelementhtml">branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-use-element.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari53777branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/LayoutTests/ChangeLog (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/ChangeLog        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/LayoutTests/ChangeLog        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -1,5 +1,33 @@
</span><span class="cx"> 2014-05-22 Lucas Forschler <lforschler@apple.com>
</span><span class="cx">
</span><ins>+ Merge r168915
+
+ 2014-05-15 Daniel Bates <dabates@apple.com>
+
+ SVG element may reference arbitrary DOM element before running its insertion logic
+ https://bugs.webkit.org/show_bug.cgi?id=132757
+ <rdar://problem/15703817>
+
+ Reviewed by Ryosuke Niwa.
+
+ Add tests to ensure that we don't cause an assertion failure when re-parenting an SVG subtree that
+ contains an element with a duplicate id.
+
+ * svg/custom/reparent-animate-element-expected.txt: Added.
+ * svg/custom/reparent-animate-element.html: Added.
+ * svg/custom/reparent-feimage-element-expected.txt: Added.
+ * svg/custom/reparent-feimage-element.html: Added.
+ * svg/custom/reparent-mpath-element-expected.txt: Added.
+ * svg/custom/reparent-mpath-element.html: Added.
+ * svg/custom/reparent-textpath-element-expected.txt: Added.
+ * svg/custom/reparent-textpath-element.html: Added.
+ * svg/custom/reparent-tref-element-expected.txt: Added.
+ * svg/custom/reparent-tref-element.html: Added.
+ * svg/custom/reparent-use-element-expected.txt: Added.
+ * svg/custom/reparent-use-element.html: Added.
+
+2014-05-22 Lucas Forschler <lforschler@apple.com>
+
</ins><span class="cx"> Merge r168636
</span><span class="cx">
</span><span class="cx"> 2014-05-12 Martin Hock <mhock@apple.com>
</span></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparentanimateelementexpectedtxtfromrev168915trunkLayoutTestssvgcustomreparentanimateelementexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-animate-element-expected.txt (from rev 168915, trunk/LayoutTests/svg/custom/reparent-animate-element-expected.txt) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-animate-element-expected.txt         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-animate-element-expected.txt        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This tests that we don't cause an assertion failure when re-parenting a <animate> after temporarily removing its referenced element.
+
+
+PASS
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparentanimateelementhtmlfromrev168915trunkLayoutTestssvgcustomreparentanimateelementhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-animate-element.html (from rev 168915, trunk/LayoutTests/svg/custom/reparent-animate-element.html) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-animate-element.html         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-animate-element.html        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<style>
+svg {
+ height: 0;
+ width: 0;
+}
+</style>
+</head>
+<p>This tests that we don't cause an assertion failure when re-parenting a &lt;animate&gt; after temporarily removing its referenced element.</p>
+<svg>
+ <circle id="a"></circle>
+ <animate xlink:href="#a" id="b"></animate>
+</svg>
+<svg id="c"></svg> <!-- This must be a <svg> element. -->
+<div id="a"></div>
+<script>
+var a = document.getElementById("a"); // <circle>
+var b = document.getElementById("b"); // <animate>
+a.parentNode.removeChild(a);
+b.appendChild(a);
+b.parentNode.removeChild(b);
+document.getElementById("c").appendChild(b);
+</script>
+<p>PASS</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparentfeimageelementexpectedtxtfromrev168915trunkLayoutTestssvgcustomreparentfeimageelementexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-feimage-element-expected.txt (from rev 168915, trunk/LayoutTests/svg/custom/reparent-feimage-element-expected.txt) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-feimage-element-expected.txt         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-feimage-element-expected.txt        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This tests that we don't cause an assertion failure when re-parenting a <feimage> after temporarily removing its referenced element.
+
+
+PASS
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparentfeimageelementhtmlfromrev168915trunkLayoutTestssvgcustomreparentfeimageelementhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-feimage-element.html (from rev 168915, trunk/LayoutTests/svg/custom/reparent-feimage-element.html) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-feimage-element.html         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-feimage-element.html        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<style>
+svg {
+ height: 0;
+ width: 0;
+}
+</style>
+</head>
+<p>This tests that we don't cause an assertion failure when re-parenting a &lt;feimage&gt; after temporarily removing its referenced element.</p>
+<svg>
+ <circle id="a"></circle>
+ <feimage xlink:href="#a" id="b"></feimage>
+</svg>
+<svg id="c"></svg>
+<div id="a"></div>
+<script>
+var a = document.getElementById("a"); // <circle>
+var b = document.getElementById("b"); // <feimage>
+a.parentNode.removeChild(a);
+b.appendChild(a);
+b.parentNode.removeChild(b);
+document.getElementById("c").appendChild(b);
+</script>
+<p>PASS</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparentmpathelementexpectedtxtfromrev168915trunkLayoutTestssvgcustomreparentmpathelementexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-mpath-element-expected.txt (from rev 168915, trunk/LayoutTests/svg/custom/reparent-mpath-element-expected.txt) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-mpath-element-expected.txt         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-mpath-element-expected.txt        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This tests that we don't cause an assertion failure when re-parenting a <mpath> after temporarily removing its referenced element.
+
+PASS
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparentmpathelementhtmlfromrev168915trunkLayoutTestssvgcustomreparentmpathelementhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-mpath-element.html (from rev 168915, trunk/LayoutTests/svg/custom/reparent-mpath-element.html) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-mpath-element.html         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-mpath-element.html        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<style>
+svg {
+ height: 0;
+ width: 0;
+}
+</style>
+</head>
+<p>This tests that we don't cause an assertion failure when re-parenting a &lt;mpath&gt; after temporarily removing its referenced element.</p>
+<svg>
+ <circle id="a"></circle>
+ <mpath xlink:href="#a" id="b"></mpath>
+</svg>
+<div id="c"></div>
+<div id="a"></div>
+<script>
+var a = document.getElementById("a"); // <circle>
+var b = document.getElementById("b"); // <mpath>
+a.parentNode.removeChild(a);
+b.appendChild(a);
+b.parentNode.removeChild(b);
+document.getElementById("c").appendChild(b);
+</script>
+<p>PASS</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparenttextpathelementexpectedtxtfromrev168915trunkLayoutTestssvgcustomreparenttextpathelementexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-textpath-element-expected.txt (from rev 168915, trunk/LayoutTests/svg/custom/reparent-textpath-element-expected.txt) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-textpath-element-expected.txt         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-textpath-element-expected.txt        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This tests that we don't cause an assertion failure when re-parenting a <textPath> after temporarily removing its referenced element.
+
+PASS
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparenttextpathelementhtmlfromrev168915trunkLayoutTestssvgcustomreparenttextpathelementhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-textpath-element.html (from rev 168915, trunk/LayoutTests/svg/custom/reparent-textpath-element.html) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-textpath-element.html         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-textpath-element.html        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<style>
+svg {
+ height: 0;
+ width: 0;
+}
+</style>
+</head>
+<p>This tests that we don't cause an assertion failure when re-parenting a &lt;textPath&gt; after temporarily removing its referenced element.</p>
+<svg>
+ <circle id="a"></circle>
+ <text>
+ <textPath xlink:href="#a" id="b"></textPath>
+ </text>
+</svg>
+<div id="c"></div>
+<div id="a"></div>
+<script>
+var a = document.getElementById("a"); // <circle>
+var b = document.getElementById("b"); // <textPath>
+a.parentNode.removeChild(a);
+b.appendChild(a);
+b.parentNode.removeChild(b);
+document.getElementById("c").appendChild(b);
+</script>
+<p>PASS</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparenttrefelementexpectedtxtfromrev168915trunkLayoutTestssvgcustomreparenttrefelementexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-tref-element-expected.txt (from rev 168915, trunk/LayoutTests/svg/custom/reparent-tref-element-expected.txt) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-tref-element-expected.txt         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-tref-element-expected.txt        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This tests that we don't cause an assertion failure when re-parenting a <tref> after temporarily removing its referenced element.
+
+PASS
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparenttrefelementhtmlfromrev168915trunkLayoutTestssvgcustomreparenttrefelementhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-tref-element.html (from rev 168915, trunk/LayoutTests/svg/custom/reparent-tref-element.html) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-tref-element.html         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-tref-element.html        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<style>
+svg {
+ height: 0;
+ width: 0;
+}
+</style>
+</head>
+<p>This tests that we don't cause an assertion failure when re-parenting a &lt;tref&gt; after temporarily removing its referenced element.</p>
+<svg>
+ <circle id="a"></circle>
+ <text>
+ <tref xlink:href="#a" id="b"></tref>
+ </text>
+</svg>
+<div id="c"></div>
+<div id="a"></div>
+<script>
+var a = document.getElementById("a"); // <circle>
+var b = document.getElementById("b"); // <tref>
+a.parentNode.removeChild(a);
+b.appendChild(a);
+b.parentNode.removeChild(b);
+document.getElementById("c").appendChild(b);
+</script>
+<p>PASS</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparentuseelementexpectedtxtfromrev168915trunkLayoutTestssvgcustomreparentuseelementexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-use-element-expected.txt (from rev 168915, trunk/LayoutTests/svg/custom/reparent-use-element-expected.txt) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-use-element-expected.txt         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-use-element-expected.txt        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This tests that we don't cause an assertion failure when re-parenting a <use> after removing its referenced element.
+
+PASS
</ins></span></pre></div>
<a id="branchessafari53777branchLayoutTestssvgcustomreparentuseelementhtmlfromrev168915trunkLayoutTestssvgcustomreparentuseelementhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-use-element.html (from rev 168915, trunk/LayoutTests/svg/custom/reparent-use-element.html) (0 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-use-element.html         (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/svg/custom/reparent-use-element.html        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<head>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+<style>
+svg {
+ height: 0;
+ width: 0;
+}
+</style>
+</head>
+<p>This tests that we don't cause an assertion failure when re-parenting a &lt;use&gt; after removing its referenced element.</p>
+<svg version="1.1">
+ <circle id="a"></circle>
+ <use xlink:href="#a" id="b"></use>
+</svg>
+<div id="c"></div>
+<div id="a"></div>
+<script>
+var a = document.getElementById("a"); // <circle>
+var b = document.getElementById("b"); // <use>
+a.parentNode.removeChild(a);
+b.appendChild(a);
+b.parentNode.removeChild(b);
+document.getElementById("c").appendChild(b);
+</script>
+<p>PASS</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari53777branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/ChangeLog (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/ChangeLog        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/ChangeLog        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -1,3 +1,69 @@
</span><ins>+2014-05-22 Lucas Forschler <lforschler@apple.com>
+
+ Merge r168915
+
+ 2014-05-15 Daniel Bates <dabates@apple.com>
+
+ SVG element may reference arbitrary DOM element before running its insertion logic
+ https://bugs.webkit.org/show_bug.cgi?id=132757
+ <rdar://problem/15703817>
+
+ Reviewed by Ryosuke Niwa.
+
+ Fixes an issue where an SVG element may reference an arbitrary DOM element e before e finished being
+ inserted in the tree.
+
+ Currently when an SVG element A is inserted into a document we use document.getElementById() to find the
+ element B it references (if any). If A is inserted before B and B has the same id as a later element in
+ the document then A can find B before B is notified that its been inserted into the document (i.e. before
+ Element::insertedFrom() is called on B). Instead, A should call document.getElementById() only after
+ cessation of the insertion operation that inserted it to ensure that all inserted nodes (including B)
+ processed their insertion-specific logic.
+
+ Tests: svg/custom/reparent-animate-element.html
+ svg/custom/reparent-feimage-element.html
+ svg/custom/reparent-mpath-element.html
+ svg/custom/reparent-textpath-element.html
+ svg/custom/reparent-tref-element.html
+ svg/custom/reparent-use-element.html
+
+ * svg/SVGFEImageElement.cpp:
+ (WebCore::SVGFEImageElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
+ we are called back to resolve our target element (i.e. call SVGFEImageElement::buildPendingResources())
+ after the subtree we're in is inserted.
+ (WebCore::SVGFEImageElement::didNotifySubtreeInsertions): Added; turns around and calls SVGFEImageElement::buildPendingResources().
+ * svg/SVGFEImageElement.h:
+ * svg/SVGMPathElement.cpp:
+ (WebCore::SVGMPathElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
+ we are called back to resolve our target element (i.e. call SVGMPathElement::buildPendingResources())
+ after the subtree we're in is inserted.
+ (WebCore::SVGMPathElement::didNotifySubtreeInsertions): Added; turns around and calls SVGMPathElement::buildPendingResources().
+ * svg/SVGMPathElement.h:
+ * svg/SVGTRefElement.cpp:
+ (WebCore::SVGTRefElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
+ we are called back to resolve our target element (i.e. call SVGTRefElement::buildPendingResources())
+ after the subtree we're in is inserted.
+ (WebCore::SVGTRefElement::didNotifySubtreeInsertions): Added; turns around and calls SVGTRefElement::buildPendingResources().
+ * svg/SVGTRefElement.h:
+ * svg/SVGTextPathElement.cpp:
+ (WebCore::SVGTextPathElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
+ we are called back to resolve our target element (i.e. call SVGTextPathElement::buildPendingResources())
+ after the subtree we're in is inserted.
+ (WebCore::SVGTextPathElement::didNotifySubtreeInsertions): Added; turns around and calls SVGTextPathElement::buildPendingResources().
+ * svg/SVGTextPathElement.h:
+ * svg/SVGUseElement.cpp:
+ (WebCore::SVGUseElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
+ we are called back to resolve our target element (i.e. call SVGUseElement::buildPendingResources()) after its subtree is
+ inserted.
+ (WebCore::SVGUseElement::didNotifySubtreeInsertions): Added; turns around and calls SVGUseElement::buildPendingResources().
+ * svg/SVGUseElement.h:
+ * svg/animation/SVGSMILElement.cpp:
+ (WebCore::SVGSMILElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
+ we are called back to resolve our target element (i.e. call SVGSMILElement::buildPendingResources())
+ after the subtree we're in is inserted.
+ (WebCore::SVGSMILElement::didNotifySubtreeInsertions): Added; turns around and calls SVGSMILElement::buildPendingResources().
+ * svg/animation/SVGSMILElement.h:
+
</ins><span class="cx"> 2014-05-22 Dana Burkart <dburkart@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r167856
</span><span class="lines">@@ -51,6 +117,7 @@
</span><span class="cx"> of a String.
</span><span class="cx"> * page/SecurityOrigin.h: Updated for above change.
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> 2014-05-22 Lucas Forschler <lforschler@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r168636
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGFEImageElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGFEImageElement.cpp (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGFEImageElement.cpp        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGFEImageElement.cpp        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -177,8 +177,12 @@
</span><span class="cx"> Node::InsertionNotificationRequest SVGFEImageElement::insertedInto(ContainerNode* rootParent)
</span><span class="cx"> {
</span><span class="cx"> SVGFilterPrimitiveStandardAttributes::insertedInto(rootParent);
</span><ins>+ return InsertionShouldCallDidNotifySubtreeInsertions;
+}
+
+void SVGFEImageElement::didNotifySubtreeInsertions(ContainerNode*)
+{
</ins><span class="cx"> buildPendingResource();
</span><del>- return InsertionDone;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void SVGFEImageElement::removedFrom(ContainerNode* rootParent)
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGFEImageElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGFEImageElement.h (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGFEImageElement.h        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGFEImageElement.h        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -45,6 +45,9 @@
</span><span class="cx">
</span><span class="cx"> virtual ~SVGFEImageElement();
</span><span class="cx">
</span><ins>+protected:
+ virtual void didNotifySubtreeInsertions(ContainerNode*) override;
+
</ins><span class="cx"> private:
</span><span class="cx"> SVGFEImageElement(const QualifiedName&, Document*);
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGMPathElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGMPathElement.cpp (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGMPathElement.cpp        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGMPathElement.cpp        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -91,10 +91,15 @@
</span><span class="cx"> {
</span><span class="cx"> SVGElement::insertedInto(rootParent);
</span><span class="cx"> if (rootParent->inDocument())
</span><del>- buildPendingResource();
</del><ins>+ return InsertionShouldCallDidNotifySubtreeInsertions;
</ins><span class="cx"> return InsertionDone;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void SVGMPathElement::didNotifySubtreeInsertions(ContainerNode*)
+{
+ buildPendingResource();
+}
+
</ins><span class="cx"> void SVGMPathElement::removedFrom(ContainerNode* rootParent)
</span><span class="cx"> {
</span><span class="cx"> SVGElement::removedFrom(rootParent);
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGMPathElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGMPathElement.h (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGMPathElement.h        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGMPathElement.h        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -43,6 +43,9 @@
</span><span class="cx">
</span><span class="cx"> void targetPathChanged();
</span><span class="cx">
</span><ins>+protected:
+ virtual void didNotifySubtreeInsertions(ContainerNode*) override;
+
</ins><span class="cx"> private:
</span><span class="cx"> SVGMPathElement(const QualifiedName&, Document*);
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGTRefElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGTRefElement.cpp (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGTRefElement.cpp        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGTRefElement.cpp        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -281,10 +281,15 @@
</span><span class="cx"> {
</span><span class="cx"> SVGStyledElement::insertedInto(rootParent);
</span><span class="cx"> if (rootParent->inDocument())
</span><del>- buildPendingResource();
</del><ins>+ return InsertionShouldCallDidNotifySubtreeInsertions;
</ins><span class="cx"> return InsertionDone;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void SVGTRefElement::didNotifySubtreeInsertions(ContainerNode*)
+{
+ buildPendingResource();
+}
+
</ins><span class="cx"> void SVGTRefElement::removedFrom(ContainerNode* rootParent)
</span><span class="cx"> {
</span><span class="cx"> SVGStyledElement::removedFrom(rootParent);
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGTRefElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGTRefElement.h (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGTRefElement.h        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGTRefElement.h        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -34,6 +34,9 @@
</span><span class="cx"> public:
</span><span class="cx"> static PassRefPtr<SVGTRefElement> create(const QualifiedName&, Document*);
</span><span class="cx">
</span><ins>+protected:
+ virtual void didNotifySubtreeInsertions(ContainerNode*) override;
+
</ins><span class="cx"> private:
</span><span class="cx"> friend class SVGTRefTargetEventListener;
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGTextPathElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGTextPathElement.cpp (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGTextPathElement.cpp        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGTextPathElement.cpp        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -181,8 +181,12 @@
</span><span class="cx"> Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(ContainerNode* rootParent)
</span><span class="cx"> {
</span><span class="cx"> SVGTextContentElement::insertedInto(rootParent);
</span><ins>+ return InsertionShouldCallDidNotifySubtreeInsertions;
+}
+
+void SVGTextPathElement::didNotifySubtreeInsertions(ContainerNode*)
+{
</ins><span class="cx"> buildPendingResource();
</span><del>- return InsertionDone;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void SVGTextPathElement::removedFrom(ContainerNode* rootParent)
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGTextPathElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGTextPathElement.h (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGTextPathElement.h        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGTextPathElement.h        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -111,7 +111,10 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> static PassRefPtr<SVGTextPathElement> create(const QualifiedName&, Document*);
</span><del>-
</del><ins>+
+protected:
+ virtual void didNotifySubtreeInsertions(ContainerNode*) override;
+
</ins><span class="cx"> private:
</span><span class="cx"> SVGTextPathElement(const QualifiedName&, Document*);
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGUseElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGUseElement.cpp (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGUseElement.cpp        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGUseElement.cpp        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -187,12 +187,17 @@
</span><span class="cx"> return InsertionDone;
</span><span class="cx"> ASSERT(!m_targetElementInstance || !isWellFormedDocument(document()));
</span><span class="cx"> ASSERT(!hasPendingResources() || !isWellFormedDocument(document()));
</span><ins>+ SVGExternalResourcesRequired::insertedIntoDocument(this);
</ins><span class="cx"> if (!m_wasInsertedByParser)
</span><del>- buildPendingResource();
- SVGExternalResourcesRequired::insertedIntoDocument(this);
</del><ins>+ return InsertionShouldCallDidNotifySubtreeInsertions;
</ins><span class="cx"> return InsertionDone;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void SVGUseElement::didNotifySubtreeInsertions(ContainerNode*)
+{
+ buildPendingResource();
+}
+
</ins><span class="cx"> void SVGUseElement::removedFrom(ContainerNode* rootParent)
</span><span class="cx"> {
</span><span class="cx"> SVGStyledTransformableElement::removedFrom(rootParent);
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvgSVGUseElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/SVGUseElement.h (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/SVGUseElement.h        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/SVGUseElement.h        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -55,6 +55,9 @@
</span><span class="cx">
</span><span class="cx"> RenderObject* rendererClipChild() const;
</span><span class="cx">
</span><ins>+protected:
+ virtual void didNotifySubtreeInsertions(ContainerNode*) override;
+
</ins><span class="cx"> private:
</span><span class="cx"> SVGUseElement(const QualifiedName&, Document*, bool wasInsertedByParser);
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvganimationSVGSMILElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/animation/SVGSMILElement.cpp (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/animation/SVGSMILElement.cpp        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/animation/SVGSMILElement.cpp        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -263,9 +263,12 @@
</span><span class="cx"> if (m_timeContainer)
</span><span class="cx"> m_timeContainer->notifyIntervalsChanged();
</span><span class="cx">
</span><ins>+ return InsertionShouldCallDidNotifySubtreeInsertions;
+}
+
+void SVGSMILElement::didNotifySubtreeInsertions(ContainerNode*)
+{
</ins><span class="cx"> buildPendingResource();
</span><del>-
- return InsertionDone;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void SVGSMILElement::removedFrom(ContainerNode* rootParent)
</span></span></pre></div>
<a id="branchessafari53777branchSourceWebCoresvganimationSVGSMILElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-537.77-branch/Source/WebCore/svg/animation/SVGSMILElement.h (169227 => 169228)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-537.77-branch/Source/WebCore/svg/animation/SVGSMILElement.h        2014-05-22 23:43:01 UTC (rev 169227)
+++ branches/safari-537.77-branch/Source/WebCore/svg/animation/SVGSMILElement.h        2014-05-22 23:50:34 UTC (rev 169228)
</span><span class="lines">@@ -120,6 +120,8 @@
</span><span class="cx"> virtual void setTargetElement(SVGElement*);
</span><span class="cx"> virtual void setAttributeName(const QualifiedName&);
</span><span class="cx">
</span><ins>+ virtual void didNotifySubtreeInsertions(ContainerNode*) override;
+
</ins><span class="cx"> private:
</span><span class="cx"> void buildPendingResource();
</span><span class="cx"> void clearResourceReferences();
</span></span></pre>
</div>
</div>
</body>
</html>