⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243121 in webkit


Ignore:
Timestamp:
Mar 18, 2019, 5:39:41 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Remove the SVG property tear off objects for SVGAnimatedBoolean
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):

Location:
trunk/Source/WebCore
Files:
34 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r243120 r243121  
     12019-03-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Remove the SVG property tear off objects for SVGAnimatedBoolean
     4        https://bugs.webkit.org/show_bug.cgi?id=195862
     5
     6        Reviewed by Simon Fraser.
     7
     8        -- SVGAnimatedBoolean will be defined as SVGAnimatedPrimitiveProperty<bool>.
     9        -- SVGAnimatedBooleanAccessor is added to access a member of this type.
     10        -- A function registerProperty() is added to SVGPropertyOwnerRegistry
     11           to register this type.
     12        -- SVGAnimatedBooleanAnimator is added to animate a member of this type.
     13        -- SVGAnimationBooleanFunction is added to handle the progress of this
     14           new type over a period of time.
     15
     16        SVGAnimationDiscreteFunction is the base class of SVGAnimationBooleanFunction.
     17        It will be the base class of all the discrete animation function types:
     18        string, bool, enum and PreserveAspectRatio types.
     19
     20        * Sources.txt:
     21        * WebCore.xcodeproj/project.pbxproj:
     22        * svg/SVGAnimationElement.h:
     23        * svg/SVGAnimatorFactory.h:
     24        (WebCore::SVGAnimatorFactory::create):
     25        * svg/SVGClipPathElement.h:
     26        * svg/SVGCursorElement.h:
     27        * svg/SVGDefsElement.h:
     28        * svg/SVGExternalResourcesRequired.cpp:
     29        (WebCore::SVGExternalResourcesRequired::SVGExternalResourcesRequired):
     30        (WebCore::SVGExternalResourcesRequired::parseAttribute):
     31        (WebCore::SVGExternalResourcesRequired::registerAttributes): Deleted.
     32        * svg/SVGExternalResourcesRequired.h:
     33        (WebCore::SVGExternalResourcesRequired::externalResourcesRequired const):
     34        (WebCore::SVGExternalResourcesRequired::externalResourcesRequiredAnimated):
     35        (WebCore::SVGExternalResourcesRequired::setExternalResourcesRequired): Deleted.
     36        * svg/SVGFEConvolveMatrixElement.cpp:
     37        (WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement):
     38        (WebCore::SVGFEConvolveMatrixElement::registerAttributes):
     39        (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
     40        * svg/SVGFEConvolveMatrixElement.h:
     41        * svg/SVGFEImageElement.h:
     42        * svg/SVGFontElement.h:
     43        * svg/SVGForeignObjectElement.h:
     44        * svg/SVGGElement.h:
     45        * svg/SVGGradientElement.h:
     46        * svg/SVGMPathElement.h:
     47        * svg/SVGMarkerElement.h:
     48        * svg/SVGMaskElement.h:
     49        * svg/SVGPathElement.h:
     50        * svg/SVGPatternElement.h:
     51        * svg/SVGRectElement.h:
     52        * svg/SVGSVGElement.h:
     53        * svg/SVGScriptElement.h:
     54        * svg/SVGSwitchElement.h:
     55        * svg/SVGSymbolElement.h:
     56        * svg/SVGTextContentElement.h:
     57        * svg/SVGUseElement.h:
     58        * svg/properties/SVGAnimatedPropertyAccessorImpl.h:
     59        * svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
     60        * svg/properties/SVGAnimatedPropertyImpl.h:
     61        * svg/properties/SVGAnimationDiscreteFunction.h: Added.
     62        (WebCore::SVGAnimationDiscreteFunction::SVGAnimationDiscreteFunction):
     63        (WebCore::SVGAnimationDiscreteFunction::progress):
     64        * svg/properties/SVGAnimationDiscreteFunctionImpl.h: Added.
     65        * svg/properties/SVGAttributeRegistry.h:
     66        * svg/properties/SVGPropertyOwnerRegistry.h:
     67        (WebCore::SVGPropertyOwnerRegistry::registerProperty):
     68
    1692019-03-18  Simon Fraser  <simon.fraser@apple.com>
    270
  • trunk/Source/WebCore/Sources.txt

    r243036 r243121  
    22712271svg/SVGAnimateTransformElement.cpp
    22722272svg/SVGAnimatedAngle.cpp
    2273 svg/SVGAnimatedBoolean.cpp
    22742273svg/SVGAnimatedColor.cpp
    22752274svg/SVGAnimatedEnumeration.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r243116 r243121  
    259259                0854B0231255E4E600B9CDD0 /* SVGRootInlineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B0111255E4E600B9CDD0 /* SVGRootInlineBox.h */; };
    260260                0854B0251255E4E600B9CDD0 /* SVGTextQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B0131255E4E600B9CDD0 /* SVGTextQuery.h */; };
    261                 085797091278394C00A8EC5F /* SVGAnimatedBoolean.h in Headers */ = {isa = PBXBuildFile; fileRef = 085797081278394C00A8EC5F /* SVGAnimatedBoolean.h */; };
    262261                085A15931289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */; };
    263262                085B92BB0EFDE73D00E6123C /* FormDataBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 085B92B90EFDE73D00E6123C /* FormDataBuilder.h */; settings = {ATTRIBUTES = (); }; };
     
    56305629                0854B0121255E4E600B9CDD0 /* SVGTextQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextQuery.cpp; sourceTree = "<group>"; };
    56315630                0854B0131255E4E600B9CDD0 /* SVGTextQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextQuery.h; sourceTree = "<group>"; };
    5632                 085797081278394C00A8EC5F /* SVGAnimatedBoolean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedBoolean.h; sourceTree = "<group>"; };
    56335631                085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedTransformListPropertyTearOff.h; sourceTree = "<group>"; };
    56345632                085B92B80EFDE73D00E6123C /* FormDataBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormDataBuilder.cpp; sourceTree = "<group>"; };
     
    75827580                431A2FD613B7707A007791E4 /* SVGAnimatedLengthList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedLengthList.cpp; sourceTree = "<group>"; };
    75837581                431A302013B89DCC007791E4 /* SVGAnimatedPreserveAspectRatio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPreserveAspectRatio.cpp; sourceTree = "<group>"; };
    7584                 431A308713B8F978007791E4 /* SVGAnimatedBoolean.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedBoolean.cpp; sourceTree = "<group>"; };
    75857582                432D3FE718A8658400D7DC03 /* SelectorCheckerTestFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorCheckerTestFunctions.h; sourceTree = "<group>"; };
    75867583                4331AC7713B6870000A9E5AE /* SVGAnimatedNumberList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumberList.cpp; sourceTree = "<group>"; };
     
    86828679                55D70D21223B00BB00044B8E /* SVGLegacyAnimatedProperty.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLegacyAnimatedProperty.cpp; sourceTree = "<group>"; };
    86838680                55D70D22223B00EA00044B8E /* SVGLegacyProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLegacyProperty.h; sourceTree = "<group>"; };
     8681                55DCC51C2240605E00C26E32 /* SVGAnimationDiscreteFunctionImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationDiscreteFunctionImpl.h; sourceTree = "<group>"; };
     8682                55DCC51D2240615500C26E32 /* SVGAnimationDiscreteFunction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationDiscreteFunction.h; sourceTree = "<group>"; };
    86848683                55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaintFrequencyTracker.h; sourceTree = "<group>"; };
    86858684                55EE5354223B29E900FBA944 /* SVGMemberAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMemberAccessor.h; sourceTree = "<group>"; };
     
    1623116230                                55EE535E223B2A0E00FBA944 /* SVGAnimationAdditiveValueFunction.h */,
    1623216231                                55BE0259223B29C10032F08A /* SVGAnimationAdditiveValueFunctionImpl.h */,
     16232                                55DCC51D2240615500C26E32 /* SVGAnimationDiscreteFunction.h */,
     16233                                55DCC51C2240605E00C26E32 /* SVGAnimationDiscreteFunctionImpl.h */,
    1623316234                                55BE025B223B29C20032F08A /* SVGAnimationFunction.h */,
    1623416235                                55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */,
     
    2411324114                                087B84951272CEC700A14417 /* SVGAnimatedAngle.h */,
    2411424115                                B22277E60D00BF1F0071B782 /* SVGAnimatedAngle.idl */,
    24115                                 431A308713B8F978007791E4 /* SVGAnimatedBoolean.cpp */,
    24116                                 085797081278394C00A8EC5F /* SVGAnimatedBoolean.h */,
    2411724116                                B22277E70D00BF1F0071B782 /* SVGAnimatedBoolean.idl */,
    2411824117                                43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */,
     
    3191131910                                B222797A0D00BF220071B782 /* SVGAnimateColorElement.h in Headers */,
    3191231911                                087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */,
    31913                                 085797091278394C00A8EC5F /* SVGAnimatedBoolean.h in Headers */,
    3191431912                                43A625F813B3304000AC94B8 /* SVGAnimatedColor.h in Headers */,
    3191531913                                08D46CE3127AD5FC0089694B /* SVGAnimatedEnumeration.h in Headers */,
  • trunk/Source/WebCore/svg/SVGAnimationElement.h

    r243114 r243121  
    2525#pragma once
    2626
    27 #include "SVGAnimatedBoolean.h"
    2827#include "SVGExternalResourcesRequired.h"
    2928#include "SVGSMILElement.h"
  • trunk/Source/WebCore/svg/SVGAnimatorFactory.h

    r243036 r243121  
    2121
    2222#include "SVGAnimatedAngle.h"
    23 #include "SVGAnimatedBoolean.h"
    2423#include "SVGAnimatedColor.h"
    2524#include "SVGAnimatedEnumeration.h"
     
    5150            return std::make_unique<SVGAnimatedAngleAnimator>(animationElement, contextElement);
    5251        case AnimatedBoolean:
    53             return std::make_unique<SVGAnimatedBooleanAnimator>(animationElement, contextElement);
     52            return nullptr;
    5453        case AnimatedColor:
    5554            return std::make_unique<SVGAnimatedColorAnimator>(*animationElement, *contextElement);
  • trunk/Source/WebCore/svg/SVGClipPathElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGAnimatedEnumeration.h"
    2625#include "SVGExternalResourcesRequired.h"
  • trunk/Source/WebCore/svg/SVGCursorElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGAnimatedLength.h"
    2625#include "SVGAnimatedString.h"
  • trunk/Source/WebCore/svg/SVGDefsElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGExternalResourcesRequired.h"
    2625#include "SVGGraphicsElement.h"
  • trunk/Source/WebCore/svg/SVGExternalResourcesRequired.cpp

    r234620 r243121  
    3030SVGExternalResourcesRequired::SVGExternalResourcesRequired(SVGElement* contextElement)
    3131    : m_contextElement(*contextElement)
     32    , m_externalResourcesRequired(SVGAnimatedBoolean::create(contextElement))
    3233{
    33     registerAttributes();
    34 }
    35 
    36 void SVGExternalResourcesRequired::registerAttributes()
    37 {
    38     auto& registry = attributeRegistry();
    39     if (!registry.isEmpty())
    40         return;
    41     registry.registerAttribute<SVGNames::externalResourcesRequiredAttr, &SVGEllipseElement::m_externalResourcesRequired>();
     34    static std::once_flag onceFlag;
     35    std::call_once(onceFlag, [] {
     36        PropertyRegistry::registerProperty<SVGNames::externalResourcesRequiredAttr, &SVGExternalResourcesRequired::m_externalResourcesRequired>();
     37    });
    4238}
    4339
     
    4541{
    4642    if (name == SVGNames::externalResourcesRequiredAttr)
    47         setExternalResourcesRequired(value == "true");
     43        m_externalResourcesRequired->setBaseValInternal(value == "true");
    4844}
    4945
  • trunk/Source/WebCore/svg/SVGExternalResourcesRequired.h

    r243114 r243121  
    5151    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGExternalResourcesRequired>;
    5252
    53     auto externalResourcesRequiredAnimated() { return m_externalResourcesRequired.animatedProperty(attributeOwnerProxy()); }
    54 
    55     bool externalResourcesRequired() const { return m_externalResourcesRequired.value(); }
    56     void setExternalResourcesRequired(bool externalResourcesRequired) { m_externalResourcesRequired.setValue(externalResourcesRequired); }
     53    bool externalResourcesRequired() const { return m_externalResourcesRequired->currentValue(); }
     54    SVGAnimatedBoolean& externalResourcesRequiredAnimated() { return m_externalResourcesRequired; }
    5755
    5856protected:
     
    7472
    7573private:
    76     static void registerAttributes();
    7774    AttributeOwnerProxy attributeOwnerProxy() { return { *this, m_contextElement }; }
    7875   
    7976    SVGElement& m_contextElement;
    80     SVGAnimatedBooleanAttribute m_externalResourcesRequired;
     77    Ref<SVGAnimatedBoolean> m_externalResourcesRequired;
    8178};
    8279
  • trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp

    r243036 r243121  
    4747        PropertyRegistry::registerProperty<SVGNames::targetXAttr, &SVGFEConvolveMatrixElement::m_targetX>();
    4848        PropertyRegistry::registerProperty<SVGNames::targetYAttr, &SVGFEConvolveMatrixElement::m_targetY>();
     49        PropertyRegistry::registerProperty<SVGNames::preserveAlphaAttr, &SVGFEConvolveMatrixElement::m_preserveAlpha>();
    4950    });
    5051}
     
    8081        &SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthX,
    8182        &SVGFEConvolveMatrixElement::kernelUnitLengthYIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthY>();
    82     registry.registerAttribute<SVGNames::preserveAlphaAttr, &SVGFEConvolveMatrixElement::m_preserveAlpha>();
    8383}
    8484
     
    153153    if (name == SVGNames::preserveAlphaAttr) {
    154154        if (value == "true")
    155             m_preserveAlpha.setValue(true);
     155            m_preserveAlpha->setBaseValInternal(true);
    156156        else if (value == "false")
    157             m_preserveAlpha.setValue(false);
     157            m_preserveAlpha->setBaseValInternal(false);
    158158        else
    159159            document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value  + "\". Filtered element will not be displayed.");
  • trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h

    r243114 r243121  
    7979    float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); }
    8080    float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); }
    81     bool preserveAlpha() const { return m_preserveAlpha.currentValue(attributeOwnerProxy()); }
     81    bool preserveAlpha() const { return m_preserveAlpha->currentValue(); }
    8282
    8383    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     
    9292    RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); }
    9393    RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); }
    94     RefPtr<SVGAnimatedBoolean> preserveAlphaAnimated() { return m_preserveAlpha.animatedProperty(attributeOwnerProxy()); }
     94    SVGAnimatedBoolean& preserveAlphaAnimated() { return m_preserveAlpha; }
    9595
    9696private:
     
    100100    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
    101101    static void registerAttributes();
    102    
     102    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     103
    103104    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFEConvolveMatrixElement, SVGFilterPrimitiveStandardAttributes>;
    104105    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
     
    109110    }
    110111
    111     const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    112112    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    113113    void svgAttributeChanged(const QualifiedName&) override;
     
    132132    SVGAnimatedNumberAttribute m_kernelUnitLengthX;
    133133    SVGAnimatedNumberAttribute m_kernelUnitLengthY;
    134     SVGAnimatedBooleanAttribute m_preserveAlpha;
     134    Ref<SVGAnimatedBoolean> m_preserveAlpha { SVGAnimatedBoolean::create(this) };
    135135};
    136136
  • trunk/Source/WebCore/svg/SVGFEImageElement.h

    r243114 r243121  
    2424#include "CachedImageClient.h"
    2525#include "CachedResourceHandle.h"
    26 #include "SVGAnimatedBoolean.h"
    2726#include "SVGAnimatedPreserveAspectRatio.h"
    2827#include "SVGExternalResourcesRequired.h"
  • trunk/Source/WebCore/svg/SVGFontElement.h

    r243114 r243121  
    2525#if ENABLE(SVG_FONTS)
    2626
    27 #include "SVGAnimatedBoolean.h"
    2827#include "SVGElement.h"
    2928#include "SVGExternalResourcesRequired.h"
  • trunk/Source/WebCore/svg/SVGForeignObjectElement.h

    r243114 r243121  
    2020#pragma once
    2121
    22 #include "SVGAnimatedBoolean.h"
    2322#include "SVGAnimatedLength.h"
    2423#include "SVGExternalResourcesRequired.h"
  • trunk/Source/WebCore/svg/SVGGElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGExternalResourcesRequired.h"
    2625#include "SVGGraphicsElement.h"
  • trunk/Source/WebCore/svg/SVGGradientElement.h

    r243114 r243121  
    2323
    2424#include "Gradient.h"
    25 #include "SVGAnimatedBoolean.h"
    2625#include "SVGAnimatedEnumeration.h"
    2726#include "SVGAnimatedTransformList.h"
  • trunk/Source/WebCore/svg/SVGMPathElement.h

    r243114 r243121  
    2121#pragma once
    2222
    23 #include "SVGAnimatedBoolean.h"
    2423#include "SVGAnimatedString.h"
    2524#include "SVGElement.h"
  • trunk/Source/WebCore/svg/SVGMarkerElement.h

    r243114 r243121  
    2323
    2424#include "SVGAnimatedAngle.h"
    25 #include "SVGAnimatedBoolean.h"
    2625#include "SVGAnimatedEnumeration.h"
    2726#include "SVGAnimatedLength.h"
  • trunk/Source/WebCore/svg/SVGMaskElement.h

    r243114 r243121  
    2121#pragma once
    2222
    23 #include "SVGAnimatedBoolean.h"
    2423#include "SVGAnimatedEnumeration.h"
    2524#include "SVGAnimatedLength.h"
  • trunk/Source/WebCore/svg/SVGPathElement.h

    r243114 r243121  
    2323
    2424#include "Path.h"
    25 #include "SVGAnimatedBoolean.h"
    2625#include "SVGAnimatedNumber.h"
    2726#include "SVGAnimatedPath.h"
  • trunk/Source/WebCore/svg/SVGPatternElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGAnimatedEnumeration.h"
    2625#include "SVGAnimatedLength.h"
  • trunk/Source/WebCore/svg/SVGRectElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGAnimatedLength.h"
    2625#include "SVGExternalResourcesRequired.h"
  • trunk/Source/WebCore/svg/SVGSVGElement.h

    r243114 r243121  
    2323
    2424#include "FloatPoint.h"
    25 #include "SVGAnimatedBoolean.h"
    2625#include "SVGAnimatedLength.h"
    2726#include "SVGAnimatedPreserveAspectRatio.h"
  • trunk/Source/WebCore/svg/SVGScriptElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGAnimatedString.h"
    2625#include "SVGElement.h"
  • trunk/Source/WebCore/svg/SVGSwitchElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGExternalResourcesRequired.h"
    2625#include "SVGGraphicsElement.h"
  • trunk/Source/WebCore/svg/SVGSymbolElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGAnimatedPreserveAspectRatio.h"
    2625#include "SVGAnimatedRect.h"
  • trunk/Source/WebCore/svg/SVGTextContentElement.h

    r243114 r243121  
    2222#pragma once
    2323
    24 #include "SVGAnimatedBoolean.h"
    2524#include "SVGAnimatedEnumeration.h"
    2625#include "SVGAnimatedLength.h"
  • trunk/Source/WebCore/svg/SVGUseElement.h

    r243114 r243121  
    2424#include "CachedResourceHandle.h"
    2525#include "CachedSVGDocumentClient.h"
    26 #include "SVGAnimatedBoolean.h"
    2726#include "SVGAnimatedLength.h"
    2827#include "SVGExternalResourcesRequired.h"
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h

    r243036 r243121  
    3434
    3535template<typename OwnerType>
     36class SVGAnimatedBooleanAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedBoolean> {
     37    using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedBoolean>;
     38    using Base::property;
     39
     40public:
     41    using Base::Base;
     42    template<Ref<SVGAnimatedBoolean> OwnerType::*property>
     43    constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedBooleanAccessor, property>(); }
     44
     45private:
     46    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     47    {
     48        return SVGAnimatedBooleanAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     49    }
     50
     51    void appendAnimatedInstance(OwnerType& owner, SVGAttributeAnimator& animator) const final
     52    {
     53        static_cast<SVGAnimatedBooleanAnimator&>(animator).appendAnimatedInstance(property(owner));
     54    }
     55};
     56
     57template<typename OwnerType>
    3658class SVGAnimatedIntegerAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedInteger> {
    3759    using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedInteger>;
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h

    r243036 r243121  
    2929#include "SVGAnimatedPropertyImpl.h"
    3030#include "SVGAnimationAdditiveValueFunctionImpl.h"
     31#include "SVGAnimationDiscreteFunctionImpl.h"
    3132
    3233namespace WebCore {
     
    3637template<typename AnimatedPropertyAnimator1, typename AnimatedPropertyAnimator2>
    3738class SVGAnimatedPropertyPairAnimator;
     39
     40class SVGAnimatedBooleanAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedBoolean, SVGAnimationBooleanFunction>  {
     41    using Base = SVGAnimatedPropertyAnimator<SVGAnimatedBoolean, SVGAnimationBooleanFunction>;
     42    using Base::Base;
     43
     44public:
     45    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedBoolean>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     46    {
     47        return std::unique_ptr<SVGAnimatedBooleanAnimator>(new SVGAnimatedBooleanAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     48    }
     49
     50private:
     51    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) final
     52    {
     53        bool& animated = m_animated->animVal();
     54        m_function.progress(targetElement, percentage, repeatCount, animated);
     55    }
     56};
    3857
    3958class SVGAnimatedIntegerAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedInteger, SVGAnimationIntegerFunction> {
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h

    r243036 r243121  
    2727
    2828#include "SVGAnimatedAngle.h"
    29 #include "SVGAnimatedBoolean.h"
    3029#include "SVGAnimatedEnumeration.h"
    3130#include "SVGAnimatedLength.h"
     
    4241namespace WebCore {
    4342
     43using SVGAnimatedBoolean = SVGAnimatedPrimitiveProperty<bool>;
    4444using SVGAnimatedInteger = SVGAnimatedPrimitiveProperty<int>;
    4545
  • trunk/Source/WebCore/svg/properties/SVGAnimationDiscreteFunction.h

    r243120 r243121  
    2626#pragma once
    2727
    28 #include "SVGAnimatedAngle.h"
    29 #include "SVGAnimatedBoolean.h"
    30 #include "SVGAnimatedEnumeration.h"
    31 #include "SVGAnimatedLength.h"
    32 #include "SVGAnimatedLengthList.h"
    33 #include "SVGAnimatedNumber.h"
    34 #include "SVGAnimatedNumberList.h"
    35 #include "SVGAnimatedPointList.h"
    36 #include "SVGAnimatedPreserveAspectRatio.h"
    37 #include "SVGAnimatedPrimitiveProperty.h"
    38 #include "SVGAnimatedRect.h"
    39 #include "SVGAnimatedString.h"
    40 #include "SVGAnimatedTransformList.h"
    41 
    4228namespace WebCore {
    4329
    44 using SVGAnimatedInteger = SVGAnimatedPrimitiveProperty<int>;
     30template<typename ValueType>
     31class SVGAnimationDiscreteFunction : public SVGAnimationFunction {
     32public:
     33    SVGAnimationDiscreteFunction(AnimationMode animationMode, CalcMode, bool, bool)
     34        : SVGAnimationFunction(animationMode)
     35    {
     36    }
     37
     38    bool isDiscrete() const override { return true; }
     39
     40    void setToAtEndOfDurationValue(const String&) override
     41    {
     42        ASSERT_NOT_REACHED();
     43    }
     44
     45    void setFromAndByValues(SVGElement*, const String&, const String&) override
     46    {
     47        ASSERT_NOT_REACHED();
     48    }
     49
     50    void progress(SVGElement*, float percentage, unsigned, ValueType& animated)
     51    {
     52        if ((m_animationMode == AnimationMode::FromTo && percentage > 0.5) || m_animationMode == AnimationMode::To || percentage == 1)
     53            animated = m_to;
     54        else
     55            animated = m_from;
     56    }
     57
     58protected:
     59    ValueType m_from;
     60    ValueType m_to;
     61};
    4562
    4663}
  • trunk/Source/WebCore/svg/properties/SVGAnimationDiscreteFunctionImpl.h

    r243120 r243121  
    11/*
    2  * Copyright (C) 2018-2019 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2019 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626#pragma once
    2727
    28 #include "SVGAnimatedAngle.h"
    29 #include "SVGAnimatedBoolean.h"
    30 #include "SVGAnimatedEnumeration.h"
    31 #include "SVGAnimatedLength.h"
    32 #include "SVGAnimatedLengthList.h"
    33 #include "SVGAnimatedNumber.h"
    34 #include "SVGAnimatedNumberList.h"
    35 #include "SVGAnimatedPointList.h"
    36 #include "SVGAnimatedPreserveAspectRatio.h"
    37 #include "SVGAnimatedPrimitiveProperty.h"
    38 #include "SVGAnimatedRect.h"
    39 #include "SVGAnimatedString.h"
    40 #include "SVGAnimatedTransformList.h"
     28#include "SVGAnimationDiscreteFunction.h"
     29#include "SVGPropertyTraits.h"
    4130
    4231namespace WebCore {
    4332
    44 using SVGAnimatedInteger = SVGAnimatedPrimitiveProperty<int>;
     33class SVGAnimationBooleanFunction : public SVGAnimationDiscreteFunction<bool> {
     34public:
     35    using Base = SVGAnimationDiscreteFunction<bool>;
     36    using Base::Base;
     37
     38    void setFromAndToValues(SVGElement*, const String& from, const String& to) override
     39    {
     40        m_from = SVGPropertyTraits<bool>::fromString(from);
     41        m_to = SVGPropertyTraits<bool>::fromString(to);
     42    }
     43};
    4544
    4645}
  • trunk/Source/WebCore/svg/properties/SVGAttributeRegistry.h

    r243036 r243121  
    2626#pragma once
    2727
    28 #include "SVGAnimatedBoolean.h"
    2928#include "SVGAnimatedEnumeration.h"
    3029#include "SVGAnimatedLength.h"
     
    6867
    6968    // Animatable attributes
    70     template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedBooleanAttribute OwnerType::*attribute>
    71     void registerAttribute()
    72     {
    73         registerAttribute(SVGAnimatedBooleanAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
    74     }
    75 
    7669    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, typename EnumType, SVGAnimatedEnumerationAttribute<EnumType> OwnerType::*attribute>
    7770    void registerAttribute()
  • trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h

    r243036 r243121  
    4343    }
    4444
     45    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedBoolean> OwnerType::*property>
     46    static void registerProperty()
     47    {
     48        registerProperty(attributeName, SVGAnimatedBooleanAccessor<OwnerType>::template singleton<property>());
     49    }
     50
    4551    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedInteger> OwnerType::*property>
    4652    static void registerProperty()
Note: See TracChangeset for help on using the changeset viewer.