Remove the SVG property tear off objects for SVGAnimatedBoolean
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Mar 2019 00:39:41 +0000 (00:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Mar 2019 00:39:41 +0000 (00:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195862

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-03-18
Reviewed by Simon Fraser.

-- SVGAnimatedBoolean will be defined as SVGAnimatedPrimitiveProperty<bool>.
-- SVGAnimatedBooleanAccessor is added to access a member of this type.
-- A function registerProperty() is added to SVGPropertyOwnerRegistry
   to register this type.
-- SVGAnimatedBooleanAnimator is added to animate a member of this type.
-- SVGAnimationBooleanFunction is added to handle the progress of this
   new type over a period of time.

SVGAnimationDiscreteFunction is the base class of SVGAnimationBooleanFunction.
It will be the base class of all the discrete animation function types:
string, bool, enum and PreserveAspectRatio types.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* svg/SVGAnimationElement.h:
* svg/SVGAnimatorFactory.h:
(WebCore::SVGAnimatorFactory::create):
* svg/SVGClipPathElement.h:
* svg/SVGCursorElement.h:
* svg/SVGDefsElement.h:
* svg/SVGExternalResourcesRequired.cpp:
(WebCore::SVGExternalResourcesRequired::SVGExternalResourcesRequired):
(WebCore::SVGExternalResourcesRequired::parseAttribute):
(WebCore::SVGExternalResourcesRequired::registerAttributes): Deleted.
* svg/SVGExternalResourcesRequired.h:
(WebCore::SVGExternalResourcesRequired::externalResourcesRequired const):
(WebCore::SVGExternalResourcesRequired::externalResourcesRequiredAnimated):
(WebCore::SVGExternalResourcesRequired::setExternalResourcesRequired): Deleted.
* svg/SVGFEConvolveMatrixElement.cpp:
(WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement):
(WebCore::SVGFEConvolveMatrixElement::registerAttributes):
(WebCore::SVGFEConvolveMatrixElement::parseAttribute):
* svg/SVGFEConvolveMatrixElement.h:
* svg/SVGFEImageElement.h:
* svg/SVGFontElement.h:
* svg/SVGForeignObjectElement.h:
* svg/SVGGElement.h:
* svg/SVGGradientElement.h:
* svg/SVGMPathElement.h:
* svg/SVGMarkerElement.h:
* svg/SVGMaskElement.h:
* svg/SVGPathElement.h:
* svg/SVGPatternElement.h:
* svg/SVGRectElement.h:
* svg/SVGSVGElement.h:
* svg/SVGScriptElement.h:
* svg/SVGSwitchElement.h:
* svg/SVGSymbolElement.h:
* svg/SVGTextContentElement.h:
* svg/SVGUseElement.h:
* svg/properties/SVGAnimatedPropertyAccessorImpl.h:
* svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
* svg/properties/SVGAnimatedPropertyImpl.h:
* svg/properties/SVGAnimationDiscreteFunction.h: Added.
(WebCore::SVGAnimationDiscreteFunction::SVGAnimationDiscreteFunction):
(WebCore::SVGAnimationDiscreteFunction::progress):
* svg/properties/SVGAnimationDiscreteFunctionImpl.h: Added.
* svg/properties/SVGAttributeRegistry.h:
* svg/properties/SVGPropertyOwnerRegistry.h:
(WebCore::SVGPropertyOwnerRegistry::registerProperty):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243121 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/svg/SVGAnimationElement.h
Source/WebCore/svg/SVGAnimatorFactory.h
Source/WebCore/svg/SVGClipPathElement.h
Source/WebCore/svg/SVGCursorElement.h
Source/WebCore/svg/SVGDefsElement.h
Source/WebCore/svg/SVGExternalResourcesRequired.cpp
Source/WebCore/svg/SVGExternalResourcesRequired.h
Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp
Source/WebCore/svg/SVGFEConvolveMatrixElement.h
Source/WebCore/svg/SVGFEImageElement.h
Source/WebCore/svg/SVGFontElement.h
Source/WebCore/svg/SVGForeignObjectElement.h
Source/WebCore/svg/SVGGElement.h
Source/WebCore/svg/SVGGradientElement.h
Source/WebCore/svg/SVGMPathElement.h
Source/WebCore/svg/SVGMarkerElement.h
Source/WebCore/svg/SVGMaskElement.h
Source/WebCore/svg/SVGPathElement.h
Source/WebCore/svg/SVGPatternElement.h
Source/WebCore/svg/SVGRectElement.h
Source/WebCore/svg/SVGSVGElement.h
Source/WebCore/svg/SVGScriptElement.h
Source/WebCore/svg/SVGSwitchElement.h
Source/WebCore/svg/SVGSymbolElement.h
Source/WebCore/svg/SVGTextContentElement.h
Source/WebCore/svg/SVGUseElement.h
Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h
Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h
Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h
Source/WebCore/svg/properties/SVGAnimationDiscreteFunction.h [new file with mode: 0644]
Source/WebCore/svg/properties/SVGAnimationDiscreteFunctionImpl.h [new file with mode: 0644]
Source/WebCore/svg/properties/SVGAttributeRegistry.h
Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h

index 6b08f62..9e8b4b2 100644 (file)
@@ -1,3 +1,71 @@
+2019-03-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Remove the SVG property tear off objects for SVGAnimatedBoolean
+        https://bugs.webkit.org/show_bug.cgi?id=195862
+
+        Reviewed by Simon Fraser.
+
+        -- SVGAnimatedBoolean will be defined as SVGAnimatedPrimitiveProperty<bool>.
+        -- SVGAnimatedBooleanAccessor is added to access a member of this type.
+        -- A function registerProperty() is added to SVGPropertyOwnerRegistry
+           to register this type.
+        -- SVGAnimatedBooleanAnimator is added to animate a member of this type.
+        -- SVGAnimationBooleanFunction is added to handle the progress of this
+           new type over a period of time.
+
+        SVGAnimationDiscreteFunction is the base class of SVGAnimationBooleanFunction.
+        It will be the base class of all the discrete animation function types:
+        string, bool, enum and PreserveAspectRatio types.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * svg/SVGAnimationElement.h:
+        * svg/SVGAnimatorFactory.h:
+        (WebCore::SVGAnimatorFactory::create):
+        * svg/SVGClipPathElement.h:
+        * svg/SVGCursorElement.h:
+        * svg/SVGDefsElement.h:
+        * svg/SVGExternalResourcesRequired.cpp:
+        (WebCore::SVGExternalResourcesRequired::SVGExternalResourcesRequired):
+        (WebCore::SVGExternalResourcesRequired::parseAttribute):
+        (WebCore::SVGExternalResourcesRequired::registerAttributes): Deleted.
+        * svg/SVGExternalResourcesRequired.h:
+        (WebCore::SVGExternalResourcesRequired::externalResourcesRequired const):
+        (WebCore::SVGExternalResourcesRequired::externalResourcesRequiredAnimated):
+        (WebCore::SVGExternalResourcesRequired::setExternalResourcesRequired): Deleted.
+        * svg/SVGFEConvolveMatrixElement.cpp:
+        (WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement):
+        (WebCore::SVGFEConvolveMatrixElement::registerAttributes):
+        (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
+        * svg/SVGFEConvolveMatrixElement.h:
+        * svg/SVGFEImageElement.h:
+        * svg/SVGFontElement.h:
+        * svg/SVGForeignObjectElement.h:
+        * svg/SVGGElement.h:
+        * svg/SVGGradientElement.h:
+        * svg/SVGMPathElement.h:
+        * svg/SVGMarkerElement.h:
+        * svg/SVGMaskElement.h:
+        * svg/SVGPathElement.h:
+        * svg/SVGPatternElement.h:
+        * svg/SVGRectElement.h:
+        * svg/SVGSVGElement.h:
+        * svg/SVGScriptElement.h:
+        * svg/SVGSwitchElement.h:
+        * svg/SVGSymbolElement.h:
+        * svg/SVGTextContentElement.h:
+        * svg/SVGUseElement.h:
+        * svg/properties/SVGAnimatedPropertyAccessorImpl.h:
+        * svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
+        * svg/properties/SVGAnimatedPropertyImpl.h:
+        * svg/properties/SVGAnimationDiscreteFunction.h: Added.
+        (WebCore::SVGAnimationDiscreteFunction::SVGAnimationDiscreteFunction):
+        (WebCore::SVGAnimationDiscreteFunction::progress):
+        * svg/properties/SVGAnimationDiscreteFunctionImpl.h: Added.
+        * svg/properties/SVGAttributeRegistry.h:
+        * svg/properties/SVGPropertyOwnerRegistry.h:
+        (WebCore::SVGPropertyOwnerRegistry::registerProperty):
+
 2019-03-18  Simon Fraser  <simon.fraser@apple.com>
 
         Crash when reloading test with async overflow scrolling
index 5e295ac..4f84213 100644 (file)
@@ -2270,7 +2270,6 @@ svg/SVGAnimateElementBase.cpp
 svg/SVGAnimateMotionElement.cpp
 svg/SVGAnimateTransformElement.cpp
 svg/SVGAnimatedAngle.cpp
-svg/SVGAnimatedBoolean.cpp
 svg/SVGAnimatedColor.cpp
 svg/SVGAnimatedEnumeration.cpp
 svg/SVGAnimatedLength.cpp
index 519dbda..e7b3a9f 100644 (file)
                0854B0211255E4E600B9CDD0 /* SVGInlineTextBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B00F1255E4E600B9CDD0 /* SVGInlineTextBox.h */; };
                0854B0231255E4E600B9CDD0 /* SVGRootInlineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B0111255E4E600B9CDD0 /* SVGRootInlineBox.h */; };
                0854B0251255E4E600B9CDD0 /* SVGTextQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B0131255E4E600B9CDD0 /* SVGTextQuery.h */; };
-               085797091278394C00A8EC5F /* SVGAnimatedBoolean.h in Headers */ = {isa = PBXBuildFile; fileRef = 085797081278394C00A8EC5F /* SVGAnimatedBoolean.h */; };
                085A15931289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */; };
                085B92BB0EFDE73D00E6123C /* FormDataBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 085B92B90EFDE73D00E6123C /* FormDataBuilder.h */; settings = {ATTRIBUTES = (); }; };
                0863951613B5FE5700BB344D /* SVGAnimatedPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 0863951413B5FE5700BB344D /* SVGAnimatedPath.h */; };
                0854B0111255E4E600B9CDD0 /* SVGRootInlineBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRootInlineBox.h; sourceTree = "<group>"; };
                0854B0121255E4E600B9CDD0 /* SVGTextQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextQuery.cpp; sourceTree = "<group>"; };
                0854B0131255E4E600B9CDD0 /* SVGTextQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextQuery.h; sourceTree = "<group>"; };
-               085797081278394C00A8EC5F /* SVGAnimatedBoolean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedBoolean.h; sourceTree = "<group>"; };
                085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedTransformListPropertyTearOff.h; sourceTree = "<group>"; };
                085B92B80EFDE73D00E6123C /* FormDataBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormDataBuilder.cpp; sourceTree = "<group>"; };
                085B92B90EFDE73D00E6123C /* FormDataBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormDataBuilder.h; sourceTree = "<group>"; };
                431A2F9B13B6F2B0007791E4 /* SVGAnimatedNumberOptionalNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumberOptionalNumber.cpp; sourceTree = "<group>"; };
                431A2FD613B7707A007791E4 /* SVGAnimatedLengthList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedLengthList.cpp; sourceTree = "<group>"; };
                431A302013B89DCC007791E4 /* SVGAnimatedPreserveAspectRatio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPreserveAspectRatio.cpp; sourceTree = "<group>"; };
-               431A308713B8F978007791E4 /* SVGAnimatedBoolean.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedBoolean.cpp; sourceTree = "<group>"; };
                432D3FE718A8658400D7DC03 /* SelectorCheckerTestFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorCheckerTestFunctions.h; sourceTree = "<group>"; };
                4331AC7713B6870000A9E5AE /* SVGAnimatedNumberList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumberList.cpp; sourceTree = "<group>"; };
                4358E87A1360A2EE00E4748C /* JSSVGFEDropShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGFEDropShadowElement.cpp; sourceTree = "<group>"; };
                55D70D20223B009100044B8E /* SVGLegacyAnimatedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLegacyAnimatedProperty.h; sourceTree = "<group>"; };
                55D70D21223B00BB00044B8E /* SVGLegacyAnimatedProperty.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLegacyAnimatedProperty.cpp; sourceTree = "<group>"; };
                55D70D22223B00EA00044B8E /* SVGLegacyProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLegacyProperty.h; sourceTree = "<group>"; };
+               55DCC51C2240605E00C26E32 /* SVGAnimationDiscreteFunctionImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationDiscreteFunctionImpl.h; sourceTree = "<group>"; };
+               55DCC51D2240615500C26E32 /* SVGAnimationDiscreteFunction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationDiscreteFunction.h; sourceTree = "<group>"; };
                55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaintFrequencyTracker.h; sourceTree = "<group>"; };
                55EE5354223B29E900FBA944 /* SVGMemberAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMemberAccessor.h; sourceTree = "<group>"; };
                55EE5356223B29F700FBA944 /* SVGAnimatedPropertyAnimatorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyAnimatorImpl.h; sourceTree = "<group>"; };
                                55BE025F223B29C50032F08A /* SVGAnimationAdditiveFunction.h */,
                                55EE535E223B2A0E00FBA944 /* SVGAnimationAdditiveValueFunction.h */,
                                55BE0259223B29C10032F08A /* SVGAnimationAdditiveValueFunctionImpl.h */,
+                               55DCC51D2240615500C26E32 /* SVGAnimationDiscreteFunction.h */,
+                               55DCC51C2240605E00C26E32 /* SVGAnimationDiscreteFunctionImpl.h */,
                                55BE025B223B29C20032F08A /* SVGAnimationFunction.h */,
                                55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */,
                                55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */,
                                4362C7B813AC6F1A00344BEB /* SVGAnimatedAngle.cpp */,
                                087B84951272CEC700A14417 /* SVGAnimatedAngle.h */,
                                B22277E60D00BF1F0071B782 /* SVGAnimatedAngle.idl */,
-                               431A308713B8F978007791E4 /* SVGAnimatedBoolean.cpp */,
-                               085797081278394C00A8EC5F /* SVGAnimatedBoolean.h */,
                                B22277E70D00BF1F0071B782 /* SVGAnimatedBoolean.idl */,
                                43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */,
                                43A625F613B3304000AC94B8 /* SVGAnimatedColor.h */,
                                B22279770D00BF220071B782 /* SVGAngle.h in Headers */,
                                B222797A0D00BF220071B782 /* SVGAnimateColorElement.h in Headers */,
                                087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */,
-                               085797091278394C00A8EC5F /* SVGAnimatedBoolean.h in Headers */,
                                43A625F813B3304000AC94B8 /* SVGAnimatedColor.h in Headers */,
                                08D46CE3127AD5FC0089694B /* SVGAnimatedEnumeration.h in Headers */,
                                71FB967B1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h in Headers */,
index 6f4032e..773088b 100644 (file)
@@ -24,7 +24,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGSMILElement.h"
 #include "SVGTests.h"
index 0f45763..2b82717 100644 (file)
@@ -20,7 +20,6 @@
 #pragma once
 
 #include "SVGAnimatedAngle.h"
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedColor.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedLength.h"
@@ -50,7 +49,7 @@ public:
         case AnimatedAngle:
             return std::make_unique<SVGAnimatedAngleAnimator>(animationElement, contextElement);
         case AnimatedBoolean:
-            return std::make_unique<SVGAnimatedBooleanAnimator>(animationElement, contextElement);
+            return nullptr;
         case AnimatedColor:
             return std::make_unique<SVGAnimatedColorAnimator>(*animationElement, *contextElement);
         case AnimatedEnumeration:
index 44f0604..03c1add 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGGraphicsElement.h"
index 15e9959..8d695ca 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedString.h"
 #include "SVGElement.h"
index fc7c2a7..3ab4e99 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGGraphicsElement.h"
 
index 3a1e56d..af261b6 100644 (file)
@@ -29,22 +29,18 @@ namespace WebCore {
 
 SVGExternalResourcesRequired::SVGExternalResourcesRequired(SVGElement* contextElement)
     : m_contextElement(*contextElement)
+    , m_externalResourcesRequired(SVGAnimatedBoolean::create(contextElement))
 {
-    registerAttributes();
-}
-
-void SVGExternalResourcesRequired::registerAttributes()
-{
-    auto& registry = attributeRegistry();
-    if (!registry.isEmpty())
-        return;
-    registry.registerAttribute<SVGNames::externalResourcesRequiredAttr, &SVGEllipseElement::m_externalResourcesRequired>();
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [] {
+        PropertyRegistry::registerProperty<SVGNames::externalResourcesRequiredAttr, &SVGExternalResourcesRequired::m_externalResourcesRequired>();
+    });
 }
 
 void SVGExternalResourcesRequired::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == SVGNames::externalResourcesRequiredAttr)
-        setExternalResourcesRequired(value == "true");
+        m_externalResourcesRequired->setBaseValInternal(value == "true");
 }
 
 void SVGExternalResourcesRequired::svgAttributeChanged(const QualifiedName& attrName)
index 909cbaa..eaeb22a 100644 (file)
@@ -50,10 +50,8 @@ public:
 
     using PropertyRegistry = SVGPropertyOwnerRegistry<SVGExternalResourcesRequired>;
 
-    auto externalResourcesRequiredAnimated() { return m_externalResourcesRequired.animatedProperty(attributeOwnerProxy()); }
-
-    bool externalResourcesRequired() const { return m_externalResourcesRequired.value(); }
-    void setExternalResourcesRequired(bool externalResourcesRequired) { m_externalResourcesRequired.setValue(externalResourcesRequired); }
+    bool externalResourcesRequired() const { return m_externalResourcesRequired->currentValue(); }
+    SVGAnimatedBoolean& externalResourcesRequiredAnimated() { return m_externalResourcesRequired; }
 
 protected:
     SVGExternalResourcesRequired(SVGElement* contextElement);
@@ -73,11 +71,10 @@ protected:
     bool haveLoadedRequiredResources() const;
 
 private:
-    static void registerAttributes();
     AttributeOwnerProxy attributeOwnerProxy() { return { *this, m_contextElement }; }
     
     SVGElement& m_contextElement;
-    SVGAnimatedBooleanAttribute m_externalResourcesRequired;
+    Ref<SVGAnimatedBoolean> m_externalResourcesRequired;
 };
 
 } // namespace WebCore
index f9c41fd..da726d6 100644 (file)
@@ -46,6 +46,7 @@ inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const QualifiedNam
         PropertyRegistry::registerProperty<SVGNames::orderAttr, &SVGFEConvolveMatrixElement::m_orderX, &SVGFEConvolveMatrixElement::m_orderY>();
         PropertyRegistry::registerProperty<SVGNames::targetXAttr, &SVGFEConvolveMatrixElement::m_targetX>();
         PropertyRegistry::registerProperty<SVGNames::targetYAttr, &SVGFEConvolveMatrixElement::m_targetY>();
+        PropertyRegistry::registerProperty<SVGNames::preserveAlphaAttr, &SVGFEConvolveMatrixElement::m_preserveAlpha>();
     });
 }
 
@@ -79,7 +80,6 @@ void SVGFEConvolveMatrixElement::registerAttributes()
     registry.registerAttribute<SVGNames::kernelUnitLengthAttr,
         &SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthX,
         &SVGFEConvolveMatrixElement::kernelUnitLengthYIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthY>();
-    registry.registerAttribute<SVGNames::preserveAlphaAttr, &SVGFEConvolveMatrixElement::m_preserveAlpha>();
 }
 
 void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -152,9 +152,9 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const
 
     if (name == SVGNames::preserveAlphaAttr) {
         if (value == "true")
-            m_preserveAlpha.setValue(true);
+            m_preserveAlpha->setBaseValInternal(true);
         else if (value == "false")
-            m_preserveAlpha.setValue(false);
+            m_preserveAlpha->setBaseValInternal(false);
         else
             document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value  + "\". Filtered element will not be displayed.");
         return;
index f857362..a446f94 100644 (file)
@@ -78,7 +78,7 @@ public:
     EdgeModeType edgeMode() const { return m_edgeMode.currentValue(attributeOwnerProxy()); }
     float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); }
     float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); }
-    bool preserveAlpha() const { return m_preserveAlpha.currentValue(attributeOwnerProxy()); }
+    bool preserveAlpha() const { return m_preserveAlpha->currentValue(); }
 
     RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     SVGAnimatedInteger& orderXAnimated() { return m_orderX; }
@@ -91,7 +91,7 @@ public:
     RefPtr<SVGAnimatedEnumeration> edgeModeAnimated() { return m_edgeMode.animatedProperty(attributeOwnerProxy()); }
     RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); }
     RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); }
-    RefPtr<SVGAnimatedBoolean> preserveAlphaAnimated() { return m_preserveAlpha.animatedProperty(attributeOwnerProxy()); }
+    SVGAnimatedBoolean& preserveAlphaAnimated() { return m_preserveAlpha; }
 
 private:
     SVGFEConvolveMatrixElement(const QualifiedName&, Document&);
@@ -99,7 +99,8 @@ private:
     using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEConvolveMatrixElement, SVGFilterPrimitiveStandardAttributes>;
     static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     static void registerAttributes();
-    
+    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
+
     using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFEConvolveMatrixElement, SVGFilterPrimitiveStandardAttributes>;
     const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
 
@@ -108,7 +109,6 @@ private:
         return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
     }
 
-    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     void parseAttribute(const QualifiedName&, const AtomicString&) override;
     void svgAttributeChanged(const QualifiedName&) override;
 
@@ -131,7 +131,7 @@ private:
     SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { EDGEMODE_DUPLICATE };
     SVGAnimatedNumberAttribute m_kernelUnitLengthX;
     SVGAnimatedNumberAttribute m_kernelUnitLengthY;
-    SVGAnimatedBooleanAttribute m_preserveAlpha;
+    Ref<SVGAnimatedBoolean> m_preserveAlpha { SVGAnimatedBoolean::create(this) };
 };
 
 } // namespace WebCore
index cbd2098..550bf90 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "CachedImageClient.h"
 #include "CachedResourceHandle.h"
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFEImage.h"
index 38dfb2e..34a0da7 100644 (file)
@@ -24,7 +24,6 @@
 
 #if ENABLE(SVG_FONTS)
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGParserUtilities.h"
index a68b48f..799fc82 100644 (file)
@@ -19,7 +19,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGGraphicsElement.h"
index 4e38f12..62a2bd2 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGGraphicsElement.h"
 
index 08cb3fb..377c45e 100644 (file)
@@ -22,7 +22,6 @@
 #pragma once
 
 #include "Gradient.h"
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedTransformList.h"
 #include "SVGElement.h"
index 070a12f..25977ef 100644 (file)
@@ -20,7 +20,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedString.h"
 #include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
index 71b9a27..fb4971a 100644 (file)
@@ -22,7 +22,6 @@
 #pragma once
 
 #include "SVGAnimatedAngle.h"
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
index 19ed3f1..d86f623 100644 (file)
@@ -20,7 +20,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedLength.h"
 #include "SVGElement.h"
index 0a30019..2764858 100644 (file)
@@ -22,7 +22,6 @@
 #pragma once
 
 #include "Path.h"
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedNumber.h"
 #include "SVGAnimatedPath.h"
 #include "SVGExternalResourcesRequired.h"
index 17018b0..be35c11 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
index 9ad8134..a69747c 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGGeometryElement.h"
index fd01635..19dc5e0 100644 (file)
@@ -22,7 +22,6 @@
 #pragma once
 
 #include "FloatPoint.h"
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGAnimatedRect.h"
index 6f8fdde..6760ccd 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedString.h"
 #include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
index 2773190..9dac1be 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGGraphicsElement.h"
 
index 961b248..90a7bc3 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGAnimatedRect.h"
 #include "SVGElement.h"
index 53012fe..2b12838 100644 (file)
@@ -21,7 +21,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedLength.h"
 #include "SVGExternalResourcesRequired.h"
index 1fb4f94..d6edafe 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "CachedResourceHandle.h"
 #include "CachedSVGDocumentClient.h"
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGGraphicsElement.h"
index a81ffc3..f012cfa 100644 (file)
 namespace WebCore {
 
 template<typename OwnerType>
+class SVGAnimatedBooleanAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedBoolean> {
+    using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedBoolean>;
+    using Base::property;
+
+public:
+    using Base::Base;
+    template<Ref<SVGAnimatedBoolean> OwnerType::*property>
+    constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedBooleanAccessor, property>(); }
+
+private:
+    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    {
+        return SVGAnimatedBooleanAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
+    }
+
+    void appendAnimatedInstance(OwnerType& owner, SVGAttributeAnimator& animator) const final
+    {
+        static_cast<SVGAnimatedBooleanAnimator&>(animator).appendAnimatedInstance(property(owner));
+    }
+};
+
+template<typename OwnerType>
 class SVGAnimatedIntegerAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedInteger> {
     using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedInteger>;
 
index 5bb1578..af33456 100644 (file)
@@ -28,6 +28,7 @@
 #include "SVGAnimatedPropertyAnimator.h"
 #include "SVGAnimatedPropertyImpl.h"
 #include "SVGAnimationAdditiveValueFunctionImpl.h"
+#include "SVGAnimationDiscreteFunctionImpl.h"
 
 namespace WebCore {
 
@@ -36,6 +37,24 @@ class SVGAnimatedIntegerPairAnimator;
 template<typename AnimatedPropertyAnimator1, typename AnimatedPropertyAnimator2>
 class SVGAnimatedPropertyPairAnimator;
 
+class SVGAnimatedBooleanAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedBoolean, SVGAnimationBooleanFunction>  {
+    using Base = SVGAnimatedPropertyAnimator<SVGAnimatedBoolean, SVGAnimationBooleanFunction>;
+    using Base::Base;
+
+public:
+    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedBoolean>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
+    {
+        return std::unique_ptr<SVGAnimatedBooleanAnimator>(new SVGAnimatedBooleanAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
+    }
+
+private:
+    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) final
+    {
+        bool& animated = m_animated->animVal();
+        m_function.progress(targetElement, percentage, repeatCount, animated);
+    }
+};
+
 class SVGAnimatedIntegerAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedInteger, SVGAnimationIntegerFunction> {
     friend class SVGAnimatedPropertyPairAnimator<SVGAnimatedIntegerAnimator, SVGAnimatedIntegerAnimator>;
     friend class SVGAnimatedIntegerPairAnimator;
index 0129154..8ef7726 100644 (file)
@@ -26,7 +26,6 @@
 #pragma once
 
 #include "SVGAnimatedAngle.h"
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedLengthList.h"
@@ -41,6 +40,7 @@
 
 namespace WebCore {
 
+using SVGAnimatedBoolean = SVGAnimatedPrimitiveProperty<bool>;
 using SVGAnimatedInteger = SVGAnimatedPrimitiveProperty<int>;
 
 }
diff --git a/Source/WebCore/svg/properties/SVGAnimationDiscreteFunction.h b/Source/WebCore/svg/properties/SVGAnimationDiscreteFunction.h
new file mode 100644 (file)
index 0000000..96707bd
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2018-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
+
+namespace WebCore {
+
+template<typename ValueType>
+class SVGAnimationDiscreteFunction : public SVGAnimationFunction {
+public:
+    SVGAnimationDiscreteFunction(AnimationMode animationMode, CalcMode, bool, bool)
+        : SVGAnimationFunction(animationMode)
+    {
+    }
+
+    bool isDiscrete() const override { return true; }
+
+    void setToAtEndOfDurationValue(const String&) override
+    {
+        ASSERT_NOT_REACHED();
+    }
+
+    void setFromAndByValues(SVGElement*, const String&, const String&) override
+    {
+        ASSERT_NOT_REACHED();
+    }
+
+    void progress(SVGElement*, float percentage, unsigned, ValueType& animated)
+    {
+        if ((m_animationMode == AnimationMode::FromTo && percentage > 0.5) || m_animationMode == AnimationMode::To || percentage == 1)
+            animated = m_to;
+        else
+            animated = m_from;
+    }
+
+protected:
+    ValueType m_from;
+    ValueType m_to;
+};
+
+}
diff --git a/Source/WebCore/svg/properties/SVGAnimationDiscreteFunctionImpl.h b/Source/WebCore/svg/properties/SVGAnimationDiscreteFunctionImpl.h
new file mode 100644 (file)
index 0000000..a66290f
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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 "SVGAnimationDiscreteFunction.h"
+#include "SVGPropertyTraits.h"
+
+namespace WebCore {
+
+class SVGAnimationBooleanFunction : public SVGAnimationDiscreteFunction<bool> {
+public:
+    using Base = SVGAnimationDiscreteFunction<bool>;
+    using Base::Base;
+
+    void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+    {
+        m_from = SVGPropertyTraits<bool>::fromString(from);
+        m_to = SVGPropertyTraits<bool>::fromString(to);
+    }
+};
+
+}
index b0b3302..b2967db 100644 (file)
@@ -25,7 +25,6 @@
 
 #pragma once
 
-#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedLengthList.h"
@@ -67,12 +66,6 @@ public:
     }
 
     // Animatable attributes
-    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedBooleanAttribute OwnerType::*attribute>
-    void registerAttribute()
-    {
-        registerAttribute(SVGAnimatedBooleanAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
-    }
-
     template<const LazyNeverDestroyed<const QualifiedName>& attributeName, typename EnumType, SVGAnimatedEnumerationAttribute<EnumType> OwnerType::*attribute>
     void registerAttribute()
     {
index ef546ff..d12b392 100644 (file)
@@ -42,6 +42,12 @@ public:
     {
     }
 
+    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedBoolean> OwnerType::*property>
+    static void registerProperty()
+    {
+        registerProperty(attributeName, SVGAnimatedBooleanAccessor<OwnerType>::template singleton<property>());
+    }
+
     template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedInteger> OwnerType::*property>
     static void registerProperty()
     {