<!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>[198246] branches/safari-601.1.46-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/198246">198246</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2016-03-15 17:22:02 -0700 (Tue, 15 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/196268">r196268</a>. rdar://problem/24748259</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestsChangeLog">branches/safari-601.1.46-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari601146branchLayoutTestsTestExpectations">branches/safari-601.1.46-branch/LayoutTests/TestExpectations</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreChangeLog">branches/safari-601.1.46-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebCorebindingsscriptsCodeGeneratorJSpm">branches/safari-601.1.46-branch/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgSVGMarkerElementcpp">branches/safari-601.1.46-branch/Source/WebCore/svg/SVGMarkerElement.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgSVGPathElementcpp">branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathElement.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgSVGPathElementh">branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathElement.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgSVGPathSegWithContexth">branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathSegWithContext.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgSVGPolyElementcpp">branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPolyElement.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgSVGPolyElementh">branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPolyElement.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgSVGViewSpeccpp">branches/safari-601.1.46-branch/Source/WebCore/svg/SVGViewSpec.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgSVGViewSpech">branches/safari-601.1.46-branch/Source/WebCore/svg/SVGViewSpec.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedListPropertyTearOffh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPathSegListPropertyTearOffh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPropertyh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPropertyMacrosh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedTransformListPropertyTearOffh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGListPropertyTearOffh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGListPropertyTearOff.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGPathSegListPropertyTearOffcpp">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestssvganimationssmilleaklistpropertyinstancesexpectedtxt">branches/safari-601.1.46-branch/LayoutTests/svg/animations/smil-leak-list-property-instances-expected.txt</a></li>
<li><a href="#branchessafari601146branchLayoutTestssvganimationssmilleaklistpropertyinstancessvg">branches/safari-601.1.46-branch/LayoutTests/svg/animations/smil-leak-list-property-instances.svg</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-03-14  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r196268. rdar://problem/24748259
+
+    2016-02-08  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+            REGRESSION(r181345): SVG polyline and polygon leak page
+            https://bugs.webkit.org/show_bug.cgi?id=152759
+
+            Reviewed by Darin Adler.
+
+            * TestExpectations: Remove flaky tests from test expectation.
+
+            * svg/animations/smil-leak-list-property-instances-expected.txt: Added.
+            * svg/animations/smil-leak-list-property-instances.svg: Added.
+            Ensure if SVGPolylineElement.points is requested from JS, the document will
+            not leak.
+
</ins><span class="cx"> 2016-02-16  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge patch for r192036 and r196679.
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/TestExpectations (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/TestExpectations        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/LayoutTests/TestExpectations        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -503,12 +503,6 @@
</span><span class="cx"> # Content extensions are Mac-WK2-only for now
</span><span class="cx"> http/tests/contentextensions [ Skip ]
</span><span class="cx"> 
</span><del>-# These tests were flaky on Mac only but they became flaky on all ports after r181345
-webkit.org/b/114280 svg/animations/smil-leak-dynamically-added-element-instances.svg [ Pass Failure ]
-webkit.org/b/114280 svg/animations/smil-leak-element-instances-noBaseValRef.svg [ Pass Failure ]
-webkit.org/b/114280 svg/animations/smil-leak-element-instances.svg [ Pass Failure ]
-webkit.org/b/114280 svg/animations/smil-leak-elements.svg [ Pass Failure ]
-
</del><span class="cx"> webkit.org/b/143085 media/track/track-mode.html [ Pass Timeout ]
</span><span class="cx"> 
</span><span class="cx"> # In ES6, Object type restrictions on a first parameter of several Object.* functions are relaxed.
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestssvganimationssmilleaklistpropertyinstancesexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/svg/animations/smil-leak-list-property-instances-expected.txt (0 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/svg/animations/smil-leak-list-property-instances-expected.txt                                (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/svg/animations/smil-leak-list-property-instances-expected.txt        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestssvganimationssmilleaklistpropertyinstancessvg"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/svg/animations/smil-leak-list-property-instances.svg (0 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/svg/animations/smil-leak-list-property-instances.svg                                (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/svg/animations/smil-leak-list-property-instances.svg        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+&lt;svg id=&quot;svg&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; onload=&quot;load()&quot;&gt;
+&lt;defs&gt;
+    &lt;polyline id=&quot;polyline&quot; points=&quot;20,20 80,20 80,80 20,80&quot; /&gt;
+&lt;/defs&gt;
+&lt;g id=&quot;g&quot;/&gt;
+&lt;text x=&quot;50&quot; y=&quot;50&quot; id=&quot;log&quot;/&gt;
+&lt;script id=&quot;script&quot;&gt;
+&lt;![CDATA[
+
+var g = document.getElementById(&quot;g&quot;);
+
+function log(message) {
+    var logDiv = document.getElementById('log');
+    logDiv.appendChild(document.createTextNode(message));
+}
+
+function createAnimatedPolylineInstance() {
+    var use = document.createElementNS(&quot;http://www.w3.org/2000/svg&quot;, &quot;use&quot;);
+    use.setAttributeNS(&quot;http://www.w3.org/1999/xlink&quot;, &quot;href&quot;, &quot;#polyline&quot;);
+
+    var anim = document.createElementNS(&quot;http://www.w3.org/2000/svg&quot;, &quot;animate&quot;);
+    anim.setAttribute(&quot;attributeType&quot;, &quot;XML&quot;);
+    anim.setAttribute(&quot;attributeName&quot;, &quot;points&quot;);
+    anim.setAttribute(&quot;from&quot;, &quot;20,20 80,20 80,80 20,80&quot;);
+    anim.setAttribute(&quot;to&quot;, &quot;10,10 90,10 90,90 10,90&quot;);
+    anim.setAttribute(&quot;begin&quot;, &quot;0s&quot;);
+    anim.setAttribute(&quot;dur&quot;, &quot;10.0s&quot;);
+    anim.setAttribute(&quot;repeatCount&quot;, 1);
+
+    use.appendChild(anim);
+
+    return use;
+}
+
+function startTest() {
+    // Collect garbage before recording starting live node count, in case there are live elements from previous tests.
+    GCController.collect();
+    originalLiveElements = window.internals.numberOfLiveNodes();
+
+    // Hold references to points and animatedPoints on the root instance.
+    points = document.getElementById(&quot;polyline&quot;).points;
+    animatedPoints = document.getElementById(&quot;polyline&quot;).animatedPoints;
+
+    for (var i = 0; i &lt; 100; i++)
+        g.appendChild(createAnimatedPolylineInstance());
+
+    setTimeout(continueTest, 0);
+}
+
+function continueTest() {
+    while (g.hasChildNodes())
+        g.removeChild(g.lastChild);
+
+    setTimeout(finishTest, 0);
+}
+
+var attemptsToFinish = 5;
+
+function finishTest() {
+    GCController.collect();
+
+    var liveDelta = window.internals.numberOfLiveNodes() - originalLiveElements;
+    if (liveDelta == 0)
+        log(&quot;PASS&quot;);
+    else if (--attemptsToFinish) {
+        setTimeout(finishTest, 100);
+        return;
+    } else
+        log(&quot;FAIL: &quot; + liveDelta + &quot; extra live node(s)&quot;);
+
+    testRunner.notifyDone();
+}
+
+function load() {
+    if (window.testRunner &amp;&amp; window.GCController &amp;&amp; window.internals) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    } else {
+        log(&quot;This test only works when run with the testRunner, GCController, and internals available.&quot;);
+        return;
+    }
+
+    setTimeout(startTest, 0);
+}
+]]&gt;
+&lt;/script&gt;
+&lt;/svg&gt;
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -1,3 +1,141 @@
</span><ins>+2016-03-14  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r196268. rdar://problem/24748259
+
+    2016-02-08  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+            REGRESSION(r181345): SVG polyline and polygon leak page
+            https://bugs.webkit.org/show_bug.cgi?id=152759
+
+            Reviewed by Darin Adler.
+
+            The leak happens because of cyclic reference between SVGListPropertyTearOff
+            and SVGAnimatedListPropertyTearOff which is derived from SVGAnimatedProperty.
+            There is also cyclic reference between SVGAnimatedProperty and SVGElement
+            and this causes the whole document to be leaked. So if the JS requests, for
+            example, an instance of SVGPolylineElement.points, the whole document will be
+            leaked.
+
+            The fix depends on having the cyclic reference as is since the owning and the
+            owned classes have to live together if any of them is referenced. But the owning
+            class caches a raw 'ref-counted' pointer of the owned class. If it is requested
+            for an instance of the owned class it returned a RefPtr&lt;&gt; of it. Once the owned
+            class is not used, it can delete itself. The only thing needed here is to notify
+            the owner class of the deletion so it cleans its caches and be able to create a
+            new pointer if it is requested for an instance of the owned class later.
+
+            Revert the change of r181345 in SVGAnimatedProperty::lookupOrCreateWrapper()
+            to break the cyclic reference between SVGElement and SVGAnimatedProperty.
+
+            Also apply the same approach in SVGAnimatedListPropertyTearOff::baseVal() and
+            animVal() to break cyclic reference between SVGListPropertyTearOff and
+            SVGAnimatedListPropertyTearOff.
+
+            Test: svg/animations/smil-leak-list-property-instances.svg
+
+            * bindings/scripts/CodeGeneratorJS.pm:
+            (NativeToJSValue): The SVG non-string list tear-off properties became of
+            type RefPtr&lt;&gt;. So we need to use get() with the casting expressions.
+
+            * svg/SVGMarkerElement.cpp:
+            (WebCore::SVGMarkerElement::orientType):
+            Use 'auto' type for the return of SVGAnimatedProperty::lookupWrapper().
+
+            * svg/SVGPathElement.cpp:
+            (WebCore::SVGPathElement::pathByteStream):
+            (WebCore::SVGPathElement::lookupOrCreateDWrapper):
+            Since SVGAnimatedProperty::lookupWrappe() returns a RefPtr&lt;&gt; we need to
+            use get() for the casting expressions.
+
+            (WebCore::SVGPathElement::pathSegList):
+            (WebCore::SVGPathElement::normalizedPathSegList):
+            (WebCore::SVGPathElement::animatedPathSegList):
+            (WebCore::SVGPathElement::animatedNormalizedPathSegList):
+            * svg/SVGPathElement.h:
+            Change the return value from raw pointer to RefPtr&lt;&gt;.
+
+            * svg/SVGPathSegWithContext.h:
+            (WebCore::SVGPathSegWithContext::animatedProperty):
+            Change the return type to be RefPtr&lt;&gt; to preserve the value from being deleted.
+
+            * svg/SVGPolyElement.cpp:
+            (WebCore::SVGPolyElement::parseAttribute):
+            Since SVGAnimatedProperty::lookupWrapper() returns a RefPtr&lt;&gt; we need to
+            use get() for the casting expressions.
+
+            (WebCore::SVGPolyElement::points):
+            (WebCore::SVGPolyElement::animatedPoints):
+            * svg/SVGPolyElement.h:
+            Change the return value from raw pointer to RefPtr&lt;&gt;.
+
+            * svg/SVGViewSpec.cpp:
+            (WebCore::SVGViewSpec::setTransformString):
+            Since SVGAnimatedProperty::lookupWrapper() returns a RefPtr&lt;&gt; we need to
+            use get() for the casting expressions.
+
+            (WebCore::SVGViewSpec::transform):
+            * svg/SVGViewSpec.h:
+            Change the return value from raw pointer to RefPtr&lt;&gt;.
+
+            * svg/properties/SVGAnimatedListPropertyTearOff.h:
+            (WebCore::SVGAnimatedListPropertyTearOff::baseVal):
+            (WebCore::SVGAnimatedListPropertyTearOff::animVal):
+            Change the return value from raw pointer to RefPtr&lt;&gt; and change the cached
+            value from RefPtr&lt;&gt; to raw pointer. If the property is null, it will be
+            created, its raw pointer will be cached and the only ref-counted RefPtr&lt;&gt;
+            will be returned. This will guarantee, the RefPtr&lt;&gt; will be deleted once
+            it is not used anymore.
+
+            (WebCore::SVGAnimatedListPropertyTearOff::propertyWillBeDeleted):
+            Clean the raw pointer caches m_baseVal and m_animVal upon deleting the
+            actual pointer. This function will be called from the destructor of
+            SVGListPropertyTearOff.
+
+            (WebCore::SVGAnimatedListPropertyTearOff::findItem):
+            (WebCore::SVGAnimatedListPropertyTearOff::removeItemFromList):
+            We have to ensure the baseVal() is created before using it.
+
+            (WebCore::SVGAnimatedListPropertyTearOff::detachListWrappers):
+            (WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue):
+            (WebCore::SVGAnimatedListPropertyTearOff::animationStarted):
+            (WebCore::SVGAnimatedListPropertyTearOff::animationEnded):
+            (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
+            (WebCore::SVGAnimatedListPropertyTearOff::animValWillChange):
+            (WebCore::SVGAnimatedListPropertyTearOff::animValDidChange):
+            For animation, a separate RefPtr&lt;&gt; 'm_animatingAnimVal' will be assigned
+            to the animVal(). This will prevent deleting m_animVal while animation.
+
+            * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
+            (WebCore::SVGAnimatedPathSegListPropertyTearOff::baseVal):
+            (WebCore::SVGAnimatedPathSegListPropertyTearOff::animVal):
+            Same as what is done in SVGAnimatedListPropertyTearOff.
+
+            (WebCore::SVGAnimatedPathSegListPropertyTearOff::findItem):
+            (WebCore::SVGAnimatedPathSegListPropertyTearOff::removeItemFromList):
+            Same as what is done in SVGAnimatedListPropertyTearOff.
+
+            * svg/properties/SVGAnimatedProperty.h:
+            (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper):
+            Change the return value from raw reference to Ref&lt;&gt; and change the
+            cached value from Ref&lt;&gt; to raw pointer. This reverts the change of
+            r181345 in this function.
+
+            (WebCore::SVGAnimatedProperty::lookupWrapper):
+            Change the return value from raw pointer to RefPtr&lt;&gt;.
+
+            * svg/properties/SVGAnimatedPropertyMacros.h:
+            Use 'auto' type for the return of SVGAnimatedProperty::lookupWrapper().
+
+            * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
+            (WebCore::SVGAnimatedTransformListPropertyTearOff::baseVal):
+            (WebCore::SVGAnimatedTransformListPropertyTearOff::animVal):
+            Same as what is done in SVGAnimatedListPropertyTearOff.
+
+            * svg/properties/SVGListPropertyTearOff.h:
+            (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff):
+            Call the SVGAnimatedListPropertyTearOff::propertyWillBeDeleted() to clean
+            its raw pointers when the RefPtr&lt;&gt; deletes itself.
+
</ins><span class="cx"> 2016-02-12  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r196401.
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -4050,7 +4050,11 @@
</span><span class="cx">         return &quot;toJSNewlyCreated(exec, $globalObject, WTF::getPtr($value))&quot;;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if ($codeGenerator-&gt;IsSVGAnimatedType($interfaceName) or $interfaceName eq &quot;SVGViewSpec&quot;) {
</del><ins>+    # $type has to be used here because SVGViewSpec.transform is of type SVGTransformList.
+    if ($codeGenerator-&gt;IsSVGTypeNeedingTearOff($type) and $type =~ /(?&lt;!String)List$/) {
+        # Convert from abstract RefPtr&lt;ListProperty&gt; to real type, so the right toJS() method can be invoked.
+        $value = &quot;static_cast&lt;&quot; . GetNativeType($type) . &quot;&gt;($value&quot; . &quot;.get())&quot;;
+    } elsif ($codeGenerator-&gt;IsSVGAnimatedType($interfaceName) or $interfaceName eq &quot;SVGViewSpec&quot;) {
</ins><span class="cx">         # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked.
</span><span class="cx">         $value = &quot;static_cast&lt;&quot; . GetNativeType($type) . &quot;&gt;($value)&quot;;
</span><span class="cx">     } elsif ($codeGenerator-&gt;IsSVGTypeNeedingTearOff($type) and not $interfaceName =~ /List$/) {
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgSVGMarkerElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/SVGMarkerElement.cpp (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/SVGMarkerElement.cpp        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/SVGMarkerElement.cpp        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -251,7 +251,7 @@
</span><span class="cx"> 
</span><span class="cx"> SVGMarkerOrientType&amp; SVGMarkerElement::orientType() const
</span><span class="cx"> {
</span><del>-    if (SVGAnimatedEnumeration* wrapper = SVGAnimatedProperty::lookupWrapper&lt;UseOwnerType, SVGAnimatedEnumeration&gt;(this, orientTypePropertyInfo())) {
</del><ins>+    if (auto wrapper = SVGAnimatedProperty::lookupWrapper&lt;UseOwnerType, SVGAnimatedEnumeration&gt;(this, orientTypePropertyInfo())) {
</ins><span class="cx">         if (wrapper-&gt;isAnimating()) {
</span><span class="cx">             ASSERT(wrapper-&gt;currentAnimatedValue() &lt; SVGMarkerOrientMax);
</span><span class="cx">             return reinterpret_cast&lt;SVGMarkerOrientType&amp;&gt;(wrapper-&gt;currentAnimatedValue());
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgSVGPathElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathElement.cpp (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathElement.cpp        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathElement.cpp        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -295,10 +295,10 @@
</span><span class="cx"> 
</span><span class="cx"> SVGPathByteStream* SVGPathElement::pathByteStream() const
</span><span class="cx"> {
</span><del>-    SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper&lt;SVGPathElement, SVGAnimatedPathSegListPropertyTearOff&gt;(this, dPropertyInfo());
</del><ins>+    auto property = SVGAnimatedProperty::lookupWrapper&lt;SVGPathElement, SVGAnimatedPathSegListPropertyTearOff&gt;(this, dPropertyInfo());
</ins><span class="cx">     if (!property || !property-&gt;isAnimating())
</span><span class="cx">         return m_pathByteStream.get();
</span><del>-    return static_cast&lt;SVGAnimatedPathSegListPropertyTearOff*&gt;(property)-&gt;animatedPathByteStream();
</del><ins>+    static_cast&lt;SVGAnimatedPathSegListPropertyTearOff*&gt;(property.get())-&gt;animatedPathByteStream();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;SVGAnimatedProperty&gt; SVGPathElement::lookupOrCreateDWrapper(SVGElement* contextElement)
</span><span class="lines">@@ -306,7 +306,7 @@
</span><span class="cx">     ASSERT(contextElement);
</span><span class="cx">     SVGPathElement&amp; ownerType = downcast&lt;SVGPathElement&gt;(*contextElement);
</span><span class="cx"> 
</span><del>-    if (SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper&lt;SVGPathElement, SVGAnimatedPathSegListPropertyTearOff&gt;(&amp;ownerType, dPropertyInfo()))
</del><ins>+    if (auto property = SVGAnimatedProperty::lookupWrapper&lt;SVGPathElement, SVGAnimatedPathSegListPropertyTearOff&gt;(&amp;ownerType, dPropertyInfo()))
</ins><span class="cx">         return *property;
</span><span class="cx"> 
</span><span class="cx">     // Build initial SVGPathSegList.
</span><span class="lines">@@ -325,29 +325,29 @@
</span><span class="cx">     ownerType.m_pathSegList.synchronize(&amp;ownerType, dPropertyInfo()-&gt;attributeName, ownerType.m_pathSegList.value.valueAsString());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGPathSegListPropertyTearOff* SVGPathElement::pathSegList()
</del><ins>+RefPtr&lt;SVGPathSegListPropertyTearOff&gt; SVGPathElement::pathSegList()
</ins><span class="cx"> {
</span><span class="cx">     m_pathSegList.shouldSynchronize = true;
</span><del>-    return static_cast&lt;SVGPathSegListPropertyTearOff*&gt;(static_reference_cast&lt;SVGAnimatedPathSegListPropertyTearOff&gt;(lookupOrCreateDWrapper(this))-&gt;baseVal());
</del><ins>+    return static_cast&lt;SVGPathSegListPropertyTearOff*&gt;(static_reference_cast&lt;SVGAnimatedPathSegListPropertyTearOff&gt;(lookupOrCreateDWrapper(this))-&gt;baseVal().get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGPathSegListPropertyTearOff* SVGPathElement::normalizedPathSegList()
</del><ins>+RefPtr&lt;SVGPathSegListPropertyTearOff&gt; SVGPathElement::normalizedPathSegList()
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists!
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGPathSegListPropertyTearOff* SVGPathElement::animatedPathSegList()
</del><ins>+RefPtr&lt;SVGPathSegListPropertyTearOff&gt; SVGPathElement::animatedPathSegList()
</ins><span class="cx"> {
</span><span class="cx">     m_pathSegList.shouldSynchronize = true;
</span><span class="cx">     m_isAnimValObserved = true;
</span><del>-    return static_cast&lt;SVGPathSegListPropertyTearOff*&gt;(static_reference_cast&lt;SVGAnimatedPathSegListPropertyTearOff&gt;(lookupOrCreateDWrapper(this))-&gt;animVal());
</del><ins>+    return static_cast&lt;SVGPathSegListPropertyTearOff*&gt;(static_reference_cast&lt;SVGAnimatedPathSegListPropertyTearOff&gt;(lookupOrCreateDWrapper(this))-&gt;animVal().get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGPathSegListPropertyTearOff* SVGPathElement::animatedNormalizedPathSegList()
</del><ins>+RefPtr&lt;SVGPathSegListPropertyTearOff&gt; SVGPathElement::animatedNormalizedPathSegList()
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists!
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGPathElement::pathSegListChanged(SVGPathSegRole role, ListModification listModification)
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgSVGPathElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathElement.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathElement.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathElement.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -82,10 +82,10 @@
</span><span class="cx">     Ref&lt;SVGPathSegCurvetoQuadraticSmoothRel&gt; createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y, SVGPathSegRole = PathSegUndefinedRole);
</span><span class="cx"> 
</span><span class="cx">     // Used in the bindings only.
</span><del>-    SVGPathSegListPropertyTearOff* pathSegList();
-    SVGPathSegListPropertyTearOff* animatedPathSegList();
-    SVGPathSegListPropertyTearOff* normalizedPathSegList();
-    SVGPathSegListPropertyTearOff* animatedNormalizedPathSegList();
</del><ins>+    RefPtr&lt;SVGPathSegListPropertyTearOff&gt; pathSegList();
+    RefPtr&lt;SVGPathSegListPropertyTearOff&gt; animatedPathSegList();
+    RefPtr&lt;SVGPathSegListPropertyTearOff&gt; normalizedPathSegList();
+    RefPtr&lt;SVGPathSegListPropertyTearOff&gt; animatedNormalizedPathSegList();
</ins><span class="cx"> 
</span><span class="cx">     SVGPathByteStream* pathByteStream() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgSVGPathSegWithContexth"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathSegWithContext.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathSegWithContext.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPathSegWithContext.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    SVGAnimatedProperty* animatedProperty() const
</del><ins>+    RefPtr&lt;SVGAnimatedProperty&gt; animatedProperty() const
</ins><span class="cx">     {
</span><span class="cx">         switch (m_role) {
</span><span class="cx">         case PathSegUndefinedRole:
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgSVGPolyElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPolyElement.cpp (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPolyElement.cpp        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPolyElement.cpp        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -68,8 +68,8 @@
</span><span class="cx">         if (!pointsListFromSVGData(newList, value))
</span><span class="cx">             document().accessSVGExtensions().reportError(&quot;Problem parsing points=\&quot;&quot; + value + &quot;\&quot;&quot;);
</span><span class="cx"> 
</span><del>-        if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper&lt;SVGPolyElement, SVGAnimatedPointList&gt;(this, pointsPropertyInfo()))
-            static_cast&lt;SVGAnimatedPointList*&gt;(wrapper)-&gt;detachListWrappers(newList.size());
</del><ins>+        if (auto wrapper = SVGAnimatedProperty::lookupWrapper&lt;SVGPolyElement, SVGAnimatedPointList&gt;(this, pointsPropertyInfo()))
+            static_pointer_cast&lt;SVGAnimatedPointList&gt;(wrapper)-&gt;detachListWrappers(newList.size());
</ins><span class="cx"> 
</span><span class="cx">         m_points.value = newList;
</span><span class="cx">         return;
</span><span class="lines">@@ -118,16 +118,16 @@
</span><span class="cx">         (&amp;ownerType, pointsPropertyInfo(), ownerType.m_points.value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGListPropertyTearOff&lt;SVGPointList&gt;* SVGPolyElement::points()
</del><ins>+RefPtr&lt;SVGListPropertyTearOff&lt;SVGPointList&gt;&gt; SVGPolyElement::points()
</ins><span class="cx"> {
</span><span class="cx">     m_points.shouldSynchronize = true;
</span><del>-    return static_cast&lt;SVGListPropertyTearOff&lt;SVGPointList&gt;*&gt;(static_reference_cast&lt;SVGAnimatedPointList&gt;(lookupOrCreatePointsWrapper(this))-&gt;baseVal());
</del><ins>+    return static_cast&lt;SVGListPropertyTearOff&lt;SVGPointList&gt;*&gt;(static_reference_cast&lt;SVGAnimatedPointList&gt;(lookupOrCreatePointsWrapper(this))-&gt;baseVal().get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGListPropertyTearOff&lt;SVGPointList&gt;* SVGPolyElement::animatedPoints()
</del><ins>+RefPtr&lt;SVGListPropertyTearOff&lt;SVGPointList&gt;&gt; SVGPolyElement::animatedPoints()
</ins><span class="cx"> {
</span><span class="cx">     m_points.shouldSynchronize = true;
</span><del>-    return static_cast&lt;SVGListPropertyTearOff&lt;SVGPointList&gt;*&gt;(static_reference_cast&lt;SVGAnimatedPointList&gt;(lookupOrCreatePointsWrapper(this))-&gt;animVal());
</del><ins>+    return static_cast&lt;SVGListPropertyTearOff&lt;SVGPointList&gt;*&gt;(static_reference_cast&lt;SVGAnimatedPointList&gt;(lookupOrCreatePointsWrapper(this))-&gt;animVal().get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgSVGPolyElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPolyElement.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPolyElement.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/SVGPolyElement.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -31,8 +31,8 @@
</span><span class="cx"> 
</span><span class="cx"> class SVGPolyElement : public SVGGraphicsElement, public SVGExternalResourcesRequired {
</span><span class="cx"> public:
</span><del>-    SVGListPropertyTearOff&lt;SVGPointList&gt;* points();
-    SVGListPropertyTearOff&lt;SVGPointList&gt;* animatedPoints();
</del><ins>+    RefPtr&lt;SVGListPropertyTearOff&lt;SVGPointList&gt;&gt; points();
+    RefPtr&lt;SVGListPropertyTearOff&lt;SVGPointList&gt;&gt; animatedPoints();
</ins><span class="cx"> 
</span><span class="cx">     SVGPointList&amp; pointList() const { return m_points.value; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgSVGViewSpeccpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/SVGViewSpec.cpp (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/SVGViewSpec.cpp        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/SVGViewSpec.cpp        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -114,8 +114,8 @@
</span><span class="cx">     SVGTransformList newList;
</span><span class="cx">     newList.parse(transform);
</span><span class="cx"> 
</span><del>-    if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper&lt;SVGElement, SVGAnimatedTransformList&gt;(m_contextElement, transformPropertyInfo()))
-        static_cast&lt;SVGAnimatedTransformList*&gt;(wrapper)-&gt;detachListWrappers(newList.size());
</del><ins>+    if (auto wrapper = SVGAnimatedProperty::lookupWrapper&lt;SVGElement, SVGAnimatedTransformList&gt;(m_contextElement, transformPropertyInfo()))
+        static_pointer_cast&lt;SVGAnimatedTransformList&gt;(wrapper)-&gt;detachListWrappers(newList.size());
</ins><span class="cx"> 
</span><span class="cx">     m_transform = newList;
</span><span class="cx"> }
</span><span class="lines">@@ -145,12 +145,12 @@
</span><span class="cx">     return downcast&lt;SVGElement&gt;(element);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGTransformListPropertyTearOff* SVGViewSpec::transform()
</del><ins>+RefPtr&lt;SVGTransformListPropertyTearOff&gt; SVGViewSpec::transform()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_contextElement)
</span><span class="cx">         return nullptr;
</span><span class="cx">     // Return the animVal here, as its readonly by default - which is exactly what we want here.
</span><del>-    return static_cast&lt;SVGTransformListPropertyTearOff*&gt;(static_reference_cast&lt;SVGAnimatedTransformList&gt;(lookupOrCreateTransformWrapper(this))-&gt;animVal());
</del><ins>+    return static_pointer_cast&lt;SVGTransformListPropertyTearOff&gt;(static_reference_cast&lt;SVGAnimatedTransformList&gt;(lookupOrCreateTransformWrapper(this))-&gt;animVal());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;SVGAnimatedRect&gt; SVGViewSpec::viewBoxAnimated()
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgSVGViewSpech"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/SVGViewSpec.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/SVGViewSpec.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/SVGViewSpec.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">     void resetContextElement() { m_contextElement = nullptr; }
</span><span class="cx"> 
</span><span class="cx">     // Custom non-animated 'transform' property.
</span><del>-    SVGTransformListPropertyTearOff* transform();
</del><ins>+    RefPtr&lt;SVGTransformListPropertyTearOff&gt; transform();
</ins><span class="cx">     SVGTransformList transformBaseValue() const { return m_transform; }
</span><span class="cx"> 
</span><span class="cx">     // Custom animated 'viewBox' property.
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedListPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -39,35 +39,49 @@
</span><span class="cx">     typedef SVGListPropertyTearOff&lt;PropertyType&gt; ListPropertyTearOff;
</span><span class="cx">     typedef PropertyType ContentType;
</span><span class="cx"> 
</span><del>-    virtual ListProperty* baseVal()
</del><ins>+    virtual RefPtr&lt;ListProperty&gt; baseVal()
</ins><span class="cx">     {
</span><del>-        if (!m_baseVal)
-            m_baseVal = ListPropertyTearOff::create(this, BaseValRole, m_values, m_wrappers);
-        return static_cast&lt;ListProperty*&gt;(m_baseVal.get());
</del><ins>+        if (m_baseVal)
+            return m_baseVal;
+
+        auto property = ListPropertyTearOff::create(this, BaseValRole, m_values, m_wrappers);
+        m_baseVal = property.ptr();
+        return WTF::move(property);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    virtual ListProperty* animVal()
</del><ins>+    virtual RefPtr&lt;ListProperty&gt; animVal()
</ins><span class="cx">     {
</span><del>-        if (!m_animVal)
-            m_animVal = ListPropertyTearOff::create(this, AnimValRole, m_values, m_wrappers);
-        return static_cast&lt;ListProperty*&gt;(m_animVal.get());
</del><ins>+        if (m_animVal)
+            return m_animVal;
+
+        auto property = ListPropertyTearOff::create(this, AnimValRole, m_values, m_wrappers);
+        m_animVal = property.ptr();
+        return WTF::move(property);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    void propertyWillBeDeleted(const ListProperty&amp; property)
+    {
+        if (&amp;property == m_baseVal)
+            m_baseVal = nullptr;
+        else if (&amp;property == m_animVal)
+            m_animVal = nullptr;
+    }
+
</ins><span class="cx">     virtual bool isAnimatedListTearOff() const override { return true; }
</span><span class="cx"> 
</span><del>-    int findItem(SVGProperty* property) const
</del><ins>+    int findItem(SVGProperty* property)
</ins><span class="cx">     {
</span><span class="cx">         // This should ever be called for our baseVal, as animVal can't modify the list.
</span><span class="cx">         // It's safe to cast to ListPropertyTearOff here as all classes inheriting from us supply their own removeItemFromList() method.
</span><span class="cx">         typedef SVGPropertyTearOff&lt;typename SVGPropertyTraits&lt;PropertyType&gt;::ListItemType&gt; ListItemTearOff;
</span><del>-        return static_cast&lt;ListPropertyTearOff*&gt;(m_baseVal.get())-&gt;findItem(static_cast&lt;ListItemTearOff*&gt;(property));
</del><ins>+        return static_pointer_cast&lt;ListPropertyTearOff&gt;(baseVal())-&gt;findItem(static_cast&lt;ListItemTearOff*&gt;(property));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
</span><span class="cx">     {
</span><span class="cx">         // This should ever be called for our baseVal, as animVal can't modify the list.
</span><span class="cx">         // It's safe to cast to ListPropertyTearOff here as all classes inheriting from us supply their own removeItemFromList() method.
</span><del>-        static_cast&lt;ListPropertyTearOff*&gt;(m_baseVal.get())-&gt;removeItemFromList(itemIndex, shouldSynchronizeWrappers);
</del><ins>+        static_pointer_cast&lt;ListPropertyTearOff&gt;(baseVal())-&gt;removeItemFromList(itemIndex, shouldSynchronizeWrappers);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void detachListWrappers(unsigned newListSize)
</span><span class="lines">@@ -78,8 +92,8 @@
</span><span class="cx">     PropertyType&amp; currentAnimatedValue()
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_isAnimating);
</span><del>-        ASSERT(m_animVal);
-        return static_cast&lt;ListProperty*&gt;(m_animVal.get())-&gt;values();
</del><ins>+        ASSERT(m_animatingAnimVal);
+        return static_pointer_cast&lt;ListProperty&gt;(m_animatingAnimVal)-&gt;values();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     const PropertyType&amp; currentBaseValue() const
</span><span class="lines">@@ -90,6 +104,7 @@
</span><span class="cx">     void animationStarted(PropertyType* newAnimVal, bool shouldOwnValues = false)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(!m_isAnimating);
</span><ins>+        ASSERT(!m_animatingAnimVal);
</ins><span class="cx">         ASSERT(newAnimVal);
</span><span class="cx">         ASSERT(m_values.size() == m_wrappers.size());
</span><span class="cx">         ASSERT(m_animatedWrappers.isEmpty());
</span><span class="lines">@@ -98,57 +113,55 @@
</span><span class="cx">         if (!newAnimVal-&gt;isEmpty())
</span><span class="cx">             m_animatedWrappers.fill(0, newAnimVal-&gt;size());
</span><span class="cx"> 
</span><del>-        ListProperty* animVal = static_cast&lt;ListProperty*&gt;(this-&gt;animVal());
-        animVal-&gt;setValuesAndWrappers(newAnimVal, &amp;m_animatedWrappers, shouldOwnValues);
-        ASSERT(animVal-&gt;values().size() == animVal-&gt;wrappers().size());
-        ASSERT(animVal-&gt;wrappers().size() == m_animatedWrappers.size());
</del><ins>+        m_animatingAnimVal = animVal();
+        m_animatingAnimVal-&gt;setValuesAndWrappers(newAnimVal, &amp;m_animatedWrappers, shouldOwnValues);
+        ASSERT(m_animatingAnimVal-&gt;values().size() == m_animatingAnimVal-&gt;wrappers().size());
+        ASSERT(m_animatingAnimVal-&gt;wrappers().size() == m_animatedWrappers.size());
</ins><span class="cx">         m_isAnimating = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animationEnded()
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_isAnimating);
</span><del>-        ASSERT(m_animVal);
</del><ins>+        ASSERT(m_animatingAnimVal);
</ins><span class="cx">         ASSERT(m_values.size() == m_wrappers.size());
</span><span class="cx"> 
</span><del>-        ListProperty* animVal = static_cast&lt;ListProperty*&gt;(m_animVal.get());
-        ASSERT(animVal-&gt;values().size() == animVal-&gt;wrappers().size());
-        ASSERT(animVal-&gt;wrappers().size() == m_animatedWrappers.size());
</del><ins>+        ASSERT(m_animatingAnimVal-&gt;values().size() == m_animatingAnimVal-&gt;wrappers().size());
+        ASSERT(m_animatingAnimVal-&gt;wrappers().size() == m_animatedWrappers.size());
</ins><span class="cx"> 
</span><del>-        animVal-&gt;setValuesAndWrappers(&amp;m_values, &amp;m_wrappers, false);
-        ASSERT(animVal-&gt;values().size() == animVal-&gt;wrappers().size());
-        ASSERT(animVal-&gt;wrappers().size() == m_wrappers.size());
</del><ins>+        m_animatingAnimVal-&gt;setValuesAndWrappers(&amp;m_values, &amp;m_wrappers, false);
+        ASSERT(m_animatingAnimVal-&gt;values().size() == m_animatingAnimVal-&gt;wrappers().size());
+        ASSERT(m_animatingAnimVal-&gt;wrappers().size() == m_wrappers.size());
</ins><span class="cx"> 
</span><span class="cx">         m_animatedWrappers.clear();
</span><ins>+        m_animatingAnimVal = nullptr;
</ins><span class="cx">         m_isAnimating = false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void synchronizeWrappersIfNeeded()
</span><span class="cx">     {
</span><ins>+        ASSERT(m_isAnimating);
+        ASSERT(m_animatingAnimVal);
+
</ins><span class="cx">         // Eventually the wrapper list needs synchronization because any SVGAnimateLengthList::calculateAnimatedValue() call may
</span><span class="cx">         // mutate the length of our values() list, and thus the wrapper() cache needs synchronization, to have the same size.
</span><span class="cx">         // Also existing wrappers which point directly at elements in the existing SVGLengthList have to be detached (so a copy
</span><span class="cx">         // of them is created, so existing animVal variables in JS are kept-alive). If we'd detach them later the underlying
</span><span class="cx">         // SVGLengthList was already mutated, and our list item wrapper tear offs would point nowhere. Assertions would fire.
</span><del>-        ListProperty* animVal = static_cast&lt;ListProperty*&gt;(m_animVal.get());
-        animVal-&gt;detachListWrappers(animVal-&gt;values().size());
</del><ins>+        m_animatingAnimVal-&gt;detachListWrappers(m_animatingAnimVal-&gt;values().size());
</ins><span class="cx"> 
</span><del>-        ASSERT(animVal-&gt;values().size() == animVal-&gt;wrappers().size());
-        ASSERT(animVal-&gt;wrappers().size() == m_animatedWrappers.size());
</del><ins>+        ASSERT(m_animatingAnimVal-&gt;values().size() == m_animatingAnimVal-&gt;wrappers().size());
+        ASSERT(m_animatingAnimVal-&gt;wrappers().size() == m_animatedWrappers.size());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animValWillChange()
</span><span class="cx">     {
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animVal);
</del><span class="cx">         ASSERT(m_values.size() == m_wrappers.size());
</span><span class="cx">         synchronizeWrappersIfNeeded();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animValDidChange()
</span><span class="cx">     {
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animVal);
</del><span class="cx">         ASSERT(m_values.size() == m_wrappers.size());
</span><span class="cx">         synchronizeWrappersIfNeeded();
</span><span class="cx">     }
</span><span class="lines">@@ -173,8 +186,13 @@
</span><span class="cx">     ListWrapperCache m_wrappers;
</span><span class="cx">     ListWrapperCache m_animatedWrappers;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;SVGProperty&gt; m_baseVal;
-    RefPtr&lt;SVGProperty&gt; m_animVal;
</del><ins>+    // Cache the raw pointer but return a RefPtr&lt;&gt;. This will break the cyclic reference
+    // between SVGListPropertyTearOff and SVGAnimatedListPropertyTearOff once the property
+    // pointer is not needed.
+    ListProperty* m_baseVal { nullptr };
+    ListProperty* m_animVal { nullptr };
+
+    RefPtr&lt;ListProperty&gt; m_animatingAnimVal;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPathSegListPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -31,32 +31,36 @@
</span><span class="cx"> 
</span><span class="cx"> class SVGAnimatedPathSegListPropertyTearOff : public SVGAnimatedListPropertyTearOff&lt;SVGPathSegList&gt; {
</span><span class="cx"> public:
</span><del>-    virtual SVGListProperty&lt;SVGPathSegList&gt;* baseVal() override
</del><ins>+    virtual RefPtr&lt;ListProperty&gt; baseVal() override
</ins><span class="cx">     {
</span><del>-        if (!m_baseVal)
-            m_baseVal = SVGPathSegListPropertyTearOff::create(this, BaseValRole, PathSegUnalteredRole, m_values, m_wrappers);
-        return static_cast&lt;SVGListProperty&lt;SVGPathSegList&gt;*&gt;(m_baseVal.get());
</del><ins>+        if (m_baseVal)
+            return m_baseVal;
+
+        auto property = SVGPathSegListPropertyTearOff::create(this, BaseValRole, PathSegUnalteredRole, m_values, m_wrappers);
+        m_baseVal = property.ptr();
+        return WTFMove(property);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    virtual SVGListProperty&lt;SVGPathSegList&gt;* animVal() override
</del><ins>+    virtual RefPtr&lt;ListProperty&gt; animVal() override
</ins><span class="cx">     {
</span><del>-        if (!m_animVal)
-            m_animVal = SVGPathSegListPropertyTearOff::create(this, AnimValRole, PathSegUnalteredRole, m_values, m_wrappers);
-        return static_cast&lt;SVGListProperty&lt;SVGPathSegList&gt;*&gt;(m_animVal.get());
</del><ins>+        if (m_animVal)
+            return m_animVal;
+
+        auto property = SVGPathSegListPropertyTearOff::create(this, AnimValRole, PathSegUnalteredRole, m_values, m_wrappers);
+        m_animVal = property.ptr();
+        return WTFMove(property);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int findItem(const RefPtr&lt;SVGPathSeg&gt;&amp; segment) const
</del><ins>+    int findItem(const RefPtr&lt;SVGPathSeg&gt;&amp; segment)
</ins><span class="cx">     {
</span><span class="cx">         // This should ever be called for our baseVal, as animVal can't modify the list.
</span><del>-        ASSERT(m_baseVal);
-        return static_cast&lt;SVGPathSegListPropertyTearOff*&gt;(m_baseVal.get())-&gt;findItem(segment);
</del><ins>+        return static_cast&lt;SVGPathSegListPropertyTearOff*&gt;(baseVal().get())-&gt;findItem(segment);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
</span><span class="cx">     {
</span><span class="cx">         // This should ever be called for our baseVal, as animVal can't modify the list.
</span><del>-        ASSERT(m_baseVal);
-        static_cast&lt;SVGPathSegListPropertyTearOff*&gt;(m_baseVal.get())-&gt;removeItemFromList(itemIndex, shouldSynchronizeWrappers);
</del><ins>+        static_cast&lt;SVGPathSegListPropertyTearOff*&gt;(baseVal().get())-&gt;removeItemFromList(itemIndex, shouldSynchronizeWrappers);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static Ref&lt;SVGAnimatedPathSegListPropertyTearOff&gt; create(SVGElement* contextElement, const QualifiedName&amp; attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegList&amp; values)
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPropertyh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -48,22 +48,27 @@
</span><span class="cx">     virtual ~SVGAnimatedProperty();
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename OwnerType, typename TearOffType, typename PropertyType&gt;
</span><del>-    static TearOffType&amp; lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType&amp; property)
</del><ins>+    static Ref&lt;TearOffType&gt; lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType&amp; property)
</ins><span class="cx">     {
</span><span class="cx">         ASSERT(info);
</span><span class="cx">         SVGAnimatedPropertyDescription key(element, info-&gt;propertyIdentifier);
</span><del>-        auto&amp; slot = animatedPropertyCache()-&gt;add(key, nullptr).iterator-&gt;value;
-        if (!slot) {
-            Ref&lt;SVGAnimatedProperty&gt; wrapper = TearOffType::create(element, info-&gt;attributeName, info-&gt;animatedPropertyType, property);
-            if (info-&gt;animatedPropertyState == PropertyIsReadOnly)
-                wrapper-&gt;setIsReadOnly();
-            slot = &amp;wrapper.leakRef();
-        }
-        return static_cast&lt;TearOffType&amp;&gt;(*slot);
</del><ins>+
+        auto result = animatedPropertyCache()-&gt;add(key, nullptr);
+        if (!result.isNewEntry)
+            return static_cast&lt;TearOffType&amp;&gt;(*result.iterator-&gt;value);
+
+        Ref&lt;SVGAnimatedProperty&gt; wrapper = TearOffType::create(element, info-&gt;attributeName, info-&gt;animatedPropertyType, property);
+        if (info-&gt;animatedPropertyState == PropertyIsReadOnly)
+            wrapper-&gt;setIsReadOnly();
+
+        // Cache the raw pointer but return a Ref&lt;&gt;. This will break the cyclic reference
+        // between SVGAnimatedProperty and SVGElement once the property pointer is not needed.
+        result.iterator-&gt;value = wrapper.ptr();
+        return static_reference_cast&lt;TearOffType&gt;(wrapper);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename OwnerType, typename TearOffType&gt;
</span><del>-    static TearOffType* lookupWrapper(OwnerType* element, const SVGPropertyInfo* info)
</del><ins>+    static RefPtr&lt;TearOffType&gt; lookupWrapper(OwnerType* element, const SVGPropertyInfo* info)
</ins><span class="cx">     {
</span><span class="cx">         ASSERT(info);
</span><span class="cx">         SVGAnimatedPropertyDescription key(element, info-&gt;propertyIdentifier);
</span><span class="lines">@@ -71,7 +76,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename OwnerType, typename TearOffType&gt;
</span><del>-    static TearOffType* lookupWrapper(const OwnerType* element, const SVGPropertyInfo* info)
</del><ins>+    static RefPtr&lt;TearOffType&gt; lookupWrapper(const OwnerType* element, const SVGPropertyInfo* info)
</ins><span class="cx">     {
</span><span class="cx">         return lookupWrapper&lt;OwnerType, TearOffType&gt;(const_cast&lt;OwnerType*&gt;(element), info);
</span><span class="cx">     }
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPropertyMacrosh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx">     static const SVGPropertyInfo* LowerProperty##PropertyInfo(); \
</span><span class="cx">     PropertyType&amp; LowerProperty() const \
</span><span class="cx">     { \
</span><del>-        if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper&lt;UseOwnerType, TearOffType&gt;(this, LowerProperty##PropertyInfo())) { \
</del><ins>+        if (auto wrapper = SVGAnimatedProperty::lookupWrapper&lt;UseOwnerType, TearOffType&gt;(this, LowerProperty##PropertyInfo())) { \
</ins><span class="cx">             if (wrapper-&gt;isAnimating()) \
</span><span class="cx">                 return wrapper-&gt;currentAnimatedValue(); \
</span><span class="cx">         } \
</span><span class="lines">@@ -184,7 +184,7 @@
</span><span class="cx"> DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty, ) \
</span><span class="cx"> void detachAnimated##UpperProperty##ListWrappers(unsigned newListSize) \
</span><span class="cx"> { \
</span><del>-    if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper&lt;UseOwnerType, TearOffType&gt;(this, LowerProperty##PropertyInfo())) \
</del><ins>+    if (auto wrapper = SVGAnimatedProperty::lookupWrapper&lt;UseOwnerType, TearOffType&gt;(this, LowerProperty##PropertyInfo())) \
</ins><span class="cx">         wrapper-&gt;detachListWrappers(newListSize); \
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedTransformListPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -28,18 +28,24 @@
</span><span class="cx"> 
</span><span class="cx"> class SVGAnimatedTransformListPropertyTearOff : public SVGAnimatedListPropertyTearOff&lt;SVGTransformList&gt; {
</span><span class="cx"> public:
</span><del>-    virtual SVGListPropertyTearOff&lt;SVGTransformList&gt;* baseVal() override
</del><ins>+    virtual RefPtr&lt;ListProperty&gt; baseVal() override
</ins><span class="cx">     {
</span><del>-        if (!m_baseVal)
-            m_baseVal = SVGTransformListPropertyTearOff::create(this, BaseValRole, m_values, m_wrappers);
-        return static_cast&lt;SVGListPropertyTearOff&lt;SVGTransformList&gt;*&gt;(m_baseVal.get());
</del><ins>+        if (m_baseVal)
+            return m_baseVal;
+
+        auto property = SVGTransformListPropertyTearOff::create(this, BaseValRole, m_values, m_wrappers);
+        m_baseVal = property.ptr();
+        return WTF::move(property);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    virtual SVGListPropertyTearOff&lt;SVGTransformList&gt;* animVal() override
</del><ins>+    virtual RefPtr&lt;ListProperty&gt; animVal() override
</ins><span class="cx">     {
</span><del>-        if (!m_animVal)
-            m_animVal = SVGTransformListPropertyTearOff::create(this, AnimValRole, m_values, m_wrappers);
-        return static_cast&lt;SVGListPropertyTearOff&lt;SVGTransformList&gt;*&gt;(m_animVal.get());
</del><ins>+        if (m_animVal)
+            return m_animVal;
+
+        auto property = SVGTransformListPropertyTearOff::create(this, AnimValRole, m_values, m_wrappers);
+        m_animVal = property.ptr();
+        return WTF::move(property);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static Ref&lt;SVGAnimatedTransformListPropertyTearOff&gt; create(SVGElement* contextElement, const QualifiedName&amp; attributeName, AnimatedPropertyType animatedPropertyType, SVGTransformList&amp; values)
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGListPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGListPropertyTearOff.h (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGListPropertyTearOff.h        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGListPropertyTearOff.h        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -120,6 +120,12 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    virtual ~SVGListPropertyTearOff()
+    {
+        if (m_animatedProperty)
+            m_animatedProperty-&gt;propertyWillBeDeleted(*this);
+    }
+
</ins><span class="cx">     virtual bool isReadOnly() const override
</span><span class="cx">     {
</span><span class="cx">         if (m_role == AnimValRole)
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGPathSegListPropertyTearOffcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp (198245 => 198246)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp        2016-03-16 00:02:05 UTC (rev 198245)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp        2016-03-16 00:22:02 UTC (rev 198246)
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> bool SVGPathSegListPropertyTearOff::processIncomingListItemValue(const ListItemType&amp; newItem, unsigned* indexToModify)
</span><span class="cx"> {
</span><span class="cx">     SVGPathSegWithContext* newItemWithContext = static_cast&lt;SVGPathSegWithContext*&gt;(newItem.get());
</span><del>-    SVGAnimatedProperty* animatedPropertyOfItem = newItemWithContext-&gt;animatedProperty();
</del><ins>+    RefPtr&lt;SVGAnimatedProperty&gt; animatedPropertyOfItem = newItemWithContext-&gt;animatedProperty();
</ins><span class="cx"> 
</span><span class="cx">     // Alter the role, after calling animatedProperty(), as that may influence the returned animated property.
</span><span class="cx">     newItemWithContext-&gt;setContextAndRole(contextElement(), m_pathSegRole);
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx">     // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
</span><span class="cx">     // 'newItem' is already living in another list. If it's not our list, synchronize the other lists wrappers after the removal.
</span><span class="cx">     bool livesInOtherList = animatedPropertyOfItem != m_animatedProperty;
</span><del>-    SVGAnimatedPathSegListPropertyTearOff* propertyTearOff = static_cast&lt;SVGAnimatedPathSegListPropertyTearOff*&gt;(animatedPropertyOfItem);
</del><ins>+    RefPtr&lt;SVGAnimatedPathSegListPropertyTearOff&gt; propertyTearOff = static_pointer_cast&lt;SVGAnimatedPathSegListPropertyTearOff&gt;(animatedPropertyOfItem);
</ins><span class="cx">     int indexToRemove = propertyTearOff-&gt;findItem(newItem.get());
</span><span class="cx">     ASSERT(indexToRemove != -1);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>