<!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>[243259] trunk/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/243259">243259</a></dd>
<dt>Author</dt> <dd>said@apple.com</dd>
<dt>Date</dt> <dd>2019-03-20 16:51:47 -0700 (Wed, 20 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove the SVG tear off objects for SVGColorAnimator
https://bugs.webkit.org/show_bug.cgi?id=196025

Reviewed by Simon Fraser.

SVG attributes like "fill" and "stroke" do not have reflecting properties
in SVGElement but they are animatable by SMIL. Animating such attributes
is different from animating the SVG animated properties. These new classes
will be added to handle the first type of this kind of attribute: the Color:

-- SVGPropertyAnimatorCreator is added to SVGElement. It is responsible 
   for creating SVGPropertyAnimators for the attribute which do not have
   reflecting animated properties stored by SVGElement. It will maintain
   a HashMap for the animated values for these attributes which is indexed
   by the attribute name. The animated values has to be RefCounted because
   the same attribute can be animated by multiple animators. So the values
   of this HashMap will be of type Ref<SVGProperty>, e.g.
    <circle cx="80" cy="120" r="35">
        <animate attributeName="fill" values="#080" begin="2s" />
        <animate attributeName="fill" values="#602;#004" begin="4s" dur="5s"/>
    </circle>

-- SVGPropertyAnimator is the a new type which animates an attribute with
   no reflecting animated property.

-- SVGPrimitivePropertyAnimator is a template class which is responsible
   for animating attributes with primitive types, e.g. Color, string and 
   float. It is derived form SVGPropertyAnimator and it is initialized 
   with a Ref<SVGValueProperty<PropertyType>> which is created and maintained
   by SVGPropertyAnimatorFactory.

-- SVGAnimationColorFunction is the animation function that animates the
   attributes whose type are Color. Note the conversion form String to 
   Color in this class has to handle the case when its value is "attributeName="
   e.g. <animate attributeName="fill" from="attributeName="r"/>

-- SVGColorAnimator will be defined to be
   SVGPrimitivePropertyAnimator<Color, SVGAnimationColorFunction>.

The life cycle of the RefCounted properties can be explained as follows:

-- SVGPropertyAnimatorFactory checks whether its HashMap has an entry
   for the given attribute name. If it does not have, it will create a
   new value through the value creation method for this attribute.

-- SVGPropertyAnimatorFactory passes the shared animated value to the
   animator creation method. So multiple animators will be accessing the
   same value through their RefCounted pointers.

-- When the animator is about to be deleted, it will notify the target
   SVGElement which will notify its SVGPropertyAnimatorFactory.
   SVGPropertyAnimatorFactory will check its HashMap and retrieves the
   entry for the given attribute name. If the refCount is 2, it is going
   to remove the entry form the HashMap.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* svg/SVGAnimateColorElement.cpp:
(WebCore::attributeValueIsCurrentColor): Deleted.
(WebCore::SVGAnimateColorElement::determinePropertyValueTypes): Deleted.
* svg/SVGAnimateColorElement.h:
* svg/SVGAnimateElementBase.cpp:
(WebCore::SVGAnimateElementBase::attributeAnimationController):
* svg/SVGAnimatedColor.cpp: Removed.
* svg/SVGAnimatedColor.h: Removed.
* svg/SVGAnimatorFactory.h:
(WebCore::SVGAnimatorFactory::create):
* svg/SVGAttributeAnimationController.cpp:
(WebCore::SVGAttributeAnimationController::~SVGAttributeAnimationController):
* svg/SVGAttributeAnimationController.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::SVGElement):
(WebCore::SVGElement::isAnimatedAttribute const):
(WebCore::SVGElement::createAnimator):
(WebCore::SVGElement::animatorWillBeDeleted):
* svg/SVGElement.h:
(WebCore::SVGElement::propertyAnimatorFactory):
* svg/SVGFitToViewBox.h:
* svg/SVGMPathElement.cpp:
* svg/graphics/filters/SVGFEImage.h:
* svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp: Added.
(WebCore::SVGAnimationColorFunction::colorFromString):
* svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
(WebCore::SVGAnimationColorFunction::progress):
* svg/properties/SVGAnimationFunction.h:
* svg/properties/SVGAttributeAnimator.cpp:
(WebCore::SVGAttributeAnimator::applyAnimatedStylePropertyChange):
(WebCore::SVGAttributeAnimator::removeAnimatedStyleProperty):
* svg/properties/SVGAttributeAnimator.h:
* svg/properties/SVGPrimitivePropertyAnimator.h: Added.
(WebCore::SVGPrimitivePropertyAnimator::create):
(WebCore::SVGPrimitivePropertyAnimator::SVGPrimitivePropertyAnimator):
* svg/properties/SVGPrimitivePropertyAnimatorImpl.h: Added.
* svg/properties/SVGPropertyAnimator.h: Added.
(WebCore::SVGPropertyAnimator::SVGPropertyAnimator):
(WebCore::SVGPropertyAnimator::adjustForInheritance const):
(WebCore::SVGPropertyAnimator::computeCSSPropertyValue const):
(WebCore::SVGPropertyAnimator::computeInheritedCSSPropertyValue const):
* svg/properties/SVGPropertyAnimatorFactory.h: Added.
(WebCore::SVGPropertyAnimatorFactory::isKnownAttribute):
(WebCore::SVGPropertyAnimatorFactory::createAnimator):
(WebCore::SVGPropertyAnimatorFactory::animatorWillBeDeleted):
(WebCore::SVGPropertyAnimatorFactory::createColorAnimator):
(WebCore::SVGPropertyAnimatorFactory::attributeAnimatorCreator):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAnimateColorElementcpp">trunk/Source/WebCore/svg/SVGAnimateColorElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAnimateColorElementh">trunk/Source/WebCore/svg/SVGAnimateColorElement.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAnimateElementBasecpp">trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAnimatorFactoryh">trunk/Source/WebCore/svg/SVGAnimatorFactory.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAttributeAnimationControllercpp">trunk/Source/WebCore/svg/SVGAttributeAnimationController.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAttributeAnimationControllerh">trunk/Source/WebCore/svg/SVGAttributeAnimationController.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGElementcpp">trunk/Source/WebCore/svg/SVGElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGElementh">trunk/Source/WebCore/svg/SVGElement.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGFitToViewBoxh">trunk/Source/WebCore/svg/SVGFitToViewBox.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGMPathElementcpp">trunk/Source/WebCore/svg/SVGMPathElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsfiltersSVGFEImageh">trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.h</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGAnimationAdditiveValueFunctionImplh">trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGAnimationFunctionh">trunk/Source/WebCore/svg/properties/SVGAnimationFunction.h</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGAttributeAnimatorcpp">trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGAttributeAnimatorh">trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGAnimationAdditiveValueFunctionImplcpp">trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGPrimitivePropertyAnimatorh">trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGPrimitivePropertyAnimatorImplh">trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimatorImpl.h</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGPropertyAnimatorh">trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGPropertyAnimatorFactoryh">trunk/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoresvgSVGAnimatedColorcpp">trunk/Source/WebCore/svg/SVGAnimatedColor.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAnimatedColorh">trunk/Source/WebCore/svg/SVGAnimatedColor.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/ChangeLog      2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -1,3 +1,110 @@
</span><ins>+2019-03-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Remove the SVG tear off objects for SVGColorAnimator
+        https://bugs.webkit.org/show_bug.cgi?id=196025
+
+        Reviewed by Simon Fraser.
+
+        SVG attributes like "fill" and "stroke" do not have reflecting properties
+        in SVGElement but they are animatable by SMIL. Animating such attributes
+        is different from animating the SVG animated properties. These new classes
+        will be added to handle the first type of this kind of attribute: the Color:
+
+        -- SVGPropertyAnimatorCreator is added to SVGElement. It is responsible 
+           for creating SVGPropertyAnimators for the attribute which do not have
+           reflecting animated properties stored by SVGElement. It will maintain
+           a HashMap for the animated values for these attributes which is indexed
+           by the attribute name. The animated values has to be RefCounted because
+           the same attribute can be animated by multiple animators. So the values
+           of this HashMap will be of type Ref<SVGProperty>, e.g.
+            <circle cx="80" cy="120" r="35">
+                <animate attributeName="fill" values="#080" begin="2s" />
+                <animate attributeName="fill" values="#602;#004" begin="4s" dur="5s"/>
+            </circle>
+
+        -- SVGPropertyAnimator is the a new type which animates an attribute with
+           no reflecting animated property.
+
+        -- SVGPrimitivePropertyAnimator is a template class which is responsible
+           for animating attributes with primitive types, e.g. Color, string and 
+           float. It is derived form SVGPropertyAnimator and it is initialized 
+           with a Ref<SVGValueProperty<PropertyType>> which is created and maintained
+           by SVGPropertyAnimatorFactory.
+
+        -- SVGAnimationColorFunction is the animation function that animates the
+           attributes whose type are Color. Note the conversion form String to 
+           Color in this class has to handle the case when its value is "attributeName="
+           e.g. <animate attributeName="fill" from="attributeName="r"/>
+
+        -- SVGColorAnimator will be defined to be
+           SVGPrimitivePropertyAnimator<Color, SVGAnimationColorFunction>.
+
+        The life cycle of the RefCounted properties can be explained as follows:
+
+        -- SVGPropertyAnimatorFactory checks whether its HashMap has an entry
+           for the given attribute name. If it does not have, it will create a
+           new value through the value creation method for this attribute.
+
+        -- SVGPropertyAnimatorFactory passes the shared animated value to the
+           animator creation method. So multiple animators will be accessing the
+           same value through their RefCounted pointers.
+
+        -- When the animator is about to be deleted, it will notify the target
+           SVGElement which will notify its SVGPropertyAnimatorFactory.
+           SVGPropertyAnimatorFactory will check its HashMap and retrieves the
+           entry for the given attribute name. If the refCount is 2, it is going
+           to remove the entry form the HashMap.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * svg/SVGAnimateColorElement.cpp:
+        (WebCore::attributeValueIsCurrentColor): Deleted.
+        (WebCore::SVGAnimateColorElement::determinePropertyValueTypes): Deleted.
+        * svg/SVGAnimateColorElement.h:
+        * svg/SVGAnimateElementBase.cpp:
+        (WebCore::SVGAnimateElementBase::attributeAnimationController):
+        * svg/SVGAnimatedColor.cpp: Removed.
+        * svg/SVGAnimatedColor.h: Removed.
+        * svg/SVGAnimatorFactory.h:
+        (WebCore::SVGAnimatorFactory::create):
+        * svg/SVGAttributeAnimationController.cpp:
+        (WebCore::SVGAttributeAnimationController::~SVGAttributeAnimationController):
+        * svg/SVGAttributeAnimationController.h:
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::SVGElement):
+        (WebCore::SVGElement::isAnimatedAttribute const):
+        (WebCore::SVGElement::createAnimator):
+        (WebCore::SVGElement::animatorWillBeDeleted):
+        * svg/SVGElement.h:
+        (WebCore::SVGElement::propertyAnimatorFactory):
+        * svg/SVGFitToViewBox.h:
+        * svg/SVGMPathElement.cpp:
+        * svg/graphics/filters/SVGFEImage.h:
+        * svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp: Added.
+        (WebCore::SVGAnimationColorFunction::colorFromString):
+        * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
+        (WebCore::SVGAnimationColorFunction::progress):
+        * svg/properties/SVGAnimationFunction.h:
+        * svg/properties/SVGAttributeAnimator.cpp:
+        (WebCore::SVGAttributeAnimator::applyAnimatedStylePropertyChange):
+        (WebCore::SVGAttributeAnimator::removeAnimatedStyleProperty):
+        * svg/properties/SVGAttributeAnimator.h:
+        * svg/properties/SVGPrimitivePropertyAnimator.h: Added.
+        (WebCore::SVGPrimitivePropertyAnimator::create):
+        (WebCore::SVGPrimitivePropertyAnimator::SVGPrimitivePropertyAnimator):
+        * svg/properties/SVGPrimitivePropertyAnimatorImpl.h: Added.
+        * svg/properties/SVGPropertyAnimator.h: Added.
+        (WebCore::SVGPropertyAnimator::SVGPropertyAnimator):
+        (WebCore::SVGPropertyAnimator::adjustForInheritance const):
+        (WebCore::SVGPropertyAnimator::computeCSSPropertyValue const):
+        (WebCore::SVGPropertyAnimator::computeInheritedCSSPropertyValue const):
+        * svg/properties/SVGPropertyAnimatorFactory.h: Added.
+        (WebCore::SVGPropertyAnimatorFactory::isKnownAttribute):
+        (WebCore::SVGPropertyAnimatorFactory::createAnimator):
+        (WebCore::SVGPropertyAnimatorFactory::animatorWillBeDeleted):
+        (WebCore::SVGPropertyAnimatorFactory::createColorAnimator):
+        (WebCore::SVGPropertyAnimatorFactory::attributeAnimatorCreator):
+
</ins><span class="cx"> 2019-03-20  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Use WeakPtr instead of storing raw pointers in WebSocket code
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/Sources.txt    2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -2270,7 +2270,6 @@
</span><span class="cx"> svg/SVGAnimateMotionElement.cpp
</span><span class="cx"> svg/SVGAnimateTransformElement.cpp
</span><span class="cx"> svg/SVGAnimatedAngle.cpp
</span><del>-svg/SVGAnimatedColor.cpp
</del><span class="cx"> svg/SVGAnimatedEnumeration.cpp
</span><span class="cx"> svg/SVGAnimatedLength.cpp
</span><span class="cx"> svg/SVGAnimatedLengthList.cpp
</span><span class="lines">@@ -2422,6 +2421,7 @@
</span><span class="cx"> 
</span><span class="cx"> svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp
</span><span class="cx"> svg/properties/SVGAnimatedProperty.cpp
</span><ins>+svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp
</ins><span class="cx"> svg/properties/SVGAttributeAnimator.cpp
</span><span class="cx"> svg/properties/SVGAttributeOwnerProxy.cpp
</span><span class="cx"> svg/properties/SVGLegacyAnimatedProperty.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -1223,7 +1223,6 @@
</span><span class="cx">          439D334313A6911C00C20F4F /* SVGAnimatedType.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334013A6911C00C20F4F /* SVGAnimatedType.h */; };
</span><span class="cx">          439D334413A6911C00C20F4F /* SVGAnimatedTypeAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */; };
</span><span class="cx">          439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */; };
</span><del>-               43A625F813B3304000AC94B8 /* SVGAnimatedColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 43A625F613B3304000AC94B8 /* SVGAnimatedColor.h */; };
</del><span class="cx">           43B85ED418CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43B85ED218CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp */; };
</span><span class="cx">          43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B9336713B261B1004584BF /* SVGAnimatedPointList.h */; };
</span><span class="cx">          43C092BC12D9E4EE00A989C3 /* RenderSVGForeignObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C092BA12D9E4EE00A989C3 /* RenderSVGForeignObject.h */; };
</span><span class="lines">@@ -7671,8 +7670,6 @@
</span><span class="cx">          439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedTypeAnimator.h; sourceTree = "<group>"; };
</span><span class="cx">          439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatorFactory.h; sourceTree = "<group>"; };
</span><span class="cx">          43A0F0B013AC7D6D00A5F0A7 /* SVGAnimatedNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumber.cpp; sourceTree = "<group>"; };
</span><del>-               43A625F613B3304000AC94B8 /* SVGAnimatedColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedColor.h; sourceTree = "<group>"; };
-               43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedColor.cpp; sourceTree = "<group>"; };
</del><span class="cx">           43A6266613B3D11000AC94B8 /* SVGAnimatedString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedString.cpp; sourceTree = "<group>"; };
</span><span class="cx">          43B85ED018CBEACE00E31AF4 /* makeSelectorPseudoClassAndCompatibilityElementMap.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = makeSelectorPseudoClassAndCompatibilityElementMap.py; sourceTree = "<group>"; };
</span><span class="cx">          43B85ED218CBEC5200E31AF4 /* SelectorPseudoClassAndCompatibilityElementMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SelectorPseudoClassAndCompatibilityElementMap.cpp; path = DerivedSources/WebCore/SelectorPseudoClassAndCompatibilityElementMap.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="lines">@@ -9527,6 +9524,11 @@
</span><span class="cx">          724ED3301A3A8B2300F5F13C /* JSEXTBlendMinMax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEXTBlendMinMax.h; sourceTree = "<group>"; };
</span><span class="cx">          724EE54E1DC7F25B00A91FFB /* ActivityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActivityState.h; sourceTree = "<group>"; };
</span><span class="cx">          724EE54F1DC7F25B00A91FFB /* ActivityStateChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActivityStateChangeObserver.h; sourceTree = "<group>"; };
</span><ins>+               7266F0132241BCE200833975 /* SVGPropertyAnimatorFactory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPropertyAnimatorFactory.h; sourceTree = "<group>"; };
+               7266F0142241BFB200833975 /* SVGPrimitivePropertyAnimatorImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPrimitivePropertyAnimatorImpl.h; sourceTree = "<group>"; };
+               7266F0152241C09800833975 /* SVGPrimitivePropertyAnimator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPrimitivePropertyAnimator.h; sourceTree = "<group>"; };
+               7266F0162241C0FE00833975 /* SVGPropertyAnimator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPropertyAnimator.h; sourceTree = "<group>"; };
+               7266F01822429CFD00833975 /* SVGAnimationAdditiveValueFunctionImpl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimationAdditiveValueFunctionImpl.cpp; sourceTree = "<group>"; };
</ins><span class="cx">           727AFED11A2EA6A0000442E8 /* EXTsRGB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTsRGB.cpp; sourceTree = "<group>"; };
</span><span class="cx">          727AFED21A2EA6A0000442E8 /* EXTsRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTsRGB.h; sourceTree = "<group>"; };
</span><span class="cx">          727AFED31A2EA6A0000442E8 /* EXTsRGB.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTsRGB.idl; sourceTree = "<group>"; };
</span><span class="lines">@@ -16235,6 +16237,7 @@
</span><span class="cx">                          721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */,
</span><span class="cx">                          55BE025F223B29C50032F08A /* SVGAnimationAdditiveFunction.h */,
</span><span class="cx">                          55EE535E223B2A0E00FBA944 /* SVGAnimationAdditiveValueFunction.h */,
</span><ins>+                               7266F01822429CFD00833975 /* SVGAnimationAdditiveValueFunctionImpl.cpp */,
</ins><span class="cx">                           55BE0259223B29C10032F08A /* SVGAnimationAdditiveValueFunctionImpl.h */,
</span><span class="cx">                          55DCC51D2240615500C26E32 /* SVGAnimationDiscreteFunction.h */,
</span><span class="cx">                          55DCC51C2240605E00C26E32 /* SVGAnimationDiscreteFunctionImpl.h */,
</span><span class="lines">@@ -16257,9 +16260,13 @@
</span><span class="cx">                          55EE5354223B29E900FBA944 /* SVGMemberAccessor.h */,
</span><span class="cx">                          55BE025A223B29C20032F08A /* SVGPointerMemberAccessor.h */,
</span><span class="cx">                          55DCC5252240749E00C26E32 /* SVGPrimitiveList.h */,
</span><ins>+                               7266F0152241C09800833975 /* SVGPrimitivePropertyAnimator.h */,
+                               7266F0142241BFB200833975 /* SVGPrimitivePropertyAnimatorImpl.h */,
</ins><span class="cx">                           55EE5363223B2A2400FBA944 /* SVGProperty.h */,
</span><span class="cx">                          55DCC526224074FA00C26E32 /* SVGPropertyAccessor.h */,
</span><span class="cx">                          55DCC5272240750B00C26E32 /* SVGPropertyAccessorImpl.h */,
</span><ins>+                               7266F0162241C0FE00833975 /* SVGPropertyAnimator.h */,
+                               7266F0132241BCE200833975 /* SVGPropertyAnimatorFactory.h */,
</ins><span class="cx">                           55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */,
</span><span class="cx">                          55BE025C223B29C30032F08A /* SVGPropertyOwnerRegistry.h */,
</span><span class="cx">                          55BE0257223B29C00032F08A /* SVGPropertyRegistry.h */,
</span><span class="lines">@@ -24129,8 +24136,6 @@
</span><span class="cx">                          087B84951272CEC700A14417 /* SVGAnimatedAngle.h */,
</span><span class="cx">                          B22277E60D00BF1F0071B782 /* SVGAnimatedAngle.idl */,
</span><span class="cx">                          B22277E70D00BF1F0071B782 /* SVGAnimatedBoolean.idl */,
</span><del>-                               43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */,
-                               43A625F613B3304000AC94B8 /* SVGAnimatedColor.h */,
</del><span class="cx">                           71CC7A1F152A0BFE009EEAF9 /* SVGAnimatedEnumeration.cpp */,
</span><span class="cx">                          08D46CE2127AD5FC0089694B /* SVGAnimatedEnumeration.h */,
</span><span class="cx">                          B22277E80D00BF1F0071B782 /* SVGAnimatedEnumeration.idl */,
</span><span class="lines">@@ -31921,7 +31926,6 @@
</span><span class="cx">                          B22279770D00BF220071B782 /* SVGAngle.h in Headers */,
</span><span class="cx">                          B222797A0D00BF220071B782 /* SVGAnimateColorElement.h in Headers */,
</span><span class="cx">                          087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */,
</span><del>-                               43A625F813B3304000AC94B8 /* SVGAnimatedColor.h in Headers */,
</del><span class="cx">                           08D46CE3127AD5FC0089694B /* SVGAnimatedEnumeration.h in Headers */,
</span><span class="cx">                          71FB967B1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h in Headers */,
</span><span class="cx">                          089021A9126EF5DE0092D5EA /* SVGAnimatedLength.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAnimateColorElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAnimateColorElement.cpp (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAnimateColorElement.cpp      2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGAnimateColorElement.cpp 2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -40,19 +40,4 @@
</span><span class="cx">     return adoptRef(*new SVGAnimateColorElement(tagName, document));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool attributeValueIsCurrentColor(const String& value)
-{
-    static NeverDestroyed<const AtomicString> currentColor("currentColor", AtomicString::ConstructFromLiteral);
-    return value == currentColor;
</del><span class="cx"> }
</span><del>-
-void SVGAnimateColorElement::determinePropertyValueTypes(const String& from, const String& to)
-{
-    SVGAnimateElementBase::determinePropertyValueTypes(from, to);
-    if (attributeValueIsCurrentColor(from))
-        m_fromPropertyValueType = CurrentColorValue;
-    if (attributeValueIsCurrentColor(to))
-        m_toPropertyValueType = CurrentColorValue;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAnimateColorElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAnimateColorElement.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAnimateColorElement.h        2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGAnimateColorElement.h   2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     SVGAnimateColorElement(const QualifiedName&, Document&);
</span><del>-    void determinePropertyValueTypes(const String& from, const String& to) override;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAnimateElementBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp       2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp  2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">     ASSERT(!hasInvalidCSSAttributeType());
</span><span class="cx"> 
</span><span class="cx">     if (!m_attributeAnimationController) {
</span><del>-        if (targetElement()->isAnimatedPropertyAttribute(attributeName()))
</del><ins>+        if (targetElement()->isAnimatedAttribute(attributeName()))
</ins><span class="cx">             m_attributeAnimationController = std::make_unique<SVGAttributeAnimationController>(*this, *targetElement());
</span><span class="cx">         else
</span><span class="cx">             m_attributeAnimationController = std::make_unique<SVGLegacyAttributeAnimationController>(*this, *targetElement());
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAnimatedColorcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/svg/SVGAnimatedColor.cpp (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAnimatedColor.cpp    2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGAnimatedColor.cpp       2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -1,120 +0,0 @@
</span><del>-/*
- * Copyright (C) Research In Motion Limited 2011. All rights reserved.
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "SVGAnimatedColor.h"
-
-#include "CSSParser.h"
-#include "RenderElement.h"
-#include "SVGAnimateElementBase.h"
-
-namespace WebCore {
-
-SVGAnimatedColorAnimator::SVGAnimatedColorAnimator(SVGAnimationElement& animationElement, SVGElement& contextElement)
-    : SVGAnimatedTypeAnimator(AnimatedColor, &animationElement, &contextElement)
-{
-}
-
-std::unique_ptr<SVGAnimatedType> SVGAnimatedColorAnimator::constructFromString(const String& string)
-{
-    return SVGAnimatedType::create(SVGPropertyTraits<Color>::fromString(string));
-}
-
-void SVGAnimatedColorAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
-{
-    ASSERT(from);
-    ASSERT(to);
-    ASSERT(from->type() == AnimatedColor);
-    ASSERT(to->type() == AnimatedColor);
-
-    // Ignores any alpha and sets alpha on result to 100% opaque.
-    const auto& fromColor = from->as<Color>();
-    auto& toColor = to->as<Color>();
-    toColor = { roundAndClampColorChannel(toColor.red() + fromColor.red()),
-        roundAndClampColorChannel(toColor.green() + fromColor.green()),
-        roundAndClampColorChannel(toColor.blue() + fromColor.blue()) };
-}
-
-static inline Color currentColor(SVGElement& targetElement)
-{
-    RenderElement* targetRenderer = targetElement.renderer();
-    if (!targetRenderer)
-        return { };
-    return targetRenderer->style().visitedDependentColor(CSSPropertyColor);
-}
-
-static Color parseColorFromString(SVGAnimationElement*, const String& string)
-{
-    return CSSParser::parseColor(string.stripWhiteSpace());
-}
-
-void SVGAnimatedColorAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
-{
-    ASSERT(m_animationElement);
-    ASSERT(m_contextElement);
-
-    auto fromColor = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<Color>();
-    auto toColor = to->as<Color>();
-
-    // Apply CSS inheritance rules.
-    m_animationElement->adjustForInheritance<Color>(parseColorFromString, m_animationElement->fromPropertyValueType(), fromColor, m_contextElement);
-    m_animationElement->adjustForInheritance<Color>(parseColorFromString, m_animationElement->toPropertyValueType(), toColor, m_contextElement);
-
-    // Apply <animateColor> rules.
-    if (m_animationElement->fromPropertyValueType() == CurrentColorValue)
-        fromColor = currentColor(*m_contextElement);
-    if (m_animationElement->toPropertyValueType() == CurrentColorValue)
-        toColor = currentColor(*m_contextElement);
-
-    const auto& toAtEndOfDurationColor = toAtEndOfDuration->as<Color>();
-    auto& animatedColor = animated->as<Color>();
-
-    // FIXME: ExtendedColor - this will need to handle blending between colors in different color spaces,
-    // as well as work with non [0-255] Colors.
-    float red = animatedColor.red();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.red(), toColor.red(), toAtEndOfDurationColor.red(), red);
-
-    float green = animatedColor.green();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.green(), toColor.green(), toAtEndOfDurationColor.green(), green);
-
-    float blue = animatedColor.blue();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.blue(), toColor.blue(), toAtEndOfDurationColor.blue(), blue);
-
-    float alpha = animatedColor.alpha();
-    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromColor.alpha(), toColor.alpha(), toAtEndOfDurationColor.alpha(), alpha);
-
-    animatedColor = { roundAndClampColorChannel(red), roundAndClampColorChannel(green), roundAndClampColorChannel(blue), roundAndClampColorChannel(alpha) };
-}
-
-float SVGAnimatedColorAnimator::calculateDistance(const String& fromString, const String& toString)
-{
-    Color from = CSSParser::parseColor(fromString.stripWhiteSpace());
-    if (!from.isValid())
-        return -1;
-    Color to = CSSParser::parseColor(toString.stripWhiteSpace());
-    if (!to.isValid())
-        return -1;
-    float red = from.red() - to.red();
-    float green = from.green() - to.green();
-    float blue = from.blue() - to.blue();
-    return sqrtf(red * red + green * green + blue * blue);
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAnimatedColorh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/svg/SVGAnimatedColor.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAnimatedColor.h      2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGAnimatedColor.h 2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -1,42 +0,0 @@
</span><del>-/*
- * Copyright (C) Research In Motion Limited 2011. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include "SVGAnimatedTypeAnimator.h"
-
-namespace WebCore {
-
-class SVGAnimatedColorAnimator final : public SVGAnimatedTypeAnimator {
-public:
-    SVGAnimatedColorAnimator(SVGAnimationElement&, SVGElement&);
-
-private:
-    std::unique_ptr<SVGAnimatedType> constructFromString(const String&) final;
-    std::unique_ptr<SVGAnimatedType> startAnimValAnimation(const SVGElementAnimatedPropertyList&) final { return nullptr; }
-    void stopAnimValAnimation(const SVGElementAnimatedPropertyList&) final { }
-    void resetAnimValToBaseVal(const SVGElementAnimatedPropertyList&, SVGAnimatedType&) final { }
-    void animValWillChange(const SVGElementAnimatedPropertyList&) final { }
-    void animValDidChange(const SVGElementAnimatedPropertyList&) final { }
-    void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) final;
-    void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*) final;
-    float calculateDistance(const String& fromString, const String& toString) final;
-};
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAnimatorFactoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAnimatorFactory.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAnimatorFactory.h    2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGAnimatorFactory.h       2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -20,7 +20,6 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "SVGAnimatedAngle.h"
</span><del>-#include "SVGAnimatedColor.h"
</del><span class="cx"> #include "SVGAnimatedEnumeration.h"
</span><span class="cx"> #include "SVGAnimatedLength.h"
</span><span class="cx"> #include "SVGAnimatedLengthList.h"
</span><span class="lines">@@ -44,18 +43,18 @@
</span><span class="cx">         ASSERT(contextElement);
</span><span class="cx"> 
</span><span class="cx">         switch (attributeType) {
</span><del>-        case AnimatedAngle:
-            return std::make_unique<SVGAnimatedAngleAnimator>(animationElement, contextElement);
</del><span class="cx">         case AnimatedBoolean:
</span><del>-            return nullptr;
</del><span class="cx">         case AnimatedColor:
</span><del>-            return std::make_unique<SVGAnimatedColorAnimator>(*animationElement, *contextElement);
-        case AnimatedEnumeration:
-            return std::make_unique<SVGAnimatedEnumerationAnimator>(animationElement, contextElement);
</del><span class="cx">         case AnimatedInteger:
</span><del>-            return nullptr;
</del><span class="cx">         case AnimatedIntegerOptionalInteger:
</span><ins>+        case AnimatedPreserveAspectRatio:
+        case AnimatedRect:
</ins><span class="cx">             return nullptr;
</span><ins>+
+        case AnimatedAngle:
+            return std::make_unique<SVGAnimatedAngleAnimator>(animationElement, contextElement);
+        case AnimatedEnumeration:
+            return std::make_unique<SVGAnimatedEnumerationAnimator>(animationElement, contextElement);
</ins><span class="cx">         case AnimatedLength:
</span><span class="cx">             return std::make_unique<SVGAnimatedLengthAnimator>(animationElement, contextElement);
</span><span class="cx">         case AnimatedLengthList:
</span><span class="lines">@@ -70,10 +69,6 @@
</span><span class="cx">             return std::make_unique<SVGAnimatedPathAnimator>(animationElement, contextElement);
</span><span class="cx">         case AnimatedPoints:
</span><span class="cx">             return std::make_unique<SVGAnimatedPointListAnimator>(animationElement, contextElement);
</span><del>-        case AnimatedPreserveAspectRatio:
-            return nullptr;
-        case AnimatedRect:
-            return nullptr;
</del><span class="cx">         case AnimatedString:
</span><span class="cx">             return std::make_unique<SVGAnimatedStringAnimator>(animationElement, contextElement);
</span><span class="cx">         case AnimatedTransformList:
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAttributeAnimationControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAttributeAnimationController.cpp (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAttributeAnimationController.cpp     2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGAttributeAnimationController.cpp        2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -37,6 +37,12 @@
</span><span class="cx">     : SVGAttributeAnimationControllerBase(animationElement, targetElement)
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+    
+SVGAttributeAnimationController::~SVGAttributeAnimationController()
+{
+    if (m_animator)
+        m_targetElement.animatorWillBeDeleted(m_animationElement.attributeName());
+}
</ins><span class="cx"> 
</span><span class="cx"> SVGAttributeAnimator* SVGAttributeAnimationController::animator() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAttributeAnimationControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAttributeAnimationController.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAttributeAnimationController.h       2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGAttributeAnimationController.h  2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> class SVGAttributeAnimationController : public SVGAttributeAnimationControllerBase {
</span><span class="cx"> public:
</span><span class="cx">     SVGAttributeAnimationController(SVGAnimationElement&, SVGElement&);
</span><ins>+    ~SVGAttributeAnimationController();
</ins><span class="cx">     
</span><span class="cx"> private:
</span><span class="cx">     SVGAttributeAnimator* animator() const;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.cpp (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.cpp  2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGElement.cpp     2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #include "SVGGraphicsElement.h"
</span><span class="cx"> #include "SVGImageElement.h"
</span><span class="cx"> #include "SVGNames.h"
</span><ins>+#include "SVGPropertyAnimatorFactory.h"
</ins><span class="cx"> #include "SVGRenderStyle.h"
</span><span class="cx"> #include "SVGRenderSupport.h"
</span><span class="cx"> #include "SVGSVGElement.h"
</span><span class="lines">@@ -275,6 +276,7 @@
</span><span class="cx"> SVGElement::SVGElement(const QualifiedName& tagName, Document& document)
</span><span class="cx">     : StyledElement(tagName, document, CreateSVGElement)
</span><span class="cx">     , SVGLangSpace(this)
</span><ins>+    , m_propertyAnimatorFactory(std::make_unique<SVGPropertyAnimatorFactory>())
</ins><span class="cx"> {
</span><span class="cx">     registerAttributes();
</span><span class="cx"> }
</span><span class="lines">@@ -756,11 +758,16 @@
</span><span class="cx"> 
</span><span class="cx"> bool SVGElement::isAnimatedAttribute(const QualifiedName& attributeName) const
</span><span class="cx"> {
</span><del>-    return isAnimatedPropertyAttribute(attributeName);
</del><ins>+    return SVGPropertyAnimatorFactory::isKnownAttribute(attributeName) || isAnimatedPropertyAttribute(attributeName);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr<SVGAttributeAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
</span><span class="cx"> {
</span><ins>+    // Property animator, e.g. "fill" or "fill-opacity".
+    if (auto animator = propertyAnimatorFactory().createAnimator(attributeName, animationMode, calcMode, isAccumulated, isAdditive))
+        return animator;
+    
+    // Animated property animator.
</ins><span class="cx">     auto animator = propertyRegistry().createAnimator(attributeName, animationMode, calcMode, isAccumulated, isAdditive);
</span><span class="cx">     if (!animator)
</span><span class="cx">         return animator;
</span><span class="lines">@@ -768,6 +775,11 @@
</span><span class="cx">         instance->propertyRegistry().appendAnimatedInstance(attributeName, *animator);
</span><span class="cx">     return animator;
</span><span class="cx"> }
</span><ins>+    
+void SVGElement::animatorWillBeDeleted(const QualifiedName& attributeName)
+{
+    propertyAnimatorFactory().animatorWillBeDeleted(attributeName);
+}
</ins><span class="cx"> 
</span><span class="cx"> Optional<ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.h    2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGElement.h       2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> class Document;
</span><span class="cx"> class SVGDocumentExtensions;
</span><span class="cx"> class SVGElementRareData;
</span><ins>+class SVGPropertyAnimatorFactory;
</ins><span class="cx"> class SVGSVGElement;
</span><span class="cx"> class SVGUseElement;
</span><span class="cx"> 
</span><span class="lines">@@ -161,7 +162,9 @@
</span><span class="cx">     void commitPropertyChange(SVGAnimatedProperty&);
</span><span class="cx"> 
</span><span class="cx">     const SVGElement* attributeContextElement() const override { return this; }
</span><ins>+    SVGPropertyAnimatorFactory& propertyAnimatorFactory() { return *m_propertyAnimatorFactory; }
</ins><span class="cx">     std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive);
</span><ins>+    void animatorWillBeDeleted(const QualifiedName&);
</ins><span class="cx"> 
</span><span class="cx">     // These are needed for the RenderTree, animation and DOM.
</span><span class="cx">     const auto& className() const { return m_className.currentValue(attributeOwnerProxy()); }
</span><span class="lines">@@ -215,6 +218,8 @@
</span><span class="cx"> 
</span><span class="cx">     HashSet<SVGElement*> m_elementsWithRelativeLengths;
</span><span class="cx"> 
</span><ins>+    std::unique_ptr<SVGPropertyAnimatorFactory> m_propertyAnimatorFactory;
+
</ins><span class="cx">     AttributeOwnerProxy m_attributeOwnerProxy { *this };
</span><span class="cx">     PropertyRegistry m_propertyRegistry { *this };
</span><span class="cx">     SVGAnimatedStringAttribute m_className;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGFitToViewBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGFitToViewBox.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGFitToViewBox.h       2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGFitToViewBox.h  2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
</span><span class="cx">  * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
</span><del>- * Copyright (C) 2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2018-2019 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">@@ -23,9 +23,12 @@
</span><span class="cx"> 
</span><span class="cx"> #include "FloatRect.h"
</span><span class="cx"> #include "QualifiedName.h"
</span><ins>+#include "SVGAnimatedPropertyImpl.h"
+#include "SVGAttributeOwnerProxyImpl.h"
</ins><span class="cx"> #include "SVGAttributeRegistry.h"
</span><span class="cx"> #include "SVGNames.h"
</span><span class="cx"> #include "SVGPreserveAspectRatio.h"
</span><ins>+#include "SVGPropertyOwnerRegistry.h"
</ins><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGMPathElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGMPathElement.cpp (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGMPathElement.cpp     2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/SVGMPathElement.cpp        2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include "SVGDocumentExtensions.h"
</span><span class="cx"> #include "SVGNames.h"
</span><span class="cx"> #include "SVGPathElement.h"
</span><ins>+#include <wtf/IsoMallocInlines.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsfiltersSVGFEImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.h   2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.h      2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> class Document;
</span><span class="cx"> class Image;
</span><span class="cx"> class RenderElement;
</span><ins>+class TreeScope;
</ins><span class="cx"> 
</span><span class="cx"> class FEImage final : public FilterEffect {
</span><span class="cx"> public:
</span></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGAnimationAdditiveValueFunctionImplcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp (0 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp                            (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp       2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SVGAnimationAdditiveValueFunctionImpl.h"
+
+#include "RenderElement.h"
+#include "SVGElement.h"
+
+namespace WebCore {
+
+Color SVGAnimationColorFunction::colorFromString(SVGElement* targetElement, const String& string)
+{
+    static NeverDestroyed<const AtomicString> currentColor("currentColor", AtomicString::ConstructFromLiteral);
+
+    if (string != currentColor.get())
+        return SVGPropertyTraits<Color>::fromString(string);
+
+    if (auto* renderer = targetElement->renderer())
+        return renderer->style().visitedDependentColor(CSSPropertyColor);
+
+    return { };
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGAnimationAdditiveValueFunctionImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h      2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h 2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -30,6 +30,62 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class SVGAnimationColorFunction : public SVGAnimationAdditiveValueFunction<Color> {
+public:
+    using Base = SVGAnimationAdditiveValueFunction<Color>;
+    using Base::Base;
+
+    void setFromAndToValues(SVGElement* targetElement, const String& from, const String& to) override
+    {
+        m_from = colorFromString(targetElement, from);
+        m_to = colorFromString(targetElement, to);
+    }
+
+    void setToAtEndOfDurationValue(const String& toAtEndOfDuration) override
+    {
+        m_toAtEndOfDuration = SVGPropertyTraits<Color>::fromString(toAtEndOfDuration);
+    }
+
+    void progress(SVGElement*, float percentage, unsigned repeatCount, Color& animated)
+    {
+        Color from = m_animationMode == AnimationMode::To ? animated : m_from;
+        
+        float red = Base::progress(percentage, repeatCount, from.red(), m_to.red(), toAtEndOfDuration().red(), animated.red());
+        float green = Base::progress(percentage, repeatCount, from.green(), m_to.green(), toAtEndOfDuration().green(), animated.green());
+        float blue = Base::progress(percentage, repeatCount, from.blue(), m_to.blue(), toAtEndOfDuration().blue(), animated.blue());
+        float alpha = Base::progress(percentage, repeatCount, from.alpha(), m_to.alpha(), toAtEndOfDuration().alpha(), animated.alpha());
+        
+        animated = { roundAndClampColorChannel(red), roundAndClampColorChannel(green), roundAndClampColorChannel(blue), roundAndClampColorChannel(alpha) };
+    }
+
+    float calculateDistance(SVGElement*, const String& from, const String& to) const override
+    {
+        Color fromColor = CSSParser::parseColor(from.stripWhiteSpace());
+        if (!fromColor.isValid())
+            return -1;
+        Color toColor = CSSParser::parseColor(to.stripWhiteSpace());
+        if (!toColor.isValid())
+            return -1;
+        float red = fromColor.red() - toColor.red();
+        float green = fromColor.green() - toColor.green();
+        float blue = fromColor.blue() - toColor.blue();
+        return sqrtf(red * red + green * green + blue * blue);
+    }
+
+private:
+    void addFromAndToValues(SVGElement*) override
+    {
+        // Ignores any alpha and sets alpha on result to 100% opaque.
+        m_to = {
+            roundAndClampColorChannel(m_to.red() + m_from.red()),
+            roundAndClampColorChannel(m_to.green() + m_from.green()),
+            roundAndClampColorChannel(m_to.blue() + m_from.blue())
+        };
+    }
+
+    static Color colorFromString(SVGElement*, const String&);
+};
+
</ins><span class="cx"> class SVGAnimationIntegerFunction : public SVGAnimationAdditiveValueFunction<int> {
</span><span class="cx">     friend class SVGAnimatedIntegerPairAnimator;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGAnimationFunctionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/properties/SVGAnimationFunction.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGAnimationFunction.h       2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationFunction.h  2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -25,8 +25,12 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include "SVGAttributeAnimator.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class SVGElement;
+
</ins><span class="cx"> class SVGAnimationFunction {
</span><span class="cx"> public:
</span><span class="cx">     virtual ~SVGAnimationFunction() = default;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGAttributeAnimatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.cpp (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.cpp     2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.cpp        2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -32,6 +32,63 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+void SVGAttributeAnimator::applyAnimatedStylePropertyChange(SVGElement* element, CSSPropertyID id, const String& value)
+{
+    ASSERT(element);
+    ASSERT(!element->m_deletionHasBegun);
+    
+    if (!element->ensureAnimatedSMILStyleProperties().setProperty(id, value, false))
+        return;
+    element->invalidateStyle();
+}
+
+void SVGAttributeAnimator::applyAnimatedStylePropertyChange(SVGElement* targetElement, const String& value)
+{
+    ASSERT(targetElement);
+    ASSERT(m_attributeName != anyQName());
+    
+    // FIXME: Do we really need to check both isConnected and !parentNode?
+    if (!targetElement->isConnected() || !targetElement->parentNode())
+        return;
+    
+    CSSPropertyID id = cssPropertyID(m_attributeName.localName());
+    
+    SVGElement::InstanceUpdateBlocker blocker(*targetElement);
+    applyAnimatedStylePropertyChange(targetElement, id, value);
+    
+    // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt.
+    for (auto* instance : targetElement->instances())
+        applyAnimatedStylePropertyChange(instance, id, value);
+}
+    
+void SVGAttributeAnimator::removeAnimatedStyleProperty(SVGElement* element, CSSPropertyID id)
+{
+    ASSERT(element);
+    ASSERT(!element->m_deletionHasBegun);
+
+    element->ensureAnimatedSMILStyleProperties().removeProperty(id);
+    element->invalidateStyle();
+}
+
+void SVGAttributeAnimator::removeAnimatedStyleProperty(SVGElement* targetElement)
+{
+    ASSERT(targetElement);
+    ASSERT(m_attributeName != anyQName());
+
+    // FIXME: Do we really need to check both isConnected and !parentNode?
+    if (!targetElement->isConnected() || !targetElement->parentNode())
+        return;
+
+    CSSPropertyID id = cssPropertyID(m_attributeName.localName());
+
+    SVGElement::InstanceUpdateBlocker blocker(*targetElement);
+    removeAnimatedStyleProperty(targetElement, id);
+
+    // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt.
+    for (auto* instance : targetElement->instances())
+        removeAnimatedStyleProperty(instance, id);
+}
+    
</ins><span class="cx"> void SVGAttributeAnimator::applyAnimatedPropertyChange(SVGElement* element, const QualifiedName& attributeName)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!element->m_deletionHasBegun);
</span></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGAttributeAnimatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.h (243258 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.h       2019-03-20 23:37:54 UTC (rev 243258)
+++ trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.h  2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -74,8 +74,12 @@
</span><span class="cx">     virtual float calculateDistance(SVGElement*, const String&, const String&) const { return -1; }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><ins>+    static void applyAnimatedStylePropertyChange(SVGElement*, CSSPropertyID, const String& value);
+    static void removeAnimatedStyleProperty(SVGElement*, CSSPropertyID);
</ins><span class="cx">     static void applyAnimatedPropertyChange(SVGElement*, const QualifiedName&);
</span><span class="cx"> 
</span><ins>+    void applyAnimatedStylePropertyChange(SVGElement*, const String& value);
+    void removeAnimatedStyleProperty(SVGElement*);
</ins><span class="cx">     void applyAnimatedPropertyChange(SVGElement*);
</span><span class="cx"> 
</span><span class="cx">     const QualifiedName& m_attributeName;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGPrimitivePropertyAnimatorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h (0 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h                               (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h  2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "SVGPropertyAnimator.h"
+#include "SVGPropertyTraits.h"
+#include "SVGValueProperty.h"
+
+namespace WebCore {
+
+template<typename PropertyType, typename AnimationFunction>
+class SVGPrimitivePropertyAnimator : public SVGPropertyAnimator<AnimationFunction> {
+    using Base = SVGPropertyAnimator<AnimationFunction>;
+    using ValuePropertyType = SVGValueProperty<PropertyType>;
+    using Base::Base;
+    using Base::applyAnimatedStylePropertyChange;
+    using Base::computeCSSPropertyValue;
+    using Base::m_attributeName;
+    using Base::m_function;
+    
+public:
+    static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
+    {
+        return std::make_unique<SVGPrimitivePropertyAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
+    }
+    
+    template<typename... Arguments>
+    SVGPrimitivePropertyAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, Arguments&&... arguments)
+        : Base(attributeName, std::forward<Arguments>(arguments)...)
+        , m_property(static_reference_cast<ValuePropertyType>(WTFMove(property)))
+    {
+    }
+
+    void start(SVGElement* targetElement) override
+    {
+        String baseValue = computeCSSPropertyValue(targetElement, cssPropertyID(m_attributeName.localName()));
+        m_property->setValue(SVGPropertyTraits<PropertyType>::fromString(baseValue));
+    }
+
+    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) override
+    {
+        PropertyType& animated = m_property->value();
+        m_function.progress(targetElement, percentage, repeatCount, animated);
+    }
+
+    void apply(SVGElement* targetElement) override
+    {
+        applyAnimatedStylePropertyChange(targetElement, SVGPropertyTraits<PropertyType>::toString(m_property->value()));
+    }
+
+protected:
+    Ref<ValuePropertyType> m_property;
+};
+    
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGPrimitivePropertyAnimatorImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimatorImpl.h (0 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimatorImpl.h                           (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimatorImpl.h      2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "SVGAnimationFunction.h"
+#include "SVGPrimitivePropertyAnimator.h"
+
+namespace WebCore {
+
+using SVGColorAnimator = SVGPrimitivePropertyAnimator<Color, SVGAnimationColorFunction>;
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGPropertyAnimatorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h (0 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h                                (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h   2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CSSComputedStyleDeclaration.h"
+#include "CSSPropertyParser.h"
+#include "SVGAttributeAnimator.h"
+#include "SVGElement.h"
+
+namespace WebCore {
+    
+template<typename AnimationFunction>
+class SVGPropertyAnimator : public SVGAttributeAnimator {
+public:
+    bool isDiscrete() const override { return m_function.isDiscrete(); }
+
+    void setFromAndToValues(SVGElement* targetElement, const String& from, const String& to) override
+    {
+        m_function.setFromAndToValues(targetElement, adjustForInheritance(targetElement, from), adjustForInheritance(targetElement, to));
+    }
+
+    void setFromAndByValues(SVGElement* targetElement, const String& from, const String& by) override
+    {
+        m_function.setFromAndByValues(targetElement, from, by);
+    }
+
+    void setToAtEndOfDurationValue(const String& toAtEndOfDuration) override
+    {
+        m_function.setToAtEndOfDurationValue(toAtEndOfDuration);
+    }
+
+protected:
+    template<typename... Arguments>
+    SVGPropertyAnimator(const QualifiedName& attributeName, Arguments&&... arguments)
+        : SVGAttributeAnimator(attributeName)
+        , m_function(std::forward<Arguments>(arguments)...)
+    {
+    }
+
+    void stop(SVGElement* targetElement) override
+    {
+        removeAnimatedStyleProperty(targetElement);
+    }
+
+    float calculateDistance(SVGElement* targetElement, const String& from, const String& to) const override
+    {
+        return m_function.calculateDistance(targetElement, from, to);
+    }
+
+    String adjustForInheritance(SVGElement* targetElement, const String& value) const
+    {
+        static NeverDestroyed<const AtomicString> inherit("inherit", AtomicString::ConstructFromLiteral);
+        return value == inherit ? computeInheritedCSSPropertyValue(targetElement) : value;
+    }
+
+    String computeCSSPropertyValue(SVGElement* targetElement, CSSPropertyID id) const
+    {
+        ASSERT(targetElement);
+
+        // Don't include any properties resulting from CSS Transitions/Animations or SMIL animations, as we want to retrieve the "base value".
+        targetElement->setUseOverrideComputedStyle(true);
+        RefPtr<CSSValue> value = ComputedStyleExtractor(targetElement).propertyValue(id);
+        targetElement->setUseOverrideComputedStyle(false);
+        return value ? value->cssText() : String();
+    }
+
+    String computeInheritedCSSPropertyValue(SVGElement* targetElement) const
+    {
+        ASSERT(targetElement);
+        auto parent = makeRefPtr(targetElement->parentElement());
+        if (!parent || !parent->isSVGElement())
+            return emptyString();
+        
+        SVGElement& svgParent = downcast<SVGElement>(*parent);
+        return computeCSSPropertyValue(&svgParent, cssPropertyID(m_attributeName.localName()));
+    }
+
+    AnimationFunction m_function;
+};
+    
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGPropertyAnimatorFactoryh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h (0 => 243259)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h                         (rev 0)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h    2019-03-20 23:51:47 UTC (rev 243259)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "SVGNames.h"
+#include "SVGPrimitivePropertyAnimatorImpl.h"
+
+namespace WebCore {
+
+class SVGPropertyAnimatorFactory {
+public:
+    SVGPropertyAnimatorFactory() = default;
+
+    static bool isKnownAttribute(const QualifiedName& attributeName)
+    {
+        return attributeAnimatorCreator().contains(attributeName.impl());
+    }
+
+    std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
+    {
+        auto iterator = attributeAnimatorCreator().find(attributeName.impl());
+        if (iterator == attributeAnimatorCreator().end())
+            return nullptr;
+
+        auto addResult = m_attributeProperty.ensure(attributeName, [&iterator]() {
+            return iterator->value.first();
+        });
+        
+        return iterator->value.second(attributeName, addResult.iterator->value.copyRef(), animationMode, calcMode, isAccumulated, isAdditive);
+    }
+
+    void animatorWillBeDeleted(const QualifiedName& attributeName)
+    {
+        auto iterator = m_attributeProperty.find(attributeName);
+        if (iterator == m_attributeProperty.end())
+            return;
+
+        // If refCount = 1 (in the animator) + 1 (in m_attributeProperty) = 2, the entry can be deleted.
+        if (iterator->value->refCount() == 2)
+            m_attributeProperty.remove(iterator);
+    }
+
+private:
+    // This HashMap maps an attribute name to a pair of static methods. The first one creates a shared
+    // Ref<SVGProperty> for the value type of this attribute. The second creates the animator given the
+    // attribute name and the shared Ref<SVGProperty>.
+    using AttributeAnimatorCreator = HashMap<
+        QualifiedName::QualifiedNameImpl*,
+        std::pair<
+            std::function<Ref<SVGProperty>()>,
+            std::function<std::unique_ptr<SVGAttributeAnimator>(const QualifiedName&, Ref<SVGProperty>&&, AnimationMode, CalcMode, bool, bool)>
+        >
+    >;
+
+    static auto createColorAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
+    {
+        return SVGColorAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
+    }
+
+    static const AttributeAnimatorCreator& attributeAnimatorCreator()
+    {
+        static NeverDestroyed<AttributeAnimatorCreator> map = AttributeAnimatorCreator({
+            { SVGNames::colorAttr->impl(),          std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
+            { SVGNames::fillAttr->impl(),           std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
+            { SVGNames::flood_colorAttr->impl(),    std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
+            { SVGNames::lighting_colorAttr->impl(), std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
+            { SVGNames::stop_colorAttr->impl(),     std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
+            { SVGNames::strokeAttr->impl(),         std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
+        });
+        return map;
+    }
+
+    using AttributeProperty = HashMap<QualifiedName, Ref<SVGProperty>>;
+    AttributeProperty m_attributeProperty;
+};
+    
+}
</ins></span></pre>
</div>
</div>

</body>
</html>