<!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>[198505] branches/safari-601.1.46-branch/Source/WebCore</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/198505">198505</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2016-03-21 16:05:18 -0700 (Mon, 21 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/197967">r197967</a>. rdar://problem/25271137</pre>

<h3>Modified Paths</h3>
<ul>
<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="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedListPropertyTearOffh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPropertycpp">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPropertyh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPropertyTearOffh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedStaticPropertyTearOffh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoresvgpropertiesSVGPropertyTearOffh">branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGPropertyTearOff.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (198504 => 198505)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2016-03-21 22:57:43 UTC (rev 198504)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2016-03-21 23:05:18 UTC (rev 198505)
</span><span class="lines">@@ -1,3 +1,99 @@
</span><ins>+2016-03-21  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r197967. rdar://problem/25271137
+
+    2016-03-10  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+            REGRESSION: GuardMallloc crash in SVGListPropertyTearOff&lt;SVGPointList&gt;::processIncomingListItemWrapper
+            https://bugs.webkit.org/show_bug.cgi?id=154969
+
+            Reviewed by Darin Adler.
+
+            The life cycle of the SVGAnimatedPropertyTearOff::m_baseVal and m_animVal
+            was not correct. Like what was done in SVGAnimatedListPropertyTearOff,
+            m_baseVal and m_animVal have to be raw RefCounted pointers. When requested
+            through, SVGAnimatedPropertyTearOff::baseVal() and animVal() they are
+            encapsulated in a RefPtr to ensure they existence as long as they are
+            referenced. When the animated property object (which is stored in either
+            m_baseVal or m_animVal) is not referenced by anyone, it is going to be
+            deleted. In the destructor of their class, SVGAnimatedPropertyTearOff
+            will be notified of this deletion through propertyWillBeDeleted() to clean
+            its member m_baseVal or m_animVal.
+
+            * bindings/scripts/CodeGeneratorJS.pm:
+            (NativeToJSValue): Now all the SVG animated property return RefPtrs. In
+            addition to that, SVGViewSpec.transform also returns
+            RefPtr&lt;SVGTransformListPropertyTearOff&gt;.
+
+            * svg/properties/SVGAnimatedListPropertyTearOff.h:
+            (WebCore::SVGAnimatedListPropertyTearOff::animVal):
+            (WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue):
+            (WebCore::SVGAnimatedListPropertyTearOff::animationStarted):
+            (WebCore::SVGAnimatedListPropertyTearOff::animationEnded):
+            (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
+            (WebCore::SVGAnimatedListPropertyTearOff::isAnimating):
+            (WebCore::SVGAnimatedListPropertyTearOff::propertyWillBeDeleted):
+            Change propertyWillBeDeleted() to be virtual and make it takes an SVGProperty*.
+            Rename m_animatingAnimVal to be m_animatedProperty. Add isAnimating() which
+            returns true if m_animatedProperty is not null. Use isAnimating() instead of
+            m_isAnimating because it's deleted from the base class.
+
+            * svg/properties/SVGAnimatedProperty.cpp:
+            (WebCore::SVGAnimatedProperty::SVGAnimatedProperty):
+            (WebCore::SVGAnimatedProperty::~SVGAnimatedProperty):
+            * svg/properties/SVGAnimatedProperty.h:
+            (WebCore::SVGAnimatedProperty::isAnimating):
+            (WebCore::SVGAnimatedProperty::propertyWillBeDeleted):
+            Delete m_isAnimating since its value can be deduced from the value of
+            m_animatedProperty in the derived class. Add propertyWillBeDeleted() and
+            isAnimating() as virtual functions with the default behavior.
+
+            * svg/properties/SVGAnimatedPropertyTearOff.h:
+            (WebCore::SVGAnimatedPropertyTearOff::baseVal):
+            (WebCore::SVGAnimatedPropertyTearOff::animVal):
+            Like SVGAnimatedListPropertyTearOff::baseVal() and animVal() create the
+            value if it does not exist. Keep a raw RefCounted pointer but return a
+            RefPtr.
+
+            (WebCore::SVGAnimatedPropertyTearOff::isAnimating):
+            (WebCore::SVGAnimatedPropertyTearOff::propertyWillBeDeleted):
+            Override virtual functions.
+
+            (WebCore::SVGAnimatedPropertyTearOff::currentAnimatedValue):
+            (WebCore::SVGAnimatedPropertyTearOff::animationStarted):
+            (WebCore::SVGAnimatedPropertyTearOff::animationEnded):
+            (WebCore::SVGAnimatedPropertyTearOff::animValWillChange):
+            (WebCore::SVGAnimatedPropertyTearOff::animValDidChange):
+            Replace m_isAnimating with isAnimating(). Ensure that we get a new animated
+            property through animVal() and store it in a RefPtr to ensure it will not
+            go away while animating.
+
+            * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
+            (WebCore::SVGAnimatedStaticPropertyTearOff::isAnimating):
+            (WebCore::SVGAnimatedStaticPropertyTearOff::currentAnimatedValue):
+            (WebCore::SVGAnimatedStaticPropertyTearOff::animationStarted):
+            (WebCore::SVGAnimatedStaticPropertyTearOff::animationEnded):
+            (WebCore::SVGAnimatedStaticPropertyTearOff::animValWillChange):
+            (WebCore::SVGAnimatedStaticPropertyTearOff::animValDidChange):
+            Add isAnimating() and replace all the instances of m_isAnimating with calls
+            to isAnimating().
+
+            * svg/properties/SVGPropertyTearOff.h:
+            (WebCore::SVGPropertyTearOff::animatedProperty):
+            (WebCore::SVGPropertyTearOff::setAnimatedProperty):
+            (WebCore::SVGPropertyTearOff::contextElement):
+            (WebCore::SVGPropertyTearOff::SVGPropertyTearOff):
+            (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
+            SVGPropertyTearOff is what SVGAnimatedPropertyTearOff creates for its
+            baseVal() and animVal() values. These values can be null anytime once
+            they are not referenced. The SVGAnimatedPropertyTearOff holds only raw
+            RefCounted pointer for them. So (1) SVGPropertyTearOff needs to hold a
+            RefPtr for its SVGAnimatedProperty and (2) it needs to notify its
+            SVGAnimatedProperty when it's deleted by calling propertyWillBeDeleted()
+            from the destructor. Also there is no need to get the contextElement()
+            and save it in class member, m_contextElement since it can be always be
+            retrieved from SVGAnimatedProperty::contextElement().
+
</ins><span class="cx"> 2016-03-18  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r192285.
</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 (198504 => 198505)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-03-21 22:57:43 UTC (rev 198504)
+++ branches/safari-601.1.46-branch/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-03-21 23:05:18 UTC (rev 198505)
</span><span class="lines">@@ -4050,11 +4050,10 @@
</span><span class="cx">         return &quot;toJSNewlyCreated(exec, $globalObject, WTF::getPtr($value))&quot;;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    # $type has to be used here because SVGViewSpec.transform is of type SVGTransformList.
-    if ($codeGenerator-&gt;IsSVGTypeNeedingTearOff($type) and $type =~ /(?&lt;!String)List$/) {
</del><ins>+    if ($codeGenerator-&gt;IsSVGAnimatedType($interfaceName) or ($interfaceName eq &quot;SVGViewSpec&quot; and $type eq &quot;SVGTransformList&quot;)) {
</ins><span class="cx">         # Convert from abstract RefPtr&lt;ListProperty&gt; 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; . &quot;.get())&quot;;
</span><del>-    } elsif ($codeGenerator-&gt;IsSVGAnimatedType($interfaceName) or $interfaceName eq &quot;SVGViewSpec&quot;) {
</del><ins>+    } elsif ($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="branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedListPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h (198504 => 198505)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h        2016-03-21 22:57:43 UTC (rev 198504)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h        2016-03-21 23:05:18 UTC (rev 198505)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
</span><ins>+ * Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -58,8 +59,10 @@
</span><span class="cx">         m_animVal = property.ptr();
</span><span class="cx">         return WTF::move(property);
</span><span class="cx">     }
</span><del>-
-    void propertyWillBeDeleted(const ListProperty&amp; property)
</del><ins>+    
+    bool isAnimating() const override { return m_animatedProperty; }
+    bool isAnimatedListTearOff() const override { return true; }
+    void propertyWillBeDeleted(const SVGProperty&amp; property) override
</ins><span class="cx">     {
</span><span class="cx">         if (&amp;property == m_baseVal)
</span><span class="cx">             m_baseVal = nullptr;
</span><span class="lines">@@ -67,8 +70,6 @@
</span><span class="cx">             m_animVal = nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    virtual bool isAnimatedListTearOff() const override { return true; }
-
</del><span class="cx">     int findItem(SVGProperty* property)
</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="lines">@@ -91,9 +92,8 @@
</span><span class="cx"> 
</span><span class="cx">     PropertyType&amp; currentAnimatedValue()
</span><span class="cx">     {
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animatingAnimVal);
-        return static_pointer_cast&lt;ListProperty&gt;(m_animatingAnimVal)-&gt;values();
</del><ins>+        ASSERT(isAnimating());
+        return m_animatedProperty-&gt;values();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     const PropertyType&amp; currentBaseValue() const
</span><span class="lines">@@ -103,8 +103,7 @@
</span><span class="cx"> 
</span><span class="cx">     void animationStarted(PropertyType* newAnimVal, bool shouldOwnValues = false)
</span><span class="cx">     {
</span><del>-        ASSERT(!m_isAnimating);
-        ASSERT(!m_animatingAnimVal);
</del><ins>+        ASSERT(!isAnimating());
</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">@@ -113,45 +112,41 @@
</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>-        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());
-        m_isAnimating = true;
</del><ins>+        m_animatedProperty = animVal();
+        m_animatedProperty-&gt;setValuesAndWrappers(newAnimVal, &amp;m_animatedWrappers, shouldOwnValues);
+        ASSERT(m_animatedProperty-&gt;values().size() == m_animatedProperty-&gt;wrappers().size());
+        ASSERT(m_animatedProperty-&gt;wrappers().size() == m_animatedWrappers.size());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animationEnded()
</span><span class="cx">     {
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animatingAnimVal);
</del><ins>+        ASSERT(isAnimating());
</ins><span class="cx">         ASSERT(m_values.size() == m_wrappers.size());
</span><span class="cx"> 
</span><del>-        ASSERT(m_animatingAnimVal-&gt;values().size() == m_animatingAnimVal-&gt;wrappers().size());
-        ASSERT(m_animatingAnimVal-&gt;wrappers().size() == m_animatedWrappers.size());
</del><ins>+        ASSERT(m_animatedProperty-&gt;values().size() == m_animatedProperty-&gt;wrappers().size());
+        ASSERT(m_animatedProperty-&gt;wrappers().size() == m_animatedWrappers.size());
</ins><span class="cx"> 
</span><del>-        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());
</del><ins>+        m_animatedProperty-&gt;setValuesAndWrappers(&amp;m_values, &amp;m_wrappers, false);
+        ASSERT(m_animatedProperty-&gt;values().size() == m_animatedProperty-&gt;wrappers().size());
+        ASSERT(m_animatedProperty-&gt;wrappers().size() == m_wrappers.size());
</ins><span class="cx"> 
</span><span class="cx">         m_animatedWrappers.clear();
</span><del>-        m_animatingAnimVal = nullptr;
-        m_isAnimating = false;
</del><ins>+        m_animatedProperty = nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void synchronizeWrappersIfNeeded()
</span><span class="cx">     {
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animatingAnimVal);
</del><ins>+        ASSERT(isAnimating());
</ins><span class="cx"> 
</span><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>-        m_animatingAnimVal-&gt;detachListWrappers(m_animatingAnimVal-&gt;values().size());
</del><ins>+        m_animatedProperty-&gt;detachListWrappers(m_animatedProperty-&gt;values().size());
</ins><span class="cx"> 
</span><del>-        ASSERT(m_animatingAnimVal-&gt;values().size() == m_animatingAnimVal-&gt;wrappers().size());
-        ASSERT(m_animatingAnimVal-&gt;wrappers().size() == m_animatedWrappers.size());
</del><ins>+        ASSERT(m_animatedProperty-&gt;values().size() == m_animatedProperty-&gt;wrappers().size());
+        ASSERT(m_animatedProperty-&gt;wrappers().size() == m_animatedWrappers.size());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animValWillChange()
</span><span class="lines">@@ -192,7 +187,7 @@
</span><span class="cx">     ListProperty* m_baseVal { nullptr };
</span><span class="cx">     ListProperty* m_animVal { nullptr };
</span><span class="cx"> 
</span><del>-    RefPtr&lt;ListProperty&gt; m_animatingAnimVal;
</del><ins>+    RefPtr&lt;ListProperty&gt; m_animatedProperty;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPropertycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp (198504 => 198505)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp        2016-03-21 22:57:43 UTC (rev 198504)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp        2016-03-21 23:05:18 UTC (rev 198505)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
</span><span class="cx">  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
</span><ins>+ * Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -29,7 +30,6 @@
</span><span class="cx">     : m_contextElement(contextElement)
</span><span class="cx">     , m_attributeName(attributeName)
</span><span class="cx">     , m_animatedPropertyType(animatedPropertyType)
</span><del>-    , m_isAnimating(false)
</del><span class="cx">     , m_isReadOnly(false)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Assure that animationEnded() was called, if animationStarted() was called before.
</span><del>-    ASSERT(!m_isAnimating);
</del><ins>+    ASSERT(!isAnimating());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGAnimatedProperty::commitChange()
</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 (198504 => 198505)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.h        2016-03-21 22:57:43 UTC (rev 198504)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedProperty.h        2016-03-21 23:05:18 UTC (rev 198505)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
</span><span class="cx">  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
</span><ins>+ * Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -28,19 +29,21 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class SVGElement;
</span><ins>+class SVGProperty;
</ins><span class="cx"> 
</span><span class="cx"> class SVGAnimatedProperty : public RefCounted&lt;SVGAnimatedProperty&gt; {
</span><span class="cx"> public:
</span><span class="cx">     SVGElement* contextElement() const { return m_contextElement.get(); }
</span><span class="cx">     const QualifiedName&amp; attributeName() const { return m_attributeName; }
</span><span class="cx">     AnimatedPropertyType animatedPropertyType() const { return m_animatedPropertyType; }
</span><del>-    bool isAnimating() const { return m_isAnimating; }
</del><span class="cx">     bool isReadOnly() const { return m_isReadOnly; }
</span><span class="cx">     void setIsReadOnly() { m_isReadOnly = true; }
</span><span class="cx"> 
</span><span class="cx">     void commitChange();
</span><span class="cx"> 
</span><ins>+    virtual bool isAnimating() const { return false; }
</ins><span class="cx">     virtual bool isAnimatedListTearOff() const { return false; }
</span><ins>+    virtual void propertyWillBeDeleted(const SVGProperty&amp;) { }
</ins><span class="cx"> 
</span><span class="cx">     // Caching facilities.
</span><span class="cx">     typedef HashMap&lt;SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits&gt; Cache;
</span><span class="lines">@@ -92,7 +95,6 @@
</span><span class="cx">     AnimatedPropertyType m_animatedPropertyType;
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    bool m_isAnimating;
</del><span class="cx">     bool m_isReadOnly;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h (198504 => 198505)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h        2016-03-21 22:57:43 UTC (rev 198504)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h        2016-03-21 23:05:18 UTC (rev 198505)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
</span><ins>+ * Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -31,30 +32,34 @@
</span><span class="cx">     typedef SVGPropertyTearOff&lt;PropertyType&gt; PropertyTearOff;
</span><span class="cx">     typedef PropertyType ContentType;
</span><span class="cx"> 
</span><del>-    virtual ~SVGAnimatedPropertyTearOff()
</del><ins>+    RefPtr&lt;PropertyTearOff&gt; baseVal()
</ins><span class="cx">     {
</span><del>-        if (m_baseVal) {
-            ASSERT(m_baseVal-&gt;animatedProperty() == this);
-            m_baseVal-&gt;setAnimatedProperty(nullptr);
-        }
-        if (m_animVal) {
-            ASSERT(m_animVal-&gt;animatedProperty() == this);
-            m_animVal-&gt;setAnimatedProperty(nullptr);
-        }
</del><ins>+        if (m_baseVal)
+            return m_baseVal;
+
+        auto property = PropertyTearOff::create(this, BaseValRole, m_property);
+        m_baseVal = property.ptr();
+        return WTF::move(property);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    PropertyTearOff* baseVal()
</del><ins>+    RefPtr&lt;PropertyTearOff&gt; animVal()
</ins><span class="cx">     {
</span><del>-        if (!m_baseVal)
-            m_baseVal = PropertyTearOff::create(this, BaseValRole, m_property);
-        return m_baseVal.get();
</del><ins>+        if (m_animVal)
+            return m_animVal;
+
+        auto property = PropertyTearOff::create(this, AnimValRole, m_property);
+        m_animVal = property.ptr();
+        return WTF::move(property);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    PropertyTearOff* animVal()
</del><ins>+    bool isAnimating() const override { return m_animatedProperty; }
+
+    void propertyWillBeDeleted(const SVGProperty&amp; property) override
</ins><span class="cx">     {
</span><del>-        if (!m_animVal)
-            m_animVal = PropertyTearOff::create(this, AnimValRole, m_property);
-        return m_animVal.get();
</del><ins>+        if (&amp;property == m_baseVal)
+            m_baseVal = nullptr;
+        else if (&amp;property == m_animVal)
+            m_animVal = nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static Ref&lt;SVGAnimatedPropertyTearOff&lt;PropertyType&gt;&gt; create(SVGElement* contextElement, const QualifiedName&amp; attributeName, AnimatedPropertyType animatedPropertyType, PropertyType&amp; property)
</span><span class="lines">@@ -65,9 +70,8 @@
</span><span class="cx"> 
</span><span class="cx">     PropertyType&amp; currentAnimatedValue()
</span><span class="cx">     {
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animVal);
-        return m_animVal-&gt;propertyReference();
</del><ins>+        ASSERT(isAnimating());
+        return m_animatedProperty-&gt;propertyReference();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     const PropertyType&amp; currentBaseValue() const
</span><span class="lines">@@ -77,32 +81,29 @@
</span><span class="cx"> 
</span><span class="cx">     void animationStarted(PropertyType* newAnimVal)
</span><span class="cx">     {
</span><del>-        ASSERT(!m_isAnimating);
</del><ins>+        ASSERT(!isAnimating());
</ins><span class="cx">         ASSERT(newAnimVal);
</span><del>-        animVal()-&gt;setValue(*newAnimVal);
-        m_isAnimating = true;
</del><ins>+        m_animatedProperty = animVal();
+        m_animatedProperty-&gt;setValue(*newAnimVal);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animationEnded()
</span><span class="cx">     {
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animVal);
-        m_animVal-&gt;setValue(m_property);
-        m_isAnimating = false;
</del><ins>+        ASSERT(isAnimating());
+        m_animatedProperty-&gt;setValue(m_property);
+        m_animatedProperty = nullptr;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animValWillChange()
</span><span class="cx">     {
</span><span class="cx">         // no-op for non list types.
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animVal);
</del><ins>+        ASSERT(isAnimating());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animValDidChange()
</span><span class="cx">     {
</span><span class="cx">         // no-op for non list types.
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animVal);
</del><ins>+        ASSERT(isAnimating());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -113,8 +114,10 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     PropertyType&amp; m_property;
</span><del>-    RefPtr&lt;PropertyTearOff&gt; m_baseVal;
-    RefPtr&lt;PropertyTearOff&gt; m_animVal;
</del><ins>+    PropertyTearOff* m_baseVal { nullptr };
+    PropertyTearOff* m_animVal { nullptr };
+
+    RefPtr&lt;PropertyTearOff&gt; m_animatedProperty;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGAnimatedStaticPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h (198504 => 198505)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h        2016-03-21 22:57:43 UTC (rev 198504)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h        2016-03-21 23:05:18 UTC (rev 198505)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
</span><ins>+ * Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -48,6 +49,8 @@
</span><span class="cx">         commitChange();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    bool isAnimating() const override { return m_animatedProperty; }
+
</ins><span class="cx">     static Ref&lt;SVGAnimatedStaticPropertyTearOff&lt;PropertyType&gt;&gt; create(SVGElement* contextElement, const QualifiedName&amp; attributeName, AnimatedPropertyType animatedPropertyType, PropertyType&amp; property)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(contextElement);
</span><span class="lines">@@ -56,8 +59,7 @@
</span><span class="cx"> 
</span><span class="cx">     PropertyType&amp; currentAnimatedValue()
</span><span class="cx">     {
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animatedProperty);
</del><ins>+        ASSERT(isAnimating());
</ins><span class="cx">         return *m_animatedProperty;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -68,33 +70,27 @@
</span><span class="cx"> 
</span><span class="cx">     void animationStarted(PropertyType* newAnimVal)
</span><span class="cx">     {
</span><del>-        ASSERT(!m_isAnimating);
-        ASSERT(!m_animatedProperty);
</del><ins>+        ASSERT(!isAnimating());
</ins><span class="cx">         ASSERT(newAnimVal);
</span><span class="cx">         m_animatedProperty = newAnimVal;
</span><del>-        m_isAnimating = true;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animationEnded()
</span><span class="cx">     {
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animatedProperty);
</del><ins>+        ASSERT(isAnimating());
</ins><span class="cx">         m_animatedProperty = nullptr;
</span><del>-        m_isAnimating = false;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animValWillChange()
</span><span class="cx">     {
</span><span class="cx">         // no-op for non list types.
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animatedProperty);
</del><ins>+        ASSERT(isAnimating());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void animValDidChange()
</span><span class="cx">     {
</span><span class="cx">         // no-op for non list types.
</span><del>-        ASSERT(m_isAnimating);
-        ASSERT(m_animatedProperty);
</del><ins>+        ASSERT(isAnimating());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoresvgpropertiesSVGPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGPropertyTearOff.h (198504 => 198505)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGPropertyTearOff.h        2016-03-21 22:57:43 UTC (rev 198504)
+++ branches/safari-601.1.46-branch/Source/WebCore/svg/properties/SVGPropertyTearOff.h        2016-03-21 23:05:18 UTC (rev 198505)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
</span><ins>+ * Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -57,7 +58,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual PropertyType&amp; propertyReference() { return *m_value; }
</span><del>-    SVGAnimatedProperty* animatedProperty() const { return m_animatedProperty; }
</del><ins>+    SVGAnimatedProperty* animatedProperty() const { return m_animatedProperty.get(); }
</ins><span class="cx"> 
</span><span class="cx">     virtual void setValue(PropertyType&amp; value)
</span><span class="cx">     {
</span><span class="lines">@@ -72,16 +73,13 @@
</span><span class="cx">     void setAnimatedProperty(SVGAnimatedProperty* animatedProperty)
</span><span class="cx">     {
</span><span class="cx">         m_animatedProperty = animatedProperty;
</span><del>-
-        if (m_animatedProperty)
-            m_contextElement = m_animatedProperty-&gt;contextElement();
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     SVGElement* contextElement() const
</span><span class="cx">     {
</span><span class="cx">         if (!m_animatedProperty || m_valueIsCopy)
</span><del>-            return 0;
-        return m_contextElement.get();
</del><ins>+            return nullptr;
+        return m_animatedProperty-&gt;contextElement();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void addChild(WeakPtr&lt;SVGPropertyTearOffBase&gt; child)
</span><span class="lines">@@ -131,11 +129,6 @@
</span><span class="cx">         , m_value(&amp;value)
</span><span class="cx">         , m_valueIsCopy(false)
</span><span class="cx">     {
</span><del>-        // Using operator &amp; is completely fine, as SVGAnimatedProperty owns this reference,
-        // and we're guaranteed to live as long as SVGAnimatedProperty does.
-
-        if (m_animatedProperty)
-            m_contextElement = m_animatedProperty-&gt;contextElement();
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     SVGPropertyTearOff(const PropertyType&amp; initialValue)
</span><span class="lines">@@ -157,6 +150,9 @@
</span><span class="cx">             detachChildren();
</span><span class="cx">             delete m_value;
</span><span class="cx">         }
</span><ins>+
+        if (m_animatedProperty)
+            m_animatedProperty-&gt;propertyWillBeDeleted(*this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void detachChildren()
</span><span class="lines">@@ -168,8 +164,7 @@
</span><span class="cx">         m_childTearOffs.clear();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;SVGElement&gt; m_contextElement;
-    SVGAnimatedProperty* m_animatedProperty;
</del><ins>+    RefPtr&lt;SVGAnimatedProperty&gt; m_animatedProperty;
</ins><span class="cx">     SVGPropertyRole m_role;
</span><span class="cx">     PropertyType* m_value;
</span><span class="cx">     Vector&lt;WeakPtr&lt;SVGPropertyTearOffBase&gt;&gt; m_childTearOffs;
</span></span></pre>
</div>
</div>

</body>
</html>