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

Changeset 234620 in webkit


Ignore:
Timestamp:
Aug 6, 2018, 2:08:53 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Remove the SVG elements' attributes macros
https://bugs.webkit.org/show_bug.cgi?id=186751

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2018-08-06
Reviewed by Simon Fraser.

This is how the SVG attributes are implemented after removing the SVG macros:

1) The SVG attribute is defined as a super class of SVGAttribute. The super

classes of SVGAttribute are template classes. The type of these template
are the property type or the TearOff type.

2) To unify accessing attributes of the SVGElements and its super classes

an SVGAttributeAccessor template class is added. It is inherited by other
template classes. The types of these templates are the owner and the
attributes types. The main functions of these classes is to synchronize
the new property value with the document attributes pool and to create
and cache the TearOff objects.

3) To make code shorter and more readable, attribute types and attribute

accessors are defined for every SVG TearOff type, e.g.
-- SVGLength:

SVGAnimatedLengthAttribute and SVGAnimatedLengthAttributeAccessor

-- SVGAnimatedNumber:

SVGAnimatedNumberAttribute and SVGAnimatedNumberAttributeAccessor

4) A special accessor is defined for animated pair and optional attributes:

SVGAnimatedPairAttributeAccessor, e.g.
-- SVGMarkerElement:

orient attribute: "angle" or "type"

-- SVGFEGaussianBlurElement:

stdDeviation attribute: "x" and "y"

5) The SVG attributes have to be registered into an singleton SVGAttributeRegistry.

The SVGAttributeRegistry is a template class. The types of this template
class are the the type of the owner and the base classes of this owner.
This registry holds a map from "attribute name" to "attribute accessor".

6) To make the code easier to read, the SVGAttributeRegistry implements

registerAttribute() for different attribute types. The owner needs only
to provide the attribute name and a pointer to the class member of this
attribute to the same function "registerAttribute()". The compiler will
pick the right function to call based on the type of the attribute.

7) Given a reference to the owner element, SVGAttributeRegistry can loop

through the attributes of this owner and through the attributes of its
base classes as well to do operations like synchronizing all the attributes
or creating the TearOff object of a certain attribute.

8) To make the base class SVGElement have the ability to access the attributes

of any of its super classes, SVGAttributeOwnerProxy will be used.
SVGAttributeOwnerProxy is a base class which have all the functions that
SVGElement needs as pure virtual functions.

9) SVGAttributeOwnerProxyImpl is a template class which implements

SVGAttributeOwnerProxy and whose types are the owner and its base classes.
SVGAttributeOwnerProxyImpl keeps a reference to the owner and the context
SVGElement.

10) All the SVG attribute owners have to implement the virtual function

attributeOwnerProxy() which returns a reference to SVGAttributeOwnerProxy.
The local attributeOwnerProxy() returns a reference to a local
SVGAttributeOwnerProxyImpl. Its type and base types are the class
hierarchy of this element.

All the attributes of the non-SVGElement-based classes are moved as members
of these classes instead of adding them to all the super classes. These
classes are:

-- SVGExternalResourcesRequired
-- SVGURIReference
-- SVGFitToViewBox
-- SVGZoomAndPan
-- SVGLangSpace

The svgAttributeChanged() of all the SVGElement-based classes are now
simplified by distributing the responsibilities of changing an attribute
to the base classes. One exception is the SVGURIReference since the action
to be taken when changing the "href" is different for every super class.

Other work will be done in separate patches.

-- Shrinking the memory of the SVGElements.
-- Making all the attributes RefCounted objects.

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • rendering/svg/RenderSVGResourceMarker.cpp:

(WebCore::RenderSVGResourceMarker::draw):

  • svg/SVGAElement.cpp:

(WebCore::SVGAElement::SVGAElement):
(WebCore::SVGAElement::registerAttributes):
(WebCore::SVGAElement::parseAttribute):
(WebCore::SVGAElement::svgAttributeChanged):

  • svg/SVGAElement.h:
  • svg/SVGAElement.idl:
  • svg/SVGAltGlyphElement.cpp:

(WebCore::SVGAltGlyphElement::SVGAltGlyphElement):

  • svg/SVGAltGlyphElement.h:
  • svg/SVGAnimatedAngle.h:
  • svg/SVGAnimatedBoolean.h:
  • svg/SVGAnimatedEnumeration.h:
  • svg/SVGAnimatedInteger.h:
  • svg/SVGAnimatedLength.h:
  • svg/SVGAnimatedLengthList.h:
  • svg/SVGAnimatedNumber.h:
  • svg/SVGAnimatedNumberList.h:
  • svg/SVGAnimatedPath.h:
  • svg/SVGAnimatedPointList.h:
  • svg/SVGAnimatedPreserveAspectRatio.h:
  • svg/SVGAnimatedRect.h:
  • svg/SVGAnimatedString.h:
  • svg/SVGAnimatedTransformList.h:
  • svg/SVGAnimatedTypeAnimator.cpp:

(WebCore::SVGAnimatedTypeAnimator::findAnimatedPropertiesForAttributeName):

  • svg/SVGAnimationElement.cpp:

(WebCore::SVGAnimationElement::SVGAnimationElement):
(WebCore::SVGAnimationElement::requiredFeatures): Deleted.
(WebCore::SVGAnimationElement::requiredExtensions): Deleted.
(WebCore::SVGAnimationElement::systemLanguage): Deleted.

  • svg/SVGAnimationElement.h:

(WebCore::SVGAnimationElement::attributeRegistry):

  • svg/SVGCircleElement.cpp:

(WebCore::SVGCircleElement::SVGCircleElement):
(WebCore::SVGCircleElement::registerAttributes):
(WebCore::SVGCircleElement::parseAttribute):
(WebCore::SVGCircleElement::svgAttributeChanged):

  • svg/SVGCircleElement.h:
  • svg/SVGClipPathElement.cpp:

(WebCore::SVGClipPathElement::SVGClipPathElement):
(WebCore::SVGClipPathElement::registerAttributes):
(WebCore::SVGClipPathElement::parseAttribute):
(WebCore::SVGClipPathElement::svgAttributeChanged):
(WebCore::SVGClipPathElement::isSupportedAttribute): Deleted.

  • svg/SVGClipPathElement.h:
  • svg/SVGComponentTransferFunctionElement.cpp:

(WebCore::SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement):
(WebCore::SVGComponentTransferFunctionElement::registerAttributes):
(WebCore::SVGComponentTransferFunctionElement::parseAttribute):
(WebCore::SVGComponentTransferFunctionElement::svgAttributeChanged):
(WebCore::SVGComponentTransferFunctionElement::transferFunction const):
(WebCore::SVGComponentTransferFunctionElement::isSupportedAttribute): Deleted.

  • svg/SVGComponentTransferFunctionElement.h:

(WebCore::SVGComponentTransferFunctionElement::type const):
(WebCore::SVGComponentTransferFunctionElement::tableValues const):
(WebCore::SVGComponentTransferFunctionElement::slope const):
(WebCore::SVGComponentTransferFunctionElement::intercept const):
(WebCore::SVGComponentTransferFunctionElement::amplitude const):
(WebCore::SVGComponentTransferFunctionElement::exponent const):
(WebCore::SVGComponentTransferFunctionElement::offset const):
(WebCore::SVGComponentTransferFunctionElement::typeAnimated):
(WebCore::SVGComponentTransferFunctionElement::tableValuesAnimated):
(WebCore::SVGComponentTransferFunctionElement::slopeAnimated):
(WebCore::SVGComponentTransferFunctionElement::interceptAnimated):
(WebCore::SVGComponentTransferFunctionElement::amplitudeAnimated):
(WebCore::SVGComponentTransferFunctionElement::exponentAnimated):
(WebCore::SVGComponentTransferFunctionElement::offsetAnimated):
(WebCore::SVGComponentTransferFunctionElement::attributeRegistry):
(WebCore::SVGComponentTransferFunctionElement::isKnownAttribute):

  • svg/SVGCursorElement.cpp:

(WebCore::SVGCursorElement::SVGCursorElement):
(WebCore::SVGCursorElement::registerAttributes):
(WebCore::SVGCursorElement::parseAttribute):
(WebCore::SVGCursorElement::svgAttributeChanged):
(WebCore::SVGCursorElement::isSupportedAttribute): Deleted.
(WebCore::SVGCursorElement::requiredFeatures): Deleted.
(WebCore::SVGCursorElement::requiredExtensions): Deleted.
(WebCore::SVGCursorElement::systemLanguage): Deleted.

  • svg/SVGCursorElement.h:
  • svg/SVGDefsElement.cpp:

(WebCore::SVGDefsElement::SVGDefsElement):

  • svg/SVGDefsElement.h:
  • svg/SVGElement.cpp:

(WebCore::SVGElement::SVGElement):
(WebCore::SVGElement::registerAttributes):
(WebCore::SVGElement::parseAttribute):
(WebCore::SVGElement::animatedPropertyTypesForAttribute):
(WebCore::SVGElement::synchronizeAllAnimatedSVGAttribute):
(WebCore::SVGElement::synchronizeAnimatedSVGAttribute const):
(WebCore::SVGElement::isPresentationAttributeWithSVGDOM):
(WebCore::SVGElement::svgAttributeChanged):
(WebCore::SVGElement::synchronizeRequiredFeatures): Deleted.
(WebCore::SVGElement::synchronizeRequiredExtensions): Deleted.
(WebCore::SVGElement::synchronizeSystemLanguage): Deleted.
(WebCore::SVGElement::isKnownAttribute): Deleted.

  • svg/SVGElement.h:

(WebCore::SVGElement::attributeRegistry):
(WebCore::SVGElement::isKnownAttribute):
(WebCore::SVGElement::attributeOwnerProxy const):
(WebCore::SVGElement::synchronizeAttribute):
(WebCore::SVGElement::synchronizeAttributes):
(WebCore::SVGElement::animatedTypes const):
(WebCore::SVGElement::lookupAnimatedProperty const):
(WebCore::SVGElement::lookupOrCreateAnimatedProperty):
(WebCore::SVGElement::lookupOrCreateAnimatedProperties):
(WebCore::SVGElement::className const):
(WebCore::SVGElement::classNameAnimated):
(WebCore::SVGElement::synchronizeRequiredFeatures): Deleted.
(WebCore::SVGElement::synchronizeRequiredExtensions): Deleted.
(WebCore::SVGElement::synchronizeSystemLanguage): Deleted.

  • svg/SVGEllipseElement.cpp:

(WebCore::SVGEllipseElement::SVGEllipseElement):
(WebCore::SVGEllipseElement::registerAttributes):
(WebCore::SVGEllipseElement::parseAttribute):
(WebCore::SVGEllipseElement::svgAttributeChanged):

  • svg/SVGEllipseElement.h:
  • svg/SVGExternalResourcesRequired.cpp:

(WebCore::SVGExternalResourcesRequired::SVGExternalResourcesRequired):
(WebCore::SVGExternalResourcesRequired::registerAttributes):
(WebCore::SVGExternalResourcesRequired::parseAttribute):
(WebCore::SVGExternalResourcesRequired::svgAttributeChanged):
(WebCore::SVGExternalResourcesRequired::addSupportedAttributes):
(WebCore::SVGExternalResourcesRequired::dispatchLoadEvent):
(WebCore::SVGExternalResourcesRequired::insertedIntoDocument):
(WebCore::SVGExternalResourcesRequired::finishParsingChildren):
(WebCore::SVGExternalResourcesRequired::haveLoadedRequiredResources const):
(WebCore::SVGExternalResourcesRequired::isKnownAttribute): Deleted.
(WebCore::SVGExternalResourcesRequired::handleAttributeChange): Deleted.

  • svg/SVGExternalResourcesRequired.h:

(WebCore::SVGExternalResourcesRequired::attributeRegistry):
(WebCore::SVGExternalResourcesRequired::externalResourcesRequiredAnimated):
(WebCore::SVGExternalResourcesRequired::externalResourcesRequired const):
(WebCore::SVGExternalResourcesRequired::setExternalResourcesRequired):
(WebCore::SVGExternalResourcesRequired::isKnownAttribute):
(WebCore::SVGExternalResourcesRequired::attributeOwnerProxy):

  • svg/SVGFEBlendElement.cpp:

(WebCore::SVGFEBlendElement::SVGFEBlendElement):
(WebCore::SVGFEBlendElement::registerAttributes):
(WebCore::SVGFEBlendElement::parseAttribute):

  • svg/SVGFEBlendElement.h:
  • svg/SVGFEColorMatrixElement.cpp:

(WebCore::SVGFEColorMatrixElement::SVGFEColorMatrixElement):
(WebCore::SVGFEColorMatrixElement::registerAttributes):
(WebCore::SVGFEColorMatrixElement::parseAttribute):

  • svg/SVGFEColorMatrixElement.h:
  • svg/SVGFEComponentTransferElement.cpp:

(WebCore::SVGFEComponentTransferElement::SVGFEComponentTransferElement):
(WebCore::SVGFEComponentTransferElement::registerAttributes):
(WebCore::SVGFEComponentTransferElement::parseAttribute):

  • svg/SVGFEComponentTransferElement.h:
  • svg/SVGFECompositeElement.cpp:

(WebCore::SVGFECompositeElement::SVGFECompositeElement):
(WebCore::SVGFECompositeElement::registerAttributes):
(WebCore::SVGFECompositeElement::parseAttribute):

  • svg/SVGFECompositeElement.h:
  • svg/SVGFEConvolveMatrixElement.cpp:

(WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement):
(WebCore::SVGFEConvolveMatrixElement::registerAttributes):
(WebCore::SVGFEConvolveMatrixElement::parseAttribute):
(WebCore::SVGFEConvolveMatrixElement::setFilterEffectAttribute):
(WebCore::SVGFEConvolveMatrixElement::setOrder):
(WebCore::SVGFEConvolveMatrixElement::setKernelUnitLength):

  • svg/SVGFEConvolveMatrixElement.h:

(WebCore::SVGPropertyTraits<EdgeModeType>::initialValue):

  • svg/SVGFEDiffuseLightingElement.cpp:

(WebCore::SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement):
(WebCore::SVGFEDiffuseLightingElement::registerAttributes):
(WebCore::SVGFEDiffuseLightingElement::parseAttribute):

  • svg/SVGFEDiffuseLightingElement.h:
  • svg/SVGFEDisplacementMapElement.cpp:

(WebCore::SVGFEDisplacementMapElement::SVGFEDisplacementMapElement):
(WebCore::SVGFEDisplacementMapElement::registerAttributes):
(WebCore::SVGFEDisplacementMapElement::parseAttribute):

  • svg/SVGFEDisplacementMapElement.h:
  • svg/SVGFEDropShadowElement.cpp:

(WebCore::SVGFEDropShadowElement::SVGFEDropShadowElement):
(WebCore::SVGFEDropShadowElement::setStdDeviation):
(WebCore::SVGFEDropShadowElement::registerAttributes):
(WebCore::SVGFEDropShadowElement::parseAttribute):
(WebCore::SVGFEDropShadowElement::svgAttributeChanged):

  • svg/SVGFEDropShadowElement.h:
  • svg/SVGFEGaussianBlurElement.cpp:

(WebCore::SVGFEGaussianBlurElement::SVGFEGaussianBlurElement):
(WebCore::SVGFEGaussianBlurElement::setStdDeviation):
(WebCore::SVGFEGaussianBlurElement::registerAttributes):
(WebCore::SVGFEGaussianBlurElement::parseAttribute):
(WebCore::SVGFEGaussianBlurElement::svgAttributeChanged):

  • svg/SVGFEGaussianBlurElement.h:
  • svg/SVGFEImageElement.cpp:

(WebCore::SVGFEImageElement::SVGFEImageElement):
(WebCore::SVGFEImageElement::registerAttributes):
(WebCore::SVGFEImageElement::parseAttribute):

  • svg/SVGFEImageElement.h:
  • svg/SVGFELightElement.cpp:

(WebCore::SVGFELightElement::SVGFELightElement):
(WebCore::SVGFELightElement::registerAttributes):
(WebCore::SVGFELightElement::parseAttribute):
(WebCore::SVGFELightElement::svgAttributeChanged):

  • svg/SVGFELightElement.h:

(WebCore::SVGFELightElement::azimuth const):
(WebCore::SVGFELightElement::elevation const):
(WebCore::SVGFELightElement::x const):
(WebCore::SVGFELightElement::y const):
(WebCore::SVGFELightElement::z const):
(WebCore::SVGFELightElement::pointsAtX const):
(WebCore::SVGFELightElement::pointsAtY const):
(WebCore::SVGFELightElement::pointsAtZ const):
(WebCore::SVGFELightElement::specularExponent const):
(WebCore::SVGFELightElement::limitingConeAngle const):
(WebCore::SVGFELightElement::azimuthAnimated):
(WebCore::SVGFELightElement::elevationAnimated):
(WebCore::SVGFELightElement::xAnimated):
(WebCore::SVGFELightElement::yAnimated):
(WebCore::SVGFELightElement::zAnimated):
(WebCore::SVGFELightElement::pointsAtXAnimated):
(WebCore::SVGFELightElement::pointsAtYAnimated):
(WebCore::SVGFELightElement::pointsAtZAnimated):
(WebCore::SVGFELightElement::specularExponentAnimated):
(WebCore::SVGFELightElement::limitingConeAngleAnimated):
(WebCore::SVGFELightElement::attributeRegistry):
(WebCore::SVGFELightElement::isKnownAttribute):

  • svg/SVGFEMergeNodeElement.cpp:

(WebCore::SVGFEMergeNodeElement::SVGFEMergeNodeElement):
(WebCore::SVGFEMergeNodeElement::registerAttributes):
(WebCore::SVGFEMergeNodeElement::parseAttribute):

  • svg/SVGFEMergeNodeElement.h:
  • svg/SVGFEMorphologyElement.cpp:

(WebCore::SVGFEMorphologyElement::SVGFEMorphologyElement):
(WebCore::SVGFEMorphologyElement::setRadius):
(WebCore::SVGFEMorphologyElement::registerAttributes):
(WebCore::SVGFEMorphologyElement::parseAttribute):

  • svg/SVGFEMorphologyElement.h:
  • svg/SVGFEOffsetElement.cpp:

(WebCore::SVGFEOffsetElement::SVGFEOffsetElement):
(WebCore::SVGFEOffsetElement::registerAttributes):
(WebCore::SVGFEOffsetElement::parseAttribute):
(WebCore::SVGFEOffsetElement::svgAttributeChanged):

  • svg/SVGFEOffsetElement.h:
  • svg/SVGFESpecularLightingElement.cpp:

(WebCore::SVGFESpecularLightingElement::SVGFESpecularLightingElement):
(WebCore::SVGFESpecularLightingElement::registerAttributes):
(WebCore::SVGFESpecularLightingElement::parseAttribute):

  • svg/SVGFESpecularLightingElement.h:
  • svg/SVGFETileElement.cpp:

(WebCore::SVGFETileElement::SVGFETileElement):
(WebCore::SVGFETileElement::registerAttributes):
(WebCore::SVGFETileElement::parseAttribute):

  • svg/SVGFETileElement.h:
  • svg/SVGFETurbulenceElement.cpp:

(WebCore::SVGFETurbulenceElement::SVGFETurbulenceElement):
(WebCore::SVGFETurbulenceElement::registerAttributes):
(WebCore::SVGFETurbulenceElement::parseAttribute):
(WebCore::SVGFETurbulenceElement::setFilterEffectAttribute):
(WebCore::SVGFETurbulenceElement::svgAttributeChanged):

  • svg/SVGFETurbulenceElement.h:
  • svg/SVGFilterElement.cpp:

(WebCore::SVGFilterElement::SVGFilterElement):
(WebCore::SVGFilterElement::setFilterRes):
(WebCore::SVGFilterElement::registerAttributes):
(WebCore::SVGFilterElement::parseAttribute):
(WebCore::SVGFilterElement::svgAttributeChanged):
(WebCore::SVGFilterElement::isSupportedAttribute): Deleted.

  • svg/SVGFilterElement.h:
  • svg/SVGFilterPrimitiveStandardAttributes.cpp:

(WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes):
(WebCore::SVGFilterPrimitiveStandardAttributes::registerAttributes):
(WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute):
(WebCore::SVGFilterPrimitiveStandardAttributes::svgAttributeChanged):
(WebCore::SVGFilterPrimitiveStandardAttributes::isSupportedAttribute): Deleted.

  • svg/SVGFilterPrimitiveStandardAttributes.h:

(WebCore::SVGFilterPrimitiveStandardAttributes::attributeRegistry):
(WebCore::SVGFilterPrimitiveStandardAttributes::x const):
(WebCore::SVGFilterPrimitiveStandardAttributes::y const):
(WebCore::SVGFilterPrimitiveStandardAttributes::width const):
(WebCore::SVGFilterPrimitiveStandardAttributes::height const):
(WebCore::SVGFilterPrimitiveStandardAttributes::result const):
(WebCore::SVGFilterPrimitiveStandardAttributes::xAnimated):
(WebCore::SVGFilterPrimitiveStandardAttributes::yAnimated):
(WebCore::SVGFilterPrimitiveStandardAttributes::widthAnimated):
(WebCore::SVGFilterPrimitiveStandardAttributes::heightAnimated):
(WebCore::SVGFilterPrimitiveStandardAttributes::resultAnimated):
(WebCore::SVGFilterPrimitiveStandardAttributes::isKnownAttribute):

  • svg/SVGFitToViewBox.cpp:

(WebCore::SVGFitToViewBox::SVGFitToViewBox):
(WebCore::SVGFitToViewBox::registerAttributes):
(WebCore::SVGFitToViewBox::setViewBox):
(WebCore::SVGFitToViewBox::resetViewBox):
(WebCore::SVGFitToViewBox::reset):
(WebCore::SVGFitToViewBox::parseAttribute):
(WebCore::SVGFitToViewBox::parseViewBox):
(WebCore::SVGFitToViewBox::isKnownAttribute): Deleted.
(WebCore::SVGFitToViewBox::addSupportedAttributes): Deleted.

  • svg/SVGFitToViewBox.h:

(WebCore::SVGFitToViewBox::attributeRegistry):
(WebCore::SVGFitToViewBox::viewBox const):
(WebCore::SVGFitToViewBox::preserveAspectRatio const):
(WebCore::SVGFitToViewBox::viewBoxAnimated):
(WebCore::SVGFitToViewBox::preserveAspectRatioAnimated):
(WebCore::SVGFitToViewBox::setPreserveAspectRatio):
(WebCore::SVGFitToViewBox::resetPreserveAspectRatio):
(WebCore::SVGFitToViewBox::viewBoxString const):
(WebCore::SVGFitToViewBox::preserveAspectRatioString const):
(WebCore::SVGFitToViewBox::hasValidViewBox const):
(WebCore::SVGFitToViewBox::hasEmptyViewBox const):
(WebCore::SVGFitToViewBox::isKnownAttribute):
(WebCore::SVGFitToViewBox::parseAttribute): Deleted.

  • svg/SVGFontElement.cpp:

(WebCore::SVGFontElement::SVGFontElement):

  • svg/SVGFontElement.h:
  • svg/SVGForeignObjectElement.cpp:

(WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
(WebCore::SVGForeignObjectElement::registerAttributes):
(WebCore::SVGForeignObjectElement::parseAttribute):
(WebCore::SVGForeignObjectElement::svgAttributeChanged):
(WebCore::SVGForeignObjectElement::isSupportedAttribute): Deleted.

  • svg/SVGForeignObjectElement.h:
  • svg/SVGGElement.cpp:

(WebCore::SVGGElement::SVGGElement):
(WebCore::SVGGElement::svgAttributeChanged):
(WebCore::SVGGElement::isSupportedAttribute): Deleted.

  • svg/SVGGElement.h:
  • svg/SVGGeometryElement.cpp:

(WebCore::SVGGeometryElement::SVGGeometryElement):
(WebCore::SVGGeometryElement::registerAttributes):
(WebCore::SVGGeometryElement::parseAttribute):
(WebCore::SVGGeometryElement::svgAttributeChanged):
(WebCore::SVGGeometryElement::isSupportedAttribute): Deleted.

  • svg/SVGGeometryElement.h:

(WebCore::SVGGeometryElement::attributeRegistry):
(WebCore::SVGGeometryElement::pathLengthAnimated):
(WebCore::SVGGeometryElement::isKnownAttribute):

  • svg/SVGGlyphRefElement.cpp:

(WebCore::SVGGlyphRefElement::SVGGlyphRefElement):

  • svg/SVGGlyphRefElement.h:
  • svg/SVGGradientElement.cpp:

(WebCore::SVGGradientElement::SVGGradientElement):
(WebCore::SVGGradientElement::registerAttributes):
(WebCore::SVGGradientElement::parseAttribute):
(WebCore::SVGGradientElement::svgAttributeChanged):
(WebCore::SVGGradientElement::isSupportedAttribute): Deleted.

  • svg/SVGGradientElement.h:

(WebCore::SVGGradientElement::attributeRegistry):
(WebCore::SVGGradientElement::spreadMethod const):
(WebCore::SVGGradientElement::gradientUnits const):
(WebCore::SVGGradientElement::gradientTransform const):
(WebCore::SVGGradientElement::spreadMethodAnimated):
(WebCore::SVGGradientElement::gradientUnitsAnimated):
(WebCore::SVGGradientElement::gradientTransformAnimated):
(WebCore::SVGGradientElement::isKnownAttribute):

  • svg/SVGGraphicsElement.cpp:

(WebCore::SVGGraphicsElement::SVGGraphicsElement):
(WebCore::SVGGraphicsElement::registerAttributes):
(WebCore::SVGGraphicsElement::parseAttribute):
(WebCore::SVGGraphicsElement::svgAttributeChanged):
(WebCore::SVGGraphicsElement::isSupportedAttribute): Deleted.
(WebCore::SVGGraphicsElement::requiredFeatures): Deleted.
(WebCore::SVGGraphicsElement::requiredExtensions): Deleted.
(WebCore::SVGGraphicsElement::systemLanguage): Deleted.

  • svg/SVGGraphicsElement.h:

(WebCore::SVGGraphicsElement::attributeRegistry):
(WebCore::SVGGraphicsElement::transform const):
(WebCore::SVGGraphicsElement::transformAnimated):
(WebCore::SVGGraphicsElement::isKnownAttribute):

  • svg/SVGImageElement.cpp:

(WebCore::SVGImageElement::SVGImageElement):
(WebCore::SVGImageElement::registerAttributes):
(WebCore::SVGImageElement::parseAttribute):
(WebCore::SVGImageElement::svgAttributeChanged):
(WebCore::SVGImageElement::haveLoadedRequiredResources):
(WebCore::SVGImageElement::isSupportedAttribute): Deleted.

  • svg/SVGImageElement.h:
  • svg/SVGImageLoader.cpp:

(WebCore::SVGImageLoader::dispatchLoadEvent):

  • svg/SVGLangSpace.cpp:

(WebCore::SVGLangSpace::SVGLangSpace):
(WebCore::SVGLangSpace::registerAttributes):
(WebCore::SVGLangSpace::xmlspace const):
(WebCore::SVGLangSpace::svgAttributeChanged):
(WebCore::SVGLangSpace::setXmllang): Deleted.
(WebCore::SVGLangSpace::setXmlspace): Deleted.
(WebCore::SVGLangSpace::isKnownAttribute): Deleted.
(WebCore::addWithAndWithoutXMLPrefix): Deleted.
(WebCore::SVGLangSpace::addSupportedAttributes): Deleted.

  • svg/SVGLangSpace.h:

(WebCore::SVGLangSpace::xmllang const):
(WebCore::SVGLangSpace::setXmllang):
(WebCore::SVGLangSpace::setXmlspace):
(WebCore::SVGLangSpace::attributeRegistry):
(WebCore::SVGLangSpace::isKnownAttribute):

  • svg/SVGLineElement.cpp:

(WebCore::SVGLineElement::SVGLineElement):
(WebCore::SVGLineElement::registerAttributes):
(WebCore::SVGLineElement::parseAttribute):
(WebCore::SVGLineElement::svgAttributeChanged):
(WebCore::SVGLineElement::isSupportedAttribute): Deleted.

  • svg/SVGLineElement.h:
  • svg/SVGLinearGradientElement.cpp:

(WebCore::SVGLinearGradientElement::SVGLinearGradientElement):
(WebCore::SVGLinearGradientElement::registerAttributes):
(WebCore::SVGLinearGradientElement::parseAttribute):
(WebCore::SVGLinearGradientElement::svgAttributeChanged):
(WebCore::SVGLinearGradientElement::isSupportedAttribute): Deleted.

  • svg/SVGLinearGradientElement.h:
  • svg/SVGMPathElement.cpp:

(WebCore::SVGMPathElement::SVGMPathElement):
(WebCore::SVGMPathElement::svgAttributeChanged):

  • svg/SVGMPathElement.h:
  • svg/SVGMarkerElement.cpp:

(WebCore::SVGMarkerElement::SVGMarkerElement):
(WebCore::SVGMarkerElement::registerAttributes):
(WebCore::SVGMarkerElement::parseAttribute):
(WebCore::SVGMarkerElement::svgAttributeChanged):
(WebCore::SVGMarkerElement::setOrient):
(WebCore::SVGMarkerElement::orientTypePropertyInfo): Deleted.
(WebCore::SVGMarkerElement::isSupportedAttribute): Deleted.
(WebCore::SVGMarkerElement::synchronizeOrientType): Deleted.
(WebCore::SVGMarkerElement::lookupOrCreateOrientTypeWrapper): Deleted.
(WebCore::SVGMarkerElement::orientType const): Deleted.
(WebCore::SVGMarkerElement::orientTypeAnimated): Deleted.

  • svg/SVGMarkerElement.h:
  • svg/SVGMaskElement.cpp:

(WebCore::SVGMaskElement::SVGMaskElement):
(WebCore::SVGMaskElement::registerAttributes):
(WebCore::SVGMaskElement::parseAttribute):
(WebCore::SVGMaskElement::svgAttributeChanged):
(WebCore::SVGMaskElement::isSupportedAttribute): Deleted.
(WebCore::SVGMaskElement::requiredFeatures): Deleted.
(WebCore::SVGMaskElement::requiredExtensions): Deleted.
(WebCore::SVGMaskElement::systemLanguage): Deleted.

  • svg/SVGMaskElement.h:
  • svg/SVGPathElement.cpp:

(WebCore::SVGPathElement::SVGPathElement):
(WebCore::SVGPathElement::registerAttributes):
(WebCore::SVGPathElement::parseAttribute):
(WebCore::SVGPathElement::svgAttributeChanged):
(WebCore::SVGPathElement::pathByteStream const):
(WebCore::SVGPathElement::lookupOrCreateDWrapper):
(WebCore::SVGPathElement::animatedPropertyWillBeDeleted):
(WebCore::SVGPathElement::pathSegList):
(WebCore::SVGPathElement::animatedPathSegList):
(WebCore::SVGPathElement::pathSegListChanged):
(WebCore::SVGPathElement::dPropertyInfo): Deleted.
(WebCore::SVGPathElement::isSupportedAttribute): Deleted.
(WebCore::SVGPathElement::synchronizeD): Deleted.

  • svg/SVGPathElement.h:
  • svg/SVGPathSegListValues.h:

(WebCore::SVGPropertyTraits<SVGPathSegListValues>::toString):

  • svg/SVGPathSegWithContext.h:

(WebCore::SVGPathSegWithContext::animatedProperty const):

  • svg/SVGPatternElement.cpp:

(WebCore::SVGPatternElement::SVGPatternElement):
(WebCore::SVGPatternElement::registerAttributes):
(WebCore::SVGPatternElement::parseAttribute):
(WebCore::SVGPatternElement::svgAttributeChanged):
(WebCore::SVGPatternElement::collectPatternAttributes const):
(WebCore::SVGPatternElement::isSupportedAttribute): Deleted.
(WebCore::SVGPatternElement::requiredFeatures): Deleted.
(WebCore::SVGPatternElement::requiredExtensions): Deleted.
(WebCore::SVGPatternElement::systemLanguage): Deleted.

  • svg/SVGPatternElement.h:
  • svg/SVGPointListValues.h:

(WebCore::SVGPropertyTraits<SVGPointListValues>::toString):

  • svg/SVGPolyElement.cpp:

(WebCore::SVGPolyElement::SVGPolyElement):
(WebCore::SVGPolyElement::registerAttributes):
(WebCore::SVGPolyElement::parseAttribute):
(WebCore::SVGPolyElement::svgAttributeChanged):
(WebCore::SVGPolyElement::points):
(WebCore::SVGPolyElement::animatedPoints):
(WebCore::SVGPolyElement::pointsPropertyInfo): Deleted.
(WebCore::SVGPolyElement::synchronizePoints): Deleted.
(WebCore::SVGPolyElement::lookupOrCreatePointsWrapper): Deleted.

  • svg/SVGPolyElement.h:

(WebCore::SVGPolyElement::pointList const):
(WebCore::SVGPolyElement::attributeRegistry):
(WebCore::SVGPolyElement::isKnownAttribute):

  • svg/SVGPreserveAspectRatioValue.cpp:

(WebCore::SVGPreserveAspectRatioValue::transformRect const):
(WebCore::SVGPreserveAspectRatioValue::transformRect): Deleted.

  • svg/SVGPreserveAspectRatioValue.h:
  • svg/SVGRadialGradientElement.cpp:

(WebCore::SVGRadialGradientElement::SVGRadialGradientElement):
(WebCore::SVGRadialGradientElement::registerAttributes):
(WebCore::SVGRadialGradientElement::parseAttribute):
(WebCore::SVGRadialGradientElement::svgAttributeChanged):
(WebCore::SVGRadialGradientElement::isSupportedAttribute): Deleted.

  • svg/SVGRadialGradientElement.h:
  • svg/SVGRectElement.cpp:

(WebCore::SVGRectElement::SVGRectElement):
(WebCore::SVGRectElement::registerAttributes):
(WebCore::SVGRectElement::parseAttribute):
(WebCore::SVGRectElement::svgAttributeChanged):

  • svg/SVGRectElement.h:
  • svg/SVGSVGElement.cpp:

(WebCore::SVGSVGElement::SVGSVGElement):
(WebCore::SVGSVGElement::registerAttributes):
(WebCore::SVGSVGElement::parseAttribute):
(WebCore::SVGSVGElement::svgAttributeChanged):
(WebCore::SVGSVGElement::viewBoxToViewTransform const):
(WebCore::SVGSVGElement::resetScrollAnchor):
(WebCore::SVGSVGElement::inheritViewAttributes):

  • svg/SVGSVGElement.h:

(WebCore::SVGSVGElement::useCurrentView const): Deleted.
(WebCore::SVGSVGElement::currentTranslateValue): Deleted.
(WebCore::SVGSVGElement::zoomAndPan const): Deleted.
(WebCore::SVGSVGElement::setZoomAndPan): Deleted.
(WebCore::SVGSVGElement::timeContainer): Deleted.
(WebCore::SVGSVGElement::hasEmptyViewBox const): Deleted.

  • svg/SVGScriptElement.cpp:

(WebCore::SVGScriptElement::SVGScriptElement):
(WebCore::SVGScriptElement::svgAttributeChanged):
(WebCore::SVGScriptElement::insertedIntoAncestor):
(WebCore::SVGScriptElement::addSubresourceAttributeURLs const):
(WebCore::SVGScriptElement::isURLAttribute const): Deleted.
(WebCore::SVGScriptElement::sourceAttributeValue const): Deleted.
(WebCore::SVGScriptElement::charsetAttributeValue const): Deleted.
(WebCore::SVGScriptElement::typeAttributeValue const): Deleted.
(WebCore::SVGScriptElement::languageAttributeValue const): Deleted.
(WebCore::SVGScriptElement::forAttributeValue const): Deleted.
(WebCore::SVGScriptElement::eventAttributeValue const): Deleted.
(WebCore::SVGScriptElement::hasAsyncAttribute const): Deleted.
(WebCore::SVGScriptElement::hasDeferAttribute const): Deleted.
(WebCore::SVGScriptElement::hasNoModuleAttribute const): Deleted.
(WebCore::SVGScriptElement::hasSourceAttribute const): Deleted.
(WebCore::SVGScriptElement::filterOutAnimatableAttribute const): Deleted.

  • svg/SVGScriptElement.h:
  • svg/SVGStopElement.cpp:

(WebCore::SVGStopElement::SVGStopElement):
(WebCore::SVGStopElement::registerAttributes):
(WebCore::SVGStopElement::parseAttribute):

  • svg/SVGStopElement.h:
  • svg/SVGStringListValues.h:

(WebCore::SVGPropertyTraits<SVGStringListValues>::toString):

  • svg/SVGSwitchElement.cpp:

(WebCore::SVGSwitchElement::SVGSwitchElement):

  • svg/SVGSwitchElement.h:
  • svg/SVGSymbolElement.cpp:

(WebCore::SVGSymbolElement::SVGSymbolElement):
(WebCore::SVGSymbolElement::parseAttribute):
(WebCore::SVGSymbolElement::svgAttributeChanged):

  • svg/SVGSymbolElement.h:
  • svg/SVGTRefElement.cpp:

(WebCore::SVGTRefElement::SVGTRefElement):

  • svg/SVGTRefElement.h:
  • svg/SVGTests.cpp:

(WebCore::SVGTests::SVGTests):
(WebCore::SVGTests::registerAttributes):
(WebCore::SVGTests::attributeRegistry):
(WebCore::SVGTests::isKnownAttribute):
(WebCore::SVGTests::isValid const):
(WebCore::SVGTests::parseAttribute):
(WebCore::SVGTests::svgAttributeChanged):
(WebCore::SVGTests::requiredFeatures):
(WebCore::SVGTests::requiredExtensions):
(WebCore::SVGTests::systemLanguage):
(WebCore::createSVGTestPropertyInfo): Deleted.
(WebCore::createSVGTextAttributeToPropertyMap): Deleted.
(WebCore::SVGTests::attributeToPropertyMap): Deleted.
(WebCore::SVGTests::handleAttributeChange): Deleted.
(WebCore::SVGTests::synchronizeAttribute): Deleted.
(WebCore::SVGTests::synchronizeRequiredFeatures): Deleted.
(WebCore::SVGTests::synchronizeRequiredExtensions): Deleted.
(WebCore::SVGTests::synchronizeSystemLanguage): Deleted.

  • svg/SVGTests.h:
  • svg/SVGTextContentElement.cpp:

(WebCore::SVGTextContentElement::SVGTextContentElement):
(WebCore::SVGTextContentElement::registerAttributes):
(WebCore::SVGTextContentElement::parseAttribute):
(WebCore::SVGTextContentElement::svgAttributeChanged):
(WebCore::SVGTextContentElement::textLengthPropertyInfo): Deleted.
(WebCore::SVGTextContentElement::synchronizeTextLength): Deleted.
(WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): Deleted.
(WebCore::SVGTextContentElement::textLengthAnimated): Deleted.
(WebCore::SVGTextContentElement::isSupportedAttribute): Deleted.

  • svg/SVGTextContentElement.h:

(WebCore::SVGTextContentElement::specifiedTextLength):
(WebCore::SVGTextContentElement::attributeRegistry):
(WebCore::SVGTextContentElement::textLength const):
(WebCore::SVGTextContentElement::lengthAdjust const):
(WebCore::SVGTextContentElement::textLengthAnimated):
(WebCore::SVGTextContentElement::lengthAdjustAnimated):
(WebCore::SVGTextContentElement::isKnownAttribute):
(WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::SVGAnimatedCustomLengthAttribute):
(WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::synchronize):
(WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::animatedProperty):

  • svg/SVGTextPathElement.cpp:

(WebCore::SVGTextPathElement::SVGTextPathElement):
(WebCore::SVGTextPathElement::registerAttributes):
(WebCore::SVGTextPathElement::parseAttribute):
(WebCore::SVGTextPathElement::svgAttributeChanged):
(WebCore::SVGTextPathElement::isSupportedAttribute): Deleted.

  • svg/SVGTextPathElement.h:
  • svg/SVGTextPositioningElement.cpp:

(WebCore::SVGTextPositioningElement::SVGTextPositioningElement):
(WebCore::SVGTextPositioningElement::registerAttributes):
(WebCore::SVGTextPositioningElement::parseAttribute):
(WebCore::SVGTextPositioningElement::svgAttributeChanged):

  • svg/SVGTextPositioningElement.h:

(WebCore::SVGTextPositioningElement::attributeRegistry):
(WebCore::SVGTextPositioningElement::x const):
(WebCore::SVGTextPositioningElement::y const):
(WebCore::SVGTextPositioningElement::dx const):
(WebCore::SVGTextPositioningElement::dy const):
(WebCore::SVGTextPositioningElement::rotate const):
(WebCore::SVGTextPositioningElement::xAnimated):
(WebCore::SVGTextPositioningElement::yAnimated):
(WebCore::SVGTextPositioningElement::dxAnimated):
(WebCore::SVGTextPositioningElement::dyAnimated):
(WebCore::SVGTextPositioningElement::rotateAnimated):
(WebCore::SVGTextPositioningElement::isKnownAttribute):

  • svg/SVGURIReference.cpp:

(WebCore::SVGURIReference::SVGURIReference):
(WebCore::SVGURIReference::registerAttributes):
(WebCore::SVGURIReference::attributeRegistry):
(WebCore::SVGURIReference::isKnownAttribute):
(WebCore::SVGURIReference::parseAttribute):
(WebCore::SVGURIReference::href const):
(WebCore::SVGURIReference::hrefAnimated):
(WebCore::SVGURIReference::addSupportedAttributes): Deleted.

  • svg/SVGURIReference.h:
  • svg/SVGUseElement.cpp:

(WebCore::SVGUseElement::SVGUseElement):
(WebCore::SVGUseElement::registerAttributes):
(WebCore::SVGUseElement::parseAttribute):
(WebCore::SVGUseElement::insertedIntoAncestor):
(WebCore::SVGUseElement::transferSizeAttributesToTargetClone const):
(WebCore::SVGUseElement::svgAttributeChanged):
(WebCore::SVGUseElement::notifyFinished):

  • svg/SVGUseElement.h:
  • svg/SVGValue.h:
  • svg/SVGViewElement.cpp:

(WebCore::SVGViewElement::SVGViewElement):
(WebCore::SVGViewElement::parseAttribute):

  • svg/SVGViewElement.h:
  • svg/SVGViewSpec.cpp:

(WebCore::SVGViewSpec::SVGViewSpec):
(WebCore::SVGViewSpec::registerAttributes):
(WebCore::SVGViewSpec::transform):
(WebCore::SVGViewSpec::reset):
(WebCore::SVGViewSpec::parseViewSpec):
(WebCore::SVGViewSpec::viewBoxPropertyInfo): Deleted.
(WebCore::SVGViewSpec::preserveAspectRatioPropertyInfo): Deleted.
(WebCore::SVGViewSpec::transformPropertyInfo): Deleted.
(WebCore::SVGViewSpec::viewBoxIdentifier): Deleted.
(WebCore::SVGViewSpec::preserveAspectRatioIdentifier): Deleted.
(WebCore::SVGViewSpec::transformIdentifier): Deleted.
(WebCore::SVGViewSpec::setZoomAndPan): Deleted.
(WebCore::SVGViewSpec::transformString const): Deleted.
(WebCore::SVGViewSpec::viewBoxString const): Deleted.
(WebCore::SVGViewSpec::preserveAspectRatioString const): Deleted.
(WebCore::SVGViewSpec::viewBoxAnimated): Deleted.
(WebCore::SVGViewSpec::preserveAspectRatioAnimated): Deleted.
(WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): Deleted.
(WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper): Deleted.
(WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): Deleted.

  • svg/SVGViewSpec.h:
  • svg/SVGViewSpec.idl:
  • svg/SVGZoomAndPan.cpp:

(WebCore::SVGZoomAndPan::SVGZoomAndPan):
(WebCore::SVGZoomAndPan::registerAttributes):
(WebCore::SVGZoomAndPan::parseZoomAndPan):
(WebCore::SVGZoomAndPan::parseAttribute):
(WebCore::SVGZoomAndPan::parse): Deleted.
(WebCore::SVGZoomAndPan::parseAttributeValue): Deleted.

  • svg/SVGZoomAndPan.h:

(WebCore::SVGZoomAndPan::zoomAndPan const):
(WebCore::SVGZoomAndPan::setZoomAndPan):
(WebCore::SVGZoomAndPan::reset):
(WebCore::SVGZoomAndPan::attributeRegistry):
(WebCore::SVGZoomAndPan::isKnownAttribute):
(WebCore::SVGZoomAndPan::parseFromNumber): Deleted.
(WebCore::SVGZoomAndPan::parseAttribute): Deleted.

  • svg/SVGZoomAndPanType.h: Copied from Source/WebCore/svg/SVGValue.h.

(WebCore::SVGPropertyTraits<SVGZoomAndPanType>::initialValue):
(WebCore::SVGPropertyTraits<SVGZoomAndPanType>::toString):
(WebCore::SVGPropertyTraits<SVGZoomAndPanType>::fromString):

  • svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
  • svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp: Copied from Source/WebCore/svg/SVGValue.h.

(WebCore::SVGAnimatedPathSegListPropertyTearOff::SVGAnimatedPathSegListPropertyTearOff):
(WebCore::SVGAnimatedPathSegListPropertyTearOff::~SVGAnimatedPathSegListPropertyTearOff):
(WebCore::SVGAnimatedPathSegListPropertyTearOff::animValDidChange):

  • svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
  • svg/properties/SVGAnimatedProperty.cpp:

(WebCore::SVGAnimatedProperty::SVGAnimatedProperty):
(WebCore::SVGAnimatedProperty::~SVGAnimatedProperty):
(WebCore::SVGAnimatedProperty::animatedPropertyCache): Deleted.

  • svg/properties/SVGAnimatedProperty.h:

(WebCore::SVGAnimatedProperty::isAnimating const):
(WebCore::SVGAnimatedProperty::isAnimatedListTearOff const):
(WebCore::SVGAnimatedProperty::lookupOrCreateAnimatedProperty):
(WebCore::SVGAnimatedProperty::lookupAnimatedProperty):
(WebCore::SVGAnimatedProperty::animatedPropertyCache):
(WebCore::SVGAnimatedProperty::lookupOrCreateWrapper): Deleted.
(WebCore::SVGAnimatedProperty::lookupWrapper): Deleted.

  • svg/properties/SVGAnimatedPropertyMacros.h: Removed.
  • svg/properties/SVGAnimatedPropertyType.h: Copied from Source/WebCore/svg/SVGAElement.idl.
  • svg/properties/SVGAttribute.h: Added.

(WebCore::SVGPropertyAttribute::SVGPropertyAttribute):
(WebCore::SVGPropertyAttribute::value):
(WebCore::SVGPropertyAttribute::value const):
(WebCore::SVGPropertyAttribute::setValue):
(WebCore::SVGPropertyAttribute::resetValue):
(WebCore::SVGPropertyAttribute::toString const):
(WebCore::SVGPropertyAttribute::setShouldSynchronize):
(WebCore::SVGPropertyAttribute::shouldSynchronize const):
(WebCore::SVGPropertyAttribute::synchronize):
(WebCore::SVGAnimatedAttribute::SVGAnimatedAttribute):
(WebCore::SVGAnimatedAttribute::currentValue const):
(WebCore::SVGAnimatedAttribute::animatedProperty):
(WebCore::SVGAnimatedAttributeList::SVGAnimatedAttributeList):
(WebCore::SVGAnimatedAttributeList::detachAnimatedListWrappers):

  • svg/properties/SVGAttributeAccessor.h: Added.

(WebCore::SVGAttributeAccessor::SVGAttributeAccessor):
(WebCore::SVGAttributeAccessor::attributeName const):
(WebCore::SVGAttributeAccessor::isAnimatedLengthAttribute const):
(WebCore::SVGAttributeAccessor::animatedType const):
(WebCore::SVGAttributeAccessor::animatedTypes const):
(WebCore::SVGAttributeAccessor::lookupOrCreateAnimatedProperty const):
(WebCore::SVGAttributeAccessor::lookupAnimatedProperty const):
(WebCore::SVGAttributeAccessor::lookupOrCreateAnimatedProperties const):
(WebCore::SVGPropertyAttributeAccessor::singleton):
(WebCore::SVGPropertyAttributeAccessor::SVGPropertyAttributeAccessor):
(WebCore::SVGPropertyAttributeAccessor::attribute const):
(WebCore::SVGAnimatedAttributeAccessor::singleton):
(WebCore::SVGAnimatedAttributeAccessor::SVGAnimatedAttributeAccessor):
(WebCore::SVGAnimatedAttributeAccessor::lookupOrCreateAnimatedProperty):
(WebCore::SVGAnimatedAttributeAccessor::lookupAnimatedProperty):
(WebCore::SVGAnimatedPairAttributeAccessor::SVGAnimatedPairAttributeAccessor):
(WebCore::SVGAnimatedPairAttributeAccessor::secondAttribute const):

  • svg/properties/SVGAttributeOwnerProxy.h: Copied from Source/WebCore/svg/SVGValue.h.

(WebCore::SVGAttributeOwnerProxy::SVGAttributeOwnerProxy):
(WebCore::SVGAttributeOwnerProxy::element const):

  • svg/properties/SVGAttributeOwnerProxyImpl.h: Added.

(WebCore::SVGAttributeOwnerProxyImpl::SVGAttributeOwnerProxyImpl):
(WebCore::SVGAttributeOwnerProxyImpl::attributeRegistry):
(WebCore::SVGAttributeOwnerProxyImpl::isKnownAttribute):
(WebCore::SVGAttributeOwnerProxyImpl::isAnimatedLengthAttribute):

  • svg/properties/SVGAttributeRegistry.h: Added.

(WebCore::SVGAttributeRegistry::registerAttribute):
(WebCore::SVGAttributeRegistry::isEmpty const):
(WebCore::SVGAttributeRegistry::isKnownAttribute const):
(WebCore::SVGAttributeRegistry::isAnimatedLengthAttribute const):
(WebCore::SVGAttributeRegistry::animatedTypes const):
(WebCore::SVGAttributeRegistry::synchronizeAttributes const):
(WebCore::SVGAttributeRegistry::synchronizeAttribute const):
(WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedProperty const):
(WebCore::SVGAttributeRegistry::lookupAnimatedProperty const):
(WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedProperties const):
(WebCore::SVGAttributeRegistry::animatedTypesBaseTypes):
(WebCore::SVGAttributeRegistry::synchronizeAttributesBaseTypes):
(WebCore::SVGAttributeRegistry::synchronizeAttributeBaseTypes):
(WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedPropertyBaseTypes):
(WebCore::SVGAttributeRegistry::lookupAnimatedPropertyBaseTypes):
(WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedPropertiesBaseTypes):
(WebCore::SVGAttributeRegistry::findAttributeAccessor const):

  • svg/properties/SVGAttributeToPropertyMap.cpp: Removed.
  • svg/properties/SVGAttributeToPropertyMap.h: Removed.
  • svg/properties/SVGPropertyInfo.cpp: Removed.
  • svg/properties/SVGPropertyInfo.h: Removed.
Location:
trunk/Source/WebCore
Files:
4 added
5 deleted
163 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r234619 r234620  
     12018-08-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Remove the SVG elements' attributes macros
     4        https://bugs.webkit.org/show_bug.cgi?id=186751
     5
     6        Reviewed by Simon Fraser.
     7
     8        This is how the SVG attributes are implemented after removing the SVG macros:
     9
     10        1) The SVG attribute is defined as a super class of SVGAttribute. The super
     11           classes of SVGAttribute are template classes. The type of these template
     12           are the property type or the TearOff type.
     13
     14        2) To unify accessing attributes of the SVGElements and its super classes
     15           an SVGAttributeAccessor template class is added. It is inherited by other
     16           template classes. The types of these templates are the owner and the
     17           attributes types. The main functions of these classes is to synchronize
     18           the new property value with the document attributes pool and to create
     19           and cache the TearOff objects.
     20
     21        3) To make code shorter and more readable, attribute types and attribute
     22           accessors are defined for every SVG TearOff type, e.g.
     23           -- SVGLength:
     24                SVGAnimatedLengthAttribute and SVGAnimatedLengthAttributeAccessor
     25           -- SVGAnimatedNumber:
     26                SVGAnimatedNumberAttribute and SVGAnimatedNumberAttributeAccessor
     27
     28        4) A special accessor is defined for animated pair and optional attributes:
     29           SVGAnimatedPairAttributeAccessor, e.g.
     30           -- SVGMarkerElement:
     31                orient attribute: "angle" or "type"
     32           -- SVGFEGaussianBlurElement:
     33                stdDeviation attribute: "x" and "y"
     34
     35        5) The SVG attributes have to be registered into an singleton SVGAttributeRegistry.
     36           The SVGAttributeRegistry is a template class. The types of this template
     37           class are the the type of the owner and the base classes of this owner.
     38           This registry holds a map from "attribute name" to  "attribute accessor".
     39
     40        6) To make the code easier to read, the SVGAttributeRegistry implements
     41           registerAttribute() for different attribute types. The owner needs only
     42           to provide the attribute name and a pointer to the class member of this
     43           attribute to the same function "registerAttribute()". The compiler will
     44           pick the right function to call based on the type of the attribute.
     45
     46        7) Given a reference to the owner element, SVGAttributeRegistry can loop
     47           through the attributes of this owner and through the attributes of its
     48           base classes as well to do operations like synchronizing all the attributes
     49           or creating the TearOff object of a certain attribute.
     50
     51        8) To make the base class SVGElement have the ability to access the attributes
     52           of any of its super classes, SVGAttributeOwnerProxy will be used.
     53           SVGAttributeOwnerProxy is a base class which have all the functions that
     54           SVGElement needs as pure virtual functions.
     55
     56        9) SVGAttributeOwnerProxyImpl is a template class which implements
     57           SVGAttributeOwnerProxy and whose types are the owner and its base classes.
     58           SVGAttributeOwnerProxyImpl keeps a reference to the owner and the context
     59           SVGElement.
     60
     61        10) All the SVG attribute owners have to implement the virtual function
     62            attributeOwnerProxy() which returns a reference to SVGAttributeOwnerProxy.
     63            The local attributeOwnerProxy() returns a reference to a local
     64            SVGAttributeOwnerProxyImpl. Its type and base types are the class
     65            hierarchy of this element.
     66
     67        All the attributes of the non-SVGElement-based classes are moved as members
     68        of these classes instead of adding them to all the super classes. These
     69        classes are:
     70           -- SVGExternalResourcesRequired
     71           -- SVGURIReference
     72           -- SVGFitToViewBox
     73           -- SVGZoomAndPan
     74           -- SVGLangSpace
     75
     76        The svgAttributeChanged() of all the SVGElement-based classes are now
     77        simplified by distributing the responsibilities of changing an attribute
     78        to the base classes. One exception is the SVGURIReference since the action
     79        to be taken when changing the "href" is different for every super class.
     80
     81        Other work will be done in separate patches.
     82           -- Shrinking the memory of the SVGElements.
     83           -- Making all the attributes RefCounted objects.
     84
     85        * Sources.txt:
     86        * WebCore.xcodeproj/project.pbxproj:
     87        * rendering/svg/RenderSVGResourceMarker.cpp:
     88        (WebCore::RenderSVGResourceMarker::draw):
     89        * svg/SVGAElement.cpp:
     90        (WebCore::SVGAElement::SVGAElement):
     91        (WebCore::SVGAElement::registerAttributes):
     92        (WebCore::SVGAElement::parseAttribute):
     93        (WebCore::SVGAElement::svgAttributeChanged):
     94        * svg/SVGAElement.h:
     95        * svg/SVGAElement.idl:
     96        * svg/SVGAltGlyphElement.cpp:
     97        (WebCore::SVGAltGlyphElement::SVGAltGlyphElement):
     98        * svg/SVGAltGlyphElement.h:
     99        * svg/SVGAnimatedAngle.h:
     100        * svg/SVGAnimatedBoolean.h:
     101        * svg/SVGAnimatedEnumeration.h:
     102        * svg/SVGAnimatedInteger.h:
     103        * svg/SVGAnimatedLength.h:
     104        * svg/SVGAnimatedLengthList.h:
     105        * svg/SVGAnimatedNumber.h:
     106        * svg/SVGAnimatedNumberList.h:
     107        * svg/SVGAnimatedPath.h:
     108        * svg/SVGAnimatedPointList.h:
     109        * svg/SVGAnimatedPreserveAspectRatio.h:
     110        * svg/SVGAnimatedRect.h:
     111        * svg/SVGAnimatedString.h:
     112        * svg/SVGAnimatedTransformList.h:
     113        * svg/SVGAnimatedTypeAnimator.cpp:
     114        (WebCore::SVGAnimatedTypeAnimator::findAnimatedPropertiesForAttributeName):
     115        * svg/SVGAnimationElement.cpp:
     116        (WebCore::SVGAnimationElement::SVGAnimationElement):
     117        (WebCore::SVGAnimationElement::requiredFeatures): Deleted.
     118        (WebCore::SVGAnimationElement::requiredExtensions): Deleted.
     119        (WebCore::SVGAnimationElement::systemLanguage): Deleted.
     120        * svg/SVGAnimationElement.h:
     121        (WebCore::SVGAnimationElement::attributeRegistry):
     122        * svg/SVGCircleElement.cpp:
     123        (WebCore::SVGCircleElement::SVGCircleElement):
     124        (WebCore::SVGCircleElement::registerAttributes):
     125        (WebCore::SVGCircleElement::parseAttribute):
     126        (WebCore::SVGCircleElement::svgAttributeChanged):
     127        * svg/SVGCircleElement.h:
     128        * svg/SVGClipPathElement.cpp:
     129        (WebCore::SVGClipPathElement::SVGClipPathElement):
     130        (WebCore::SVGClipPathElement::registerAttributes):
     131        (WebCore::SVGClipPathElement::parseAttribute):
     132        (WebCore::SVGClipPathElement::svgAttributeChanged):
     133        (WebCore::SVGClipPathElement::isSupportedAttribute): Deleted.
     134        * svg/SVGClipPathElement.h:
     135        * svg/SVGComponentTransferFunctionElement.cpp:
     136        (WebCore::SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement):
     137        (WebCore::SVGComponentTransferFunctionElement::registerAttributes):
     138        (WebCore::SVGComponentTransferFunctionElement::parseAttribute):
     139        (WebCore::SVGComponentTransferFunctionElement::svgAttributeChanged):
     140        (WebCore::SVGComponentTransferFunctionElement::transferFunction const):
     141        (WebCore::SVGComponentTransferFunctionElement::isSupportedAttribute): Deleted.
     142        * svg/SVGComponentTransferFunctionElement.h:
     143        (WebCore::SVGComponentTransferFunctionElement::type const):
     144        (WebCore::SVGComponentTransferFunctionElement::tableValues const):
     145        (WebCore::SVGComponentTransferFunctionElement::slope const):
     146        (WebCore::SVGComponentTransferFunctionElement::intercept const):
     147        (WebCore::SVGComponentTransferFunctionElement::amplitude const):
     148        (WebCore::SVGComponentTransferFunctionElement::exponent const):
     149        (WebCore::SVGComponentTransferFunctionElement::offset const):
     150        (WebCore::SVGComponentTransferFunctionElement::typeAnimated):
     151        (WebCore::SVGComponentTransferFunctionElement::tableValuesAnimated):
     152        (WebCore::SVGComponentTransferFunctionElement::slopeAnimated):
     153        (WebCore::SVGComponentTransferFunctionElement::interceptAnimated):
     154        (WebCore::SVGComponentTransferFunctionElement::amplitudeAnimated):
     155        (WebCore::SVGComponentTransferFunctionElement::exponentAnimated):
     156        (WebCore::SVGComponentTransferFunctionElement::offsetAnimated):
     157        (WebCore::SVGComponentTransferFunctionElement::attributeRegistry):
     158        (WebCore::SVGComponentTransferFunctionElement::isKnownAttribute):
     159        * svg/SVGCursorElement.cpp:
     160        (WebCore::SVGCursorElement::SVGCursorElement):
     161        (WebCore::SVGCursorElement::registerAttributes):
     162        (WebCore::SVGCursorElement::parseAttribute):
     163        (WebCore::SVGCursorElement::svgAttributeChanged):
     164        (WebCore::SVGCursorElement::isSupportedAttribute): Deleted.
     165        (WebCore::SVGCursorElement::requiredFeatures): Deleted.
     166        (WebCore::SVGCursorElement::requiredExtensions): Deleted.
     167        (WebCore::SVGCursorElement::systemLanguage): Deleted.
     168        * svg/SVGCursorElement.h:
     169        * svg/SVGDefsElement.cpp:
     170        (WebCore::SVGDefsElement::SVGDefsElement):
     171        * svg/SVGDefsElement.h:
     172        * svg/SVGElement.cpp:
     173        (WebCore::SVGElement::SVGElement):
     174        (WebCore::SVGElement::registerAttributes):
     175        (WebCore::SVGElement::parseAttribute):
     176        (WebCore::SVGElement::animatedPropertyTypesForAttribute):
     177        (WebCore::SVGElement::synchronizeAllAnimatedSVGAttribute):
     178        (WebCore::SVGElement::synchronizeAnimatedSVGAttribute const):
     179        (WebCore::SVGElement::isPresentationAttributeWithSVGDOM):
     180        (WebCore::SVGElement::svgAttributeChanged):
     181        (WebCore::SVGElement::synchronizeRequiredFeatures): Deleted.
     182        (WebCore::SVGElement::synchronizeRequiredExtensions): Deleted.
     183        (WebCore::SVGElement::synchronizeSystemLanguage): Deleted.
     184        (WebCore::SVGElement::isKnownAttribute): Deleted.
     185        * svg/SVGElement.h:
     186        (WebCore::SVGElement::attributeRegistry):
     187        (WebCore::SVGElement::isKnownAttribute):
     188        (WebCore::SVGElement::attributeOwnerProxy const):
     189        (WebCore::SVGElement::synchronizeAttribute):
     190        (WebCore::SVGElement::synchronizeAttributes):
     191        (WebCore::SVGElement::animatedTypes const):
     192        (WebCore::SVGElement::lookupAnimatedProperty const):
     193        (WebCore::SVGElement::lookupOrCreateAnimatedProperty):
     194        (WebCore::SVGElement::lookupOrCreateAnimatedProperties):
     195        (WebCore::SVGElement::className const):
     196        (WebCore::SVGElement::classNameAnimated):
     197        (WebCore::SVGElement::synchronizeRequiredFeatures): Deleted.
     198        (WebCore::SVGElement::synchronizeRequiredExtensions): Deleted.
     199        (WebCore::SVGElement::synchronizeSystemLanguage): Deleted.
     200        * svg/SVGEllipseElement.cpp:
     201        (WebCore::SVGEllipseElement::SVGEllipseElement):
     202        (WebCore::SVGEllipseElement::registerAttributes):
     203        (WebCore::SVGEllipseElement::parseAttribute):
     204        (WebCore::SVGEllipseElement::svgAttributeChanged):
     205        * svg/SVGEllipseElement.h:
     206        * svg/SVGExternalResourcesRequired.cpp:
     207        (WebCore::SVGExternalResourcesRequired::SVGExternalResourcesRequired):
     208        (WebCore::SVGExternalResourcesRequired::registerAttributes):
     209        (WebCore::SVGExternalResourcesRequired::parseAttribute):
     210        (WebCore::SVGExternalResourcesRequired::svgAttributeChanged):
     211        (WebCore::SVGExternalResourcesRequired::addSupportedAttributes):
     212        (WebCore::SVGExternalResourcesRequired::dispatchLoadEvent):
     213        (WebCore::SVGExternalResourcesRequired::insertedIntoDocument):
     214        (WebCore::SVGExternalResourcesRequired::finishParsingChildren):
     215        (WebCore::SVGExternalResourcesRequired::haveLoadedRequiredResources const):
     216        (WebCore::SVGExternalResourcesRequired::isKnownAttribute): Deleted.
     217        (WebCore::SVGExternalResourcesRequired::handleAttributeChange): Deleted.
     218        * svg/SVGExternalResourcesRequired.h:
     219        (WebCore::SVGExternalResourcesRequired::attributeRegistry):
     220        (WebCore::SVGExternalResourcesRequired::externalResourcesRequiredAnimated):
     221        (WebCore::SVGExternalResourcesRequired::externalResourcesRequired const):
     222        (WebCore::SVGExternalResourcesRequired::setExternalResourcesRequired):
     223        (WebCore::SVGExternalResourcesRequired::isKnownAttribute):
     224        (WebCore::SVGExternalResourcesRequired::attributeOwnerProxy):
     225        * svg/SVGFEBlendElement.cpp:
     226        (WebCore::SVGFEBlendElement::SVGFEBlendElement):
     227        (WebCore::SVGFEBlendElement::registerAttributes):
     228        (WebCore::SVGFEBlendElement::parseAttribute):
     229        * svg/SVGFEBlendElement.h:
     230        * svg/SVGFEColorMatrixElement.cpp:
     231        (WebCore::SVGFEColorMatrixElement::SVGFEColorMatrixElement):
     232        (WebCore::SVGFEColorMatrixElement::registerAttributes):
     233        (WebCore::SVGFEColorMatrixElement::parseAttribute):
     234        * svg/SVGFEColorMatrixElement.h:
     235        * svg/SVGFEComponentTransferElement.cpp:
     236        (WebCore::SVGFEComponentTransferElement::SVGFEComponentTransferElement):
     237        (WebCore::SVGFEComponentTransferElement::registerAttributes):
     238        (WebCore::SVGFEComponentTransferElement::parseAttribute):
     239        * svg/SVGFEComponentTransferElement.h:
     240        * svg/SVGFECompositeElement.cpp:
     241        (WebCore::SVGFECompositeElement::SVGFECompositeElement):
     242        (WebCore::SVGFECompositeElement::registerAttributes):
     243        (WebCore::SVGFECompositeElement::parseAttribute):
     244        * svg/SVGFECompositeElement.h:
     245        * svg/SVGFEConvolveMatrixElement.cpp:
     246        (WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement):
     247        (WebCore::SVGFEConvolveMatrixElement::registerAttributes):
     248        (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
     249        (WebCore::SVGFEConvolveMatrixElement::setFilterEffectAttribute):
     250        (WebCore::SVGFEConvolveMatrixElement::setOrder):
     251        (WebCore::SVGFEConvolveMatrixElement::setKernelUnitLength):
     252        * svg/SVGFEConvolveMatrixElement.h:
     253        (WebCore::SVGPropertyTraits<EdgeModeType>::initialValue):
     254        * svg/SVGFEDiffuseLightingElement.cpp:
     255        (WebCore::SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement):
     256        (WebCore::SVGFEDiffuseLightingElement::registerAttributes):
     257        (WebCore::SVGFEDiffuseLightingElement::parseAttribute):
     258        * svg/SVGFEDiffuseLightingElement.h:
     259        * svg/SVGFEDisplacementMapElement.cpp:
     260        (WebCore::SVGFEDisplacementMapElement::SVGFEDisplacementMapElement):
     261        (WebCore::SVGFEDisplacementMapElement::registerAttributes):
     262        (WebCore::SVGFEDisplacementMapElement::parseAttribute):
     263        * svg/SVGFEDisplacementMapElement.h:
     264        * svg/SVGFEDropShadowElement.cpp:
     265        (WebCore::SVGFEDropShadowElement::SVGFEDropShadowElement):
     266        (WebCore::SVGFEDropShadowElement::setStdDeviation):
     267        (WebCore::SVGFEDropShadowElement::registerAttributes):
     268        (WebCore::SVGFEDropShadowElement::parseAttribute):
     269        (WebCore::SVGFEDropShadowElement::svgAttributeChanged):
     270        * svg/SVGFEDropShadowElement.h:
     271        * svg/SVGFEGaussianBlurElement.cpp:
     272        (WebCore::SVGFEGaussianBlurElement::SVGFEGaussianBlurElement):
     273        (WebCore::SVGFEGaussianBlurElement::setStdDeviation):
     274        (WebCore::SVGFEGaussianBlurElement::registerAttributes):
     275        (WebCore::SVGFEGaussianBlurElement::parseAttribute):
     276        (WebCore::SVGFEGaussianBlurElement::svgAttributeChanged):
     277        * svg/SVGFEGaussianBlurElement.h:
     278        * svg/SVGFEImageElement.cpp:
     279        (WebCore::SVGFEImageElement::SVGFEImageElement):
     280        (WebCore::SVGFEImageElement::registerAttributes):
     281        (WebCore::SVGFEImageElement::parseAttribute):
     282        * svg/SVGFEImageElement.h:
     283        * svg/SVGFELightElement.cpp:
     284        (WebCore::SVGFELightElement::SVGFELightElement):
     285        (WebCore::SVGFELightElement::registerAttributes):
     286        (WebCore::SVGFELightElement::parseAttribute):
     287        (WebCore::SVGFELightElement::svgAttributeChanged):
     288        * svg/SVGFELightElement.h:
     289        (WebCore::SVGFELightElement::azimuth const):
     290        (WebCore::SVGFELightElement::elevation const):
     291        (WebCore::SVGFELightElement::x const):
     292        (WebCore::SVGFELightElement::y const):
     293        (WebCore::SVGFELightElement::z const):
     294        (WebCore::SVGFELightElement::pointsAtX const):
     295        (WebCore::SVGFELightElement::pointsAtY const):
     296        (WebCore::SVGFELightElement::pointsAtZ const):
     297        (WebCore::SVGFELightElement::specularExponent const):
     298        (WebCore::SVGFELightElement::limitingConeAngle const):
     299        (WebCore::SVGFELightElement::azimuthAnimated):
     300        (WebCore::SVGFELightElement::elevationAnimated):
     301        (WebCore::SVGFELightElement::xAnimated):
     302        (WebCore::SVGFELightElement::yAnimated):
     303        (WebCore::SVGFELightElement::zAnimated):
     304        (WebCore::SVGFELightElement::pointsAtXAnimated):
     305        (WebCore::SVGFELightElement::pointsAtYAnimated):
     306        (WebCore::SVGFELightElement::pointsAtZAnimated):
     307        (WebCore::SVGFELightElement::specularExponentAnimated):
     308        (WebCore::SVGFELightElement::limitingConeAngleAnimated):
     309        (WebCore::SVGFELightElement::attributeRegistry):
     310        (WebCore::SVGFELightElement::isKnownAttribute):
     311        * svg/SVGFEMergeNodeElement.cpp:
     312        (WebCore::SVGFEMergeNodeElement::SVGFEMergeNodeElement):
     313        (WebCore::SVGFEMergeNodeElement::registerAttributes):
     314        (WebCore::SVGFEMergeNodeElement::parseAttribute):
     315        * svg/SVGFEMergeNodeElement.h:
     316        * svg/SVGFEMorphologyElement.cpp:
     317        (WebCore::SVGFEMorphologyElement::SVGFEMorphologyElement):
     318        (WebCore::SVGFEMorphologyElement::setRadius):
     319        (WebCore::SVGFEMorphologyElement::registerAttributes):
     320        (WebCore::SVGFEMorphologyElement::parseAttribute):
     321        * svg/SVGFEMorphologyElement.h:
     322        * svg/SVGFEOffsetElement.cpp:
     323        (WebCore::SVGFEOffsetElement::SVGFEOffsetElement):
     324        (WebCore::SVGFEOffsetElement::registerAttributes):
     325        (WebCore::SVGFEOffsetElement::parseAttribute):
     326        (WebCore::SVGFEOffsetElement::svgAttributeChanged):
     327        * svg/SVGFEOffsetElement.h:
     328        * svg/SVGFESpecularLightingElement.cpp:
     329        (WebCore::SVGFESpecularLightingElement::SVGFESpecularLightingElement):
     330        (WebCore::SVGFESpecularLightingElement::registerAttributes):
     331        (WebCore::SVGFESpecularLightingElement::parseAttribute):
     332        * svg/SVGFESpecularLightingElement.h:
     333        * svg/SVGFETileElement.cpp:
     334        (WebCore::SVGFETileElement::SVGFETileElement):
     335        (WebCore::SVGFETileElement::registerAttributes):
     336        (WebCore::SVGFETileElement::parseAttribute):
     337        * svg/SVGFETileElement.h:
     338        * svg/SVGFETurbulenceElement.cpp:
     339        (WebCore::SVGFETurbulenceElement::SVGFETurbulenceElement):
     340        (WebCore::SVGFETurbulenceElement::registerAttributes):
     341        (WebCore::SVGFETurbulenceElement::parseAttribute):
     342        (WebCore::SVGFETurbulenceElement::setFilterEffectAttribute):
     343        (WebCore::SVGFETurbulenceElement::svgAttributeChanged):
     344        * svg/SVGFETurbulenceElement.h:
     345        * svg/SVGFilterElement.cpp:
     346        (WebCore::SVGFilterElement::SVGFilterElement):
     347        (WebCore::SVGFilterElement::setFilterRes):
     348        (WebCore::SVGFilterElement::registerAttributes):
     349        (WebCore::SVGFilterElement::parseAttribute):
     350        (WebCore::SVGFilterElement::svgAttributeChanged):
     351        (WebCore::SVGFilterElement::isSupportedAttribute): Deleted.
     352        * svg/SVGFilterElement.h:
     353        * svg/SVGFilterPrimitiveStandardAttributes.cpp:
     354        (WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes):
     355        (WebCore::SVGFilterPrimitiveStandardAttributes::registerAttributes):
     356        (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute):
     357        (WebCore::SVGFilterPrimitiveStandardAttributes::svgAttributeChanged):
     358        (WebCore::SVGFilterPrimitiveStandardAttributes::isSupportedAttribute): Deleted.
     359        * svg/SVGFilterPrimitiveStandardAttributes.h:
     360        (WebCore::SVGFilterPrimitiveStandardAttributes::attributeRegistry):
     361        (WebCore::SVGFilterPrimitiveStandardAttributes::x const):
     362        (WebCore::SVGFilterPrimitiveStandardAttributes::y const):
     363        (WebCore::SVGFilterPrimitiveStandardAttributes::width const):
     364        (WebCore::SVGFilterPrimitiveStandardAttributes::height const):
     365        (WebCore::SVGFilterPrimitiveStandardAttributes::result const):
     366        (WebCore::SVGFilterPrimitiveStandardAttributes::xAnimated):
     367        (WebCore::SVGFilterPrimitiveStandardAttributes::yAnimated):
     368        (WebCore::SVGFilterPrimitiveStandardAttributes::widthAnimated):
     369        (WebCore::SVGFilterPrimitiveStandardAttributes::heightAnimated):
     370        (WebCore::SVGFilterPrimitiveStandardAttributes::resultAnimated):
     371        (WebCore::SVGFilterPrimitiveStandardAttributes::isKnownAttribute):
     372        * svg/SVGFitToViewBox.cpp:
     373        (WebCore::SVGFitToViewBox::SVGFitToViewBox):
     374        (WebCore::SVGFitToViewBox::registerAttributes):
     375        (WebCore::SVGFitToViewBox::setViewBox):
     376        (WebCore::SVGFitToViewBox::resetViewBox):
     377        (WebCore::SVGFitToViewBox::reset):
     378        (WebCore::SVGFitToViewBox::parseAttribute):
     379        (WebCore::SVGFitToViewBox::parseViewBox):
     380        (WebCore::SVGFitToViewBox::isKnownAttribute): Deleted.
     381        (WebCore::SVGFitToViewBox::addSupportedAttributes): Deleted.
     382        * svg/SVGFitToViewBox.h:
     383        (WebCore::SVGFitToViewBox::attributeRegistry):
     384        (WebCore::SVGFitToViewBox::viewBox const):
     385        (WebCore::SVGFitToViewBox::preserveAspectRatio const):
     386        (WebCore::SVGFitToViewBox::viewBoxAnimated):
     387        (WebCore::SVGFitToViewBox::preserveAspectRatioAnimated):
     388        (WebCore::SVGFitToViewBox::setPreserveAspectRatio):
     389        (WebCore::SVGFitToViewBox::resetPreserveAspectRatio):
     390        (WebCore::SVGFitToViewBox::viewBoxString const):
     391        (WebCore::SVGFitToViewBox::preserveAspectRatioString const):
     392        (WebCore::SVGFitToViewBox::hasValidViewBox const):
     393        (WebCore::SVGFitToViewBox::hasEmptyViewBox const):
     394        (WebCore::SVGFitToViewBox::isKnownAttribute):
     395        (WebCore::SVGFitToViewBox::parseAttribute): Deleted.
     396        * svg/SVGFontElement.cpp:
     397        (WebCore::SVGFontElement::SVGFontElement):
     398        * svg/SVGFontElement.h:
     399        * svg/SVGForeignObjectElement.cpp:
     400        (WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
     401        (WebCore::SVGForeignObjectElement::registerAttributes):
     402        (WebCore::SVGForeignObjectElement::parseAttribute):
     403        (WebCore::SVGForeignObjectElement::svgAttributeChanged):
     404        (WebCore::SVGForeignObjectElement::isSupportedAttribute): Deleted.
     405        * svg/SVGForeignObjectElement.h:
     406        * svg/SVGGElement.cpp:
     407        (WebCore::SVGGElement::SVGGElement):
     408        (WebCore::SVGGElement::svgAttributeChanged):
     409        (WebCore::SVGGElement::isSupportedAttribute): Deleted.
     410        * svg/SVGGElement.h:
     411        * svg/SVGGeometryElement.cpp:
     412        (WebCore::SVGGeometryElement::SVGGeometryElement):
     413        (WebCore::SVGGeometryElement::registerAttributes):
     414        (WebCore::SVGGeometryElement::parseAttribute):
     415        (WebCore::SVGGeometryElement::svgAttributeChanged):
     416        (WebCore::SVGGeometryElement::isSupportedAttribute): Deleted.
     417        * svg/SVGGeometryElement.h:
     418        (WebCore::SVGGeometryElement::attributeRegistry):
     419        (WebCore::SVGGeometryElement::pathLengthAnimated):
     420        (WebCore::SVGGeometryElement::isKnownAttribute):
     421        * svg/SVGGlyphRefElement.cpp:
     422        (WebCore::SVGGlyphRefElement::SVGGlyphRefElement):
     423        * svg/SVGGlyphRefElement.h:
     424        * svg/SVGGradientElement.cpp:
     425        (WebCore::SVGGradientElement::SVGGradientElement):
     426        (WebCore::SVGGradientElement::registerAttributes):
     427        (WebCore::SVGGradientElement::parseAttribute):
     428        (WebCore::SVGGradientElement::svgAttributeChanged):
     429        (WebCore::SVGGradientElement::isSupportedAttribute): Deleted.
     430        * svg/SVGGradientElement.h:
     431        (WebCore::SVGGradientElement::attributeRegistry):
     432        (WebCore::SVGGradientElement::spreadMethod const):
     433        (WebCore::SVGGradientElement::gradientUnits const):
     434        (WebCore::SVGGradientElement::gradientTransform const):
     435        (WebCore::SVGGradientElement::spreadMethodAnimated):
     436        (WebCore::SVGGradientElement::gradientUnitsAnimated):
     437        (WebCore::SVGGradientElement::gradientTransformAnimated):
     438        (WebCore::SVGGradientElement::isKnownAttribute):
     439        * svg/SVGGraphicsElement.cpp:
     440        (WebCore::SVGGraphicsElement::SVGGraphicsElement):
     441        (WebCore::SVGGraphicsElement::registerAttributes):
     442        (WebCore::SVGGraphicsElement::parseAttribute):
     443        (WebCore::SVGGraphicsElement::svgAttributeChanged):
     444        (WebCore::SVGGraphicsElement::isSupportedAttribute): Deleted.
     445        (WebCore::SVGGraphicsElement::requiredFeatures): Deleted.
     446        (WebCore::SVGGraphicsElement::requiredExtensions): Deleted.
     447        (WebCore::SVGGraphicsElement::systemLanguage): Deleted.
     448        * svg/SVGGraphicsElement.h:
     449        (WebCore::SVGGraphicsElement::attributeRegistry):
     450        (WebCore::SVGGraphicsElement::transform const):
     451        (WebCore::SVGGraphicsElement::transformAnimated):
     452        (WebCore::SVGGraphicsElement::isKnownAttribute):
     453        * svg/SVGImageElement.cpp:
     454        (WebCore::SVGImageElement::SVGImageElement):
     455        (WebCore::SVGImageElement::registerAttributes):
     456        (WebCore::SVGImageElement::parseAttribute):
     457        (WebCore::SVGImageElement::svgAttributeChanged):
     458        (WebCore::SVGImageElement::haveLoadedRequiredResources):
     459        (WebCore::SVGImageElement::isSupportedAttribute): Deleted.
     460        * svg/SVGImageElement.h:
     461        * svg/SVGImageLoader.cpp:
     462        (WebCore::SVGImageLoader::dispatchLoadEvent):
     463        * svg/SVGLangSpace.cpp:
     464        (WebCore::SVGLangSpace::SVGLangSpace):
     465        (WebCore::SVGLangSpace::registerAttributes):
     466        (WebCore::SVGLangSpace::xmlspace const):
     467        (WebCore::SVGLangSpace::svgAttributeChanged):
     468        (WebCore::SVGLangSpace::setXmllang): Deleted.
     469        (WebCore::SVGLangSpace::setXmlspace): Deleted.
     470        (WebCore::SVGLangSpace::isKnownAttribute): Deleted.
     471        (WebCore::addWithAndWithoutXMLPrefix): Deleted.
     472        (WebCore::SVGLangSpace::addSupportedAttributes): Deleted.
     473        * svg/SVGLangSpace.h:
     474        (WebCore::SVGLangSpace::xmllang const):
     475        (WebCore::SVGLangSpace::setXmllang):
     476        (WebCore::SVGLangSpace::setXmlspace):
     477        (WebCore::SVGLangSpace::attributeRegistry):
     478        (WebCore::SVGLangSpace::isKnownAttribute):
     479        * svg/SVGLineElement.cpp:
     480        (WebCore::SVGLineElement::SVGLineElement):
     481        (WebCore::SVGLineElement::registerAttributes):
     482        (WebCore::SVGLineElement::parseAttribute):
     483        (WebCore::SVGLineElement::svgAttributeChanged):
     484        (WebCore::SVGLineElement::isSupportedAttribute): Deleted.
     485        * svg/SVGLineElement.h:
     486        * svg/SVGLinearGradientElement.cpp:
     487        (WebCore::SVGLinearGradientElement::SVGLinearGradientElement):
     488        (WebCore::SVGLinearGradientElement::registerAttributes):
     489        (WebCore::SVGLinearGradientElement::parseAttribute):
     490        (WebCore::SVGLinearGradientElement::svgAttributeChanged):
     491        (WebCore::SVGLinearGradientElement::isSupportedAttribute): Deleted.
     492        * svg/SVGLinearGradientElement.h:
     493        * svg/SVGMPathElement.cpp:
     494        (WebCore::SVGMPathElement::SVGMPathElement):
     495        (WebCore::SVGMPathElement::svgAttributeChanged):
     496        * svg/SVGMPathElement.h:
     497        * svg/SVGMarkerElement.cpp:
     498        (WebCore::SVGMarkerElement::SVGMarkerElement):
     499        (WebCore::SVGMarkerElement::registerAttributes):
     500        (WebCore::SVGMarkerElement::parseAttribute):
     501        (WebCore::SVGMarkerElement::svgAttributeChanged):
     502        (WebCore::SVGMarkerElement::setOrient):
     503        (WebCore::SVGMarkerElement::orientTypePropertyInfo): Deleted.
     504        (WebCore::SVGMarkerElement::isSupportedAttribute): Deleted.
     505        (WebCore::SVGMarkerElement::synchronizeOrientType): Deleted.
     506        (WebCore::SVGMarkerElement::lookupOrCreateOrientTypeWrapper): Deleted.
     507        (WebCore::SVGMarkerElement::orientType const): Deleted.
     508        (WebCore::SVGMarkerElement::orientTypeAnimated): Deleted.
     509        * svg/SVGMarkerElement.h:
     510        * svg/SVGMaskElement.cpp:
     511        (WebCore::SVGMaskElement::SVGMaskElement):
     512        (WebCore::SVGMaskElement::registerAttributes):
     513        (WebCore::SVGMaskElement::parseAttribute):
     514        (WebCore::SVGMaskElement::svgAttributeChanged):
     515        (WebCore::SVGMaskElement::isSupportedAttribute): Deleted.
     516        (WebCore::SVGMaskElement::requiredFeatures): Deleted.
     517        (WebCore::SVGMaskElement::requiredExtensions): Deleted.
     518        (WebCore::SVGMaskElement::systemLanguage): Deleted.
     519        * svg/SVGMaskElement.h:
     520        * svg/SVGPathElement.cpp:
     521        (WebCore::SVGPathElement::SVGPathElement):
     522        (WebCore::SVGPathElement::registerAttributes):
     523        (WebCore::SVGPathElement::parseAttribute):
     524        (WebCore::SVGPathElement::svgAttributeChanged):
     525        (WebCore::SVGPathElement::pathByteStream const):
     526        (WebCore::SVGPathElement::lookupOrCreateDWrapper):
     527        (WebCore::SVGPathElement::animatedPropertyWillBeDeleted):
     528        (WebCore::SVGPathElement::pathSegList):
     529        (WebCore::SVGPathElement::animatedPathSegList):
     530        (WebCore::SVGPathElement::pathSegListChanged):
     531        (WebCore::SVGPathElement::dPropertyInfo): Deleted.
     532        (WebCore::SVGPathElement::isSupportedAttribute): Deleted.
     533        (WebCore::SVGPathElement::synchronizeD): Deleted.
     534        * svg/SVGPathElement.h:
     535        * svg/SVGPathSegListValues.h:
     536        (WebCore::SVGPropertyTraits<SVGPathSegListValues>::toString):
     537        * svg/SVGPathSegWithContext.h:
     538        (WebCore::SVGPathSegWithContext::animatedProperty const):
     539        * svg/SVGPatternElement.cpp:
     540        (WebCore::SVGPatternElement::SVGPatternElement):
     541        (WebCore::SVGPatternElement::registerAttributes):
     542        (WebCore::SVGPatternElement::parseAttribute):
     543        (WebCore::SVGPatternElement::svgAttributeChanged):
     544        (WebCore::SVGPatternElement::collectPatternAttributes const):
     545        (WebCore::SVGPatternElement::isSupportedAttribute): Deleted.
     546        (WebCore::SVGPatternElement::requiredFeatures): Deleted.
     547        (WebCore::SVGPatternElement::requiredExtensions): Deleted.
     548        (WebCore::SVGPatternElement::systemLanguage): Deleted.
     549        * svg/SVGPatternElement.h:
     550        * svg/SVGPointListValues.h:
     551        (WebCore::SVGPropertyTraits<SVGPointListValues>::toString):
     552        * svg/SVGPolyElement.cpp:
     553        (WebCore::SVGPolyElement::SVGPolyElement):
     554        (WebCore::SVGPolyElement::registerAttributes):
     555        (WebCore::SVGPolyElement::parseAttribute):
     556        (WebCore::SVGPolyElement::svgAttributeChanged):
     557        (WebCore::SVGPolyElement::points):
     558        (WebCore::SVGPolyElement::animatedPoints):
     559        (WebCore::SVGPolyElement::pointsPropertyInfo): Deleted.
     560        (WebCore::SVGPolyElement::synchronizePoints): Deleted.
     561        (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper): Deleted.
     562        * svg/SVGPolyElement.h:
     563        (WebCore::SVGPolyElement::pointList const):
     564        (WebCore::SVGPolyElement::attributeRegistry):
     565        (WebCore::SVGPolyElement::isKnownAttribute):
     566        * svg/SVGPreserveAspectRatioValue.cpp:
     567        (WebCore::SVGPreserveAspectRatioValue::transformRect const):
     568        (WebCore::SVGPreserveAspectRatioValue::transformRect): Deleted.
     569        * svg/SVGPreserveAspectRatioValue.h:
     570        * svg/SVGRadialGradientElement.cpp:
     571        (WebCore::SVGRadialGradientElement::SVGRadialGradientElement):
     572        (WebCore::SVGRadialGradientElement::registerAttributes):
     573        (WebCore::SVGRadialGradientElement::parseAttribute):
     574        (WebCore::SVGRadialGradientElement::svgAttributeChanged):
     575        (WebCore::SVGRadialGradientElement::isSupportedAttribute): Deleted.
     576        * svg/SVGRadialGradientElement.h:
     577        * svg/SVGRectElement.cpp:
     578        (WebCore::SVGRectElement::SVGRectElement):
     579        (WebCore::SVGRectElement::registerAttributes):
     580        (WebCore::SVGRectElement::parseAttribute):
     581        (WebCore::SVGRectElement::svgAttributeChanged):
     582        * svg/SVGRectElement.h:
     583        * svg/SVGSVGElement.cpp:
     584        (WebCore::SVGSVGElement::SVGSVGElement):
     585        (WebCore::SVGSVGElement::registerAttributes):
     586        (WebCore::SVGSVGElement::parseAttribute):
     587        (WebCore::SVGSVGElement::svgAttributeChanged):
     588        (WebCore::SVGSVGElement::viewBoxToViewTransform const):
     589        (WebCore::SVGSVGElement::resetScrollAnchor):
     590        (WebCore::SVGSVGElement::inheritViewAttributes):
     591        * svg/SVGSVGElement.h:
     592        (WebCore::SVGSVGElement::useCurrentView const): Deleted.
     593        (WebCore::SVGSVGElement::currentTranslateValue): Deleted.
     594        (WebCore::SVGSVGElement::zoomAndPan const): Deleted.
     595        (WebCore::SVGSVGElement::setZoomAndPan): Deleted.
     596        (WebCore::SVGSVGElement::timeContainer): Deleted.
     597        (WebCore::SVGSVGElement::hasEmptyViewBox const): Deleted.
     598        * svg/SVGScriptElement.cpp:
     599        (WebCore::SVGScriptElement::SVGScriptElement):
     600        (WebCore::SVGScriptElement::svgAttributeChanged):
     601        (WebCore::SVGScriptElement::insertedIntoAncestor):
     602        (WebCore::SVGScriptElement::addSubresourceAttributeURLs const):
     603        (WebCore::SVGScriptElement::isURLAttribute const): Deleted.
     604        (WebCore::SVGScriptElement::sourceAttributeValue const): Deleted.
     605        (WebCore::SVGScriptElement::charsetAttributeValue const): Deleted.
     606        (WebCore::SVGScriptElement::typeAttributeValue const): Deleted.
     607        (WebCore::SVGScriptElement::languageAttributeValue const): Deleted.
     608        (WebCore::SVGScriptElement::forAttributeValue const): Deleted.
     609        (WebCore::SVGScriptElement::eventAttributeValue const): Deleted.
     610        (WebCore::SVGScriptElement::hasAsyncAttribute const): Deleted.
     611        (WebCore::SVGScriptElement::hasDeferAttribute const): Deleted.
     612        (WebCore::SVGScriptElement::hasNoModuleAttribute const): Deleted.
     613        (WebCore::SVGScriptElement::hasSourceAttribute const): Deleted.
     614        (WebCore::SVGScriptElement::filterOutAnimatableAttribute const): Deleted.
     615        * svg/SVGScriptElement.h:
     616        * svg/SVGStopElement.cpp:
     617        (WebCore::SVGStopElement::SVGStopElement):
     618        (WebCore::SVGStopElement::registerAttributes):
     619        (WebCore::SVGStopElement::parseAttribute):
     620        * svg/SVGStopElement.h:
     621        * svg/SVGStringListValues.h:
     622        (WebCore::SVGPropertyTraits<SVGStringListValues>::toString):
     623        * svg/SVGSwitchElement.cpp:
     624        (WebCore::SVGSwitchElement::SVGSwitchElement):
     625        * svg/SVGSwitchElement.h:
     626        * svg/SVGSymbolElement.cpp:
     627        (WebCore::SVGSymbolElement::SVGSymbolElement):
     628        (WebCore::SVGSymbolElement::parseAttribute):
     629        (WebCore::SVGSymbolElement::svgAttributeChanged):
     630        * svg/SVGSymbolElement.h:
     631        * svg/SVGTRefElement.cpp:
     632        (WebCore::SVGTRefElement::SVGTRefElement):
     633        * svg/SVGTRefElement.h:
     634        * svg/SVGTests.cpp:
     635        (WebCore::SVGTests::SVGTests):
     636        (WebCore::SVGTests::registerAttributes):
     637        (WebCore::SVGTests::attributeRegistry):
     638        (WebCore::SVGTests::isKnownAttribute):
     639        (WebCore::SVGTests::isValid const):
     640        (WebCore::SVGTests::parseAttribute):
     641        (WebCore::SVGTests::svgAttributeChanged):
     642        (WebCore::SVGTests::requiredFeatures):
     643        (WebCore::SVGTests::requiredExtensions):
     644        (WebCore::SVGTests::systemLanguage):
     645        (WebCore::createSVGTestPropertyInfo): Deleted.
     646        (WebCore::createSVGTextAttributeToPropertyMap): Deleted.
     647        (WebCore::SVGTests::attributeToPropertyMap): Deleted.
     648        (WebCore::SVGTests::handleAttributeChange): Deleted.
     649        (WebCore::SVGTests::synchronizeAttribute): Deleted.
     650        (WebCore::SVGTests::synchronizeRequiredFeatures): Deleted.
     651        (WebCore::SVGTests::synchronizeRequiredExtensions): Deleted.
     652        (WebCore::SVGTests::synchronizeSystemLanguage): Deleted.
     653        * svg/SVGTests.h:
     654        * svg/SVGTextContentElement.cpp:
     655        (WebCore::SVGTextContentElement::SVGTextContentElement):
     656        (WebCore::SVGTextContentElement::registerAttributes):
     657        (WebCore::SVGTextContentElement::parseAttribute):
     658        (WebCore::SVGTextContentElement::svgAttributeChanged):
     659        (WebCore::SVGTextContentElement::textLengthPropertyInfo): Deleted.
     660        (WebCore::SVGTextContentElement::synchronizeTextLength): Deleted.
     661        (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): Deleted.
     662        (WebCore::SVGTextContentElement::textLengthAnimated): Deleted.
     663        (WebCore::SVGTextContentElement::isSupportedAttribute): Deleted.
     664        * svg/SVGTextContentElement.h:
     665        (WebCore::SVGTextContentElement::specifiedTextLength):
     666        (WebCore::SVGTextContentElement::attributeRegistry):
     667        (WebCore::SVGTextContentElement::textLength const):
     668        (WebCore::SVGTextContentElement::lengthAdjust const):
     669        (WebCore::SVGTextContentElement::textLengthAnimated):
     670        (WebCore::SVGTextContentElement::lengthAdjustAnimated):
     671        (WebCore::SVGTextContentElement::isKnownAttribute):
     672        (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::SVGAnimatedCustomLengthAttribute):
     673        (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::synchronize):
     674        (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::animatedProperty):
     675        * svg/SVGTextPathElement.cpp:
     676        (WebCore::SVGTextPathElement::SVGTextPathElement):
     677        (WebCore::SVGTextPathElement::registerAttributes):
     678        (WebCore::SVGTextPathElement::parseAttribute):
     679        (WebCore::SVGTextPathElement::svgAttributeChanged):
     680        (WebCore::SVGTextPathElement::isSupportedAttribute): Deleted.
     681        * svg/SVGTextPathElement.h:
     682        * svg/SVGTextPositioningElement.cpp:
     683        (WebCore::SVGTextPositioningElement::SVGTextPositioningElement):
     684        (WebCore::SVGTextPositioningElement::registerAttributes):
     685        (WebCore::SVGTextPositioningElement::parseAttribute):
     686        (WebCore::SVGTextPositioningElement::svgAttributeChanged):
     687        * svg/SVGTextPositioningElement.h:
     688        (WebCore::SVGTextPositioningElement::attributeRegistry):
     689        (WebCore::SVGTextPositioningElement::x const):
     690        (WebCore::SVGTextPositioningElement::y const):
     691        (WebCore::SVGTextPositioningElement::dx const):
     692        (WebCore::SVGTextPositioningElement::dy const):
     693        (WebCore::SVGTextPositioningElement::rotate const):
     694        (WebCore::SVGTextPositioningElement::xAnimated):
     695        (WebCore::SVGTextPositioningElement::yAnimated):
     696        (WebCore::SVGTextPositioningElement::dxAnimated):
     697        (WebCore::SVGTextPositioningElement::dyAnimated):
     698        (WebCore::SVGTextPositioningElement::rotateAnimated):
     699        (WebCore::SVGTextPositioningElement::isKnownAttribute):
     700        * svg/SVGURIReference.cpp:
     701        (WebCore::SVGURIReference::SVGURIReference):
     702        (WebCore::SVGURIReference::registerAttributes):
     703        (WebCore::SVGURIReference::attributeRegistry):
     704        (WebCore::SVGURIReference::isKnownAttribute):
     705        (WebCore::SVGURIReference::parseAttribute):
     706        (WebCore::SVGURIReference::href const):
     707        (WebCore::SVGURIReference::hrefAnimated):
     708        (WebCore::SVGURIReference::addSupportedAttributes): Deleted.
     709        * svg/SVGURIReference.h:
     710        * svg/SVGUseElement.cpp:
     711        (WebCore::SVGUseElement::SVGUseElement):
     712        (WebCore::SVGUseElement::registerAttributes):
     713        (WebCore::SVGUseElement::parseAttribute):
     714        (WebCore::SVGUseElement::insertedIntoAncestor):
     715        (WebCore::SVGUseElement::transferSizeAttributesToTargetClone const):
     716        (WebCore::SVGUseElement::svgAttributeChanged):
     717        (WebCore::SVGUseElement::notifyFinished):
     718        * svg/SVGUseElement.h:
     719        * svg/SVGValue.h:
     720        * svg/SVGViewElement.cpp:
     721        (WebCore::SVGViewElement::SVGViewElement):
     722        (WebCore::SVGViewElement::parseAttribute):
     723        * svg/SVGViewElement.h:
     724        * svg/SVGViewSpec.cpp:
     725        (WebCore::SVGViewSpec::SVGViewSpec):
     726        (WebCore::SVGViewSpec::registerAttributes):
     727        (WebCore::SVGViewSpec::transform):
     728        (WebCore::SVGViewSpec::reset):
     729        (WebCore::SVGViewSpec::parseViewSpec):
     730        (WebCore::SVGViewSpec::viewBoxPropertyInfo): Deleted.
     731        (WebCore::SVGViewSpec::preserveAspectRatioPropertyInfo): Deleted.
     732        (WebCore::SVGViewSpec::transformPropertyInfo): Deleted.
     733        (WebCore::SVGViewSpec::viewBoxIdentifier): Deleted.
     734        (WebCore::SVGViewSpec::preserveAspectRatioIdentifier): Deleted.
     735        (WebCore::SVGViewSpec::transformIdentifier): Deleted.
     736        (WebCore::SVGViewSpec::setZoomAndPan): Deleted.
     737        (WebCore::SVGViewSpec::transformString const): Deleted.
     738        (WebCore::SVGViewSpec::viewBoxString const): Deleted.
     739        (WebCore::SVGViewSpec::preserveAspectRatioString const): Deleted.
     740        (WebCore::SVGViewSpec::viewBoxAnimated): Deleted.
     741        (WebCore::SVGViewSpec::preserveAspectRatioAnimated): Deleted.
     742        (WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): Deleted.
     743        (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper): Deleted.
     744        (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): Deleted.
     745        * svg/SVGViewSpec.h:
     746        * svg/SVGViewSpec.idl:
     747        * svg/SVGZoomAndPan.cpp:
     748        (WebCore::SVGZoomAndPan::SVGZoomAndPan):
     749        (WebCore::SVGZoomAndPan::registerAttributes):
     750        (WebCore::SVGZoomAndPan::parseZoomAndPan):
     751        (WebCore::SVGZoomAndPan::parseAttribute):
     752        (WebCore::SVGZoomAndPan::parse): Deleted.
     753        (WebCore::SVGZoomAndPan::parseAttributeValue): Deleted.
     754        * svg/SVGZoomAndPan.h:
     755        (WebCore::SVGZoomAndPan::zoomAndPan const):
     756        (WebCore::SVGZoomAndPan::setZoomAndPan):
     757        (WebCore::SVGZoomAndPan::reset):
     758        (WebCore::SVGZoomAndPan::attributeRegistry):
     759        (WebCore::SVGZoomAndPan::isKnownAttribute):
     760        (WebCore::SVGZoomAndPan::parseFromNumber): Deleted.
     761        (WebCore::SVGZoomAndPan::parseAttribute): Deleted.
     762        * svg/SVGZoomAndPanType.h: Copied from Source/WebCore/svg/SVGValue.h.
     763        (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::initialValue):
     764        (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::toString):
     765        (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::fromString):
     766        * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
     767        * svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp: Copied from Source/WebCore/svg/SVGValue.h.
     768        (WebCore::SVGAnimatedPathSegListPropertyTearOff::SVGAnimatedPathSegListPropertyTearOff):
     769        (WebCore::SVGAnimatedPathSegListPropertyTearOff::~SVGAnimatedPathSegListPropertyTearOff):
     770        (WebCore::SVGAnimatedPathSegListPropertyTearOff::animValDidChange):
     771        * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
     772        * svg/properties/SVGAnimatedProperty.cpp:
     773        (WebCore::SVGAnimatedProperty::SVGAnimatedProperty):
     774        (WebCore::SVGAnimatedProperty::~SVGAnimatedProperty):
     775        (WebCore::SVGAnimatedProperty::animatedPropertyCache): Deleted.
     776        * svg/properties/SVGAnimatedProperty.h:
     777        (WebCore::SVGAnimatedProperty::isAnimating const):
     778        (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const):
     779        (WebCore::SVGAnimatedProperty::lookupOrCreateAnimatedProperty):
     780        (WebCore::SVGAnimatedProperty::lookupAnimatedProperty):
     781        (WebCore::SVGAnimatedProperty::animatedPropertyCache):
     782        (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper): Deleted.
     783        (WebCore::SVGAnimatedProperty::lookupWrapper): Deleted.
     784        * svg/properties/SVGAnimatedPropertyMacros.h: Removed.
     785        * svg/properties/SVGAnimatedPropertyType.h: Copied from Source/WebCore/svg/SVGAElement.idl.
     786        * svg/properties/SVGAttribute.h: Added.
     787        (WebCore::SVGPropertyAttribute::SVGPropertyAttribute):
     788        (WebCore::SVGPropertyAttribute::value):
     789        (WebCore::SVGPropertyAttribute::value const):
     790        (WebCore::SVGPropertyAttribute::setValue):
     791        (WebCore::SVGPropertyAttribute::resetValue):
     792        (WebCore::SVGPropertyAttribute::toString const):
     793        (WebCore::SVGPropertyAttribute::setShouldSynchronize):
     794        (WebCore::SVGPropertyAttribute::shouldSynchronize const):
     795        (WebCore::SVGPropertyAttribute::synchronize):
     796        (WebCore::SVGAnimatedAttribute::SVGAnimatedAttribute):
     797        (WebCore::SVGAnimatedAttribute::currentValue const):
     798        (WebCore::SVGAnimatedAttribute::animatedProperty):
     799        (WebCore::SVGAnimatedAttributeList::SVGAnimatedAttributeList):
     800        (WebCore::SVGAnimatedAttributeList::detachAnimatedListWrappers):
     801        * svg/properties/SVGAttributeAccessor.h: Added.
     802        (WebCore::SVGAttributeAccessor::SVGAttributeAccessor):
     803        (WebCore::SVGAttributeAccessor::attributeName const):
     804        (WebCore::SVGAttributeAccessor::isAnimatedLengthAttribute const):
     805        (WebCore::SVGAttributeAccessor::animatedType const):
     806        (WebCore::SVGAttributeAccessor::animatedTypes const):
     807        (WebCore::SVGAttributeAccessor::lookupOrCreateAnimatedProperty const):
     808        (WebCore::SVGAttributeAccessor::lookupAnimatedProperty const):
     809        (WebCore::SVGAttributeAccessor::lookupOrCreateAnimatedProperties const):
     810        (WebCore::SVGPropertyAttributeAccessor::singleton):
     811        (WebCore::SVGPropertyAttributeAccessor::SVGPropertyAttributeAccessor):
     812        (WebCore::SVGPropertyAttributeAccessor::attribute const):
     813        (WebCore::SVGAnimatedAttributeAccessor::singleton):
     814        (WebCore::SVGAnimatedAttributeAccessor::SVGAnimatedAttributeAccessor):
     815        (WebCore::SVGAnimatedAttributeAccessor::lookupOrCreateAnimatedProperty):
     816        (WebCore::SVGAnimatedAttributeAccessor::lookupAnimatedProperty):
     817        (WebCore::SVGAnimatedPairAttributeAccessor::SVGAnimatedPairAttributeAccessor):
     818        (WebCore::SVGAnimatedPairAttributeAccessor::secondAttribute const):
     819        * svg/properties/SVGAttributeOwnerProxy.h: Copied from Source/WebCore/svg/SVGValue.h.
     820        (WebCore::SVGAttributeOwnerProxy::SVGAttributeOwnerProxy):
     821        (WebCore::SVGAttributeOwnerProxy::element const):
     822        * svg/properties/SVGAttributeOwnerProxyImpl.h: Added.
     823        (WebCore::SVGAttributeOwnerProxyImpl::SVGAttributeOwnerProxyImpl):
     824        (WebCore::SVGAttributeOwnerProxyImpl::attributeRegistry):
     825        (WebCore::SVGAttributeOwnerProxyImpl::isKnownAttribute):
     826        (WebCore::SVGAttributeOwnerProxyImpl::isAnimatedLengthAttribute):
     827        * svg/properties/SVGAttributeRegistry.h: Added.
     828        (WebCore::SVGAttributeRegistry::registerAttribute):
     829        (WebCore::SVGAttributeRegistry::isEmpty const):
     830        (WebCore::SVGAttributeRegistry::isKnownAttribute const):
     831        (WebCore::SVGAttributeRegistry::isAnimatedLengthAttribute const):
     832        (WebCore::SVGAttributeRegistry::animatedTypes const):
     833        (WebCore::SVGAttributeRegistry::synchronizeAttributes const):
     834        (WebCore::SVGAttributeRegistry::synchronizeAttribute const):
     835        (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedProperty const):
     836        (WebCore::SVGAttributeRegistry::lookupAnimatedProperty const):
     837        (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedProperties const):
     838        (WebCore::SVGAttributeRegistry::animatedTypesBaseTypes):
     839        (WebCore::SVGAttributeRegistry::synchronizeAttributesBaseTypes):
     840        (WebCore::SVGAttributeRegistry::synchronizeAttributeBaseTypes):
     841        (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedPropertyBaseTypes):
     842        (WebCore::SVGAttributeRegistry::lookupAnimatedPropertyBaseTypes):
     843        (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedPropertiesBaseTypes):
     844        (WebCore::SVGAttributeRegistry::findAttributeAccessor const):
     845        * svg/properties/SVGAttributeToPropertyMap.cpp: Removed.
     846        * svg/properties/SVGAttributeToPropertyMap.h: Removed.
     847        * svg/properties/SVGPropertyInfo.cpp: Removed.
     848        * svg/properties/SVGPropertyInfo.h: Removed.
     849
    18502018-08-06  Alex Christensen  <achristensen@webkit.org>
    2851
  • trunk/Source/WebCore/Sources.txt

    r234586 r234620  
    22752275svg/graphics/filters/SVGFilterBuilder.cpp
    22762276
     2277svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp
    22772278svg/properties/SVGAnimatedProperty.cpp
    2278 svg/properties/SVGAttributeToPropertyMap.cpp
    2279 svg/properties/SVGPropertyInfo.cpp
    22802279
    22812280workers/AbstractWorker.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r234586 r234620  
    233233                081668DA125603D5006F25DE /* SVGTextLayoutEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 081668D8125603D5006F25DE /* SVGTextLayoutEngine.h */; };
    234234                081AA8DA1111237E002AB06E /* SVGElementRareData.h in Headers */ = {isa = PBXBuildFile; fileRef = 081AA8D91111237E002AB06E /* SVGElementRareData.h */; };
    235                 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
    236235                081EBF3B0FD34F4100DA7559 /* SVGFilterBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */; };
    237236                0823D159127AD6AC000EBC95 /* SVGAnimatedInteger.h in Headers */ = {isa = PBXBuildFile; fileRef = 0823D158127AD6AC000EBC95 /* SVGAnimatedInteger.h */; };
     
    265264                0885068011DA045B00182B98 /* PaintPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0885067E11DA045B00182B98 /* PaintPhase.h */; settings = {ATTRIBUTES = (Private, ); }; };
    266265                088A0E04126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */; };
    267                 088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
    268266                088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
    269                 088A0E07126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };
    270267                088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */; };
    271268                088A0E09126EF1DB00978F7A /* SVGListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */; };
     
    293290                08F859D51463F9CD0067D933 /* SVGImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 08F859D31463F9CD0067D933 /* SVGImageCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
    294291                08F859D51463F9CD0067D934 /* SVGImageForContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 08F859D31463F9CD0067D934 /* SVGImageForContainer.h */; };
    295                 08FB3F8413BC754C0099FC18 /* SVGAttributeToPropertyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
    296292                08FE0BC5127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FE0BC4127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h */; };
    297293                0AFDAC3D10F5448C00E1F3D2 /* PluginViewBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AFDAC3C10F5448C00E1F3D2 /* PluginViewBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    17131709                53ED3FDF167A88E7006762E6 /* JSInternalSettingsGenerated.h in Headers */ = {isa = PBXBuildFile; fileRef = 53ED3FDD167A88E7006762E6 /* JSInternalSettingsGenerated.h */; };
    17141710                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1711                55346AF121150FAF0059BCDD /* SVGAttributeOwnerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17151712                5546757B1FD212A9003B10B0 /* ImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 554675781FD1FC1A003B10B0 /* ImageSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17161713                5550CB421E955E3C00111AA0 /* ImageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5550CB411E955E3C00111AA0 /* ImageTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    17221719                55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17231720                55EC9599206AA7A0007DD0A9 /* PaintFrequencyTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1721                55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1722                55FA7FF5210FB6B1005AEFE7 /* SVGAttributeAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1723                55FA7FF7210FBE3E005AEFE7 /* SVGAttributeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */; };
     1724                55FA7FFB2110ECD7005AEFE7 /* SVGZoomAndPanType.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1725                55FA7FFF21110E6E005AEFE7 /* SVGAnimatedPropertyType.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1726                55FA8001211113EE005AEFE7 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17241727                5704405A1E53936200356601 /* JSAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 570440591E53936200356601 /* JSAesCbcCfbParams.h */; };
    17251728                5706A6961DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */; };
     
    54525455                081668D8125603D5006F25DE /* SVGTextLayoutEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutEngine.h; sourceTree = "<group>"; };
    54535456                081AA8D91111237E002AB06E /* SVGElementRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElementRareData.h; sourceTree = "<group>"; };
    5454                 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyInfo.h; sourceTree = "<group>"; };
    54555457                081EBF380FD34F4100DA7559 /* SVGFilterBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFilterBuilder.cpp; sourceTree = "<group>"; };
    54565458                081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFilterBuilder.h; sourceTree = "<group>"; };
     
    55015503                088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedProperty.h; sourceTree = "<group>"; };
    55025504                088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyDescription.h; sourceTree = "<group>"; };
    5503                 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyMacros.h; sourceTree = "<group>"; };
    55045505                088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyTearOff.h; sourceTree = "<group>"; };
    55055506                088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGListPropertyTearOff.h; sourceTree = "<group>"; };
     
    55355536                08F859D31463F9CD0067D933 /* SVGImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageCache.h; sourceTree = "<group>"; };
    55365537                08F859D31463F9CD0067D934 /* SVGImageForContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageForContainer.h; sourceTree = "<group>"; };
    5537                 08FB17C013BC7E9100040086 /* SVGAttributeToPropertyMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAttributeToPropertyMap.cpp; sourceTree = "<group>"; };
    5538                 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeToPropertyMap.h; sourceTree = "<group>"; };
    55395538                08FE0BC4127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPreserveAspectRatio.h; sourceTree = "<group>"; };
    55405539                0AFDAC3C10F5448C00E1F3D2 /* PluginViewBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginViewBase.h; sourceTree = "<group>"; };
     
    83818380                55137B2C20379E550001004B /* SVGMarkerTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerTypes.h; sourceTree = "<group>"; };
    83828381                55137B34203CEB710001004B /* SVGValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGValue.h; sourceTree = "<group>"; };
     8382                55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeOwnerProxy.h; sourceTree = "<group>"; };
     8383                55346AFA2117FFAF0059BCDD /* SVGAttributeOwnerProxyImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeOwnerProxyImpl.h; sourceTree = "<group>"; };
    83838384                554675771FD1FC1A003B10B0 /* ImageSource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageSource.cpp; sourceTree = "<group>"; };
    83848385                554675781FD1FC1A003B10B0 /* ImageSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageSource.h; sourceTree = "<group>"; };
     
    83968397                55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; };
    83978398                55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaintFrequencyTracker.h; sourceTree = "<group>"; };
     8399                55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttribute.h; sourceTree = "<group>"; };
     8400                55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeAccessor.h; sourceTree = "<group>"; };
     8401                55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeRegistry.h; sourceTree = "<group>"; };
     8402                55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGZoomAndPanType.h; sourceTree = "<group>"; };
     8403                55FA7FFC2110F813005AEFE7 /* SVGAnimatedPathSegListPropertyTearOff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPathSegListPropertyTearOff.cpp; sourceTree = "<group>"; };
     8404                55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyType.h; sourceTree = "<group>"; };
    83988405                570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; };
    83998406                570440591E53936200356601 /* JSAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcCfbParams.h; sourceTree = "<group>"; };
     
    1254512552                B5320D69122A24E9002D1440 /* FontPlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontPlatformData.h; sourceTree = "<group>"; };
    1254612553                B5320D6A122A24E9002D1440 /* FontPlatformDataCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FontPlatformDataCocoa.mm; sourceTree = "<group>"; };
    12547                 B543B85617EB758F003BE93A /* SVGPropertyInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPropertyInfo.cpp; sourceTree = "<group>"; };
    1254812554                B562DB5E17D3CD560010AF96 /* HTMLElementTypeHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HTMLElementTypeHelpers.h; sourceTree = "<group>"; };
    1254912555                B562DB5F17D3CD560010AF96 /* SVGElementTypeHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGElementTypeHelpers.h; sourceTree = "<group>"; };
     
    1546115467                                71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */,
    1546215468                                088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */,
     15469                                55FA7FFC2110F813005AEFE7 /* SVGAnimatedPathSegListPropertyTearOff.cpp */,
    1546315470                                089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */,
    1546415471                                836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */,
    1546515472                                088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */,
    1546615473                                088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */,
    15467                                 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */,
    1546815474                                088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */,
     15475                                55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */,
    1546915476                                08525E621278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h */,
    1547015477                                085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */,
    15471                                 08FB17C013BC7E9100040086 /* SVGAttributeToPropertyMap.cpp */,
    15472                                 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */,
     15478                                55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */,
     15479                                55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */,
     15480                                55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */,
     15481                                55346AFA2117FFAF0059BCDD /* SVGAttributeOwnerProxyImpl.h */,
     15482                                55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */,
    1547315483                                0810764312828556007C63BA /* SVGListProperty.h */,
    1547415484                                088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */,
    1547515485                                08CA3D4312894A3800FFF260 /* SVGMatrixTearOff.h */,
    1547615486                                088A0E01126EF1DB00978F7A /* SVGProperty.h */,
    15477                                 B543B85617EB758F003BE93A /* SVGPropertyInfo.cpp */,
    15478                                 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */,
    1547915487                                088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */,
    1548015488                                088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */,
     
    2349223500                                B22279600D00BF210071B782 /* SVGZoomAndPan.h */,
    2349323501                                B22279610D00BF210071B782 /* SVGZoomAndPan.idl */,
     23502                                55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */,
    2349423503                                B2E4EC940D00C22B00432643 /* SVGZoomEvent.cpp */,
    2349523504                                B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */,
     
    3044730456                                43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */,
    3044830457                                08FE0BC5127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h in Headers */,
    30449                                 088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */,
     30458                                55FA8001211113EE005AEFE7 /* SVGAnimatedProperty.h in Headers */,
    3045030459                                088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */,
    30451                                 088A0E07126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h in Headers */,
    3045230460                                088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */,
     30461                                55FA7FFF21110E6E005AEFE7 /* SVGAnimatedPropertyType.h in Headers */,
    3045330462                                08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */,
    3045430463                                08525E631278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h in Headers */,
     
    3046430473                                B22279980D00BF220071B782 /* SVGAnimationElement.h in Headers */,
    3046530474                                439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */,
    30466                                 08FB3F8413BC754C0099FC18 /* SVGAttributeToPropertyMap.h in Headers */,
     30475                                55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */,
     30476                                55FA7FF5210FB6B1005AEFE7 /* SVGAttributeAccessor.h in Headers */,
     30477                                55346AF121150FAF0059BCDD /* SVGAttributeOwnerProxy.h in Headers */,
     30478                                55FA7FF7210FBE3E005AEFE7 /* SVGAttributeRegistry.h in Headers */,
    3046730479                                B222799C0D00BF220071B782 /* SVGCircleElement.h in Headers */,
    3046830480                                B222799F0D00BF220071B782 /* SVGClipPathElement.h in Headers */,
     
    3060730619                                B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */,
    3060830620                                088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */,
    30609                                 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */,
    3061030621                                088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */,
    3061130622                                088A0E0C126EF1DB00978F7A /* SVGPropertyTraits.h in Headers */,
     
    3066830679                                8485228B1190173C006EDC7F /* SVGVKernElement.h in Headers */,
    3066930680                                B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */,
     30681                                55FA7FFB2110ECD7005AEFE7 /* SVGZoomAndPanType.h in Headers */,
    3067030682                                B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */,
    3067130683                                46ECB6381FD0A3C80088E5AD /* SWClientConnection.h in Headers */,
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp

    r224537 r234620  
    116116{
    117117    // An empty viewBox disables rendering.
    118     if (markerElement().hasAttribute(SVGNames::viewBoxAttr) && markerElement().viewBoxIsValid() && markerElement().viewBox().isEmpty())
     118    if (markerElement().hasAttribute(SVGNames::viewBoxAttr) && markerElement().hasEmptyViewBox())
    119119        return;
    120120
  • trunk/Source/WebCore/svg/SVGAElement.cpp

    r229694 r234620  
    33 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
    5  * Copyright (C) 2010 Apple Inc. All rights reserved.
     5 * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
    66 *
    77 * This library is free software; you can redistribute it and/or
     
    4747WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAElement);
    4848
    49 // Animated property definitions
    50 DEFINE_ANIMATED_STRING(SVGAElement, SVGNames::targetAttr, SVGTarget, svgTarget)
    51 DEFINE_ANIMATED_STRING(SVGAElement, XLinkNames::hrefAttr, Href, href)
    52 DEFINE_ANIMATED_BOOLEAN(SVGAElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    53 
    54 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAElement)
    55     REGISTER_LOCAL_ANIMATED_PROPERTY(svgTarget)
    56     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    57     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    58     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    59 END_REGISTER_ANIMATED_PROPERTIES
    60 
    6149inline SVGAElement::SVGAElement(const QualifiedName& tagName, Document& document)
    6250    : SVGGraphicsElement(tagName, document)
     51    , SVGExternalResourcesRequired(this)
     52    , SVGURIReference(this)
    6353{
    6454    ASSERT(hasTagName(SVGNames::aTag));
    65     registerAnimatedPropertiesForSVGAElement();
     55    registerAttributes();
    6656}
    6757
     
    8272}
    8373
     74void SVGAElement::registerAttributes()
     75{
     76    auto& registry = attributeRegistry();
     77    if (!registry.isEmpty())
     78        return;
     79    registry.registerAttribute<SVGNames::targetAttr, &SVGAElement::m_target>();
     80}
     81
    8482void SVGAElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    8583{
    8684    if (name == SVGNames::targetAttr) {
    87         setSVGTargetBaseValue(value);
     85        m_target.setValue(value);
    8886        return;
    8987    }
     
    103101            invalidateStyleForSubtree();
    104102        }
     103        return;
    105104    }
    106105
    107106    SVGGraphicsElement::svgAttributeChanged(attrName);
     107    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    108108}
    109109
  • trunk/Source/WebCore/svg/SVGAElement.h

    r229694 r234620  
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    2223#pragma once
    2324
    24 #include "SVGAnimatedBoolean.h"
    2525#include "SVGExternalResourcesRequired.h"
    2626#include "SVGGraphicsElement.h"
     
    2929namespace WebCore {
    3030
    31 class SVGAElement final : public SVGGraphicsElement, public SVGURIReference, public SVGExternalResourcesRequired {
     31class SVGAElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGURIReference {
    3232    WTF_MAKE_ISO_ALLOCATED(SVGAElement);
    3333public:
    3434    static Ref<SVGAElement> create(const QualifiedName&, Document&);
    3535
     36    String target() const final { return m_target.currentValue(attributeOwnerProxy()); }
     37    RefPtr<SVGAnimatedString> targetAnimated() { return m_target.animatedProperty(attributeOwnerProxy()); }
     38
    3639private:
    3740    SVGAElement(const QualifiedName&, Document&);
    3841
    39     bool isValid() const final { return SVGTests::isValid(); }
    40    
    41     String title() const final;
    42     String target() const final { return svgTarget(); }
     42    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
     43    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     44    static void registerAttributes();
    4345
     46    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4447    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    4548    void svgAttributeChanged(const QualifiedName&) final;
     
    4851    bool childShouldCreateRenderer(const Node&) const final;
    4952
     53    bool isValid() const final { return SVGTests::isValid(); }
     54    String title() const final;
    5055    void defaultEventHandler(Event&) final;
    5156   
     
    5964    bool willRespondToMouseClickEvents() final;
    6065
    61     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAElement)
    62         // This declaration used to define a non-virtual "String& target() const" method, that clashes with "virtual String Element::target() const".
    63         // That's why it has been renamed to "svgTarget", the CodeGenerators take care of calling svgTargetAnimated() instead of targetAnimated(), see CodeGenerator.pm.
    64         DECLARE_ANIMATED_STRING(SVGTarget, svgTarget)
    65         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    66         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    67     END_DECLARE_ANIMATED_PROPERTIES
     66    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     67    SVGAnimatedStringAttribute m_target;
    6868};
    6969
  • trunk/Source/WebCore/svg/SVGAElement.idl

    r163440 r234620  
    2525
    2626interface SVGAElement : SVGGraphicsElement {
    27     [ImplementedAs=svgTarget] readonly attribute SVGAnimatedString target;
     27    readonly attribute SVGAnimatedString target;
    2828};
    2929
  • trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2008 Apple Inc. All rights reserved.
     4 * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
    55 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
    66 *
     
    3838WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAltGlyphElement);
    3939
    40 // Animated property definitions
    41 DEFINE_ANIMATED_STRING(SVGAltGlyphElement, XLinkNames::hrefAttr, Href, href)
    42 
    43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAltGlyphElement)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    45     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextPositioningElement)
    46 END_REGISTER_ANIMATED_PROPERTIES
    47 
    4840inline SVGAltGlyphElement::SVGAltGlyphElement(const QualifiedName& tagName, Document& document)
    4941    : SVGTextPositioningElement(tagName, document)
     42    , SVGURIReference(this)
    5043{
    5144    ASSERT(hasTagName(SVGNames::altGlyphTag));
    52     registerAnimatedPropertiesForSVGAltGlyphElement();
    5345}
    5446
  • trunk/Source/WebCore/svg/SVGAltGlyphElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2008 Apple Inc. All rights reserved.
     4 * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    4646    SVGAltGlyphElement(const QualifiedName&, Document&);
    4747
     48    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAltGlyphElement, SVGTextPositioningElement, SVGURIReference>;
     49    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     50
    4851    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
    4952    bool childShouldCreateRenderer(const Node&) const override;
    5053
    51     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAltGlyphElement)
    52         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    53     END_DECLARE_ANIMATED_PROPERTIES
     54    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    5455};
    5556
  • trunk/Source/WebCore/svg/SVGAnimatedAngle.h

    r208668 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2324#include "SVGAnimatedPropertyTearOff.h"
    2425#include "SVGAnimatedTypeAnimator.h"
     26#include "SVGAttribute.h"
    2527
    2628namespace WebCore {
    2729
     30class SVGAnimationElement;
     31
    2832using SVGAnimatedAngle = SVGAnimatedPropertyTearOff<SVGAngle>;
    29 
    30 // Helper macros to declare/define a SVGAnimatedAngle object. SVGAnimatedAngle is only used in the SVG DOM for SVGMarkerElement.
    31 #define DECLARE_ANIMATED_ANGLE(UpperProperty, LowerProperty) \
    32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedAngle, SVGAngleValue, UpperProperty, LowerProperty, )
    33 
    34 // Only used for SVGMarkerElements orientAttr, which maps to SVGAnimatedAngle orientAngle and SVGAnimatedEnumeration orientType.
    35 #define DEFINE_ANIMATED_ANGLE_AND_ENUMERATION(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \
    36 DEFINE_ANIMATED_PROPERTY(AnimatedAngle, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty)
    37 
    38 class SVGAnimationElement;
     33using SVGAnimatedAngleAttribute = SVGAnimatedAttribute<SVGAnimatedAngle>;
    3934
    4035class SVGAnimatedAngleAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedBoolean.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGAnimatedStaticPropertyTearOff.h"
    2324#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2426
    2527namespace WebCore {
    2628
    27 typedef SVGAnimatedStaticPropertyTearOff<bool> SVGAnimatedBoolean;
     29class SVGAnimationElement;
    2830
    29 // Helper macros to declare/define a SVGAnimatedBoolean object
    30 #define DECLARE_ANIMATED_BOOLEAN(UpperProperty, LowerProperty) \
    31 DECLARE_ANIMATED_PROPERTY(SVGAnimatedBoolean, bool, UpperProperty, LowerProperty, )
     31using SVGAnimatedBoolean = SVGAnimatedStaticPropertyTearOff<bool>;
     32using SVGAnimatedBooleanAttribute = SVGAnimatedAttribute<SVGAnimatedBoolean>;
    3233
    33 #define DECLARE_ANIMATED_BOOLEAN_OVERRIDE(UpperProperty, LowerProperty) \
    34 DECLARE_ANIMATED_PROPERTY(SVGAnimatedBoolean, bool, UpperProperty, LowerProperty, override)
    35 
    36 #define DEFINE_ANIMATED_BOOLEAN(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    37 DEFINE_ANIMATED_PROPERTY(AnimatedBoolean, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
    38 
    39 class SVGAnimationElement;
     34template<typename OwnerType>
     35using SVGAnimatedBooleanAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedBooleanAttribute, AnimatedBoolean>;
    4036
    4137class SVGAnimatedBooleanAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedEnumeration.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2122
    2223#include "SVGAnimatedEnumerationPropertyTearOff.h"
    23 #include "SVGAnimatedPropertyMacros.h"
    2424#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2526
    2627namespace WebCore {
    2728
    28 typedef SVGAnimatedStaticPropertyTearOff<unsigned> SVGAnimatedEnumeration;
     29class SVGAnimationElement;
    2930
    30 // Helper macros to declare/define a SVGAnimatedEnumeration object
    31 #define DECLARE_ANIMATED_ENUMERATION(UpperProperty, LowerProperty, EnumType) \
    32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedEnumerationPropertyTearOff<EnumType>, EnumType, UpperProperty, LowerProperty, )
     31using SVGAnimatedEnumeration = SVGAnimatedStaticPropertyTearOff<unsigned>;
    3332
    34 #define DEFINE_ANIMATED_ENUMERATION(OwnerType, DOMAttribute, UpperProperty, LowerProperty, EnumType) \
    35 DEFINE_ANIMATED_PROPERTY(AnimatedEnumeration, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
     33template<typename EnumType>
     34using SVGAnimatedEnumerationAttribute = SVGAnimatedAttribute<SVGAnimatedEnumerationPropertyTearOff<EnumType>>;
     35
     36template<typename OwnerType, typename EnumType>
     37using SVGAnimatedEnumerationAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedEnumerationAttribute<EnumType>, AnimatedEnumeration>;
    3638
    3739class SVGAnimatedEnumerationAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedInteger.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2021#pragma once
    2122
    22 #include "SVGAnimatedPropertyMacros.h"
    2323#include "SVGAnimatedStaticPropertyTearOff.h"
    2424#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2526
    2627namespace WebCore {
    2728
    28 typedef SVGAnimatedStaticPropertyTearOff<int> SVGAnimatedInteger;
     29class SVGAnimationElement;
    2930
    30 // Helper macros to declare/define a SVGAnimatedInteger object
    31 #define DECLARE_ANIMATED_INTEGER(UpperProperty, LowerProperty) \
    32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedInteger, int, UpperProperty, LowerProperty, )
     31using SVGAnimatedInteger = SVGAnimatedStaticPropertyTearOff<int>;
     32using SVGAnimatedIntegerAttribute = SVGAnimatedAttribute<SVGAnimatedInteger>;
    3333
    34 #define DEFINE_ANIMATED_INTEGER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    35 DEFINE_ANIMATED_PROPERTY(AnimatedInteger, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
     34template<typename OwnerType>
     35using SVGAnimatedIntegerAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedIntegerAttribute, AnimatedInteger>;
    3636
    37 #define DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \
    38 DEFINE_ANIMATED_PROPERTY(AnimatedIntegerOptionalInteger, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty)
    39 
    40 class SVGAnimationElement;
     37template<typename OwnerType>
     38using SVGAnimatedOptionalIntegerAttributeAccessor = SVGAnimatedOptionalAttributeAccessor<OwnerType, SVGAnimatedIntegerAttribute, AnimatedIntegerOptionalInteger>;
    4139
    4240class SVGAnimatedIntegerAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedLength.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGAnimatedPropertyTearOff.h"
    2324#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2426#include "SVGLength.h"
    2527
    2628namespace WebCore {
    2729
     30class SVGAnimationElement;
     31
    2832using SVGAnimatedLength = SVGAnimatedPropertyTearOff<SVGLength>;
     33using SVGAnimatedLengthAttribute = SVGAnimatedAttribute<SVGAnimatedLength>;
    2934
    30 // Helper macros to declare/define a SVGAnimatedLength object
    31 #define DECLARE_ANIMATED_LENGTH(UpperProperty, LowerProperty) \
    32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedLength, SVGLengthValue, UpperProperty, LowerProperty, )
    33 
    34 #define DEFINE_ANIMATED_LENGTH(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    35 DEFINE_ANIMATED_PROPERTY(AnimatedLength, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
    36 
    37 class SVGAnimationElement;
     35template<typename OwnerType>
     36using SVGAnimatedLengthAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedLengthAttribute, AnimatedLength>;
    3837
    3938class SVGAnimatedLengthAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedLengthList.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGAnimatedListPropertyTearOff.h"
    2324#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2426#include "SVGLength.h"
    2527#include "SVGLengthList.h"
     
    2729namespace WebCore {
    2830
     31class SVGAnimationElement;
     32
    2933using SVGAnimatedLengthList = SVGAnimatedListPropertyTearOff<SVGLengthListValues>;
     34using SVGAnimatedLengthListAttribute = SVGAnimatedAttributeList<SVGAnimatedLengthList>;
    3035
    31 // Helper macros to declare/define a SVGAnimatedLengthList object
    32 #define DECLARE_ANIMATED_LENGTH_LIST(UpperProperty, LowerProperty) \
    33 DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedLengthList, SVGLengthListValues, UpperProperty, LowerProperty)
    34 
    35 #define DEFINE_ANIMATED_LENGTH_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    36 DEFINE_ANIMATED_PROPERTY(AnimatedLengthList, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
    37 
    38 class SVGAnimationElement;
     36template<typename OwnerType>
     37using SVGAnimatedLengthListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedLengthListAttribute, AnimatedLengthList>;
    3938
    4039class SVGAnimatedLengthListAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedNumber.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2021#pragma once
    2122
    22 #include "SVGAnimatedPropertyMacros.h"
    2323#include "SVGAnimatedStaticPropertyTearOff.h"
    2424#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2526
    2627namespace WebCore {
    2728
    28 typedef SVGAnimatedStaticPropertyTearOff<float> SVGAnimatedNumber;
     29class SVGAnimationElement;
    2930
    30 // Helper macros to declare/define a SVGAnimatedNumber object
    31 #define DECLARE_ANIMATED_NUMBER(UpperProperty, LowerProperty) \
    32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedNumber, float, UpperProperty, LowerProperty, )
     31using SVGAnimatedNumber = SVGAnimatedStaticPropertyTearOff<float>;
     32using SVGAnimatedNumberAttribute = SVGAnimatedAttribute<SVGAnimatedNumber>;
    3333
    34 #define DEFINE_ANIMATED_NUMBER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    35 DEFINE_ANIMATED_PROPERTY(AnimatedNumber, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
     34template<typename OwnerType>
     35using SVGAnimatedNumberAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedNumberAttribute, AnimatedNumber>;
    3636
    37 #define DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \
    38 DEFINE_ANIMATED_PROPERTY(AnimatedNumberOptionalNumber, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty)
    39 
    40 class SVGAnimationElement;
     37template<typename OwnerType>
     38using SVGAnimatedOptionalNumberAttributeAccessor = SVGAnimatedOptionalAttributeAccessor<OwnerType, SVGAnimatedNumberAttribute, AnimatedNumberOptionalNumber>;
    4139
    4240class SVGAnimatedNumberAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedNumberList.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGAnimatedListPropertyTearOff.h"
    2324#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2426#include "SVGNumber.h"
    2527#include "SVGNumberList.h"
     
    2729namespace WebCore {
    2830
     31class SVGAnimationElement;
     32
    2933using SVGAnimatedNumberList = SVGAnimatedListPropertyTearOff<SVGNumberListValues>;
     34using SVGAnimatedNumberListAttribute = SVGAnimatedAttributeList<SVGAnimatedNumberList>;
    3035
    31 // Helper macros to declare/define a SVGAnimatedNumberList object
    32 #define DECLARE_ANIMATED_NUMBER_LIST(UpperProperty, LowerProperty) \
    33 DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedNumberList, SVGNumberListValues, UpperProperty, LowerProperty)
    34 
    35 #define DEFINE_ANIMATED_NUMBER_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    36 DEFINE_ANIMATED_PROPERTY(AnimatedNumberList, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
    37 
    38 class SVGAnimationElement;
     36template<typename OwnerType>
     37using SVGAnimatedNumberListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedNumberListAttribute, AnimatedNumberList>;
    3938
    4039class SVGAnimatedNumberListAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedPath.h

    r208668 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2011, 2012. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2021#pragma once
    2122
     23#include "SVGAnimatedPathSegListPropertyTearOff.h"
    2224#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2326
    2427namespace WebCore {
    2528
    2629class SVGAnimationElement;
     30
     31using SVGAnimatedPathSegList = SVGAnimatedPathSegListPropertyTearOff;
     32using SVGAnimatedPathSegListAttribute = SVGAnimatedAttributeList<SVGAnimatedPathSegList>;
    2733
    2834class SVGAnimatedPathAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedPointList.h

    r208863 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2627namespace WebCore {
    2728
     29class SVGAnimationElement;
     30
    2831using SVGAnimatedPointList = SVGAnimatedListPropertyTearOff<SVGPointListValues>;
     32using SVGAnimatedPointListAttribute = SVGAnimatedAttributeList<SVGAnimatedPointList>;
    2933
    30 class SVGAnimationElement;
     34template<typename OwnerType>
     35using SVGAnimatedPointListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedPointListAttribute, AnimatedPoints>;
    3136
    3237class SVGAnimatedPointListAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGAnimatedPropertyTearOff.h"
    2324#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2426#include "SVGPreserveAspectRatio.h"
    2527
    2628namespace WebCore {
    2729
    28 template<typename T>
    29 class SVGPropertyTearOff;
     30class SVGAnimationElement;
    3031
    3132using SVGAnimatedPreserveAspectRatio = SVGAnimatedPropertyTearOff<SVGPreserveAspectRatio>;
     33using SVGAnimatedPreserveAspectRatioAttribute = SVGAnimatedAttribute<SVGAnimatedPreserveAspectRatio>;
    3234
    33 // Helper macros to declare/define a SVGAnimatedPreserveAspectRatio object
    34 #define DECLARE_ANIMATED_PRESERVEASPECTRATIO(UpperProperty, LowerProperty) \
    35 DECLARE_ANIMATED_PROPERTY(SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatioValue, UpperProperty, LowerProperty, )
    36 
    37 #define DEFINE_ANIMATED_PRESERVEASPECTRATIO(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    38 DEFINE_ANIMATED_PROPERTY(AnimatedPreserveAspectRatio, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
    39 
    40 class SVGAnimationElement;
     35template<typename OwnerType>
     36using SVGAnimatedPreserveAspectRatioAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedPreserveAspectRatioAttribute, AnimatedPreserveAspectRatio>;
    4137
    4238class SVGAnimatedPreserveAspectRatioAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedRect.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2021#pragma once
    2122
    22 #include "SVGAnimatedPropertyMacros.h"
    2323#include "SVGAnimatedPropertyTearOff.h"
    2424#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2526#include "SVGRect.h"
    2627
    2728namespace WebCore {
    2829
     30class SVGAnimationElement;
    2931class SVGRect;
    3032
    3133using SVGAnimatedRect = SVGAnimatedPropertyTearOff<SVGRect>;
     34using SVGAnimatedRectAttribute = SVGAnimatedAttribute<SVGAnimatedRect>;
    3235
    33 // Helper macros to declare/define a SVGAnimatedRect object
    34 #define DECLARE_ANIMATED_RECT(UpperProperty, LowerProperty) \
    35 DECLARE_ANIMATED_PROPERTY(SVGAnimatedRect, FloatRect, UpperProperty, LowerProperty, )
    36 
    37 #define DEFINE_ANIMATED_RECT(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    38 DEFINE_ANIMATED_PROPERTY(AnimatedRect, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
    39 
    40 class SVGAnimationElement;
     36template<typename OwnerType>
     37using SVGAnimatedRectAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedRectAttribute, AnimatedRect>;
    4138
    4239class SVGAnimatedRectAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedString.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2021#pragma once
    2122
    22 #include "SVGAnimatedPropertyMacros.h"
    2323#include "SVGAnimatedStaticPropertyTearOff.h"
    2424#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2526
    2627namespace WebCore {
    2728
    28 typedef SVGAnimatedStaticPropertyTearOff<String> SVGAnimatedString;
     29class SVGAnimationElement;
    2930
    30 // Helper macros to declare/define a SVGAnimatedString object
    31 #define DECLARE_ANIMATED_STRING(UpperProperty, LowerProperty) \
    32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedString, String, UpperProperty, LowerProperty, )
     31using SVGAnimatedString = SVGAnimatedStaticPropertyTearOff<String>;
     32using SVGAnimatedStringAttribute = SVGAnimatedAttribute<SVGAnimatedString>;
    3333
    34 #define DECLARE_ANIMATED_STRING_OVERRIDE(UpperProperty, LowerProperty) \
    35 DECLARE_ANIMATED_PROPERTY(SVGAnimatedString, String, UpperProperty, LowerProperty, override)
    36 
    37 #define DEFINE_ANIMATED_STRING(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    38 DEFINE_ANIMATED_PROPERTY(AnimatedString, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
    39 
    40 class SVGAnimationElement;
     34template<typename OwnerType>
     35using SVGAnimatedStringAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedStringAttribute, AnimatedString>;
    4136
    4237class SVGAnimatedStringAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedTransformList.h

    r224213 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGAnimatedTransformListPropertyTearOff.h"
    2324#include "SVGAnimatedTypeAnimator.h"
     25#include "SVGAttributeAccessor.h"
    2426#include "SVGTransformList.h"
    2527
    2628namespace WebCore {
    2729
     30class SVGAnimationElement;
     31
    2832using SVGAnimatedTransformList = SVGAnimatedTransformListPropertyTearOff;
     33using SVGAnimatedTransformListAttribute = SVGAnimatedAttributeList<SVGAnimatedTransformList>;
    2934
    30 // Helper macros to declare/define a SVGAnimatedTransformList object
    31 #define DECLARE_ANIMATED_TRANSFORM_LIST(UpperProperty, LowerProperty) \
    32 DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedTransformList, SVGTransformListValues, UpperProperty, LowerProperty)
    33 
    34 #define DEFINE_ANIMATED_TRANSFORM_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
    35 DEFINE_ANIMATED_PROPERTY(AnimatedTransformList, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty)
    36 
    37 class SVGAnimationElement;
     35template<typename OwnerType>
     36using SVGAnimatedTransformListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedTransformListAttribute, AnimatedTransformList>;
    3837
    3938class SVGAnimatedTransformListAnimator final : public SVGAnimatedTypeAnimator {
  • trunk/Source/WebCore/svg/SVGAnimatedTypeAnimator.cpp

    r223728 r234620  
    2323#include "SVGAnimatedTypeAnimator.h"
    2424
    25 #include "SVGAttributeToPropertyMap.h"
    2625#include "SVGElement.h"
    2726
     
    5756        return result;
    5857
    59     auto& propertyMap = targetElement.localAttributeToPropertyMap();
    60     auto targetProperties = propertyMap.properties(targetElement, attributeName);
    61 
     58    auto targetProperties = targetElement.lookupOrCreateAnimatedProperties(attributeName);
    6259    if (targetProperties.isEmpty())
    6360        return result;
     
    6663
    6764    for (SVGElement* instance : targetElement.instances())
    68         result.append(SVGElementAnimatedProperties { instance, propertyMap.properties(*instance, attributeName) });
     65        result.append(SVGElementAnimatedProperties { instance, instance->lookupOrCreateAnimatedProperties(attributeName) });
    6966
    7067#if !ASSERT_DISABLED
  • trunk/Source/WebCore/svg/SVGAnimationElement.cpp

    r234278 r234620  
    4848WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAnimationElement);
    4949
    50 // Animated property definitions
    51 DEFINE_ANIMATED_BOOLEAN(SVGAnimationElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    52 
    53 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAnimationElement)
    54     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    55     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
    56 END_REGISTER_ANIMATED_PROPERTIES
    57 
    5850SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document& document)
    5951    : SVGSMILElement(tagName, document)
    60 {
    61     registerAnimatedPropertiesForSVGAnimationElement();
     52    , SVGExternalResourcesRequired(this)
     53    , SVGTests(this)
     54{
    6255}
    6356
     
    692685}
    693686
    694 Ref<SVGStringList> SVGAnimationElement::requiredFeatures()
    695 {
    696     return SVGTests::requiredFeatures(*this);
    697 }
    698 
    699 Ref<SVGStringList> SVGAnimationElement::requiredExtensions()
    700 {
    701     return SVGTests::requiredExtensions(*this);
    702 }
    703 
    704 Ref<SVGStringList> SVGAnimationElement::systemLanguage()
    705 {
    706     return SVGTests::systemLanguage(*this);
    707 }
    708 
    709 }
     687}
  • trunk/Source/WebCore/svg/SVGAnimationElement.h

    r229694 r234620  
    5353enum class CalcMode { Discrete, Linear, Paced, Spline };
    5454
    55 class SVGAnimationElement : public SVGSMILElement, public SVGTests, public SVGExternalResourcesRequired {
     55class SVGAnimationElement : public SVGSMILElement, public SVGExternalResourcesRequired, public SVGTests {
    5656    WTF_MAKE_ISO_ALLOCATED(SVGAnimationElement);
    5757public:
     
    147147    }
    148148
    149     // SVGTests
    150     Ref<SVGStringList> requiredFeatures();
    151     Ref<SVGStringList> requiredExtensions();
    152     Ref<SVGStringList> systemLanguage();
    153 
    154149protected:
    155150    SVGAnimationElement(const QualifiedName&, Document&);
     151
     152    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAnimationElement, SVGElement, SVGExternalResourcesRequired, SVGTests>;
     153    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     154    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
    156155
    157156    void computeCSSPropertyValue(SVGElement*, CSSPropertyID, String& value);
     
    208207    void applyAnimatedValue(ShouldApplyAnimation, SVGElement* targetElement, const QualifiedName& attributeName, SVGAnimatedType*);
    209208    void adjustForInheritance(SVGElement* targetElement, const QualifiedName& attributeName, String&);
    210 
    211     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAnimationElement)
    212         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    213     END_DECLARE_ANIMATED_PROPERTIES
    214 
    215     // SVGTests
    216     void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); }
    217     void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); }
    218     void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); }
    219209
    220210    void setCalcMode(const AtomicString&);
     
    232222    CalcMode m_calcMode { CalcMode::Linear };
    233223    AnimationMode m_animationMode { NoAnimation };
     224    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    234225};
    235226
  • trunk/Source/WebCore/svg/SVGCircleElement.cpp

    r231955 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGCircleElement.h"
    2324
    24 #include "FloatPoint.h"
    2525#include "RenderSVGEllipse.h"
    26 #include "RenderSVGPath.h"
    2726#include "RenderSVGResource.h"
    28 #include "SVGLengthValue.h"
    29 #include "SVGNames.h"
    3027#include <wtf/IsoMallocInlines.h>
    3128
     
    3431WTF_MAKE_ISO_ALLOCATED_IMPL(SVGCircleElement);
    3532
    36 // Animated property definitions
    37 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cxAttr, Cx, cx)
    38 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cyAttr, Cy, cy)
    39 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::rAttr, R, r)
    40 DEFINE_ANIMATED_BOOLEAN(SVGCircleElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    41 
    42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCircleElement)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(cx)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(cy)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(r)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    47     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
    48 END_REGISTER_ANIMATED_PROPERTIES
    49 
    5033inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document& document)
    5134    : SVGGeometryElement(tagName, document)
    52     , m_cx(LengthModeWidth)
    53     , m_cy(LengthModeHeight)
    54     , m_r(LengthModeOther)
     35    , SVGExternalResourcesRequired(this)
    5536{
    5637    ASSERT(hasTagName(SVGNames::circleTag));
    57     registerAnimatedPropertiesForSVGCircleElement();
     38    registerAttributes();
    5839}
    5940
     
    6344}
    6445
     46void SVGCircleElement::registerAttributes()
     47{
     48    auto& registry = attributeRegistry();
     49    if (!registry.isEmpty())
     50        return;
     51    registry.registerAttribute<SVGNames::cxAttr, &SVGCircleElement::m_cx>();
     52    registry.registerAttribute<SVGNames::cyAttr, &SVGCircleElement::m_cy>();
     53    registry.registerAttribute<SVGNames::rAttr, &SVGCircleElement::m_r>();
     54}
     55
    6556void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    6657{
     
    6859
    6960    if (name == SVGNames::cxAttr)
    70         setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     61        m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    7162    else if (name == SVGNames::cyAttr)
    72         setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     63        m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    7364    else if (name == SVGNames::rAttr)
    74         setRBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
     65        m_r.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
    7566
    7667    reportAttributeParsingError(parseError, name, value);
    7768
    78     SVGGraphicsElement::parseAttribute(name, value);
     69    SVGGeometryElement::parseAttribute(name, value);
    7970    SVGExternalResourcesRequired::parseAttribute(name, value);
    8071}
     
    8273void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName)
    8374{
    84     SVGGraphicsElement::svgAttributeChanged(attrName);
    85 
    86     if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || attrName == SVGNames::rAttr) {
     75    if (isKnownAttribute(attrName)) {
    8776        InstanceInvalidationGuard guard(*this);
    8877        invalidateSVGPresentationAttributeStyle();
     
    9079    }
    9180
    92     auto* renderer = downcast<RenderSVGShape>(this->renderer());
    93     if (!renderer)
    94         return;
    95 
    96     if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
    97         InstanceInvalidationGuard guard(*this);
    98         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    99     }
     81    SVGGeometryElement::svgAttributeChanged(attrName);
     82    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    10083}
    10184
  • trunk/Source/WebCore/svg/SVGCircleElement.h

    r231955 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2122#pragma once
    2223
    23 #include "SVGAnimatedBoolean.h"
    2424#include "SVGAnimatedLength.h"
    2525#include "SVGExternalResourcesRequired.h"
    2626#include "SVGGeometryElement.h"
     27#include "SVGNames.h"
    2728
    2829namespace WebCore {
     
    3334    static Ref<SVGCircleElement> create(const QualifiedName&, Document&);
    3435
     36    const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); }
     37    const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); }
     38    const SVGLengthValue& r() const { return m_r.currentValue(attributeOwnerProxy()); }
     39
     40    RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); }
     41    RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); }
     42    RefPtr<SVGAnimatedLength> rAnimated() { return m_r.animatedProperty(attributeOwnerProxy()); }
     43
    3544private:
    3645    SVGCircleElement(const QualifiedName&, Document&);
    3746
    38     bool isValid() const final { return SVGTests::isValid(); }
     47    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCircleElement, SVGGeometryElement, SVGExternalResourcesRequired>;
     48    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     49    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     50    static void registerAttributes();
    3951
     52    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4053    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    4154    void svgAttributeChanged(const QualifiedName&) final;
    4255
     56    bool isValid() const final { return SVGTests::isValid(); }
    4357    bool selfHasRelativeLengths() const final { return true; }
    4458
    4559    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    4660
    47     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGCircleElement)
    48         DECLARE_ANIMATED_LENGTH(Cx, cx)
    49         DECLARE_ANIMATED_LENGTH(Cy, cy)
    50         DECLARE_ANIMATED_LENGTH(R, r)
    51         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    52     END_DECLARE_ANIMATED_PROPERTIES
     61    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     62    SVGAnimatedLengthAttribute m_cx { LengthModeWidth };
     63    SVGAnimatedLengthAttribute m_cy { LengthModeHeight };
     64    SVGAnimatedLengthAttribute m_r { LengthModeOther };
    5365};
    5466
  • trunk/Source/WebCore/svg/SVGClipPathElement.cpp

    r229694 r234620  
    33 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
    44 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    3435WTF_MAKE_ISO_ALLOCATED_IMPL(SVGClipPathElement);
    3536
    36 // Animated property definitions
    37 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, ClipPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType)
    38 DEFINE_ANIMATED_BOOLEAN(SVGClipPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    39 
    40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement)
    41     REGISTER_LOCAL_ANIMATED_PROPERTY(clipPathUnits)
    42     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    43     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    44 END_REGISTER_ANIMATED_PROPERTIES
    45 
    4637inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document& document)
    4738    : SVGGraphicsElement(tagName, document)
    48     , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
     39    , SVGExternalResourcesRequired(this)
    4940{
    5041    ASSERT(hasTagName(SVGNames::clipPathTag));
    51     registerAnimatedPropertiesForSVGClipPathElement();
     42    registerAttributes();
    5243}
    5344
     
    5748}
    5849
    59 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName)
     50void SVGClipPathElement::registerAttributes()
    6051{
    61     static const auto supportedAttributes = makeNeverDestroyed([] {
    62         HashSet<QualifiedName> set;
    63         SVGLangSpace::addSupportedAttributes(set);
    64         SVGExternalResourcesRequired::addSupportedAttributes(set);
    65         set.add(SVGNames::clipPathUnitsAttr);
    66         return set;
    67     }());
    68     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     52    auto& registry = attributeRegistry();
     53    if (!registry.isEmpty())
     54        return;
     55    registry.registerAttribute<SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGClipPathElement::m_clipPathUnits>();
    6956}
    7057
     
    7461        auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
    7562        if (propertyValue > 0)
    76             setClipPathUnitsBaseValue(propertyValue);
     63            m_clipPathUnits.setValue(propertyValue);
    7764        return;
    7865    }
     
    8471void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName)
    8572{
    86     if (!isSupportedAttribute(attrName)) {
    87         SVGGraphicsElement::svgAttributeChanged(attrName);
     73    if (isKnownAttribute(attrName)) {
     74        InstanceInvalidationGuard guard(*this);
     75
     76        if (RenderObject* object = renderer())
     77            object->setNeedsLayout();
    8878        return;
    8979    }
    9080
    91     InstanceInvalidationGuard guard(*this);
    92 
    93     if (RenderObject* object = renderer())
    94         object->setNeedsLayout();
     81    SVGGraphicsElement::svgAttributeChanged(attrName);
     82    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    9583}
    9684
  • trunk/Source/WebCore/svg/SVGClipPathElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3637    static Ref<SVGClipPathElement> create(const QualifiedName&, Document&);
    3738
     39    SVGUnitTypes::SVGUnitType clipPathUnits() const { return m_clipPathUnits.currentValue(attributeOwnerProxy()); }
     40    RefPtr<SVGAnimatedEnumeration> clipPathUnitsAnimated() { return m_clipPathUnits.animatedProperty(attributeOwnerProxy()); }
     41
    3842private:
    3943    SVGClipPathElement(const QualifiedName&, Document&);
     44
     45    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGClipPathElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
     46    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     47    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     48    static void registerAttributes();
     49
     50    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     51    void parseAttribute(const QualifiedName&, const AtomicString&) final;
     52    void svgAttributeChanged(const QualifiedName&) final;
     53    void childrenChanged(const ChildChange&) final;
    4054
    4155    bool isValid() const final { return SVGTests::isValid(); }
     
    4357    bool needsPendingResourceHandling() const final { return false; }
    4458
    45     static bool isSupportedAttribute(const QualifiedName&);
    46     void parseAttribute(const QualifiedName&, const AtomicString&) final;
    47     void svgAttributeChanged(const QualifiedName&) final;
    48     void childrenChanged(const ChildChange&) final;
    49 
    5059    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    5160
    52     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGClipPathElement)
    53         DECLARE_ANIMATED_ENUMERATION(ClipPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType)
    54         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    55     END_DECLARE_ANIMATED_PROPERTIES
     61    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     62    SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_clipPathUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE };
    5663};
    5764
  • trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3233WTF_MAKE_ISO_ALLOCATED_IMPL(SVGComponentTransferFunctionElement);
    3334
    34 // Animated property definitions
    35 DEFINE_ANIMATED_ENUMERATION(SVGComponentTransferFunctionElement, SVGNames::typeAttr, Type, type, ComponentTransferType)
    36 DEFINE_ANIMATED_NUMBER_LIST(SVGComponentTransferFunctionElement, SVGNames::tableValuesAttr, TableValues, tableValues)
    37 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::slopeAttr, Slope, slope)
    38 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::interceptAttr, Intercept, intercept)
    39 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::amplitudeAttr, Amplitude, amplitude)
    40 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::exponentAttr, Exponent, exponent)
    41 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::offsetAttr, Offset, offset)
    42 
    43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(type)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(tableValues)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(slope)
    47     REGISTER_LOCAL_ANIMATED_PROPERTY(intercept)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(amplitude)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(exponent)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(offset)
    51 END_REGISTER_ANIMATED_PROPERTIES
    52 
    5335SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document& document)
    5436    : SVGElement(tagName, document)
    55     , m_type(FECOMPONENTTRANSFER_TYPE_IDENTITY)
    56     , m_slope(1)
    57     , m_amplitude(1)
    58     , m_exponent(1)
    5937{
    60     registerAnimatedPropertiesForSVGComponentTransferFunctionElement();
     38    registerAttributes();
    6139}
    6240
    63 bool SVGComponentTransferFunctionElement::isSupportedAttribute(const QualifiedName& attrName)
     41void SVGComponentTransferFunctionElement::registerAttributes()
    6442{
    65     static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> {
    66         SVGNames::typeAttr,
    67         SVGNames::tableValuesAttr,
    68         SVGNames::slopeAttr,
    69         SVGNames::interceptAttr,
    70         SVGNames::amplitudeAttr,
    71         SVGNames::exponentAttr,
    72         SVGNames::offsetAttr,
    73     });
    74     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     43    auto& registry = attributeRegistry();
     44    if (!registry.isEmpty())
     45        return;
     46    registry.registerAttribute<SVGNames::typeAttr, ComponentTransferType, &SVGComponentTransferFunctionElement::m_type>();
     47    registry.registerAttribute<SVGNames::tableValuesAttr, &SVGComponentTransferFunctionElement::m_tableValues>();
     48    registry.registerAttribute<SVGNames::slopeAttr, &SVGComponentTransferFunctionElement::m_slope>();
     49    registry.registerAttribute<SVGNames::interceptAttr, &SVGComponentTransferFunctionElement::m_intercept>();
     50    registry.registerAttribute<SVGNames::amplitudeAttr, &SVGComponentTransferFunctionElement::m_amplitude>();
     51    registry.registerAttribute<SVGNames::exponentAttr, &SVGComponentTransferFunctionElement::m_exponent>();
     52    registry.registerAttribute<SVGNames::offsetAttr, &SVGComponentTransferFunctionElement::m_offset>();
    7553}
    7654
     
    8058        ComponentTransferType propertyValue = SVGPropertyTraits<ComponentTransferType>::fromString(value);
    8159        if (propertyValue > 0)
    82             setTypeBaseValue(propertyValue);
     60            m_type.setValue(propertyValue);
    8361        return;
    8462    }
     
    8765        SVGNumberListValues newList;
    8866        newList.parse(value);
    89         detachAnimatedTableValuesListWrappers(newList.size());
    90         setTableValuesBaseValue(newList);
     67        m_tableValues.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     68        m_tableValues.setValue(WTFMove(newList));
    9169        return;
    9270    }
    9371
    9472    if (name == SVGNames::slopeAttr) {
    95         setSlopeBaseValue(value.toFloat());
     73        m_slope.setValue(value.toFloat());
    9674        return;
    9775    }
    9876
    9977    if (name == SVGNames::interceptAttr) {
    100         setInterceptBaseValue(value.toFloat());
     78        m_intercept.setValue(value.toFloat());
    10179        return;
    10280    }
    10381
    10482    if (name == SVGNames::amplitudeAttr) {
    105         setAmplitudeBaseValue(value.toFloat());
     83        m_amplitude.setValue(value.toFloat());
    10684        return;
    10785    }
    10886
    10987    if (name == SVGNames::exponentAttr) {
    110         setExponentBaseValue(value.toFloat());
     88        m_exponent.setValue(value.toFloat());
    11189        return;
    11290    }
    11391
    11492    if (name == SVGNames::offsetAttr) {
    115         setOffsetBaseValue(value.toFloat());
     93        m_offset.setValue(value.toFloat());
    11694        return;
    11795    }
     
    122100void SVGComponentTransferFunctionElement::svgAttributeChanged(const QualifiedName& attrName)
    123101{
    124     if (!isSupportedAttribute(attrName)) {
    125         SVGElement::svgAttributeChanged(attrName);
     102    if (isKnownAttribute(attrName)) {
     103        InstanceInvalidationGuard guard(*this);
     104        invalidateFilterPrimitiveParent(this);
    126105        return;
    127106    }
    128107
    129     InstanceInvalidationGuard guard(*this);
    130 
    131     invalidateFilterPrimitiveParent(this);
     108    SVGElement::svgAttributeChanged(attrName);
    132109}
    133110
    134111ComponentTransferFunction SVGComponentTransferFunctionElement::transferFunction() const
    135112{
    136     ComponentTransferFunction func;
    137     func.type = type();
    138     func.slope = slope();
    139     func.intercept = intercept();
    140     func.amplitude = amplitude();
    141     func.exponent = exponent();
    142     func.offset = offset();
    143     func.tableValues = tableValues();
    144     return func;
     113    return {
     114        type(),
     115        slope(),
     116        intercept(),
     117        amplitude(),
     118        exponent(),
     119        offset(),
     120        tableValues()
     121    };
    145122}
    146123
  • trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.h

    r233122 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    7576    ComponentTransferFunction transferFunction() const;
    7677
     78    ComponentTransferType type() const { return m_type.currentValue(attributeOwnerProxy()); }
     79    const SVGNumberListValues& tableValues() const { return m_tableValues.currentValue(attributeOwnerProxy()); }
     80    float slope() const { return m_slope.currentValue(attributeOwnerProxy()); }
     81    float intercept() const { return m_intercept.currentValue(attributeOwnerProxy()); }
     82    float amplitude() const { return m_amplitude.currentValue(attributeOwnerProxy()); }
     83    float exponent() const { return m_exponent.currentValue(attributeOwnerProxy()); }
     84    float offset() const { return m_offset.currentValue(attributeOwnerProxy()); }
     85
     86    RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(attributeOwnerProxy()); }
     87    RefPtr<SVGAnimatedNumberList> tableValuesAnimated() { return m_tableValues.animatedProperty(attributeOwnerProxy()); }
     88    RefPtr<SVGAnimatedNumber> slopeAnimated() { return m_slope.animatedProperty(attributeOwnerProxy()); }
     89    RefPtr<SVGAnimatedNumber> interceptAnimated() { return m_intercept.animatedProperty(attributeOwnerProxy()); }
     90    RefPtr<SVGAnimatedNumber> amplitudeAnimated() { return m_amplitude.animatedProperty(attributeOwnerProxy()); }
     91    RefPtr<SVGAnimatedNumber> exponentAnimated() { return m_exponent.animatedProperty(attributeOwnerProxy()); }
     92    RefPtr<SVGAnimatedNumber> offsetAnimated() { return m_offset.animatedProperty(attributeOwnerProxy()); }
     93
    7794protected:
    7895    SVGComponentTransferFunctionElement(const QualifiedName&, Document&);
    7996
     97    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGComponentTransferFunctionElement, SVGElement>;
     98    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     99    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     100    static void registerAttributes();
     101
     102    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
    80103    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    81104    void svgAttributeChanged(const QualifiedName&) override;
     
    84107   
    85108private:
    86     static bool isSupportedAttribute(const QualifiedName&);
    87 
    88     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement)
    89         DECLARE_ANIMATED_ENUMERATION(Type, type, ComponentTransferType)
    90         DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues)
    91         DECLARE_ANIMATED_NUMBER(Slope, slope)
    92         DECLARE_ANIMATED_NUMBER(Intercept, intercept)
    93         DECLARE_ANIMATED_NUMBER(Amplitude, amplitude)
    94         DECLARE_ANIMATED_NUMBER(Exponent, exponent)
    95         DECLARE_ANIMATED_NUMBER(Offset, offset)
    96     END_DECLARE_ANIMATED_PROPERTIES
     109    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     110    SVGAnimatedEnumerationAttribute<ComponentTransferType> m_type { FECOMPONENTTRANSFER_TYPE_IDENTITY };
     111    SVGAnimatedNumberListAttribute m_tableValues;
     112    SVGAnimatedNumberAttribute m_slope { 1 };
     113    SVGAnimatedNumberAttribute m_intercept;
     114    SVGAnimatedNumberAttribute m_amplitude { 1 };
     115    SVGAnimatedNumberAttribute m_exponent { 1 };
     116    SVGAnimatedNumberAttribute m_offset;
    97117};
    98118
  • trunk/Source/WebCore/svg/SVGCursorElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3435WTF_MAKE_ISO_ALLOCATED_IMPL(SVGCursorElement);
    3536
    36 // Animated property definitions
    37 DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::xAttr, X, x)
    38 DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::yAttr, Y, y)
    39 DEFINE_ANIMATED_STRING(SVGCursorElement, XLinkNames::hrefAttr, Href, href)
    40 DEFINE_ANIMATED_BOOLEAN(SVGCursorElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    41 
    42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    47     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
    48 END_REGISTER_ANIMATED_PROPERTIES
    49 
    5037inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document& document)
    5138    : SVGElement(tagName, document)
    52     , m_x(LengthModeWidth)
    53     , m_y(LengthModeHeight)
     39    , SVGExternalResourcesRequired(this)
     40    , SVGTests(this)
     41    , SVGURIReference(this)
    5442{
    5543    ASSERT(hasTagName(SVGNames::cursorTag));
    56     registerAnimatedPropertiesForSVGCursorElement();
     44    registerAttributes();
    5745}
    5846
     
    6856}
    6957
    70 bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName)
     58void SVGCursorElement::registerAttributes()
    7159{
    72     static const auto supportedAttributes = makeNeverDestroyed([] {
    73         HashSet<QualifiedName> set;
    74         SVGTests::addSupportedAttributes(set);
    75         SVGExternalResourcesRequired::addSupportedAttributes(set);
    76         SVGURIReference::addSupportedAttributes(set);
    77         set.add({ SVGNames::xAttr.get(), SVGNames::yAttr.get() });
    78         return set;
    79     }());
    80     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     60    auto& registry = attributeRegistry();
     61    if (!registry.isEmpty())
     62        return;
     63    registry.registerAttribute<SVGNames::xAttr, &SVGCursorElement::m_x>();
     64    registry.registerAttribute<SVGNames::yAttr, &SVGCursorElement::m_y>();
    8165}
    8266
     
    8670
    8771    if (name == SVGNames::xAttr)
    88         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     72        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    8973    else if (name == SVGNames::yAttr)
    90         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     74        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    9175
    9276    reportAttributeParsingError(parseError, name, value);
     
    11094void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName)
    11195{
    112     if (!isSupportedAttribute(attrName)) {
    113         SVGElement::svgAttributeChanged(attrName);
     96    if (isKnownAttribute(attrName)) {
     97        InstanceInvalidationGuard guard(*this);
     98        for (auto& client : m_clients)
     99            client->cursorElementChanged(*this);
    114100        return;
    115101    }
    116102
    117     InstanceInvalidationGuard guard(*this);
    118     for (auto& client : m_clients)
    119         client->cursorElementChanged(*this);
     103    SVGElement::svgAttributeChanged(attrName);
    120104}
    121105
     
    127111}
    128112
    129 Ref<SVGStringList> SVGCursorElement::requiredFeatures()
    130 {
    131     return SVGTests::requiredFeatures(*this);
    132113}
    133 
    134 Ref<SVGStringList> SVGCursorElement::requiredExtensions()
    135 {
    136     return SVGTests::requiredExtensions(*this);
    137 }
    138 
    139 Ref<SVGStringList> SVGCursorElement::systemLanguage()
    140 {
    141     return SVGTests::systemLanguage(*this);
    142 }
    143 
    144 }
  • trunk/Source/WebCore/svg/SVGCursorElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3334class CSSCursorImageValue;
    3435
    35 class SVGCursorElement final : public SVGElement, public SVGTests, public SVGExternalResourcesRequired, public SVGURIReference {
     36class SVGCursorElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGTests, public SVGURIReference {
    3637    WTF_MAKE_ISO_ALLOCATED(SVGCursorElement);
    3738public:
     
    4344    void removeClient(CSSCursorImageValue&);
    4445
    45     // SVGTests
    46     Ref<SVGStringList> requiredFeatures();
    47     Ref<SVGStringList> requiredExtensions();
    48     Ref<SVGStringList> systemLanguage();
     46    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     47    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     48
     49    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     50    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
    4951
    5052private:
    5153    SVGCursorElement(const QualifiedName&, Document&);
    5254
    53     bool isValid() const final { return SVGTests::isValid(); }
     55    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCursorElement, SVGElement, SVGExternalResourcesRequired, SVGTests, SVGURIReference>;
     56    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     57    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     58    static void registerAttributes();
    5459
    55     static bool isSupportedAttribute(const QualifiedName&);
     60    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    5661    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    5762    void svgAttributeChanged(const QualifiedName&) final;
    5863
     64    bool isValid() const final { return SVGTests::isValid(); }
    5965    bool rendererIsNeeded(const RenderStyle&) final { return false; }
    6066
    6167    void addSubresourceAttributeURLs(ListHashSet<URL>&) const final;
    6268
    63     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGCursorElement)
    64         DECLARE_ANIMATED_LENGTH(X, x)
    65         DECLARE_ANIMATED_LENGTH(Y, y)
    66         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    67         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    68     END_DECLARE_ANIMATED_PROPERTIES
    69 
    70     // SVGTests
    71     void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); }
    72     void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); }
    73     void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); }
    74 
     69    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     70    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
     71    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
    7572    HashSet<CSSCursorImageValue*> m_clients;
    7673};
  • trunk/Source/WebCore/svg/SVGDefsElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3031WTF_MAKE_ISO_ALLOCATED_IMPL(SVGDefsElement);
    3132
    32 // Animated property definitions
    33 DEFINE_ANIMATED_BOOLEAN(SVGDefsElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    34 
    35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGDefsElement)
    36     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    37     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    38 END_REGISTER_ANIMATED_PROPERTIES
    39 
    4033inline SVGDefsElement::SVGDefsElement(const QualifiedName& tagName, Document& document)
    4134    : SVGGraphicsElement(tagName, document)
     35    , SVGExternalResourcesRequired(this)
    4236{
    4337    ASSERT(hasTagName(SVGNames::defsTag));
    44     registerAnimatedPropertiesForSVGDefsElement();
    4538}
    4639
  • trunk/Source/WebCore/svg/SVGDefsElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3536    SVGDefsElement(const QualifiedName&, Document&);
    3637
     38    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGDefsElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
     39    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     40
    3741    bool isValid() const final;
    3842    bool supportsFocus() const final { return false; }
     
    4044    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    4145
    42     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGDefsElement)
    43         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    44     END_DECLARE_ANIMATED_PROPERTIES
     46    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    4547};
    4648
  • trunk/Source/WebCore/svg/SVGElement.cpp

    r234563 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2008-2017 Apple Inc. All rights reserved.
     4 * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
    55 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
    66 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
     
    6464
    6565WTF_MAKE_ISO_ALLOCATED_IMPL(SVGElement);
    66 
    67 // Animated property definitions
    68 DEFINE_ANIMATED_STRING(SVGElement, HTMLNames::classAttr, ClassName, className)
    69 
    70 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGElement)
    71     REGISTER_LOCAL_ANIMATED_PROPERTY(className)
    72 END_REGISTER_ANIMATED_PROPERTIES
    7366
    7467static NEVER_INLINE HashMap<AtomicStringImpl*, CSSPropertyID> createAttributeNameToCSSPropertyIDMap()
     
    283276SVGElement::SVGElement(const QualifiedName& tagName, Document& document)
    284277    : StyledElement(tagName, document, CreateSVGElement)
    285 {
    286     registerAnimatedPropertiesForSVGElement();
     278    , SVGLangSpace(this)
     279{
     280    registerAttributes();
    287281}
    288282
     
    459453}
    460454
     455void SVGElement::registerAttributes()
     456{
     457    auto& registry = attributeRegistry();
     458    if (!registry.isEmpty())
     459        return;
     460    registry.registerAttribute<HTMLNames::classAttr, &SVGElement::m_className>();
     461}
     462
    461463void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    462464{
    463465    if (name == HTMLNames::classAttr) {
    464         setClassNameBaseValue(value);
     466        m_className.setValue(value);
    465467        return;
    466468    }
     
    485487Vector<AnimatedPropertyType> SVGElement::animatedPropertyTypesForAttribute(const QualifiedName& attributeName)
    486488{
    487     auto types = localAttributeToPropertyMap().types(attributeName);
     489    auto types = animatedTypes(attributeName);
    488490    if (!types.isEmpty())
    489491        return types;
     
    696698    ASSERT(svgElement->elementData()->animatedSVGAttributesAreDirty());
    697699
    698     svgElement->localAttributeToPropertyMap().synchronizeProperties(*svgElement);
     700    svgElement->synchronizeAttributes();
    699701    svgElement->elementData()->setAnimatedSVGAttributesAreDirty(false);
    700702}
     
    709711        synchronizeAllAnimatedSVGAttribute(nonConstThis);
    710712    else
    711         nonConstThis->localAttributeToPropertyMap().synchronizeProperty(*nonConstThis, name);
    712 }
    713 
    714 void SVGElement::synchronizeRequiredFeatures(SVGElement* contextElement)
    715 {
    716     ASSERT(contextElement);
    717     contextElement->synchronizeRequiredFeatures();
    718 }
    719 
    720 void SVGElement::synchronizeRequiredExtensions(SVGElement* contextElement)
    721 {
    722     ASSERT(contextElement);
    723     contextElement->synchronizeRequiredExtensions();
    724 }
    725 
    726 void SVGElement::synchronizeSystemLanguage(SVGElement* contextElement)
    727 {
    728     ASSERT(contextElement);
    729     contextElement->synchronizeSystemLanguage();
     713        nonConstThis->synchronizeAttribute(name);
    730714}
    731715
     
    940924bool SVGElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attributeName)
    941925{
    942     return !localAttributeToPropertyMap().types(attributeName).isEmpty();
     926    return !animatedTypes(attributeName).isEmpty();
    943927}
    944928
     
    955939    if (propertyID > 0)
    956940        addPropertyToPresentationAttributeStyle(style, propertyID, value);
    957 }
    958 
    959 bool SVGElement::isKnownAttribute(const QualifiedName& attrName)
    960 {
    961     return attrName == HTMLNames::idAttr;
    962941}
    963942
     
    986965        return;
    987966    }
     967
     968    SVGLangSpace::svgAttributeChanged(attrName);
    988969}
    989970
  • trunk/Source/WebCore/svg/SVGElement.h

    r232178 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2009-2016 Apple Inc. All rights reserved.
     4 * Copyright (C) 2009-2018 Apple Inc. All rights reserved.
    55 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
    66 *
     
    2424
    2525#include "SVGAnimatedString.h"
     26#include "SVGAttributeOwnerProxy.h"
    2627#include "SVGLangSpace.h"
    2728#include "SVGLocatable.h"
    2829#include "SVGNames.h"
    2930#include "SVGParsingError.h"
    30 #include "SVGPropertyInfo.h"
    3131#include "StyledElement.h"
    3232#include <wtf/HashMap.h>
     
    3939class DeprecatedCSSOMValue;
    4040class Document;
    41 class SVGAttributeToPropertyMap;
    4241class SVGDocumentExtensions;
    4342class SVGElementRareData;
     
    5857    static bool isAnimatableCSSProperty(const QualifiedName&);
    5958    bool isPresentationAttributeWithSVGDOM(const QualifiedName&);
    60     bool isKnownAttribute(const QualifiedName&);
    6159    RefPtr<DeprecatedCSSOMValue> getPresentationAttribute(const String& name);
    6260    virtual bool supportsMarkers() const { return false; }
     
    110108    std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
    111109
    112     static void synchronizeRequiredFeatures(SVGElement* contextElement);
    113     static void synchronizeRequiredExtensions(SVGElement* contextElement);
    114     static void synchronizeSystemLanguage(SVGElement* contextElement);
    115 
    116     virtual void synchronizeRequiredFeatures() { }
    117     virtual void synchronizeRequiredExtensions() { }
    118     virtual void synchronizeSystemLanguage() { }
    119 
    120110    static QualifiedName animatableAttributeForName(const AtomicString&);
    121111#ifndef NDEBUG
     
    139129
    140130    class InstanceUpdateBlocker;
     131    class InstanceInvalidationGuard;
     132
     133    // The definition of the owner proxy has to match the class inheritance but we are interested in the SVG objects only.
     134    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGElement, SVGLangSpace>;
     135    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     136    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     137    static void registerAttributes();
     138
     139    // A super class will override this function to return its owner proxy. The attributes of the super class will
     140    // be accessible through the registry of the owner proxy.
     141    virtual const SVGAttributeOwnerProxy& attributeOwnerProxy() const { return m_attributeOwnerProxy; }
     142
     143    // Helper functions which return info for the super class' attributes.
     144    void synchronizeAttribute(const QualifiedName& name) { attributeOwnerProxy().synchronizeAttribute(name); }
     145    void synchronizeAttributes() { attributeOwnerProxy().synchronizeAttributes(); }
     146    Vector<AnimatedPropertyType> animatedTypes(const QualifiedName& attributeName) const { return attributeOwnerProxy().animatedTypes(attributeName); }
     147    RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGAttribute& attribute) const { return attributeOwnerProxy().lookupAnimatedProperty(attribute); }
     148    RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(const SVGAttribute& attribute) { return attributeOwnerProxy().lookupOrCreateAnimatedProperty(attribute); }
     149    Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(const QualifiedName& name) { return attributeOwnerProxy().lookupOrCreateAnimatedProperties(name); }
     150
     151    // These are needed for the RenderTree, animation and DOM.
     152    const auto& className() const { return m_className.currentValue(attributeOwnerProxy()); }
     153    auto classNameAnimated() { return m_className.animatedProperty(attributeOwnerProxy()); }
    141154
    142155protected:
     
    170183    void willRecalcStyle(Style::Change) override;
    171184
    172     class InstanceInvalidationGuard;
    173 
    174185private:
    175186    const RenderStyle* computedStyle(PseudoId = PseudoId::None) final;
     
    190201    HashSet<SVGElement*> m_elementsWithRelativeLengths;
    191202
    192     BEGIN_DECLARE_ANIMATED_PROPERTIES_BASE(SVGElement)
    193         DECLARE_ANIMATED_STRING(ClassName, className)
    194     END_DECLARE_ANIMATED_PROPERTIES
    195 
     203    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     204    SVGAnimatedStringAttribute m_className;
    196205};
    197206
  • trunk/Source/WebCore/svg/SVGEllipseElement.cpp

    r231955 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGEllipseElement.h"
    2324
    24 #include "FloatPoint.h"
    2525#include "RenderSVGEllipse.h"
    26 #include "RenderSVGPath.h"
    2726#include "RenderSVGResource.h"
    28 #include "SVGLengthValue.h"
    29 #include "SVGNames.h"
    3027#include <wtf/IsoMallocInlines.h>
    3128
     
    3431WTF_MAKE_ISO_ALLOCATED_IMPL(SVGEllipseElement);
    3532
    36 // Animated property definitions
    37 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cxAttr, Cx, cx)
    38 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cyAttr, Cy, cy)
    39 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx)
    40 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry)
    41 DEFINE_ANIMATED_BOOLEAN(SVGEllipseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    42 
    43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(cx)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(cy)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(rx)
    47     REGISTER_LOCAL_ANIMATED_PROPERTY(ry)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    49     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
    50 END_REGISTER_ANIMATED_PROPERTIES
    51 
    5233inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document& document)
    5334    : SVGGeometryElement(tagName, document)
    54     , m_cx(LengthModeWidth)
    55     , m_cy(LengthModeHeight)
    56     , m_rx(LengthModeWidth)
    57     , m_ry(LengthModeHeight)
     35    , SVGExternalResourcesRequired(this)
    5836{
    5937    ASSERT(hasTagName(SVGNames::ellipseTag));
    60     registerAnimatedPropertiesForSVGEllipseElement();
     38    registerAttributes();
    6139}   
    6240
     
    6644}
    6745
     46void SVGEllipseElement::registerAttributes()
     47{
     48    auto& registry = attributeRegistry();
     49    if (!registry.isEmpty())
     50        return;
     51    registry.registerAttribute<SVGNames::cxAttr, &SVGEllipseElement::m_cx>();
     52    registry.registerAttribute<SVGNames::cyAttr, &SVGEllipseElement::m_cy>();
     53    registry.registerAttribute<SVGNames::rxAttr, &SVGEllipseElement::m_rx>();
     54    registry.registerAttribute<SVGNames::ryAttr, &SVGEllipseElement::m_ry>();
     55}
     56
    6857void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    6958{
     
    7160
    7261    if (name == SVGNames::cxAttr)
    73         setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     62        m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    7463    else if (name == SVGNames::cyAttr)
    75         setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     64        m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    7665    else if (name == SVGNames::rxAttr)
    77         setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     66        m_rx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
    7867    else if (name == SVGNames::ryAttr)
    79         setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
     68        m_ry.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
    8069
    8170    reportAttributeParsingError(parseError, name, value);
    8271
    83     SVGGraphicsElement::parseAttribute(name, value);
     72    SVGGeometryElement::parseAttribute(name, value);
    8473    SVGExternalResourcesRequired::parseAttribute(name, value);
    8574}
     
    8776void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName)
    8877{
    89     if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) {
     78    if (isKnownAttribute(attrName)) {
    9079        InstanceInvalidationGuard guard(*this);
    9180        invalidateSVGPresentationAttributeStyle();
     
    9382    }
    9483
    95     if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
    96         if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) {
    97             InstanceInvalidationGuard guard(*this);
    98             RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    99         }
    100         return;
    101     }
    102 
    103     SVGGraphicsElement::svgAttributeChanged(attrName);
     84    SVGGeometryElement::svgAttributeChanged(attrName);
     85    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    10486}
    10587
  • trunk/Source/WebCore/svg/SVGEllipseElement.h

    r231955 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2122#pragma once
    2223
    23 #include "SVGAnimatedBoolean.h"
    2424#include "SVGAnimatedLength.h"
    2525#include "SVGExternalResourcesRequired.h"
    2626#include "SVGGeometryElement.h"
     27#include "SVGNames.h"
    2728
    2829namespace WebCore {
     
    3334    static Ref<SVGEllipseElement> create(const QualifiedName&, Document&);
    3435
     36    const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); }
     37    const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); }
     38    const SVGLengthValue& rx() const { return m_rx.currentValue(attributeOwnerProxy()); }
     39    const SVGLengthValue& ry() const { return m_ry.currentValue(attributeOwnerProxy()); }
     40
     41    RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); }
     42    RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); }
     43    RefPtr<SVGAnimatedLength> rxAnimated() { return m_rx.animatedProperty(attributeOwnerProxy()); }
     44    RefPtr<SVGAnimatedLength> ryAnimated() { return m_ry.animatedProperty(attributeOwnerProxy()); }
     45
    3546private:
    3647    SVGEllipseElement(const QualifiedName&, Document&);
    37    
    38     bool isValid() const final { return SVGTests::isValid(); }
    3948
     49    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGEllipseElement, SVGGeometryElement, SVGExternalResourcesRequired>;
     50    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     51    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     52    static void registerAttributes();
     53
     54    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4055    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    4156    void svgAttributeChanged(const QualifiedName&) final;
    4257
     58    bool isValid() const final { return SVGTests::isValid(); }
    4359    bool selfHasRelativeLengths() const final { return true; }
    4460
    4561    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    4662
    47     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGEllipseElement)
    48         DECLARE_ANIMATED_LENGTH(Cx, cx)
    49         DECLARE_ANIMATED_LENGTH(Cy, cy)
    50         DECLARE_ANIMATED_LENGTH(Rx, rx)
    51         DECLARE_ANIMATED_LENGTH(Ry, ry)
    52         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    53     END_DECLARE_ANIMATED_PROPERTIES
     63    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     64    SVGAnimatedLengthAttribute m_cx { LengthModeWidth };
     65    SVGAnimatedLengthAttribute m_cy { LengthModeHeight };
     66    SVGAnimatedLengthAttribute m_rx { LengthModeWidth };
     67    SVGAnimatedLengthAttribute m_ry { LengthModeHeight };
    5468};
    5569
  • trunk/Source/WebCore/svg/SVGExternalResourcesRequired.cpp

    r211591 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2728namespace WebCore {
    2829
     30SVGExternalResourcesRequired::SVGExternalResourcesRequired(SVGElement* contextElement)
     31    : m_contextElement(*contextElement)
     32{
     33    registerAttributes();
     34}
     35
     36void SVGExternalResourcesRequired::registerAttributes()
     37{
     38    auto& registry = attributeRegistry();
     39    if (!registry.isEmpty())
     40        return;
     41    registry.registerAttribute<SVGNames::externalResourcesRequiredAttr, &SVGEllipseElement::m_externalResourcesRequired>();
     42}
     43
    2944void SVGExternalResourcesRequired::parseAttribute(const QualifiedName& name, const AtomicString& value)
    3045{
    3146    if (name == SVGNames::externalResourcesRequiredAttr)
    32         setExternalResourcesRequiredBaseValue(value == "true");
     47        setExternalResourcesRequired(value == "true");
    3348}
    3449
    35 bool SVGExternalResourcesRequired::isKnownAttribute(const QualifiedName& attrName)
     50void SVGExternalResourcesRequired::svgAttributeChanged(const QualifiedName& attrName)
    3651{
    37     return attrName == SVGNames::externalResourcesRequiredAttr;
     52    if (!isKnownAttribute(attrName))
     53        return;
     54    if (!m_contextElement.isConnected())
     55        return;
     56
     57    // Handle dynamic updates of the 'externalResourcesRequired' attribute. Only possible case: changing from 'true' to 'false'
     58    // causes an immediate dispatch of the SVGLoad event. If the attribute value was 'false' before inserting the script element
     59    // in the document, the SVGLoad event has already been dispatched.
     60    if (!externalResourcesRequired() && !haveFiredLoadEvent() && !isParserInserted()) {
     61        setHaveFiredLoadEvent(true);
     62
     63        ASSERT(m_contextElement.haveLoadedRequiredResources());
     64        m_contextElement.sendSVGLoadEventIfPossible();
     65    }
     66
     67    auto* renderer = m_contextElement.renderer();
     68    if (renderer && is<RenderSVGShape>(renderer)) {
     69        SVGElement::InstanceInvalidationGuard guard(m_contextElement);
     70        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     71    }
    3872}
    3973
     
    4377}
    4478
    45 bool SVGExternalResourcesRequired::handleAttributeChange(SVGElement* targetElement, const QualifiedName& attrName)
     79void SVGExternalResourcesRequired::dispatchLoadEvent()
    4680{
    47     ASSERT(targetElement);
    48     if (!isKnownAttribute(attrName))
    49         return false;
    50     if (!targetElement->isConnected())
    51         return true;
    52 
    53     // Handle dynamic updates of the 'externalResourcesRequired' attribute. Only possible case: changing from 'true' to 'false'
    54     // causes an immediate dispatch of the SVGLoad event. If the attribute value was 'false' before inserting the script element
    55     // in the document, the SVGLoad event has already been dispatched.
    56     if (!externalResourcesRequiredBaseValue() && !haveFiredLoadEvent() && !isParserInserted()) {
    57         setHaveFiredLoadEvent(true);
    58         ASSERT(targetElement->haveLoadedRequiredResources());
    59 
    60         targetElement->sendSVGLoadEventIfPossible();
    61     }
    62 
    63     return true;
    64 }
    65 
    66 void SVGExternalResourcesRequired::dispatchLoadEvent(SVGElement* targetElement)
    67 {
    68     bool externalResourcesRequired = externalResourcesRequiredBaseValue();
    69 
    7081    if (isParserInserted())
    71         ASSERT(externalResourcesRequired != haveFiredLoadEvent());
     82        ASSERT(externalResourcesRequired() != haveFiredLoadEvent());
    7283    else if (haveFiredLoadEvent())
    7384        return;
     
    7788    // SVG fires the SVGLoad event immediately after parsing the <script> element, if externalResourcesRequired
    7889    // is set to 'false', otherwise it dispatches the 'SVGLoad' event just after loading the remote resource.
    79     if (!externalResourcesRequired)
     90    if (!externalResourcesRequired())
    8091        return;
    8192
     
    8495    // Dispatch SVGLoad event
    8596    setHaveFiredLoadEvent(true);
    86     ASSERT(targetElement->haveLoadedRequiredResources());
     97    ASSERT(m_contextElement.haveLoadedRequiredResources());
    8798
    88     targetElement->sendSVGLoadEventIfPossible();
     99    m_contextElement.sendSVGLoadEventIfPossible();
    89100}
    90101
    91 void SVGExternalResourcesRequired::insertedIntoDocument(SVGElement* targetElement)
     102void SVGExternalResourcesRequired::insertedIntoDocument()
    92103{
    93104    if (isParserInserted())
     
    95106
    96107    // Eventually send SVGLoad event now for the dynamically inserted script element.
    97     if (externalResourcesRequiredBaseValue())
     108    if (externalResourcesRequired())
    98109        return;
    99110    setHaveFiredLoadEvent(true);
    100     targetElement->sendSVGLoadEventIfPossibleAsynchronously();
     111    m_contextElement.sendSVGLoadEventIfPossibleAsynchronously();
    101112}
    102113
     
    104115{
    105116    // A SVGLoad event has been fired by SVGElement::finishParsingChildren.
    106     if (!externalResourcesRequiredBaseValue())
     117    if (!externalResourcesRequired())
    107118        setHaveFiredLoadEvent(true);
    108119}
     
    110121bool SVGExternalResourcesRequired::haveLoadedRequiredResources() const
    111122{
    112     return !externalResourcesRequiredBaseValue() || haveFiredLoadEvent();
     123    return !externalResourcesRequired() || haveFiredLoadEvent();
    113124}
    114125
  • trunk/Source/WebCore/svg/SVGExternalResourcesRequired.h

    r223728 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2223
    2324#include "QualifiedName.h"
     25#include "SVGAttributeOwnerProxyImpl.h"
    2426#include <wtf/HashSet.h>
    2527
     
    3436// FIXME: When implementing animVal support, make sure that animVal==baseVal for externalResourcesRequired
    3537class SVGExternalResourcesRequired {
     38    WTF_MAKE_NONCOPYABLE(SVGExternalResourcesRequired);
    3639public:
    3740    virtual ~SVGExternalResourcesRequired() = default;
    3841
    3942    void parseAttribute(const QualifiedName&, const AtomicString&);
     43    void svgAttributeChanged(const QualifiedName&);
    4044
    41     static bool isKnownAttribute(const QualifiedName&);
    4245    static void addSupportedAttributes(HashSet<QualifiedName>&);
    4346
    44     bool handleAttributeChange(SVGElement*, const QualifiedName&);
     47    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGExternalResourcesRequired>;
     48    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     49
     50    auto externalResourcesRequiredAnimated() { return m_externalResourcesRequired.animatedProperty(attributeOwnerProxy()); }
     51
     52    bool externalResourcesRequired() const { return m_externalResourcesRequired.value(); }
     53    void setExternalResourcesRequired(bool externalResourcesRequired) { m_externalResourcesRequired.setValue(externalResourcesRequired); }
    4554
    4655protected:
    47     // These types look a bit awkward, but have to match the generic types of the SVGAnimatedProperty macros.
    48     virtual void setExternalResourcesRequiredBaseValue(const bool&, const bool validValue = true) = 0;
    49     virtual bool& externalResourcesRequiredBaseValue() const = 0;
     56    SVGExternalResourcesRequired(SVGElement* contextElement);
     57
     58    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
    5059
    5160    virtual void setHaveFiredLoadEvent(bool) { }
     
    5362    virtual bool haveFiredLoadEvent() const { return false; }
    5463
    55     void dispatchLoadEvent(SVGElement*);
    56     void insertedIntoDocument(SVGElement*);
     64    void dispatchLoadEvent();
     65    void insertedIntoDocument();
    5766    void finishParsingChildren();
    5867    bool haveLoadedRequiredResources() const;
     68
     69private:
     70    static void registerAttributes();
     71    AttributeOwnerProxy attributeOwnerProxy() { return { *this, m_contextElement }; }
     72   
     73    SVGElement& m_contextElement;
     74    SVGAnimatedBooleanAttribute m_externalResourcesRequired;
    5975};
    6076
  • trunk/Source/WebCore/svg/SVGFEBlendElement.cpp

    r234610 r234620  
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    3334WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEBlendElement);
    3435
    35 // Animated property definitions
    36 DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::inAttr, In1, in1)
    37 DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::in2Attr, In2, in2)
    38 DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode, BlendMode)
    39 
    40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEBlendElement)
    41     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    42     REGISTER_LOCAL_ANIMATED_PROPERTY(in2)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(mode)
    44     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    45 END_REGISTER_ANIMATED_PROPERTIES
    46 
    4736inline SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document& document)
    4837    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    49     , m_mode(BlendMode::Normal)
    5038{
    5139    ASSERT(hasTagName(SVGNames::feBlendTag));
    52     registerAnimatedPropertiesForSVGFEBlendElement();
     40    registerAttributes();
    5341}
    5442
     
    5644{
    5745    return adoptRef(*new SVGFEBlendElement(tagName, document));
     46}
     47   
     48void SVGFEBlendElement::registerAttributes()
     49{
     50    auto& registry = attributeRegistry();
     51    if (!registry.isEmpty())
     52        return;
     53    registry.registerAttribute<SVGNames::inAttr, &SVGFEBlendElement::m_in1>();
     54    registry.registerAttribute<SVGNames::in2Attr, &SVGFEBlendElement::m_in2>();
     55    registry.registerAttribute<SVGNames::modeAttr, BlendMode, &SVGFEBlendElement::m_mode>();
    5856}
    5957
     
    6361        BlendMode mode = BlendMode::Normal;
    6462        if (parseBlendMode(value, mode))
    65             setModeBaseValue(mode);
     63            m_mode.setValue(mode);
    6664        return;
    6765    }
    6866
    6967    if (name == SVGNames::inAttr) {
    70         setIn1BaseValue(value);
     68        m_in1.setValue(value);
    7169        return;
    7270    }
    7371
    7472    if (name == SVGNames::in2Attr) {
    75         setIn2BaseValue(value);
     73        m_in2.setValue(value);
    7674        return;
    7775    }
  • trunk/Source/WebCore/svg/SVGFEBlendElement.h

    r234610 r234620  
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    4647    static Ref<SVGFEBlendElement> create(const QualifiedName&, Document&);
    4748
     49    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     50    String in2() const { return m_in2.currentValue(attributeOwnerProxy()); }
     51    BlendMode mode() const { return m_mode.currentValue(attributeOwnerProxy()); }
     52
     53    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     54    RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); }
     55    RefPtr<SVGAnimatedEnumeration> modeAnimated() { return m_mode.animatedProperty(attributeOwnerProxy()); }
     56
    4857private:
    4958    SVGFEBlendElement(const QualifiedName&, Document&);
    5059
     60    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEBlendElement, SVGFilterPrimitiveStandardAttributes>;
     61    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     62    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     63    static void registerAttributes();
     64
     65    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    5166    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     67    void svgAttributeChanged(const QualifiedName&) override;
     68
     69    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    5270    bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
    53     void svgAttributeChanged(const QualifiedName&) override;
    54     RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    5571
    56     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEBlendElement)
    57         DECLARE_ANIMATED_STRING(In1, in1)
    58         DECLARE_ANIMATED_STRING(In2, in2)
    59         DECLARE_ANIMATED_ENUMERATION(Mode, mode, BlendMode)
    60     END_DECLARE_ANIMATED_PROPERTIES
     72    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     73    SVGAnimatedStringAttribute m_in1;
     74    SVGAnimatedStringAttribute m_in2;
     75    SVGAnimatedEnumerationAttribute<BlendMode> m_mode { BlendMode::Normal };
    6176};
    6277
  • trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3132WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEColorMatrixElement);
    3233
    33 // Animated property definitions
    34 DEFINE_ANIMATED_STRING(SVGFEColorMatrixElement, SVGNames::inAttr, In1, in1)
    35 DEFINE_ANIMATED_ENUMERATION(SVGFEColorMatrixElement, SVGNames::typeAttr, Type, type, ColorMatrixType)
    36 DEFINE_ANIMATED_NUMBER_LIST(SVGFEColorMatrixElement, SVGNames::valuesAttr, Values, values)
    37 
    38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEColorMatrixElement)
    39     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    40     REGISTER_LOCAL_ANIMATED_PROPERTY(type)
    41     REGISTER_LOCAL_ANIMATED_PROPERTY(values)
    42     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    43 END_REGISTER_ANIMATED_PROPERTIES
    44 
    4534inline SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document& document)
    4635    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    47     , m_type(FECOLORMATRIX_TYPE_MATRIX)
    4836{
    4937    ASSERT(hasTagName(SVGNames::feColorMatrixTag));
    50     registerAnimatedPropertiesForSVGFEColorMatrixElement();
     38    registerAttributes();
    5139}
    5240
     
    5644}
    5745
     46void SVGFEColorMatrixElement::registerAttributes()
     47{
     48    auto& registry = attributeRegistry();
     49    if (!registry.isEmpty())
     50        return;
     51    registry.registerAttribute<SVGNames::inAttr, &SVGFEColorMatrixElement::m_in1>();
     52    registry.registerAttribute<SVGNames::typeAttr, ColorMatrixType, &SVGFEColorMatrixElement::m_type>();
     53    registry.registerAttribute<SVGNames::valuesAttr, &SVGFEColorMatrixElement::m_values>();
     54}
     55
    5856void SVGFEColorMatrixElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    5957{
     
    6159        auto propertyValue = SVGPropertyTraits<ColorMatrixType>::fromString(value);
    6260        if (propertyValue > 0)
    63             setTypeBaseValue(propertyValue);
     61            m_type.setValue(propertyValue);
    6462        return;
    6563    }
    6664
    6765    if (name == SVGNames::inAttr) {
    68         setIn1BaseValue(value);
     66        m_in1.setValue(value);
    6967        return;
    7068    }
     
    7371        SVGNumberListValues newList;
    7472        newList.parse(value);
    75         detachAnimatedValuesListWrappers(newList.size());
    76         setValuesBaseValue(newList);
     73        m_values.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     74        m_values.setValue(WTFMove(newList));
    7775        return;
    7876    }
  • trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h

    r233122 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    7071    static Ref<SVGFEColorMatrixElement> create(const QualifiedName&, Document&);
    7172
     73    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     74    ColorMatrixType type() const { return m_type.currentValue(attributeOwnerProxy()); }
     75    const SVGNumberListValues& values() const { return m_values.currentValue(attributeOwnerProxy()); }
     76
     77    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     78    RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(attributeOwnerProxy()); }
     79    RefPtr<SVGAnimatedNumberList> valuesAnimated() { return m_values.animatedProperty(attributeOwnerProxy()); }
     80
    7281private:
    7382    SVGFEColorMatrixElement(const QualifiedName&, Document&);
    7483
     84    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEColorMatrixElement, SVGFilterPrimitiveStandardAttributes>;
     85    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     86    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     87    static void registerAttributes();
     88
     89    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    7590    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     91    void svgAttributeChanged(const QualifiedName&) override;
     92
    7693    bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
    77     void svgAttributeChanged(const QualifiedName&) override;
    7894    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    7995
    80     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEColorMatrixElement)
    81         DECLARE_ANIMATED_STRING(In1, in1)
    82         DECLARE_ANIMATED_ENUMERATION(Type, type, ColorMatrixType)
    83         DECLARE_ANIMATED_NUMBER_LIST(Values, values)
    84     END_DECLARE_ANIMATED_PROPERTIES
     96    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     97    SVGAnimatedStringAttribute m_in1;
     98    SVGAnimatedEnumerationAttribute<ColorMatrixType> m_type { FECOLORMATRIX_TYPE_MATRIX };
     99    SVGAnimatedNumberListAttribute m_values;
    85100};
    86101
  • trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3637WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEComponentTransferElement);
    3738
    38 // Animated property definitions
    39 DEFINE_ANIMATED_STRING(SVGFEComponentTransferElement, SVGNames::inAttr, In1, in1)
    40 
    41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEComponentTransferElement)
    42     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    43     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    44 END_REGISTER_ANIMATED_PROPERTIES
    45 
    4639inline SVGFEComponentTransferElement::SVGFEComponentTransferElement(const QualifiedName& tagName, Document& document)
    4740    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    4841{
    4942    ASSERT(hasTagName(SVGNames::feComponentTransferTag));
    50     registerAnimatedPropertiesForSVGFEComponentTransferElement();
     43    registerAttributes();
    5144}
    5245
     
    5649}
    5750
     51void SVGFEComponentTransferElement::registerAttributes()
     52{
     53    auto& registry = attributeRegistry();
     54    if (!registry.isEmpty())
     55        return;
     56    registry.registerAttribute<SVGNames::inAttr, &SVGFEComponentTransferElement::m_in1>();
     57}
     58
    5859void SVGFEComponentTransferElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    5960{
    6061    if (name == SVGNames::inAttr) {
    61         setIn1BaseValue(value);
     62        m_in1.setValue(value);
    6263        return;
    6364    }
  • trunk/Source/WebCore/svg/SVGFEComponentTransferElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3031    static Ref<SVGFEComponentTransferElement> create(const QualifiedName&, Document&);
    3132
     33    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     34    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     35
    3236private:
    3337    SVGFEComponentTransferElement(const QualifiedName&, Document&);
    3438
     39    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEComponentTransferElement, SVGFilterPrimitiveStandardAttributes>;
     40    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     41    static void registerAttributes();
     42
    3543    // FIXME: svgAttributeChanged missing.
     44    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    3645    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     46
    3747    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    3848
    39     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEComponentTransferElement)
    40         DECLARE_ANIMATED_STRING(In1, in1)
    41     END_DECLARE_ANIMATED_PROPERTIES
     49    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     50    SVGAnimatedStringAttribute m_in1;
    4251};
    4352
  • trunk/Source/WebCore/svg/SVGFECompositeElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3132WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFECompositeElement);
    3233
    33 // Animated property definitions
    34 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::inAttr, In1, in1)
    35 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::in2Attr, In2, in2)
    36 DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, SVGOperator, svgOperator, CompositeOperationType)
    37 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k1Attr, K1, k1)
    38 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k2Attr, K2, k2)
    39 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k3Attr, K3, k3)
    40 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k4Attr, K4, k4)
    41 
    42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFECompositeElement)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(in2)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(k1)
    47     REGISTER_LOCAL_ANIMATED_PROPERTY(k2)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(k3)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(k4)
    50     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    51 END_REGISTER_ANIMATED_PROPERTIES
    52 
    5334inline SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document& document)
    5435    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    55     , m_svgOperator(FECOMPOSITE_OPERATOR_OVER)
    5636{
    5737    ASSERT(hasTagName(SVGNames::feCompositeTag));
    58     registerAnimatedPropertiesForSVGFECompositeElement();
     38    registerAttributes();
    5939}
    6040
     
    6444}
    6545
     46void SVGFECompositeElement::registerAttributes()
     47{
     48    auto& registry = attributeRegistry();
     49    if (!registry.isEmpty())
     50        return;
     51    registry.registerAttribute<SVGNames::inAttr, &SVGFECompositeElement::m_in1>();
     52    registry.registerAttribute<SVGNames::in2Attr, &SVGFECompositeElement::m_in2>();
     53    registry.registerAttribute<SVGNames::operatorAttr, CompositeOperationType, &SVGFECompositeElement::m_svgOperator>();
     54    registry.registerAttribute<SVGNames::k1Attr, &SVGFECompositeElement::m_k1>();
     55    registry.registerAttribute<SVGNames::k2Attr, &SVGFECompositeElement::m_k2>();
     56    registry.registerAttribute<SVGNames::k3Attr, &SVGFECompositeElement::m_k3>();
     57    registry.registerAttribute<SVGNames::k4Attr, &SVGFECompositeElement::m_k4>();
     58}
     59
    6660void SVGFECompositeElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    6761{
     
    6963        CompositeOperationType propertyValue = SVGPropertyTraits<CompositeOperationType>::fromString(value);
    7064        if (propertyValue > 0)
    71             setSVGOperatorBaseValue(propertyValue);
     65            m_svgOperator.setValue(propertyValue);
    7266        return;
    7367    }
    7468
    7569    if (name == SVGNames::inAttr) {
    76         setIn1BaseValue(value);
     70        m_in1.setValue(value);
    7771        return;
    7872    }
    7973
    8074    if (name == SVGNames::in2Attr) {
    81         setIn2BaseValue(value);
     75        m_in2.setValue(value);
    8276        return;
    8377    }
    8478
    8579    if (name == SVGNames::k1Attr) {
    86         setK1BaseValue(value.toFloat());
     80        m_k1.setValue(value.toFloat());
    8781        return;
    8882    }
    8983
    9084    if (name == SVGNames::k2Attr) {
    91         setK2BaseValue(value.toFloat());
     85        m_k2.setValue(value.toFloat());
    9286        return;
    9387    }
    9488
    9589    if (name == SVGNames::k3Attr) {
    96         setK3BaseValue(value.toFloat());
     90        m_k3.setValue(value.toFloat());
    9791        return;
    9892    }
    9993
    10094    if (name == SVGNames::k4Attr) {
    101         setK4BaseValue(value.toFloat());
     95        m_k4.setValue(value.toFloat());
    10296        return;
    10397    }
  • trunk/Source/WebCore/svg/SVGFECompositeElement.h

    r233122 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    8586    static Ref<SVGFECompositeElement> create(const QualifiedName&, Document&);
    8687
     88    String in1() { return m_in1.currentValue(attributeOwnerProxy()); }
     89    String in2() { return m_in2.currentValue(attributeOwnerProxy()); }
     90    CompositeOperationType svgOperator() const { return m_svgOperator.currentValue(attributeOwnerProxy()); }
     91    float k1() const { return m_k1.currentValue(attributeOwnerProxy()); }
     92    float k2() const { return m_k2.currentValue(attributeOwnerProxy()); }
     93    float k3() const { return m_k3.currentValue(attributeOwnerProxy()); }
     94    float k4() const { return m_k4.currentValue(attributeOwnerProxy()); }
     95
     96    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     97    RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); }
     98    RefPtr<SVGAnimatedEnumeration> svgOperatorAnimated() { return m_svgOperator.animatedProperty(attributeOwnerProxy()); }
     99    RefPtr<SVGAnimatedNumber> k1Animated() { return m_k1.animatedProperty(attributeOwnerProxy()); }
     100    RefPtr<SVGAnimatedNumber> k2Animated() { return m_k2.animatedProperty(attributeOwnerProxy()); }
     101    RefPtr<SVGAnimatedNumber> k3Animated() { return m_k3.animatedProperty(attributeOwnerProxy()); }
     102    RefPtr<SVGAnimatedNumber> k4Animated() { return m_k4.animatedProperty(attributeOwnerProxy()); }
     103
    87104private:
    88105    SVGFECompositeElement(const QualifiedName&, Document&);
    89106
     107    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFECompositeElement, SVGFilterPrimitiveStandardAttributes>;
     108    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     109    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     110    static void registerAttributes();
     111
     112    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    90113    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     114    void svgAttributeChanged(const QualifiedName&) override;
     115
    91116    bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
    92     void svgAttributeChanged(const QualifiedName&) override;
    93117    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    94118
    95     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFECompositeElement)
    96         DECLARE_ANIMATED_STRING(In1, in1)
    97         DECLARE_ANIMATED_STRING(In2, in2)
    98         DECLARE_ANIMATED_ENUMERATION(SVGOperator, svgOperator, CompositeOperationType)
    99         DECLARE_ANIMATED_NUMBER(K1, k1)
    100         DECLARE_ANIMATED_NUMBER(K2, k2)
    101         DECLARE_ANIMATED_NUMBER(K3, k3)
    102         DECLARE_ANIMATED_NUMBER(K4, k4)
    103     END_DECLARE_ANIMATED_PROPERTIES
     119    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     120    SVGAnimatedStringAttribute m_in1;
     121    SVGAnimatedStringAttribute m_in2;
     122    SVGAnimatedEnumerationAttribute<CompositeOperationType> m_svgOperator { FECOMPOSITE_OPERATOR_OVER };
     123    SVGAnimatedNumberAttribute m_k1;
     124    SVGAnimatedNumberAttribute m_k2;
     125    SVGAnimatedNumberAttribute m_k3;
     126    SVGAnimatedNumberAttribute m_k4;
    104127};
    105128
  • trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp

    r229694 r234620  
    11/*
    22 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3536WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEConvolveMatrixElement);
    3637
    37 // Animated property definitions
    38 DEFINE_ANIMATED_STRING(SVGFEConvolveMatrixElement, SVGNames::inAttr, In1, in1)
    39 DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderXIdentifier(), OrderX, orderX)
    40 DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderYIdentifier(), OrderY, orderY)
    41 DEFINE_ANIMATED_NUMBER_LIST(SVGFEConvolveMatrixElement, SVGNames::kernelMatrixAttr, KernelMatrix, kernelMatrix)
    42 DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::divisorAttr, Divisor, divisor)
    43 DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::biasAttr, Bias, bias)
    44 DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, TargetX, targetX)
    45 DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, TargetY, targetY)
    46 DEFINE_ANIMATED_ENUMERATION(SVGFEConvolveMatrixElement, SVGNames::edgeModeAttr, EdgeMode, edgeMode, EdgeModeType)
    47 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX)
    48 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY)
    49 DEFINE_ANIMATED_BOOLEAN(SVGFEConvolveMatrixElement, SVGNames::preserveAlphaAttr, PreserveAlpha, preserveAlpha)
    50 
    51 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement)
    52     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    53     REGISTER_LOCAL_ANIMATED_PROPERTY(orderX)
    54     REGISTER_LOCAL_ANIMATED_PROPERTY(orderY)
    55     REGISTER_LOCAL_ANIMATED_PROPERTY(kernelMatrix)
    56     REGISTER_LOCAL_ANIMATED_PROPERTY(divisor)
    57     REGISTER_LOCAL_ANIMATED_PROPERTY(bias)
    58     REGISTER_LOCAL_ANIMATED_PROPERTY(targetX)
    59     REGISTER_LOCAL_ANIMATED_PROPERTY(targetY)
    60     REGISTER_LOCAL_ANIMATED_PROPERTY(edgeMode)
    61     REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX)
    62     REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY)
    63     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAlpha)
    64     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    65 END_REGISTER_ANIMATED_PROPERTIES
    66 
    6738inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const QualifiedName& tagName, Document& document)
    6839    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    69     , m_edgeMode(EDGEMODE_DUPLICATE)
    7040{
    7141    ASSERT(hasTagName(SVGNames::feConvolveMatrixTag));
    72     registerAnimatedPropertiesForSVGFEConvolveMatrixElement();
     42    registerAttributes();
    7343}
    7444
     
    10272}
    10373
     74void SVGFEConvolveMatrixElement::registerAttributes()
     75{
     76    auto& registry = attributeRegistry();
     77    if (!registry.isEmpty())
     78        return;
     79    registry.registerAttribute<SVGNames::inAttr, &SVGFEConvolveMatrixElement::m_in1>();
     80    registry.registerAttribute<SVGNames::orderAttr,
     81        &SVGFEConvolveMatrixElement::orderXIdentifier, &SVGFEConvolveMatrixElement::m_orderX,
     82        &SVGFEConvolveMatrixElement::orderYIdentifier, &SVGFEConvolveMatrixElement::m_orderY>();
     83    registry.registerAttribute<SVGNames::kernelMatrixAttr, &SVGFEConvolveMatrixElement::m_kernelMatrix>();
     84    registry.registerAttribute<SVGNames::divisorAttr, &SVGFEConvolveMatrixElement::m_divisor>();
     85    registry.registerAttribute<SVGNames::biasAttr, &SVGFEConvolveMatrixElement::m_bias>();
     86    registry.registerAttribute<SVGNames::targetXAttr, &SVGFEConvolveMatrixElement::m_targetX>();
     87    registry.registerAttribute<SVGNames::targetYAttr, &SVGFEConvolveMatrixElement::m_targetY>();
     88    registry.registerAttribute<SVGNames::edgeModeAttr, EdgeModeType, &SVGFEConvolveMatrixElement::m_edgeMode>();
     89    registry.registerAttribute<SVGNames::kernelUnitLengthAttr,
     90        &SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthX,
     91        &SVGFEConvolveMatrixElement::kernelUnitLengthYIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthY>();
     92    registry.registerAttribute<SVGNames::preserveAlphaAttr, &SVGFEConvolveMatrixElement::m_preserveAlpha>();
     93}
     94
    10495void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    10596{
    10697    if (name == SVGNames::inAttr) {
    107         setIn1BaseValue(value);
     98        m_in1.setValue(value);
    10899        return;
    109100    }
     
    112103        float x, y;
    113104        if (parseNumberOptionalNumber(value, x, y) && x >= 1 && y >= 1) {
    114             setOrderXBaseValue(x);
    115             setOrderYBaseValue(y);
     105            m_orderX.setValue(x);
     106            m_orderY.setValue(y);
    116107        } else
    117108            document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing order=\"" + value + "\". Filtered element will not be displayed.");
     
    122113        EdgeModeType propertyValue = SVGPropertyTraits<EdgeModeType>::fromString(value);
    123114        if (propertyValue > 0)
    124             setEdgeModeBaseValue(propertyValue);
     115            m_edgeMode.setValue(propertyValue);
    125116        else
    126117            document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing edgeMode=\"" + value + "\". Filtered element will not be displayed.");
     
    131122        SVGNumberListValues newList;
    132123        newList.parse(value);
    133         detachAnimatedKernelMatrixListWrappers(newList.size());
    134         setKernelMatrixBaseValue(newList);
     124        m_kernelMatrix.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     125        m_kernelMatrix.setValue(WTFMove(newList));
    135126        return;
    136127    }
     
    139130        float divisor = value.toFloat();
    140131        if (divisor)
    141             setDivisorBaseValue(divisor);
     132            m_divisor.setValue(divisor);
    142133        else
    143134            document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing divisor=\"" + value + "\". Filtered element will not be displayed.");
     
    146137   
    147138    if (name == SVGNames::biasAttr) {
    148         setBiasBaseValue(value.toFloat());
     139        m_bias.setValue(value.toFloat());
    149140        return;
    150141    }
    151142
    152143    if (name == SVGNames::targetXAttr) {
    153         setTargetXBaseValue(value.string().toUIntStrict());
     144        m_targetX.setValue(value.string().toUIntStrict());
    154145        return;
    155146    }
    156147
    157148    if (name == SVGNames::targetYAttr) {
    158         setTargetYBaseValue(value.string().toUIntStrict());
     149        m_targetY.setValue(value.string().toUIntStrict());
    159150        return;
    160151    }
     
    163154        float x, y;
    164155        if (parseNumberOptionalNumber(value, x, y) && x > 0 && y > 0) {
    165             setKernelUnitLengthXBaseValue(x);
    166             setKernelUnitLengthYBaseValue(y);
     156            m_kernelUnitLengthX.setValue(x);
     157            m_kernelUnitLengthY.setValue(y);
    167158        } else
    168159            document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing kernelUnitLength=\"" + value + "\". Filtered element will not be displayed.");
     
    172163    if (name == SVGNames::preserveAlphaAttr) {
    173164        if (value == "true")
    174             setPreserveAlphaBaseValue(true);
     165            m_preserveAlpha.setValue(true);
    175166        else if (value == "false")
    176             setPreserveAlphaBaseValue(false);
     167            m_preserveAlpha.setValue(false);
    177168        else
    178169            document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value  + "\". Filtered element will not be displayed.");
     
    193184        return convolveMatrix->setBias(bias());
    194185    if (attrName == SVGNames::targetXAttr)
    195        return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY()));
     186        return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY()));
    196187    if (attrName == SVGNames::targetYAttr)
    197        return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY()));
     188        return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY()));
    198189    if (attrName == SVGNames::kernelUnitLengthAttr)
    199        return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY()));
     190        return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY()));
    200191    if (attrName == SVGNames::preserveAlphaAttr)
    201192        return convolveMatrix->setPreserveAlpha(preserveAlpha());
     
    207198void SVGFEConvolveMatrixElement::setOrder(float x, float y)
    208199{
    209     setOrderXBaseValue(x);
    210     setOrderYBaseValue(y);
     200    m_orderX.setValue(x);
     201    m_orderY.setValue(y);
    211202    invalidate();
    212203}
     
    214205void SVGFEConvolveMatrixElement::setKernelUnitLength(float x, float y)
    215206{
    216     setKernelUnitLengthXBaseValue(x);
    217     setKernelUnitLengthYBaseValue(y);
     207    m_kernelUnitLengthX.setValue(x);
     208    m_kernelUnitLengthY.setValue(y);
    218209    invalidate();
    219210}
  • trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h

    r233122 r234620  
    11/*
    22 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3334struct SVGPropertyTraits<EdgeModeType> {
    3435    static unsigned highestEnumValue() { return EDGEMODE_NONE; }
     36    static EdgeModeType initialValue() { return EDGEMODE_NONE; }
    3537
    3638    static String toString(EdgeModeType type)
     
    7173    void setKernelUnitLength(float kernelUnitLengthX, float kernelUnitLengthY);
    7274
     75    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     76    int orderX() const { return m_orderX.currentValue(attributeOwnerProxy()); }
     77    int orderY() const { return m_orderY.currentValue(attributeOwnerProxy()); }
     78    const SVGNumberListValues& kernelMatrix() const { return m_kernelMatrix.currentValue(attributeOwnerProxy()); }
     79    float divisor() const { return m_divisor.currentValue(attributeOwnerProxy()); }
     80    float bias() const { return m_bias.currentValue(attributeOwnerProxy()); }
     81    int targetX() const { return m_targetX.currentValue(attributeOwnerProxy()); }
     82    int targetY() const { return m_targetY.currentValue(attributeOwnerProxy()); }
     83    EdgeModeType edgeMode() const { return m_edgeMode.currentValue(attributeOwnerProxy()); }
     84    float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); }
     85    float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); }
     86    bool preserveAlpha() const { return m_preserveAlpha.currentValue(attributeOwnerProxy()); }
     87
     88    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     89    RefPtr<SVGAnimatedInteger> orderXAnimated() { return m_orderX.animatedProperty(attributeOwnerProxy()); }
     90    RefPtr<SVGAnimatedInteger> orderYAnimated() { return m_orderY.animatedProperty(attributeOwnerProxy()); }
     91    RefPtr<SVGAnimatedNumberList> kernelMatrixAnimated() { return m_kernelMatrix.animatedProperty(attributeOwnerProxy()); }
     92    RefPtr<SVGAnimatedNumber> divisorAnimated() { return m_divisor.animatedProperty(attributeOwnerProxy()); }
     93    RefPtr<SVGAnimatedNumber> biasAnimated() { return m_bias.animatedProperty(attributeOwnerProxy()); }
     94    RefPtr<SVGAnimatedInteger> targetXAnimated() { return m_targetX.animatedProperty(attributeOwnerProxy()); }
     95    RefPtr<SVGAnimatedInteger> targetYAnimated() { return m_targetY.animatedProperty(attributeOwnerProxy()); }
     96    RefPtr<SVGAnimatedEnumeration> edgeModeAnimated() { return m_edgeMode.animatedProperty(attributeOwnerProxy()); }
     97    RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); }
     98    RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); }
     99    RefPtr<SVGAnimatedBoolean> preserveAlphaAnimated() { return m_preserveAlpha.animatedProperty(attributeOwnerProxy()); }
     100
    73101private:
    74102    SVGFEConvolveMatrixElement(const QualifiedName&, Document&);
    75103
     104    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEConvolveMatrixElement, SVGFilterPrimitiveStandardAttributes>;
     105    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     106    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     107    static void registerAttributes();
     108
     109    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    76110    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     111    void svgAttributeChanged(const QualifiedName&) override;
     112
    77113    bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
    78     void svgAttributeChanged(const QualifiedName&) override;
    79114    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    80115
     
    84119    static const AtomicString& kernelUnitLengthYIdentifier();
    85120
    86     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement)
    87         DECLARE_ANIMATED_STRING(In1, in1)
    88         DECLARE_ANIMATED_INTEGER(OrderX, orderX)
    89         DECLARE_ANIMATED_INTEGER(OrderY, orderY)
    90         DECLARE_ANIMATED_NUMBER_LIST(KernelMatrix, kernelMatrix)
    91         DECLARE_ANIMATED_NUMBER(Divisor, divisor)
    92         DECLARE_ANIMATED_NUMBER(Bias, bias)
    93         DECLARE_ANIMATED_INTEGER(TargetX, targetX)
    94         DECLARE_ANIMATED_INTEGER(TargetY, targetY)
    95         DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode, EdgeModeType)
    96         DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX)
    97         DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY)
    98         DECLARE_ANIMATED_BOOLEAN(PreserveAlpha, preserveAlpha)
    99     END_DECLARE_ANIMATED_PROPERTIES
     121    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     122    SVGAnimatedStringAttribute m_in1;
     123    SVGAnimatedIntegerAttribute m_orderX;
     124    SVGAnimatedIntegerAttribute m_orderY;
     125    SVGAnimatedNumberListAttribute m_kernelMatrix;
     126    SVGAnimatedNumberAttribute m_divisor;
     127    SVGAnimatedNumberAttribute m_bias;
     128    SVGAnimatedIntegerAttribute m_targetX;
     129    SVGAnimatedIntegerAttribute m_targetY;
     130    SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { EDGEMODE_DUPLICATE };
     131    SVGAnimatedNumberAttribute m_kernelUnitLengthX;
     132    SVGAnimatedNumberAttribute m_kernelUnitLengthY;
     133    SVGAnimatedBooleanAttribute m_preserveAlpha;
    100134};
    101135
  • trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp

    r231153 r234620  
    11/*
    22 * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3435WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEDiffuseLightingElement);
    3536
    36 // Animated property definitions
    37 DEFINE_ANIMATED_STRING(SVGFEDiffuseLightingElement, SVGNames::inAttr, In1, in1)
    38 DEFINE_ANIMATED_NUMBER(SVGFEDiffuseLightingElement, SVGNames::diffuseConstantAttr, DiffuseConstant, diffuseConstant)
    39 DEFINE_ANIMATED_NUMBER(SVGFEDiffuseLightingElement, SVGNames::surfaceScaleAttr, SurfaceScale, surfaceScale)
    40 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX)
    41 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY)
    42 
    43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDiffuseLightingElement)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(diffuseConstant)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(surfaceScale)
    47     REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY)
    49     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    50 END_REGISTER_ANIMATED_PROPERTIES
    51 
    5237inline SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const QualifiedName& tagName, Document& document)
    5338    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    54     , m_diffuseConstant(1)
    55     , m_surfaceScale(1)
    5639{
    5740    ASSERT(hasTagName(SVGNames::feDiffuseLightingTag));
    58     registerAnimatedPropertiesForSVGFEDiffuseLightingElement();
     41    registerAttributes();
    5942}
    6043
     
    7659}
    7760
     61void SVGFEDiffuseLightingElement::registerAttributes()
     62{
     63    auto& registry = attributeRegistry();
     64    if (!registry.isEmpty())
     65        return;
     66    registry.registerAttribute<SVGNames::inAttr, &SVGFEDiffuseLightingElement::m_in1>();
     67    registry.registerAttribute<SVGNames::diffuseConstantAttr, &SVGFEDiffuseLightingElement::m_diffuseConstant>();
     68    registry.registerAttribute<SVGNames::surfaceScaleAttr, &SVGFEDiffuseLightingElement::m_surfaceScale>();
     69    registry.registerAttribute<SVGNames::kernelUnitLengthAttr,
     70        &SVGFEDiffuseLightingElement::kernelUnitLengthXIdentifier, &SVGFEDiffuseLightingElement::m_kernelUnitLengthX,
     71        &SVGFEDiffuseLightingElement::kernelUnitLengthYIdentifier, &SVGFEDiffuseLightingElement::m_kernelUnitLengthY>();
     72}
     73
    7874void SVGFEDiffuseLightingElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    7975{
    8076    if (name == SVGNames::inAttr) {
    81         setIn1BaseValue(value);
     77        m_in1.setValue(value);
    8278        return;
    8379    }
    8480
    8581    if (name == SVGNames::surfaceScaleAttr) {
    86         setSurfaceScaleBaseValue(value.toFloat());
     82        m_surfaceScale.setValue(value.toFloat());
    8783        return;
    8884    }
    8985
    9086    if (name == SVGNames::diffuseConstantAttr) {
    91         setDiffuseConstantBaseValue(value.toFloat());
     87        m_diffuseConstant.setValue(value.toFloat());
    9288        return;
    9389    }
     
    9692        float x, y;
    9793        if (parseNumberOptionalNumber(value, x, y)) {
    98             setKernelUnitLengthXBaseValue(x);
    99             setKernelUnitLengthYBaseValue(y);
     94            m_kernelUnitLengthX.setValue(x);
     95            m_kernelUnitLengthY.setValue(y);
    10096        }
    10197        return;
  • trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.h

    r229694 r234620  
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    3637    void lightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&);
    3738
     39    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     40    float diffuseConstant() const { return m_diffuseConstant.currentValue(attributeOwnerProxy()); }
     41    float surfaceScale() const { return m_surfaceScale.currentValue(attributeOwnerProxy()); }
     42    float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); }
     43    float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); }
     44
     45    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     46    RefPtr<SVGAnimatedNumber> diffuseConstantAnimated() { return m_diffuseConstant.animatedProperty(attributeOwnerProxy()); }
     47    RefPtr<SVGAnimatedNumber> surfaceScaleAnimated() { return m_surfaceScale.animatedProperty(attributeOwnerProxy()); }
     48    RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); }
     49    RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); }
     50
    3851private:
    3952    SVGFEDiffuseLightingElement(const QualifiedName&, Document&);
    4053
     54    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEDiffuseLightingElement, SVGFilterPrimitiveStandardAttributes>;
     55    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     56    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     57    static void registerAttributes();
     58
     59    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4160    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     61    void svgAttributeChanged(const QualifiedName&) override;
     62
    4263    bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
    43     void svgAttributeChanged(const QualifiedName&) override;
    4464    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    4565
     
    4767    static const AtomicString& kernelUnitLengthYIdentifier();
    4868
    49     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDiffuseLightingElement)
    50         DECLARE_ANIMATED_STRING(In1, in1)
    51         DECLARE_ANIMATED_NUMBER(DiffuseConstant, diffuseConstant)
    52         DECLARE_ANIMATED_NUMBER(SurfaceScale, surfaceScale)
    53         DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX)
    54         DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY)
    55     END_DECLARE_ANIMATED_PROPERTIES
     69    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     70    SVGAnimatedStringAttribute m_in1;
     71    SVGAnimatedNumberAttribute m_diffuseConstant { 1 };
     72    SVGAnimatedNumberAttribute m_surfaceScale { 1 };
     73    SVGAnimatedNumberAttribute m_kernelUnitLengthX;
     74    SVGAnimatedNumberAttribute m_kernelUnitLengthY;
    5675};
    5776
  • trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp

    r229694 r234620  
    11/*
    22 * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3031WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEDisplacementMapElement);
    3132
    32 // Animated property definitions
    33 DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::inAttr, In1, in1)
    34 DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::in2Attr, In2, in2)
    35 DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, XChannelSelector, xChannelSelector, ChannelSelectorType)
    36 DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, YChannelSelector, yChannelSelector, ChannelSelectorType)
    37 DEFINE_ANIMATED_NUMBER(SVGFEDisplacementMapElement, SVGNames::scaleAttr, Scale, scale)
    38 
    39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement)
    40     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    41     REGISTER_LOCAL_ANIMATED_PROPERTY(in2)
    42     REGISTER_LOCAL_ANIMATED_PROPERTY(xChannelSelector)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(yChannelSelector)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(scale)
    45     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    46 END_REGISTER_ANIMATED_PROPERTIES
    47 
    4833inline SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const QualifiedName& tagName, Document& document)
    4934    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    50     , m_xChannelSelector(CHANNEL_A)
    51     , m_yChannelSelector(CHANNEL_A)
    5235{
    5336    ASSERT(hasTagName(SVGNames::feDisplacementMapTag));
    54     registerAnimatedPropertiesForSVGFEDisplacementMapElement();
     37    registerAttributes();
    5538}
    5639
     
    6043}
    6144
     45void SVGFEDisplacementMapElement::registerAttributes()
     46{
     47    auto& registry = attributeRegistry();
     48    if (!registry.isEmpty())
     49        return;
     50    registry.registerAttribute<SVGNames::inAttr, &SVGFEDisplacementMapElement::m_in1>();
     51    registry.registerAttribute<SVGNames::in2Attr, &SVGFEDisplacementMapElement::m_in2>();
     52    registry.registerAttribute<SVGNames::xChannelSelectorAttr, ChannelSelectorType, &SVGFEDisplacementMapElement::m_xChannelSelector>();
     53    registry.registerAttribute<SVGNames::yChannelSelectorAttr, ChannelSelectorType, &SVGFEDisplacementMapElement::m_yChannelSelector>();
     54    registry.registerAttribute<SVGNames::scaleAttr, &SVGFEDisplacementMapElement::m_scale>();
     55}
     56
    6257void SVGFEDisplacementMapElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    6358{
     
    6560        auto propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value);
    6661        if (propertyValue > 0)
    67             setXChannelSelectorBaseValue(propertyValue);
     62            m_xChannelSelector.setValue(propertyValue);
    6863        return;
    6964    }
     
    7267        auto propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value);
    7368        if (propertyValue > 0)
    74             setYChannelSelectorBaseValue(propertyValue);
     69            m_yChannelSelector.setValue(propertyValue);
    7570        return;
    7671    }
    7772
    7873    if (name == SVGNames::inAttr) {
    79         setIn1BaseValue(value);
     74        m_in1.setValue(value);
    8075        return;
    8176    }
    8277
    8378    if (name == SVGNames::in2Attr) {
    84         setIn2BaseValue(value);
     79        m_in2.setValue(value);
    8580        return;
    8681    }
    8782
    8883    if (name == SVGNames::scaleAttr) {
    89         setScaleBaseValue(value.toFloat());
     84        m_scale.setValue(value.toFloat());
    9085        return;
    9186    }
  • trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h

    r233122 r234620  
    11/*
    22 * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    7071
    7172    static ChannelSelectorType stringToChannel(const String&);
    72    
     73
     74    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     75    String in2() const { return m_in2.currentValue(attributeOwnerProxy()); }
     76    ChannelSelectorType xChannelSelector() const { return m_xChannelSelector.currentValue(attributeOwnerProxy()); }
     77    ChannelSelectorType yChannelSelector() const { return m_yChannelSelector.currentValue(attributeOwnerProxy()); }
     78    float scale() const { return m_scale.currentValue(attributeOwnerProxy()); }
     79
     80    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     81    RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); }
     82    RefPtr<SVGAnimatedEnumeration> xChannelSelectorAnimated() { return m_xChannelSelector.animatedProperty(attributeOwnerProxy()); }
     83    RefPtr<SVGAnimatedEnumeration> yChannelSelectorAnimated() { return m_yChannelSelector.animatedProperty(attributeOwnerProxy()); }
     84    RefPtr<SVGAnimatedNumber> scaleAnimated() { return m_scale.animatedProperty(attributeOwnerProxy()); }
     85
    7386private:
    7487    SVGFEDisplacementMapElement(const QualifiedName& tagName, Document&);
    75    
     88
     89    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEDisplacementMapElement, SVGFilterPrimitiveStandardAttributes>;
     90    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     91    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     92    static void registerAttributes();
     93
     94    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    7695    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     96    void svgAttributeChanged(const QualifiedName&) override;
     97
    7798    bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
    78     void svgAttributeChanged(const QualifiedName&) override;
    7999    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    80100
    81     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement)
    82         DECLARE_ANIMATED_STRING(In1, in1)
    83         DECLARE_ANIMATED_STRING(In2, in2)
    84         DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector, ChannelSelectorType)
    85         DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector, ChannelSelectorType)
    86         DECLARE_ANIMATED_NUMBER(Scale, scale)
    87     END_DECLARE_ANIMATED_PROPERTIES
     101    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     102    SVGAnimatedStringAttribute m_in1;
     103    SVGAnimatedStringAttribute m_in2;
     104    SVGAnimatedEnumerationAttribute<ChannelSelectorType> m_xChannelSelector { CHANNEL_A };
     105    SVGAnimatedEnumerationAttribute<ChannelSelectorType> m_yChannelSelector { CHANNEL_A };
     106    SVGAnimatedNumberAttribute m_scale;
    88107};
    89108
  • trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp

    r231153 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3233WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEDropShadowElement);
    3334
    34 // Animated property definitions
    35 DEFINE_ANIMATED_STRING(SVGFEDropShadowElement, SVGNames::inAttr, In1, in1)
    36 DEFINE_ANIMATED_NUMBER(SVGFEDropShadowElement, SVGNames::dxAttr, Dx, dx)
    37 DEFINE_ANIMATED_NUMBER(SVGFEDropShadowElement, SVGNames::dyAttr, Dy, dy)
    38 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDropShadowElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), StdDeviationX, stdDeviationX)
    39 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDropShadowElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), StdDeviationY, stdDeviationY)
    40 
    41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDropShadowElement)
    42     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(dx)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(dy)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationX)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationY)
    47     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    48 END_REGISTER_ANIMATED_PROPERTIES
    49 
    5035inline SVGFEDropShadowElement::SVGFEDropShadowElement(const QualifiedName& tagName, Document& document)
    5136    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    52     , m_dx(2)
    53     , m_dy(2)
    54     , m_stdDeviationX(2)
    55     , m_stdDeviationY(2)
    5637{
    5738    ASSERT(hasTagName(SVGNames::feDropShadowTag));
    58     registerAnimatedPropertiesForSVGFEDropShadowElement();
     39    registerAttributes();
    5940}
    6041
     
    7859void SVGFEDropShadowElement::setStdDeviation(float x, float y)
    7960{
    80     setStdDeviationXBaseValue(x);
    81     setStdDeviationYBaseValue(y);
     61    m_stdDeviationX.setValue(x);
     62    m_stdDeviationY.setValue(y);
    8263    invalidate();
     64}
     65
     66void SVGFEDropShadowElement::registerAttributes()
     67{
     68    auto& registry = attributeRegistry();
     69    if (!registry.isEmpty())
     70        return;
     71    registry.registerAttribute<SVGNames::inAttr, &SVGFEDropShadowElement::m_in1>();
     72    registry.registerAttribute<SVGNames::dxAttr, &SVGFEDropShadowElement::m_dx>();
     73    registry.registerAttribute<SVGNames::dyAttr, &SVGFEDropShadowElement::m_dy>();
     74    registry.registerAttribute<SVGNames::stdDeviationAttr,
     75        &SVGFEDropShadowElement::stdDeviationXIdentifier, &SVGFEDropShadowElement::m_stdDeviationX,
     76        &SVGFEDropShadowElement::stdDeviationYIdentifier, &SVGFEDropShadowElement::m_stdDeviationY>();
    8377}
    8478
     
    8882        float x, y;
    8983        if (parseNumberOptionalNumber(value, x, y)) {
    90             setStdDeviationXBaseValue(x);
    91             setStdDeviationYBaseValue(y);
     84            m_stdDeviationX.setValue(x);
     85            m_stdDeviationY.setValue(y);
    9286        }
    9387        return;
     
    9589
    9690    if (name == SVGNames::inAttr) {
    97         setIn1BaseValue(value);
     91        m_in1.setValue(value);
    9892        return;
    9993    }
    10094
    10195    if (name == SVGNames::dxAttr) {
    102         setDxBaseValue(value.toFloat());
     96        m_dx.setValue(value.toFloat());
    10397        return;
    10498    }
    10599
    106100    if (name == SVGNames::dyAttr) {
    107         setDyBaseValue(value.toFloat());
     101        m_dy.setValue(value.toFloat());
    108102        return;
    109103    }
     
    114108void SVGFEDropShadowElement::svgAttributeChanged(const QualifiedName& attrName)
    115109{
    116     if (attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr) {
     110    if (isKnownAttribute(attrName)) {
    117111        InstanceInvalidationGuard guard(*this);
    118112        invalidate();
  • trunk/Source/WebCore/svg/SVGFEDropShadowElement.h

    r229694 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2526
    2627namespace WebCore {
    27    
     28
    2829class SVGFEDropShadowElement final : public SVGFilterPrimitiveStandardAttributes {
    2930    WTF_MAKE_ISO_ALLOCATED(SVGFEDropShadowElement);
     
    3233   
    3334    void setStdDeviation(float stdDeviationX, float stdDeviationY);
    34    
     35
     36    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     37    float dx() const { return m_dx.currentValue(attributeOwnerProxy()); }
     38    float dy() const { return m_dy.currentValue(attributeOwnerProxy()); }
     39    float stdDeviationX() const { return m_stdDeviationX.currentValue(attributeOwnerProxy()); }
     40    float stdDeviationY() const { return m_stdDeviationY.currentValue(attributeOwnerProxy()); }
     41
     42    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     43    RefPtr<SVGAnimatedNumber> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); }
     44    RefPtr<SVGAnimatedNumber> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); }
     45    RefPtr<SVGAnimatedNumber> stdDeviationXAnimated() { return m_stdDeviationX.animatedProperty(attributeOwnerProxy()); }
     46    RefPtr<SVGAnimatedNumber> stdDeviationYAnimated() { return m_stdDeviationY.animatedProperty(attributeOwnerProxy()); }
     47
    3548private:
    3649    SVGFEDropShadowElement(const QualifiedName&, Document&);
    37    
     50
     51    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEDropShadowElement, SVGFilterPrimitiveStandardAttributes>;
     52    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     53    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     54    static void registerAttributes();
     55
     56    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    3857    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    3958    void svgAttributeChanged(const QualifiedName&) override;
     59
    4060    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    41    
     61
    4262    static const AtomicString& stdDeviationXIdentifier();
    4363    static const AtomicString& stdDeviationYIdentifier();
    44    
    45     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDropShadowElement)
    46         DECLARE_ANIMATED_STRING(In1, in1)
    47         DECLARE_ANIMATED_NUMBER(Dx, dx)
    48         DECLARE_ANIMATED_NUMBER(Dy, dy)
    49         DECLARE_ANIMATED_NUMBER(StdDeviationX, stdDeviationX)
    50         DECLARE_ANIMATED_NUMBER(StdDeviationY, stdDeviationY)
    51     END_DECLARE_ANIMATED_PROPERTIES
     64
     65    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     66    SVGAnimatedStringAttribute m_in1;
     67    SVGAnimatedNumberAttribute m_dx { 2 };
     68    SVGAnimatedNumberAttribute m_dy { 2 };
     69    SVGAnimatedNumberAttribute m_stdDeviationX { 2 };
     70    SVGAnimatedNumberAttribute m_stdDeviationY { 2 };
    5271};
    5372   
  • trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3233WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEGaussianBlurElement);
    3334
    34 // Animated property definitions
    35 DEFINE_ANIMATED_STRING(SVGFEGaussianBlurElement, SVGNames::inAttr, In1, in1)
    36 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), StdDeviationX, stdDeviationX)
    37 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), StdDeviationY, stdDeviationY)
    38 DEFINE_ANIMATED_ENUMERATION(SVGFEGaussianBlurElement, SVGNames::edgeModeAttr, EdgeMode, edgeMode, EdgeModeType)
    39 
    40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEGaussianBlurElement)
    41     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    42     REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationX)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationY)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(edgeMode)
    45     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    46 END_REGISTER_ANIMATED_PROPERTIES
    47 
    4835inline SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName& tagName, Document& document)
    4936    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    50     , m_edgeMode(EDGEMODE_NONE)
    5137{
    5238    ASSERT(hasTagName(SVGNames::feGaussianBlurTag));
    53     registerAnimatedPropertiesForSVGFEGaussianBlurElement();
     39    registerAttributes();
    5440}
    5541
     
    7359void SVGFEGaussianBlurElement::setStdDeviation(float x, float y)
    7460{
    75     setStdDeviationXBaseValue(x);
    76     setStdDeviationYBaseValue(y);
     61    m_stdDeviationX.setValue(x);
     62    m_stdDeviationY.setValue(y);
    7763    invalidate();
     64}
     65
     66void SVGFEGaussianBlurElement::registerAttributes()
     67{
     68    auto& registry = attributeRegistry();
     69    if (!registry.isEmpty())
     70        return;
     71    registry.registerAttribute<SVGNames::inAttr, &SVGFEGaussianBlurElement::m_in1>();
     72    registry.registerAttribute<SVGNames::stdDeviationAttr,
     73        &SVGFEGaussianBlurElement::stdDeviationXIdentifier, &SVGFEGaussianBlurElement::m_stdDeviationX,
     74        &SVGFEGaussianBlurElement::stdDeviationYIdentifier, &SVGFEGaussianBlurElement::m_stdDeviationY>();
     75    registry.registerAttribute<SVGNames::edgeModeAttr, EdgeModeType, &SVGFEGaussianBlurElement::m_edgeMode>();
    7876}
    7977
     
    8381        float x, y;
    8482        if (parseNumberOptionalNumber(value, x, y)) {
    85             setStdDeviationXBaseValue(x);
    86             setStdDeviationYBaseValue(y);
     83            m_stdDeviationX.setValue(x);
     84            m_stdDeviationY.setValue(y);
    8785        }
    8886        return;
     
    9088
    9189    if (name == SVGNames::inAttr) {
    92         setIn1BaseValue(value);
     90        m_in1.setValue(value);
    9391        return;
    9492    }
     
    9795        auto propertyValue = SVGPropertyTraits<EdgeModeType>::fromString(value);
    9896        if (propertyValue > 0)
    99             setEdgeModeBaseValue(propertyValue);
     97            m_edgeMode.setValue(propertyValue);
    10098        else
    10199            document().accessSVGExtensions().reportWarning("feGaussianBlur: problem parsing edgeMode=\"" + value + "\". Filtered element will not be displayed.");
     
    108106void SVGFEGaussianBlurElement::svgAttributeChanged(const QualifiedName& attrName)
    109107{
    110     if (attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr || attrName == SVGNames::edgeModeAttr) {
     108    if (isKnownAttribute(attrName)) {
    111109        InstanceInvalidationGuard guard(*this);
    112110        invalidate();
  • trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3637    void setStdDeviation(float stdDeviationX, float stdDeviationY);
    3738
     39    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     40    float stdDeviationX() const { return m_stdDeviationX.currentValue(attributeOwnerProxy()); }
     41    float stdDeviationY() const { return m_stdDeviationY.currentValue(attributeOwnerProxy()); }
     42    EdgeModeType edgeMode() const { return m_edgeMode.currentValue(attributeOwnerProxy()); }
     43
     44    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     45    RefPtr<SVGAnimatedNumber> stdDeviationXAnimated() { return m_stdDeviationX.animatedProperty(attributeOwnerProxy()); }
     46    RefPtr<SVGAnimatedNumber> stdDeviationYAnimated() { return m_stdDeviationY.animatedProperty(attributeOwnerProxy()); }
     47    RefPtr<SVGAnimatedEnumeration> edgeModeAnimated() { return m_edgeMode.animatedProperty(attributeOwnerProxy()); }
     48
    3849private:
    3950    SVGFEGaussianBlurElement(const QualifiedName&, Document&);
    4051
     52    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEGaussianBlurElement, SVGFilterPrimitiveStandardAttributes>;
     53    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     54    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     55    static void registerAttributes();
     56
     57    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4158    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    4259    void svgAttributeChanged(const QualifiedName&) override;
     60
    4361    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    4462
     
    4664    static const AtomicString& stdDeviationYIdentifier();
    4765
    48     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEGaussianBlurElement)
    49         DECLARE_ANIMATED_STRING(In1, in1)
    50         DECLARE_ANIMATED_NUMBER(StdDeviationX, stdDeviationX)
    51         DECLARE_ANIMATED_NUMBER(StdDeviationY, stdDeviationY)
    52         DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode, EdgeModeType)
    53     END_DECLARE_ANIMATED_PROPERTIES
     66    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     67    SVGAnimatedStringAttribute m_in1;
     68    SVGAnimatedNumberAttribute m_stdDeviationX;
     69    SVGAnimatedNumberAttribute m_stdDeviationY;
     70    SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { EDGEMODE_NONE };
    5471};
    5572
  • trunk/Source/WebCore/svg/SVGFEImageElement.cpp

    r229694 r234620  
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org>
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    3940WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEImageElement);
    4041
    41 // Animated property definitions
    42 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)
    43 DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href)
    44 DEFINE_ANIMATED_BOOLEAN(SVGFEImageElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    45 
    46 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement)
    47     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    50     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    51 END_REGISTER_ANIMATED_PROPERTIES
    52 
    5342inline SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Document& document)
    5443    : SVGFilterPrimitiveStandardAttributes(tagName, document)
     44    , SVGExternalResourcesRequired(this)
     45    , SVGURIReference(this)
    5546{
    5647    ASSERT(hasTagName(SVGNames::feImageTag));
    57     registerAnimatedPropertiesForSVGFEImageElement();
     48    registerAttributes();
    5849}
    5950
     
    123114}
    124115
     116void SVGFEImageElement::registerAttributes()
     117{
     118    auto& registry = attributeRegistry();
     119    if (!registry.isEmpty())
     120        return;
     121    registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGFEImageElement::m_preserveAspectRatio>();
     122}
     123
    125124void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    126125{
     
    128127        SVGPreserveAspectRatioValue preserveAspectRatio;
    129128        preserveAspectRatio.parse(value);
    130         setPreserveAspectRatioBaseValue(preserveAspectRatio);
     129        m_preserveAspectRatio.setValue(preserveAspectRatio);
    131130        return;
    132131    }
  • trunk/Source/WebCore/svg/SVGFEImageElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3233namespace WebCore {
    3334
    34 class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes, public SVGURIReference, public SVGExternalResourcesRequired, public CachedImageClient {
     35class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes, public SVGExternalResourcesRequired, public SVGURIReference, public CachedImageClient {
    3536    WTF_MAKE_ISO_ALLOCATED(SVGFEImageElement);
    3637public:
     
    4142    bool hasSingleSecurityOrigin() const;
    4243
     44    const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(attributeOwnerProxy()); }
     45    RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(attributeOwnerProxy()); }
     46
    4347private:
    4448    SVGFEImageElement(const QualifiedName&, Document&);
    4549
     50    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEImageElement, SVGFilterPrimitiveStandardAttributes, SVGExternalResourcesRequired, SVGURIReference>;
     51    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     52    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     53    static void registerAttributes();
     54
     55    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     56    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     57    void svgAttributeChanged(const QualifiedName&) override;
     58
     59    void notifyFinished(CachedResource&) final;
     60    void addSubresourceAttributeURLs(ListHashSet<URL>&) const override;
     61
    4662    void didFinishInsertingNode() override;
    4763
    48     void parseAttribute(const QualifiedName&, const AtomicString&) override;
    49     void svgAttributeChanged(const QualifiedName&) override;
    50     void notifyFinished(CachedResource&) final;
    51 
    52     void addSubresourceAttributeURLs(ListHashSet<URL>&) const override;
    5364    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    5465
     
    6071    void removedFromAncestor(RemovalType, ContainerNode&) override;
    6172
    62     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEImageElement)
    63         DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
    64         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    65         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    66     END_DECLARE_ANIMATED_PROPERTIES
    67 
     73    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     74    SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio;
    6875    CachedResourceHandle<CachedImage> m_cachedImage;
    6976};
  • trunk/Source/WebCore/svg/SVGFELightElement.cpp

    r229694 r234620  
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    4041WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFELightElement);
    4142
    42 // Animated property definitions
    43 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::azimuthAttr, Azimuth, azimuth)
    44 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::elevationAttr, Elevation, elevation)
    45 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::xAttr, X, x)
    46 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::yAttr, Y, y)
    47 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::zAttr, Z, z)
    48 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtXAttr, PointsAtX, pointsAtX)
    49 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtYAttr, PointsAtY, pointsAtY)
    50 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtZAttr, PointsAtZ, pointsAtZ)
    51 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::specularExponentAttr, SpecularExponent, specularExponent)
    52 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::limitingConeAngleAttr, LimitingConeAngle, limitingConeAngle)
    53 
    54 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFELightElement)
    55     REGISTER_LOCAL_ANIMATED_PROPERTY(azimuth)
    56     REGISTER_LOCAL_ANIMATED_PROPERTY(elevation)
    57     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    58     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    59     REGISTER_LOCAL_ANIMATED_PROPERTY(z)
    60     REGISTER_LOCAL_ANIMATED_PROPERTY(pointsAtX)
    61     REGISTER_LOCAL_ANIMATED_PROPERTY(pointsAtY)
    62     REGISTER_LOCAL_ANIMATED_PROPERTY(pointsAtZ)
    63     REGISTER_LOCAL_ANIMATED_PROPERTY(specularExponent)
    64     REGISTER_LOCAL_ANIMATED_PROPERTY(limitingConeAngle)
    65 END_REGISTER_ANIMATED_PROPERTIES
    66 
    6743SVGFELightElement::SVGFELightElement(const QualifiedName& tagName, Document& document)
    6844    : SVGElement(tagName, document)
    69     , m_specularExponent(1)
    7045{
    71     registerAnimatedPropertiesForSVGFELightElement();
     46    registerAttributes();
    7247}
    7348
     
    8156}
    8257
     58void SVGFELightElement::registerAttributes()
     59{
     60    auto& registry = attributeRegistry();
     61    if (!registry.isEmpty())
     62        return;
     63    registry.registerAttribute<SVGNames::azimuthAttr, &SVGFELightElement::m_azimuth>();
     64    registry.registerAttribute<SVGNames::elevationAttr, &SVGFELightElement::m_elevation>();
     65    registry.registerAttribute<SVGNames::xAttr, &SVGFELightElement::m_x>();
     66    registry.registerAttribute<SVGNames::yAttr, &SVGFELightElement::m_y>();
     67    registry.registerAttribute<SVGNames::zAttr, &SVGFELightElement::m_z>();
     68    registry.registerAttribute<SVGNames::pointsAtXAttr, &SVGFELightElement::m_pointsAtX>();
     69    registry.registerAttribute<SVGNames::pointsAtYAttr, &SVGFELightElement::m_pointsAtY>();
     70    registry.registerAttribute<SVGNames::pointsAtZAttr, &SVGFELightElement::m_pointsAtZ>();
     71    registry.registerAttribute<SVGNames::specularExponentAttr, &SVGFELightElement::m_specularExponent>();
     72    registry.registerAttribute<SVGNames::limitingConeAngleAttr, &SVGFELightElement::m_limitingConeAngle>();
     73}
     74
    8375void SVGFELightElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    8476{
    8577    if (name == SVGNames::azimuthAttr) {
    86         setAzimuthBaseValue(value.toFloat());
     78        m_azimuth.setValue(value.toFloat());
    8779        return;
    8880    }
    8981
    9082    if (name == SVGNames::elevationAttr) {
    91         setElevationBaseValue(value.toFloat());
     83        m_elevation.setValue(value.toFloat());
    9284        return;
    9385    }
    9486
    9587    if (name == SVGNames::xAttr) {
    96         setXBaseValue(value.toFloat());
     88        m_x.setValue(value.toFloat());
    9789        return;
    9890    }
    9991
    10092    if (name == SVGNames::yAttr) {
    101         setYBaseValue(value.toFloat());
     93        m_y.setValue(value.toFloat());
    10294        return;
    10395    }
    10496
    10597    if (name == SVGNames::zAttr) {
    106         setZBaseValue(value.toFloat());
     98        m_z.setValue(value.toFloat());
    10799        return;
    108100    }
    109101
    110102    if (name == SVGNames::pointsAtXAttr) {
    111         setPointsAtXBaseValue(value.toFloat());
     103        m_pointsAtX.setValue(value.toFloat());
    112104        return;
    113105    }
    114106
    115107    if (name == SVGNames::pointsAtYAttr) {
    116         setPointsAtYBaseValue(value.toFloat());
     108        m_pointsAtY.setValue(value.toFloat());
    117109        return;
    118110    }
    119111
    120112    if (name == SVGNames::pointsAtZAttr) {
    121         setPointsAtZBaseValue(value.toFloat());
     113        m_pointsAtZ.setValue(value.toFloat());
    122114        return;
    123115    }
    124116
    125117    if (name == SVGNames::specularExponentAttr) {
    126         setSpecularExponentBaseValue(value.toFloat());
     118        m_specularExponent.setValue(value.toFloat());
    127119        return;
    128120    }
    129121
    130122    if (name == SVGNames::limitingConeAngleAttr) {
    131         setLimitingConeAngleBaseValue(value.toFloat());
     123        m_limitingConeAngle.setValue(value.toFloat());
    132124        return;
    133125    }
     
    138130void SVGFELightElement::svgAttributeChanged(const QualifiedName& attrName)
    139131{
    140     if (attrName == SVGNames::azimuthAttr || attrName == SVGNames::elevationAttr
    141         || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::zAttr
    142         || attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAttr || attrName == SVGNames::pointsAtZAttr
    143         || attrName == SVGNames::specularExponentAttr || attrName == SVGNames::limitingConeAngleAttr) {
    144 
     132    if (isKnownAttribute(attrName)) {
    145133        auto parent = makeRefPtr(parentElement());
    146134        if (!parent)
  • trunk/Source/WebCore/svg/SVGFELightElement.h

    r229694 r234620  
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    3637    static SVGFELightElement* findLightElement(const SVGElement*);
    3738
     39    float azimuth() const { return m_azimuth.currentValue(attributeOwnerProxy()); }
     40    float elevation() const { return m_elevation.currentValue(attributeOwnerProxy()); }
     41    float x() const { return m_x.currentValue(attributeOwnerProxy()); }
     42    float y() const { return m_y.currentValue(attributeOwnerProxy()); }
     43    float z() const { return m_z.currentValue(attributeOwnerProxy()); }
     44    float pointsAtX() const { return m_pointsAtX.currentValue(attributeOwnerProxy()); }
     45    float pointsAtY() const { return m_pointsAtY.currentValue(attributeOwnerProxy()); }
     46    float pointsAtZ() const { return m_pointsAtZ.currentValue(attributeOwnerProxy()); }
     47    float specularExponent() const { return m_specularExponent.currentValue(attributeOwnerProxy()); }
     48    float limitingConeAngle() const { return m_limitingConeAngle.currentValue(attributeOwnerProxy()); }
     49
     50    RefPtr<SVGAnimatedNumber> azimuthAnimated() { return m_azimuth.animatedProperty(attributeOwnerProxy()); }
     51    RefPtr<SVGAnimatedNumber> elevationAnimated() { return m_elevation.animatedProperty(attributeOwnerProxy()); }
     52    RefPtr<SVGAnimatedNumber> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     53    RefPtr<SVGAnimatedNumber> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     54    RefPtr<SVGAnimatedNumber> zAnimated() { return m_z.animatedProperty(attributeOwnerProxy()); }
     55    RefPtr<SVGAnimatedNumber> pointsAtXAnimated() { return m_pointsAtX.animatedProperty(attributeOwnerProxy()); }
     56    RefPtr<SVGAnimatedNumber> pointsAtYAnimated() { return m_pointsAtY.animatedProperty(attributeOwnerProxy()); }
     57    RefPtr<SVGAnimatedNumber> pointsAtZAnimated() { return m_pointsAtZ.animatedProperty(attributeOwnerProxy()); }
     58    RefPtr<SVGAnimatedNumber> specularExponentAnimated() { return m_specularExponent.animatedProperty(attributeOwnerProxy()); }
     59    RefPtr<SVGAnimatedNumber> limitingConeAngleAnimated() { return m_limitingConeAngle.animatedProperty(attributeOwnerProxy()); }
     60
    3861protected:
    3962    SVGFELightElement(const QualifiedName&, Document&);
     
    4265
    4366private:
     67    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFELightElement, SVGElement>;
     68    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     69    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     70    static void registerAttributes();
     71
     72    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4473    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    4574    void svgAttributeChanged(const QualifiedName&) override;
    4675    void childrenChanged(const ChildChange&) override;
    4776
    48     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFELightElement)
    49         DECLARE_ANIMATED_NUMBER(Azimuth, azimuth)
    50         DECLARE_ANIMATED_NUMBER(Elevation, elevation)
    51         DECLARE_ANIMATED_NUMBER(X, x)
    52         DECLARE_ANIMATED_NUMBER(Y, y)
    53         DECLARE_ANIMATED_NUMBER(Z, z)
    54         DECLARE_ANIMATED_NUMBER(PointsAtX, pointsAtX)
    55         DECLARE_ANIMATED_NUMBER(PointsAtY, pointsAtY)
    56         DECLARE_ANIMATED_NUMBER(PointsAtZ, pointsAtZ)
    57         DECLARE_ANIMATED_NUMBER(SpecularExponent, specularExponent)
    58         DECLARE_ANIMATED_NUMBER(LimitingConeAngle, limitingConeAngle)
    59     END_DECLARE_ANIMATED_PROPERTIES
     77    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     78    SVGAnimatedNumberAttribute m_azimuth;
     79    SVGAnimatedNumberAttribute m_elevation;
     80    SVGAnimatedNumberAttribute m_x;
     81    SVGAnimatedNumberAttribute m_y;
     82    SVGAnimatedNumberAttribute m_z;
     83    SVGAnimatedNumberAttribute m_pointsAtX;
     84    SVGAnimatedNumberAttribute m_pointsAtY;
     85    SVGAnimatedNumberAttribute m_pointsAtZ;
     86    SVGAnimatedNumberAttribute m_specularExponent { 1 };
     87    SVGAnimatedNumberAttribute m_limitingConeAngle;
    6088};
    6189
  • trunk/Source/WebCore/svg/SVGFEMergeNodeElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3233WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEMergeNodeElement);
    3334
    34 // Animated property definitions
    35 DEFINE_ANIMATED_STRING(SVGFEMergeNodeElement, SVGNames::inAttr, In1, in1)
    36 
    37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMergeNodeElement)
    38     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    39 END_REGISTER_ANIMATED_PROPERTIES
    40 
    4135inline SVGFEMergeNodeElement::SVGFEMergeNodeElement(const QualifiedName& tagName, Document& document)
    4236    : SVGElement(tagName, document)
    4337{
    4438    ASSERT(hasTagName(SVGNames::feMergeNodeTag));
    45     registerAnimatedPropertiesForSVGFEMergeNodeElement();
     39    registerAttributes();
    4640}
    4741
     
    5145}
    5246
     47void SVGFEMergeNodeElement::registerAttributes()
     48{
     49    auto& registry = attributeRegistry();
     50    if (!registry.isEmpty())
     51        return;
     52    registry.registerAttribute<SVGNames::inAttr, &SVGFEMergeNodeElement::m_in1>();
     53}
     54
    5355void SVGFEMergeNodeElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    5456{
    5557    if (name == SVGNames::inAttr) {
    56         setIn1BaseValue(value);
     58        m_in1.setValue(value);
    5759        return;
    5860    }
  • trunk/Source/WebCore/svg/SVGFEMergeNodeElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3132    static Ref<SVGFEMergeNodeElement> create(const QualifiedName&, Document&);
    3233
     34    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     35    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     36
    3337private:
    3438    SVGFEMergeNodeElement(const QualifiedName&, Document&);
    3539
     40    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEMergeNodeElement, SVGElement>;
     41    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     42    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     43    static void registerAttributes();
     44
     45    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    3646    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    3747    void svgAttributeChanged(const QualifiedName&) final;
     48
    3849    bool rendererIsNeeded(const RenderStyle&) final { return false; }
    3950
    40     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMergeNodeElement)
    41         DECLARE_ANIMATED_STRING(In1, in1)
    42     END_DECLARE_ANIMATED_PROPERTIES
     51    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     52    SVGAnimatedStringAttribute m_in1;
    4353};
    4454
  • trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp

    r229694 r234620  
    11/*
    22 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3132WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEMorphologyElement);
    3233
    33 // Animated property definitions
    34 DEFINE_ANIMATED_STRING(SVGFEMorphologyElement, SVGNames::inAttr, In1, in1)
    35 DEFINE_ANIMATED_ENUMERATION(SVGFEMorphologyElement, SVGNames::operatorAttr, SVGOperator, svgOperator, MorphologyOperatorType)
    36 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusXIdentifier(), RadiusX, radiusX)
    37 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusYIdentifier(), RadiusY, radiusY)
    38 
    39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMorphologyElement)
    40     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    41     REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator)
    42     REGISTER_LOCAL_ANIMATED_PROPERTY(radiusX)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(radiusY)
    44     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    45 END_REGISTER_ANIMATED_PROPERTIES
    46 
    4734inline SVGFEMorphologyElement::SVGFEMorphologyElement(const QualifiedName& tagName, Document& document)
    4835    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    49     , m_svgOperator(FEMORPHOLOGY_OPERATOR_ERODE)
    5036{
    5137    ASSERT(hasTagName(SVGNames::feMorphologyTag));
    52     registerAnimatedPropertiesForSVGFEMorphologyElement();
     38    registerAttributes();
    5339}
    5440
     
    7258void SVGFEMorphologyElement::setRadius(float x, float y)
    7359{
    74     setRadiusXBaseValue(x);
    75     setRadiusYBaseValue(y);
     60    m_radiusX.setValue(x);
     61    m_radiusY.setValue(y);
    7662    invalidate();
     63}
     64
     65void SVGFEMorphologyElement::registerAttributes()
     66{
     67    auto& registry = attributeRegistry();
     68    if (!registry.isEmpty())
     69        return;
     70    registry.registerAttribute<SVGNames::inAttr, &SVGFEMorphologyElement::m_in1>();
     71    registry.registerAttribute<SVGNames::operatorAttr, MorphologyOperatorType, &SVGFEMorphologyElement::m_svgOperator>();
     72    registry.registerAttribute<SVGNames::radiusAttr,
     73        &SVGFEMorphologyElement::radiusXIdentifier, &SVGFEMorphologyElement::m_radiusX,
     74        &SVGFEMorphologyElement::radiusYIdentifier, &SVGFEMorphologyElement::m_radiusY>();
    7775}
    7876
     
    8280        MorphologyOperatorType propertyValue = SVGPropertyTraits<MorphologyOperatorType>::fromString(value);
    8381        if (propertyValue > 0)
    84             setSVGOperatorBaseValue(propertyValue);
     82            m_svgOperator.setValue(propertyValue);
    8583        return;
    8684    }
    8785
    8886    if (name == SVGNames::inAttr) {
    89         setIn1BaseValue(value);
     87        m_in1.setValue(value);
    9088        return;
    9189    }
     
    9492        float x, y;
    9593        if (parseNumberOptionalNumber(value, x, y)) {
    96             setRadiusXBaseValue(x);
    97             setRadiusYBaseValue(y);
     94            m_radiusX.setValue(x);
     95            m_radiusY.setValue(y);
    9896        }
    9997        return;
  • trunk/Source/WebCore/svg/SVGFEMorphologyElement.h

    r233122 r234620  
    11/*
    22 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    6364    void setRadius(float radiusX, float radiusY);
    6465
     66    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     67    MorphologyOperatorType svgOperator() const { return m_svgOperator.currentValue(attributeOwnerProxy()); }
     68    float radiusX() const { return m_radiusX.currentValue(attributeOwnerProxy()); }
     69    float radiusY() const { return m_radiusY.currentValue(attributeOwnerProxy()); }
     70
     71    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     72    RefPtr<SVGAnimatedEnumeration> svgOperatorAnimated() { return m_svgOperator.animatedProperty(attributeOwnerProxy()); }
     73    RefPtr<SVGAnimatedNumber> radiusXAnimated() { return m_radiusX.animatedProperty(attributeOwnerProxy()); }
     74    RefPtr<SVGAnimatedNumber> radiusYAnimated() { return m_radiusY.animatedProperty(attributeOwnerProxy()); }
     75
    6576private:
    6677    SVGFEMorphologyElement(const QualifiedName&, Document&);
    6778
     79    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEMorphologyElement, SVGFilterPrimitiveStandardAttributes>;
     80    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     81    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     82    static void registerAttributes();
     83
     84    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    6885    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     86    void svgAttributeChanged(const QualifiedName&) override;
     87
    6988    bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
    70     void svgAttributeChanged(const QualifiedName&) override;
    7189    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    7290
     
    7492    static const AtomicString& radiusYIdentifier();
    7593
    76     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMorphologyElement)
    77         DECLARE_ANIMATED_STRING(In1, in1)
    78         DECLARE_ANIMATED_ENUMERATION(SVGOperator, svgOperator, MorphologyOperatorType)
    79         DECLARE_ANIMATED_NUMBER(RadiusX, radiusX)
    80         DECLARE_ANIMATED_NUMBER(RadiusY, radiusY)
    81     END_DECLARE_ANIMATED_PROPERTIES
     94    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     95    SVGAnimatedStringAttribute m_in1;
     96    SVGAnimatedEnumerationAttribute<MorphologyOperatorType> m_svgOperator { FEMORPHOLOGY_OPERATOR_ERODE };
     97    SVGAnimatedNumberAttribute m_radiusX;
     98    SVGAnimatedNumberAttribute m_radiusY;
    8299};
    83100
  • trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3233WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEOffsetElement);
    3334
    34 // Animated property definitions
    35 DEFINE_ANIMATED_STRING(SVGFEOffsetElement, SVGNames::inAttr, In1, in1)
    36 DEFINE_ANIMATED_NUMBER(SVGFEOffsetElement, SVGNames::dxAttr, Dx, dx)
    37 DEFINE_ANIMATED_NUMBER(SVGFEOffsetElement, SVGNames::dyAttr, Dy, dy)
    38 
    39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEOffsetElement)
    40     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    41     REGISTER_LOCAL_ANIMATED_PROPERTY(dx)
    42     REGISTER_LOCAL_ANIMATED_PROPERTY(dy)
    43     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    44 END_REGISTER_ANIMATED_PROPERTIES
    45 
    4635inline SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document& document)
    4736    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    4837{
    4938    ASSERT(hasTagName(SVGNames::feOffsetTag));
    50     registerAnimatedPropertiesForSVGFEOffsetElement();
     39    registerAttributes();
    5140}
    5241
     
    5645}
    5746
     47void SVGFEOffsetElement::registerAttributes()
     48{
     49    auto& registry = attributeRegistry();
     50    if (!registry.isEmpty())
     51        return;
     52    registry.registerAttribute<SVGNames::inAttr, &SVGFEOffsetElement::m_in1>();
     53    registry.registerAttribute<SVGNames::dxAttr, &SVGFEOffsetElement::m_dx>();
     54    registry.registerAttribute<SVGNames::dyAttr, &SVGFEOffsetElement::m_dy>();
     55}
     56
    5857void SVGFEOffsetElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    5958{
    6059    if (name == SVGNames::dxAttr) {
    61         setDxBaseValue(value.toFloat());
     60        m_dx.setValue(value.toFloat());
    6261        return;
    6362    }
    6463
    6564    if (name == SVGNames::dyAttr) {
    66         setDyBaseValue(value.toFloat());
     65        m_dy.setValue(value.toFloat());
    6766        return;
    6867    }
    6968
    7069    if (name == SVGNames::inAttr) {
    71         setIn1BaseValue(value);
     70        m_in1.setValue(value);
    7271        return;
    7372    }
     
    7877void SVGFEOffsetElement::svgAttributeChanged(const QualifiedName& attrName)
    7978{
    80     if (attrName == SVGNames::inAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr) {
     79    if (isKnownAttribute(attrName)) {
    8180        InstanceInvalidationGuard guard(*this);
    8281        invalidate();
  • trunk/Source/WebCore/svg/SVGFEOffsetElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3132    static Ref<SVGFEOffsetElement> create(const QualifiedName&, Document&);
    3233
     34    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     35    float dx() const { return m_dx.currentValue(attributeOwnerProxy()); }
     36    float dy() const { return m_dy.currentValue(attributeOwnerProxy()); }
     37
     38    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     39    RefPtr<SVGAnimatedNumber> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); }
     40    RefPtr<SVGAnimatedNumber> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); }
     41
    3342private:
    3443    SVGFEOffsetElement(const QualifiedName&, Document&);
    3544
     45    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEOffsetElement, SVGFilterPrimitiveStandardAttributes>;
     46    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     47    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     48    static void registerAttributes();
     49
     50    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    3651    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    3752    void svgAttributeChanged(const QualifiedName&) override;
     53
    3854    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    3955
    40     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEOffsetElement)
    41         DECLARE_ANIMATED_STRING(In1, in1)
    42         DECLARE_ANIMATED_NUMBER(Dx, dx)
    43         DECLARE_ANIMATED_NUMBER(Dy, dy)
    44     END_DECLARE_ANIMATED_PROPERTIES
     56    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     57    SVGAnimatedStringAttribute m_in1;
     58    SVGAnimatedNumberAttribute m_dx;
     59    SVGAnimatedNumberAttribute m_dy;
    4560};
    4661
  • trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp

    r231153 r234620  
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    3536WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFESpecularLightingElement);
    3637
    37 // Animated property definitions
    38 DEFINE_ANIMATED_STRING(SVGFESpecularLightingElement, SVGNames::inAttr, In1, in1)
    39 DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::specularConstantAttr, SpecularConstant, specularConstant)
    40 DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::specularExponentAttr, SpecularExponent, specularExponent)
    41 DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::surfaceScaleAttr, SurfaceScale, surfaceScale)
    42 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX)
    43 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY)
    44 
    45 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFESpecularLightingElement)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    47     REGISTER_LOCAL_ANIMATED_PROPERTY(specularConstant)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(specularExponent)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(surfaceScale)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY)
    52     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    53 END_REGISTER_ANIMATED_PROPERTIES
    54 
    5538inline SVGFESpecularLightingElement::SVGFESpecularLightingElement(const QualifiedName& tagName, Document& document)
    5639    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    57     , m_specularConstant(1)
    58     , m_specularExponent(1)
    59     , m_surfaceScale(1)
    6040{
    6141    ASSERT(hasTagName(SVGNames::feSpecularLightingTag));
    62     registerAnimatedPropertiesForSVGFESpecularLightingElement();
     42    registerAttributes();
    6343}
    6444
     
    8060}
    8161
     62void SVGFESpecularLightingElement::registerAttributes()
     63{
     64    auto& registry = attributeRegistry();
     65    if (!registry.isEmpty())
     66        return;
     67    registry.registerAttribute<SVGNames::inAttr, &SVGFESpecularLightingElement::m_in1>();
     68    registry.registerAttribute<SVGNames::specularConstantAttr, &SVGFESpecularLightingElement::m_specularConstant>();
     69    registry.registerAttribute<SVGNames::specularExponentAttr, &SVGFESpecularLightingElement::m_specularExponent>();
     70    registry.registerAttribute<SVGNames::surfaceScaleAttr, &SVGFESpecularLightingElement::m_surfaceScale>();
     71    registry.registerAttribute<SVGNames::kernelUnitLengthAttr,
     72        &SVGFESpecularLightingElement::kernelUnitLengthXIdentifier, &SVGFESpecularLightingElement::m_kernelUnitLengthX,
     73        &SVGFESpecularLightingElement::kernelUnitLengthYIdentifier, &SVGFESpecularLightingElement::m_kernelUnitLengthY>();
     74}
     75
    8276void SVGFESpecularLightingElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    8377{
    8478    if (name == SVGNames::inAttr) {
    85         setIn1BaseValue(value);
     79        m_in1.setValue(value);
    8680        return;
    8781    }
    8882
    8983    if (name == SVGNames::surfaceScaleAttr) {
    90         setSurfaceScaleBaseValue(value.toFloat());
     84        m_surfaceScale.setValue(value.toFloat());
    9185        return;
    9286    }
    9387
    9488    if (name == SVGNames::specularConstantAttr) {
    95         setSpecularConstantBaseValue(value.toFloat());
     89        m_specularConstant.setValue(value.toFloat());
    9690        return;
    9791    }
    9892
    9993    if (name == SVGNames::specularExponentAttr) {
    100         setSpecularExponentBaseValue(value.toFloat());
     94        m_specularExponent.setValue(value.toFloat());
    10195        return;
    10296    }
     
    10599        float x, y;
    106100        if (parseNumberOptionalNumber(value, x, y)) {
    107             setKernelUnitLengthXBaseValue(x);
    108             setKernelUnitLengthYBaseValue(y);
     101            m_kernelUnitLengthX.setValue(x);
     102            m_kernelUnitLengthY.setValue(y);
    109103        }
    110104        return;
  • trunk/Source/WebCore/svg/SVGFESpecularLightingElement.h

    r229694 r234620  
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com>
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    3536    void lightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&);
    3637
     38    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     39    float specularConstant() const  { return m_specularConstant.currentValue(attributeOwnerProxy()); }
     40    float specularExponent() const { return m_specularExponent.currentValue(attributeOwnerProxy()); }
     41    float surfaceScale() const { return m_surfaceScale.currentValue(attributeOwnerProxy()); }
     42    float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); }
     43    float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); }
     44
     45    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     46    RefPtr<SVGAnimatedNumber> specularConstantAnimated() { return m_specularConstant.animatedProperty(attributeOwnerProxy()); }
     47    RefPtr<SVGAnimatedNumber> specularExponentAnimated() { return m_specularExponent.animatedProperty(attributeOwnerProxy()); }
     48    RefPtr<SVGAnimatedNumber> surfaceScaleAnimated() { return m_surfaceScale.animatedProperty(attributeOwnerProxy()); }
     49    RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); }
     50    RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); }
     51
    3752private:
    3853    SVGFESpecularLightingElement(const QualifiedName&, Document&);
    39    
     54
     55    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFESpecularLightingElement, SVGFilterPrimitiveStandardAttributes>;
     56    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     57    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     58    static void registerAttributes();
     59
     60    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4061    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     62    void svgAttributeChanged(const QualifiedName&) override;
     63
    4164    bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
    42     void svgAttributeChanged(const QualifiedName&) override;
    4365    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    4466
     
    4668    static const AtomicString& kernelUnitLengthYIdentifier();
    4769
    48     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFESpecularLightingElement)
    49         DECLARE_ANIMATED_STRING(In1, in1)
    50         DECLARE_ANIMATED_NUMBER(SpecularConstant, specularConstant)
    51         DECLARE_ANIMATED_NUMBER(SpecularExponent, specularExponent)
    52         DECLARE_ANIMATED_NUMBER(SurfaceScale, surfaceScale)
    53         DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX)
    54         DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY)
    55     END_DECLARE_ANIMATED_PROPERTIES
     70    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     71    SVGAnimatedStringAttribute m_in1;
     72    SVGAnimatedNumberAttribute m_specularConstant { 1 };
     73    SVGAnimatedNumberAttribute m_specularExponent { 1 };
     74    SVGAnimatedNumberAttribute m_surfaceScale { 1 };
     75    SVGAnimatedNumberAttribute m_kernelUnitLengthX;
     76    SVGAnimatedNumberAttribute m_kernelUnitLengthY;
    5677};
    5778
  • trunk/Source/WebCore/svg/SVGFETileElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3334WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFETileElement);
    3435
    35 // Animated property definitions
    36 DEFINE_ANIMATED_STRING(SVGFETileElement, SVGNames::inAttr, In1, in1)
    37 
    38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETileElement)
    39     REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
    40     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    41 END_REGISTER_ANIMATED_PROPERTIES
    42 
    4336inline SVGFETileElement::SVGFETileElement(const QualifiedName& tagName, Document& document)
    4437    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    4538{
    4639    ASSERT(hasTagName(SVGNames::feTileTag));
    47     registerAnimatedPropertiesForSVGFETileElement();
     40    registerAttributes();
    4841}
    4942
     
    5346}
    5447
     48void SVGFETileElement::registerAttributes()
     49{
     50    auto& registry = attributeRegistry();
     51    if (!registry.isEmpty())
     52        return;
     53    registry.registerAttribute<SVGNames::inAttr, &SVGFETileElement::m_in1>();
     54}
     55
    5556void SVGFETileElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    5657{
    5758    if (name == SVGNames::inAttr) {
    58         setIn1BaseValue(value);
     59        m_in1.setValue(value);
    5960        return;
    6061    }
  • trunk/Source/WebCore/svg/SVGFETileElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3031    static Ref<SVGFETileElement> create(const QualifiedName&, Document&);
    3132
     33    String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
     34    RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
     35
    3236private:
    3337    SVGFETileElement(const QualifiedName&, Document&);
    3438
     39    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFETileElement, SVGFilterPrimitiveStandardAttributes>;
     40    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     41    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     42    static void registerAttributes();
     43
     44    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    3545    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    3646    void svgAttributeChanged(const QualifiedName&) override;
     47
    3748    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    3849
    39     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFETileElement)
    40         DECLARE_ANIMATED_STRING(In1, in1)
    41     END_DECLARE_ANIMATED_PROPERTIES
     50    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     51    SVGAnimatedStringAttribute m_in1;
    4252};
    4353
  • trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3031WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFETurbulenceElement);
    3132
    32 // Animated property definitions
    33 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyXIdentifier(), BaseFrequencyX, baseFrequencyX)
    34 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyYIdentifier(), BaseFrequencyY, baseFrequencyY)
    35 DEFINE_ANIMATED_INTEGER(SVGFETurbulenceElement, SVGNames::numOctavesAttr, NumOctaves, numOctaves)
    36 DEFINE_ANIMATED_NUMBER(SVGFETurbulenceElement, SVGNames::seedAttr, Seed, seed)
    37 DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, StitchTiles, stitchTiles, SVGStitchOptions)
    38 DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::typeAttr, Type, type, TurbulenceType)
    39 
    40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETurbulenceElement)
    41     REGISTER_LOCAL_ANIMATED_PROPERTY(baseFrequencyX)
    42     REGISTER_LOCAL_ANIMATED_PROPERTY(baseFrequencyY)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(numOctaves)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(seed)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(stitchTiles)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(type)
    47     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    48 END_REGISTER_ANIMATED_PROPERTIES
    49 
    5033inline SVGFETurbulenceElement::SVGFETurbulenceElement(const QualifiedName& tagName, Document& document)
    5134    : SVGFilterPrimitiveStandardAttributes(tagName, document)
    52     , m_numOctaves(1)
    53     , m_stitchTiles(SVG_STITCHTYPE_NOSTITCH)
    54     , m_type(TurbulenceType::Turbulence)
    5535{
    5636    ASSERT(hasTagName(SVGNames::feTurbulenceTag));
    57     registerAnimatedPropertiesForSVGFETurbulenceElement();
     37    registerAttributes();
    5838}
    5939
     
    7555}
    7656
     57void SVGFETurbulenceElement::registerAttributes()
     58{
     59    auto& registry = attributeRegistry();
     60    if (!registry.isEmpty())
     61        return;
     62    registry.registerAttribute<SVGNames::baseFrequencyAttr,
     63        &SVGFETurbulenceElement::baseFrequencyXIdentifier, &SVGFETurbulenceElement::m_baseFrequencyX,
     64        &SVGFETurbulenceElement::baseFrequencyYIdentifier, &SVGFETurbulenceElement::m_baseFrequencyY>();
     65    registry.registerAttribute<SVGNames::numOctavesAttr, &SVGFETurbulenceElement::m_numOctaves>();
     66    registry.registerAttribute<SVGNames::seedAttr, &SVGFETurbulenceElement::m_seed>();
     67    registry.registerAttribute<SVGNames::stitchTilesAttr, SVGStitchOptions, &SVGFETurbulenceElement::m_stitchTiles>();
     68    registry.registerAttribute<SVGNames::typeAttr, TurbulenceType, &SVGFETurbulenceElement::m_type>();
     69}
     70
    7771void SVGFETurbulenceElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    7872{
     
    8074        TurbulenceType propertyValue = SVGPropertyTraits<TurbulenceType>::fromString(value);
    8175        if (propertyValue != TurbulenceType::Unknown)
    82             setTypeBaseValue(propertyValue);
     76            m_type.setValue(propertyValue);
    8377        return;
    8478    }
     
    8781        SVGStitchOptions propertyValue = SVGPropertyTraits<SVGStitchOptions>::fromString(value);
    8882        if (propertyValue > 0)
    89             setStitchTilesBaseValue(propertyValue);
     83            m_stitchTiles.setValue(propertyValue);
    9084        return;
    9185    }
     
    9488        float x, y;
    9589        if (parseNumberOptionalNumber(value, x, y)) {
    96             setBaseFrequencyXBaseValue(x);
    97             setBaseFrequencyYBaseValue(y);
     90            m_baseFrequencyX.setValue(x);
     91            m_baseFrequencyY.setValue(y);
    9892        }
    9993        return;
     
    10195
    10296    if (name == SVGNames::seedAttr) {
    103         setSeedBaseValue(value.toFloat());
     97        m_seed.setValue(value.toFloat());
    10498        return;
    10599    }
    106100
    107101    if (name == SVGNames::numOctavesAttr) {
    108         setNumOctavesBaseValue(value.string().toUIntStrict());
     102        m_numOctaves.setValue(value.string().toUIntStrict());
    109103        return;
    110104    }
     
    125119        return turbulence->setSeed(seed());
    126120    if (attrName == SVGNames::numOctavesAttr)
    127        return turbulence->setNumOctaves(numOctaves());
     121        return turbulence->setNumOctaves(numOctaves());
    128122
    129123    ASSERT_NOT_REACHED();
     
    133127void SVGFETurbulenceElement::svgAttributeChanged(const QualifiedName& attrName)
    134128{
    135     if (attrName == SVGNames::baseFrequencyAttr || attrName == SVGNames::numOctavesAttr || attrName == SVGNames::seedAttr || attrName == SVGNames::stitchTilesAttr || attrName == SVGNames::typeAttr) {
     129    if (isKnownAttribute(attrName)) {
    136130        InstanceInvalidationGuard guard(*this);
    137131        primitiveAttributeChanged(attrName);
  • trunk/Source/WebCore/svg/SVGFETurbulenceElement.h

    r233122 r234620  
    22 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    9899    static Ref<SVGFETurbulenceElement> create(const QualifiedName&, Document&);
    99100
     101    float baseFrequencyX() const { return m_baseFrequencyX.currentValue(attributeOwnerProxy()); }
     102    float baseFrequencyY() const { return m_baseFrequencyY.currentValue(attributeOwnerProxy()); }
     103    int numOctaves() const { return m_numOctaves.currentValue(attributeOwnerProxy()); }
     104    float seed() const { return m_seed.currentValue(attributeOwnerProxy()); }
     105    SVGStitchOptions stitchTiles() const { return m_stitchTiles.currentValue(attributeOwnerProxy()); }
     106    TurbulenceType type() const { return m_type.currentValue(attributeOwnerProxy()); }
     107
     108    RefPtr<SVGAnimatedNumber> baseFrequencyXAnimated() { return m_baseFrequencyX.animatedProperty(attributeOwnerProxy()); }
     109    RefPtr<SVGAnimatedNumber> baseFrequencyYAnimated() { return m_baseFrequencyY.animatedProperty(attributeOwnerProxy()); }
     110    RefPtr<SVGAnimatedInteger> numOctavesAnimated() { return m_numOctaves.animatedProperty(attributeOwnerProxy()); }
     111    RefPtr<SVGAnimatedNumber> seedAnimated() { return m_seed.animatedProperty(attributeOwnerProxy()); }
     112    RefPtr<SVGAnimatedEnumeration> stitchTilesAnimated() { return m_stitchTiles.animatedProperty(attributeOwnerProxy()); }
     113    RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(attributeOwnerProxy()); }
     114
    100115private:
    101116    SVGFETurbulenceElement(const QualifiedName&, Document&);
    102117
     118    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFETurbulenceElement, SVGFilterPrimitiveStandardAttributes>;
     119    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     120    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     121    static void registerAttributes();
     122
     123    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    103124    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     125    void svgAttributeChanged(const QualifiedName&) override;
     126
    104127    bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
    105     void svgAttributeChanged(const QualifiedName&) override;
    106128    RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
    107129
     
    109131    static const AtomicString& baseFrequencyYIdentifier();
    110132
    111     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFETurbulenceElement)
    112         DECLARE_ANIMATED_NUMBER(BaseFrequencyX, baseFrequencyX)
    113         DECLARE_ANIMATED_NUMBER(BaseFrequencyY, baseFrequencyY)
    114         DECLARE_ANIMATED_INTEGER(NumOctaves, numOctaves)
    115         DECLARE_ANIMATED_NUMBER(Seed, seed)
    116         DECLARE_ANIMATED_ENUMERATION(StitchTiles, stitchTiles, SVGStitchOptions)
    117         DECLARE_ANIMATED_ENUMERATION(Type, type, TurbulenceType)
    118     END_DECLARE_ANIMATED_PROPERTIES
     133    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     134    SVGAnimatedNumberAttribute m_baseFrequencyX;
     135    SVGAnimatedNumberAttribute m_baseFrequencyY;
     136    SVGAnimatedIntegerAttribute m_numOctaves { 1 };
     137    SVGAnimatedNumberAttribute m_seed;
     138    SVGAnimatedEnumerationAttribute<SVGStitchOptions> m_stitchTiles { SVG_STITCHTYPE_NOSTITCH };
     139    SVGAnimatedEnumerationAttribute<TurbulenceType> m_type { TurbulenceType::Turbulence };
    119140};
    120141
  • trunk/Source/WebCore/svg/SVGFilterElement.cpp

    r229694 r234620  
    66 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
    77 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
     8 * Copyright (C) 2018 Apple Inc. All rights reserved.
    89 *
    910 * This library is free software; you can redistribute it and/or
     
    3940WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFilterElement);
    4041
    41 // Animated property definitions
    42 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::filterUnitsAttr, FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType)
    43 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::primitiveUnitsAttr, PrimitiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType)
    44 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::xAttr, X, x)
    45 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::yAttr, Y, y)
    46 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::widthAttr, Width, width)
    47 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::heightAttr, Height, height)
    48 DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, filterResXIdentifier(), FilterResX, filterResX)
    49 DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, filterResYIdentifier(), FilterResY, filterResY)
    50 DEFINE_ANIMATED_STRING(SVGFilterElement, XLinkNames::hrefAttr, Href, href)
    51 DEFINE_ANIMATED_BOOLEAN(SVGFilterElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    52 
    53 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterElement)
    54     REGISTER_LOCAL_ANIMATED_PROPERTY(filterUnits)
    55     REGISTER_LOCAL_ANIMATED_PROPERTY(primitiveUnits)
    56     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    57     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    58     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
    59     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
    60     REGISTER_LOCAL_ANIMATED_PROPERTY(filterResX)
    61     REGISTER_LOCAL_ANIMATED_PROPERTY(filterResY)
    62     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    63     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    64 END_REGISTER_ANIMATED_PROPERTIES
    65 
    6642inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document& document)
    6743    : SVGElement(tagName, document)
    68     , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
    69     , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
    70     , m_x(LengthModeWidth, "-10%")
    71     , m_y(LengthModeHeight, "-10%")
    72     , m_width(LengthModeWidth, "120%")
    73     , m_height(LengthModeHeight, "120%")
     44    , SVGExternalResourcesRequired(this)
     45    , SVGURIReference(this)
    7446{
    7547    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
    7648    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
    7749    ASSERT(hasTagName(SVGNames::filterTag));
    78     registerAnimatedPropertiesForSVGFilterElement();
     50    registerAttributes();
    7951}
    8052
     
    9870void SVGFilterElement::setFilterRes(unsigned filterResX, unsigned filterResY)
    9971{
    100     setFilterResXBaseValue(filterResX);
    101     setFilterResYBaseValue(filterResY);
     72    m_filterResX.setValue(filterResX);
     73    m_filterResY.setValue(filterResY);
    10274
    10375    if (RenderObject* object = renderer())
     
    10577}
    10678
    107 bool SVGFilterElement::isSupportedAttribute(const QualifiedName& attrName)
    108 {
    109     static const auto supportedAttributes = makeNeverDestroyed([] {
    110         HashSet<QualifiedName> set;
    111         SVGURIReference::addSupportedAttributes(set);
    112         SVGLangSpace::addSupportedAttributes(set);
    113         SVGExternalResourcesRequired::addSupportedAttributes(set);
    114         set.add({
    115             SVGNames::filterUnitsAttr.get(),
    116             SVGNames::primitiveUnitsAttr.get(),
    117             SVGNames::xAttr.get(),
    118             SVGNames::yAttr.get(),
    119             SVGNames::widthAttr.get(),
    120             SVGNames::heightAttr.get(),
    121             SVGNames::filterResAttr.get(),
    122         });
    123         return set;
    124     }());
    125     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     79void SVGFilterElement::registerAttributes()
     80{
     81    auto& registry = attributeRegistry();
     82    if (!registry.isEmpty())
     83        return;
     84    registry.registerAttribute<SVGNames::filterUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_filterUnits>();
     85    registry.registerAttribute<SVGNames::primitiveUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_primitiveUnits>();
     86    registry.registerAttribute<SVGNames::xAttr, &SVGFilterElement::m_x>();
     87    registry.registerAttribute<SVGNames::yAttr, &SVGFilterElement::m_y>();
     88    registry.registerAttribute<SVGNames::widthAttr, &SVGFilterElement::m_width>();
     89    registry.registerAttribute<SVGNames::heightAttr, &SVGFilterElement::m_height>();
     90    registry.registerAttribute<SVGNames::filterResAttr,
     91        &SVGFilterElement::filterResXIdentifier, &SVGFilterElement::m_filterResX,
     92        &SVGFilterElement::filterResYIdentifier, &SVGFilterElement::m_filterResY>();
    12693}
    12794
     
    133100        SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
    134101        if (propertyValue > 0)
    135             setFilterUnitsBaseValue(propertyValue);
     102            m_filterUnits.setValue(propertyValue);
    136103    } else if (name == SVGNames::primitiveUnitsAttr) {
    137104        SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
    138105        if (propertyValue > 0)
    139             setPrimitiveUnitsBaseValue(propertyValue);
     106            m_primitiveUnits.setValue(propertyValue);
    140107    } else if (name == SVGNames::xAttr)
    141         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     108        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    142109    else if (name == SVGNames::yAttr)
    143         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     110        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    144111    else if (name == SVGNames::widthAttr)
    145         setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     112        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    146113    else if (name == SVGNames::heightAttr)
    147         setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     114        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    148115    else if (name == SVGNames::filterResAttr) {
    149116        float x, y;
    150117        if (parseNumberOptionalNumber(value, x, y)) {
    151             setFilterResXBaseValue(x);
    152             setFilterResYBaseValue(y);
     118            m_filterResX.setValue(x);
     119            m_filterResY.setValue(y);
    153120        }
    154121    }
     
    163130void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName)
    164131{
    165     if (!isSupportedAttribute(attrName)) {
    166         SVGElement::svgAttributeChanged(attrName);
    167         return;
    168     }
    169 
    170     InstanceInvalidationGuard guard(*this);
    171 
    172     if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
     132    if (isAnimatedLengthAttribute(attrName)) {
     133        InstanceInvalidationGuard guard(*this);
    173134        invalidateSVGPresentationAttributeStyle();
    174135        return;
    175136    }
    176137
    177     if (auto* renderer = this->renderer())
    178         renderer->setNeedsLayout();
     138    if (isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) {
     139        if (auto* renderer = this->renderer())
     140            renderer->setNeedsLayout();
     141        return;
     142    }
     143
     144    SVGElement::svgAttributeChanged(attrName);
     145    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    179146}
    180147
  • trunk/Source/WebCore/svg/SVGFilterElement.h

    r229694 r234620  
    44 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
    55 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     6 * Copyright (C) 2018 Apple Inc. All rights reserved.
    67 *
    78 * This library is free software; you can redistribute it and/or
     
    2324#pragma once
    2425
    25 #include "SVGAnimatedBoolean.h"
    2626#include "SVGAnimatedEnumeration.h"
    2727#include "SVGAnimatedInteger.h"
     
    3434namespace WebCore {
    3535
    36 class SVGFilterElement final : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired {
     36class SVGFilterElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference {
    3737    WTF_MAKE_ISO_ALLOCATED(SVGFilterElement);
    3838public:
     
    4141    void setFilterRes(unsigned filterResX, unsigned filterResY);
    4242
     43    SVGUnitTypes::SVGUnitType filterUnits() const { return m_filterUnits.currentValue(attributeOwnerProxy()); }
     44    SVGUnitTypes::SVGUnitType primitiveUnits() const { return m_primitiveUnits.currentValue(attributeOwnerProxy()); }
     45    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     46    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     47    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
     48    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
     49    int filterResX() const { return m_filterResX.currentValue(attributeOwnerProxy()); }
     50    int filterResY() const { return m_filterResY.currentValue(attributeOwnerProxy()); }
     51
     52    RefPtr<SVGAnimatedEnumeration> filterUnitsAnimated() { return m_filterUnits.animatedProperty(attributeOwnerProxy()); }
     53    RefPtr<SVGAnimatedEnumeration> primitiveUnitsAnimated() { return m_primitiveUnits.animatedProperty(attributeOwnerProxy()); }
     54    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     55    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     56    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
     57    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
     58    RefPtr<SVGAnimatedInteger> filterResXAnimated() { return m_filterResX.animatedProperty(attributeOwnerProxy()); }
     59    RefPtr<SVGAnimatedInteger> filterResYAnimated() { return m_filterResY.animatedProperty(attributeOwnerProxy()); }
     60
    4361private:
    4462    SVGFilterElement(const QualifiedName&, Document&);
    4563
    46     bool needsPendingResourceHandling() const final { return false; }
     64    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFilterElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>;
     65    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     66    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     67    static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); }
     68    static void registerAttributes();
    4769
    48     static bool isSupportedAttribute(const QualifiedName&);
     70    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4971    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    5072    void svgAttributeChanged(const QualifiedName&) final;
    5173    void childrenChanged(const ChildChange&) final;
     74
     75    bool needsPendingResourceHandling() const final { return false; }
    5276
    5377    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
     
    5983    static const AtomicString& filterResYIdentifier();
    6084
    61     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFilterElement)
    62         DECLARE_ANIMATED_ENUMERATION(FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType)
    63         DECLARE_ANIMATED_ENUMERATION(PrimitiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType)
    64         DECLARE_ANIMATED_LENGTH(X, x)
    65         DECLARE_ANIMATED_LENGTH(Y, y)
    66         DECLARE_ANIMATED_LENGTH(Width, width)
    67         DECLARE_ANIMATED_LENGTH(Height, height)
    68         DECLARE_ANIMATED_INTEGER(FilterResX, filterResX)
    69         DECLARE_ANIMATED_INTEGER(FilterResY, filterResY)
    70         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    71         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    72     END_DECLARE_ANIMATED_PROPERTIES
     85    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     86    SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_filterUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX };
     87    SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_primitiveUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE };
     88    SVGAnimatedLengthAttribute m_x { LengthModeWidth, "-10%" };
     89    SVGAnimatedLengthAttribute m_y { LengthModeHeight, "-10%" };
     90    SVGAnimatedLengthAttribute m_width { LengthModeWidth, "120%" };
     91    SVGAnimatedLengthAttribute m_height { LengthModeHeight, "120%" };
     92    SVGAnimatedIntegerAttribute m_filterResX;
     93    SVGAnimatedIntegerAttribute m_filterResY;
    7394};
    7495
  • trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp

    r229694 r234620  
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    2526#include "FilterEffect.h"
    2627#include "RenderSVGResourceFilterPrimitive.h"
    27 #include "SVGElement.h"
    2828#include "SVGFilterBuilder.h"
    29 #include "SVGLengthValue.h"
    30 #include "SVGNames.h"
    31 #include "SVGUnitTypes.h"
    3229#include <wtf/IsoMallocInlines.h>
    3330#include <wtf/NeverDestroyed.h>
     
    3734WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFilterPrimitiveStandardAttributes);
    3835
    39 // Animated property definitions
    40 DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::xAttr, X, x)
    41 DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::yAttr, Y, y)
    42 DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::widthAttr, Width, width)
    43 DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::heightAttr, Height, height)
    44 DEFINE_ANIMATED_STRING(SVGFilterPrimitiveStandardAttributes, SVGNames::resultAttr, Result, result)
    45 
    46 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    47     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(result)
    52     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    53 END_REGISTER_ANIMATED_PROPERTIES
    54 
    5536SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document)
    5637    : SVGElement(tagName, document)
    57     , m_x(LengthModeWidth, "0%")
    58     , m_y(LengthModeHeight, "0%")
    59     , m_width(LengthModeWidth, "100%")
    60     , m_height(LengthModeHeight, "100%")
    6138{
    62     // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified.
    63     // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified.
    64     registerAnimatedPropertiesForSVGFilterPrimitiveStandardAttributes();
     39    registerAttributes();
    6540}
    6641
    67 bool SVGFilterPrimitiveStandardAttributes::isSupportedAttribute(const QualifiedName& attrName)
     42void SVGFilterPrimitiveStandardAttributes::registerAttributes()
    6843{
    69     static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> {
    70         SVGNames::xAttr.get(),
    71         SVGNames::yAttr.get(),
    72         SVGNames::widthAttr.get(),
    73         SVGNames::heightAttr.get(),
    74         SVGNames::resultAttr.get(),
    75     });
    76     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     44    auto& registry = attributeRegistry();
     45    if (!registry.isEmpty())
     46        return;
     47    registry.registerAttribute<SVGNames::xAttr, &SVGFilterPrimitiveStandardAttributes::m_x>();
     48    registry.registerAttribute<SVGNames::yAttr, &SVGFilterPrimitiveStandardAttributes::m_y>();
     49    registry.registerAttribute<SVGNames::widthAttr, &SVGFilterPrimitiveStandardAttributes::m_width>();
     50    registry.registerAttribute<SVGNames::heightAttr, &SVGFilterPrimitiveStandardAttributes::m_height>();
     51    registry.registerAttribute<SVGNames::resultAttr, &SVGFilterPrimitiveStandardAttributes::m_result>();
    7752}
    7853
     
    8257
    8358    if (name == SVGNames::xAttr)
    84         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     59        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    8560    else if (name == SVGNames::yAttr)
    86         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     61        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    8762    else if (name == SVGNames::widthAttr)
    88         setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     63        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    8964    else if (name == SVGNames::heightAttr)
    90         setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     65        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    9166    else if (name == SVGNames::resultAttr)
    92         setResultBaseValue(value);
     67        m_result.setValue(value);
    9368
    9469    reportAttributeParsingError(parseError, name, value);
     
    10681void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedName& attrName)
    10782{
    108     if (!isSupportedAttribute(attrName)) {
    109         SVGElement::svgAttributeChanged(attrName);
     83    if (isKnownAttribute(attrName)) {
     84        InstanceInvalidationGuard guard(*this);
     85        invalidate();
    11086        return;
    11187    }
    11288
    113     InstanceInvalidationGuard guard(*this);
    114     invalidate();
     89    SVGElement::svgAttributeChanged(attrName);
    11590}
    11691
  • trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2627#include "SVGAnimatedString.h"
    2728#include "SVGElement.h"
     29#include "SVGNames.h"
    2830#include <wtf/RefPtr.h>
    2931
     
    4345    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
    4446
     47    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFilterPrimitiveStandardAttributes, SVGElement>;
     48    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     49
     50    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     51    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     52    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
     53    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
     54    const String& result() const { return m_result.currentValue(attributeOwnerProxy()); }
     55
     56    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     57    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     58    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
     59    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
     60    RefPtr<SVGAnimatedString> resultAnimated() { return m_result.animatedProperty(attributeOwnerProxy()); }
     61
    4562protected:
    4663    SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document&);
     
    5471
    5572private:
     73    static void registerAttributes();
     74    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     75
    5676    bool isFilterEffect() const override { return true; }
    5777
     
    6080    bool childShouldCreateRenderer(const Node&) const override { return false; }
    6181
    62     static bool isSupportedAttribute(const QualifiedName&);
     82    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
    6383
    64     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)
    65         DECLARE_ANIMATED_LENGTH(X, x)
    66         DECLARE_ANIMATED_LENGTH(Y, y)
    67         DECLARE_ANIMATED_LENGTH(Width, width)
    68         DECLARE_ANIMATED_LENGTH(Height, height)
    69         DECLARE_ANIMATED_STRING(Result, result)
    70     END_DECLARE_ANIMATED_PROPERTIES
     84    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     85
     86    // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified.
     87    // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified.
     88    SVGAnimatedLengthAttribute m_x { LengthModeWidth, "0%" };
     89    SVGAnimatedLengthAttribute m_y { LengthModeHeight, "0%" };
     90    SVGAnimatedLengthAttribute m_width { LengthModeWidth, "100%" };
     91    SVGAnimatedLengthAttribute m_height { LengthModeHeight, "100%" };
     92    SVGAnimatedStringAttribute m_result;
    7193};
    7294
  • trunk/Source/WebCore/svg/SVGFitToViewBox.cpp

    r208581 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2627#include "FloatRect.h"
    2728#include "SVGDocumentExtensions.h"
     29#include "SVGElement.h"
    2830#include "SVGNames.h"
    2931#include "SVGParserUtilities.h"
     
    3335namespace WebCore {
    3436
    35 bool SVGFitToViewBox::parseViewBox(Document* doc, const String& s, FloatRect& viewBox)
     37SVGFitToViewBox::SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState animatedState)
     38    : m_attributeOwnerProxy(*this, *contextElement, animatedState)
    3639{
    37     auto upconvertedCharacters = StringView(s).upconvertedCharacters();
    38     const UChar* characters = upconvertedCharacters;
    39     return parseViewBox(doc, characters, characters + s.length(), viewBox, true);
     40    registerAttributes();
    4041}
    4142
    42 bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate)
     43void SVGFitToViewBox::registerAttributes()
     44{
     45    auto& registry = attributeRegistry();
     46    if (!registry.isEmpty())
     47        return;
     48    registry.registerAttribute<SVGNames::viewBoxAttr, &SVGFitToViewBox::m_viewBox>();
     49    registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGFitToViewBox::m_preserveAspectRatio>();
     50}
     51
     52void SVGFitToViewBox::setViewBox(const FloatRect& viewBox)
     53{
     54    m_viewBox.setValue(viewBox);
     55    m_isViewBoxValid = true;
     56}
     57
     58void SVGFitToViewBox::resetViewBox()
     59{
     60    m_viewBox.resetValue();
     61    m_isViewBoxValid = false;
     62}
     63
     64void SVGFitToViewBox::reset()
     65{
     66    resetViewBox();
     67    resetPreserveAspectRatio();
     68}
     69
     70bool SVGFitToViewBox::parseAttribute(const QualifiedName& name, const AtomicString& value)
     71{
     72    if (name == SVGNames::viewBoxAttr) {
     73        FloatRect viewBox;
     74        if (!value.isNull() && parseViewBox(value, viewBox))
     75            setViewBox(viewBox);
     76        else
     77            resetViewBox();
     78        return true;
     79    }
     80
     81    if (name == SVGNames::preserveAspectRatioAttr) {
     82        SVGPreserveAspectRatioValue preserveAspectRatio;
     83        preserveAspectRatio.parse(value);
     84        setPreserveAspectRatio(preserveAspectRatio);
     85        return true;
     86    }
     87
     88    return false;
     89}
     90
     91bool SVGFitToViewBox::parseViewBox(const AtomicString& value, FloatRect& viewBox)
     92{
     93    auto upconvertedCharacters = StringView(value).upconvertedCharacters();
     94    const UChar* characters = upconvertedCharacters;
     95    return parseViewBox(characters, characters + value.length(), viewBox);
     96}
     97
     98bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate)
    4399{
    44100    String str(c, end - c);
     
    51107    float height = 0.0f;
    52108    bool valid = parseNumber(c, end, x) && parseNumber(c, end, y) && parseNumber(c, end, width) && parseNumber(c, end, height, false);
    53     if (!validate) {
    54         viewBox = FloatRect(x, y, width, height);
    55         return true;
    56     }
    57     if (!valid) {
    58         doc->accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\"");
    59         return false;
     109
     110    if (validate) {
     111        Document& document = m_attributeOwnerProxy.element().document();
     112
     113        if (!valid) {
     114            document.accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\"");
     115            return false;
     116        }
     117
     118        // Check that width is positive.
     119        if (width < 0.0) {
     120            document.accessSVGExtensions().reportError("A negative value for ViewBox width is not allowed");
     121            return false;
     122        }
     123
     124        // Check that height is positive.
     125        if (height < 0.0) {
     126            document.accessSVGExtensions().reportError("A negative value for ViewBox height is not allowed");
     127            return false;
     128        }
     129
     130        // Nothing should come after the last, fourth number.
     131        skipOptionalSVGSpaces(c, end);
     132        if (c < end) {
     133            document.accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\"");
     134            return false;
     135        }
    60136    }
    61137
    62     if (width < 0.0) { // check that width is positive
    63         doc->accessSVGExtensions().reportError("A negative value for ViewBox width is not allowed");
    64         return false;
    65     }
    66     if (height < 0.0) { // check that height is positive
    67         doc->accessSVGExtensions().reportError("A negative value for ViewBox height is not allowed");
    68         return false;
    69     }
    70     skipOptionalSVGSpaces(c, end);
    71     if (c < end) { // nothing should come after the last, fourth number
    72         doc->accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\"");
    73         return false;
    74     }
    75 
    76     viewBox = FloatRect(x, y, width, height);
     138    viewBox = { x, y, width, height };
    77139    return true;
    78140}
     
    86148}
    87149
    88 bool SVGFitToViewBox::isKnownAttribute(const QualifiedName& attrName)
    89 {
    90     return attrName == SVGNames::viewBoxAttr || attrName == SVGNames::preserveAspectRatioAttr;
    91150}
    92 
    93 void SVGFitToViewBox::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes)
    94 {
    95     supportedAttributes.add(SVGNames::viewBoxAttr);
    96     supportedAttributes.add(SVGNames::preserveAspectRatioAttr);
    97 }
    98 
    99 }
  • trunk/Source/WebCore/svg/SVGFitToViewBox.h

    r208668 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2324#include "FloatRect.h"
    2425#include "QualifiedName.h"
     26#include "SVGAttributeRegistry.h"
    2527#include "SVGNames.h"
    2628#include "SVGPreserveAspectRatio.h"
     
    3032
    3133class AffineTransform;
    32 class Document;
    3334
    3435class SVGFitToViewBox {
     36    WTF_MAKE_NONCOPYABLE(SVGFitToViewBox);
    3537public:
    3638    static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatioValue&, float viewWidth, float viewHeight);
    3739
    38     static bool isKnownAttribute(const QualifiedName&);
    39     static void addSupportedAttributes(HashSet<QualifiedName>&);
     40    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFitToViewBox>;
     41    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
    4042
    41     template<class SVGElementTarget>
    42     static bool parseAttribute(SVGElementTarget* target, const QualifiedName& name, const AtomicString& value)
    43     {
    44         ASSERT(target);
    45         if (name == SVGNames::viewBoxAttr) {
    46             FloatRect viewBox;
    47             bool valueIsValid = !value.isNull() && parseViewBox(&target->document(), value, viewBox);
    48             target->setViewBoxBaseValue(viewBox, valueIsValid);
    49             return true;
    50         }
     43    const FloatRect& viewBox() const { return m_viewBox.currentValue(m_attributeOwnerProxy); }
     44    const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(m_attributeOwnerProxy); }
    5145
    52         if (name == SVGNames::preserveAspectRatioAttr) {
    53             SVGPreserveAspectRatioValue preserveAspectRatio;
    54             preserveAspectRatio.parse(value);
    55             target->setPreserveAspectRatioBaseValue(preserveAspectRatio);
    56             return true;
    57         }
     46    RefPtr<SVGAnimatedRect> viewBoxAnimated() { return m_viewBox.animatedProperty(m_attributeOwnerProxy); }
     47    RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(m_attributeOwnerProxy); }
    5848
    59         return false;
    60     }
     49    void setViewBox(const FloatRect&);
     50    void resetViewBox();
    6151
    62     static bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true);
     52    void setPreserveAspectRatio(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio.setValue(preserveAspectRatio); }
     53    void resetPreserveAspectRatio() { m_preserveAspectRatio.resetValue(); }
     54
     55    String viewBoxString() const { return m_viewBox.toString(); }
     56    String preserveAspectRatioString() const { return m_preserveAspectRatio.toString(); }
     57
     58    bool hasValidViewBox() const { return m_isViewBoxValid; }
     59    bool hasEmptyViewBox() const { return m_isViewBoxValid && viewBox().isEmpty(); }
     60
     61protected:
     62    SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState = PropertyIsReadWrite);
     63
     64    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     65
     66    void reset();
     67    bool parseAttribute(const QualifiedName&, const AtomicString&);
     68    bool parseViewBox(const AtomicString& value, FloatRect& viewBox);
     69    bool parseViewBox(const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true);
    6370
    6471private:
    65     static bool parseViewBox(Document*, const String&, FloatRect&);
     72    static void registerAttributes();
     73
     74    AttributeOwnerProxy m_attributeOwnerProxy;
     75    SVGAnimatedRectAttribute m_viewBox;
     76    SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio;
     77    bool m_isViewBoxValid { false };
    6678};
    6779
  • trunk/Source/WebCore/svg/SVGFontElement.cpp

    r229694 r234620  
    33 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
    44 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    4041WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFontElement);
    4142
    42 // Animated property definitions
    43 DEFINE_ANIMATED_BOOLEAN(SVGFontElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    44 
    45 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFontElement)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    47     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    48 END_REGISTER_ANIMATED_PROPERTIES
    49 
    5043inline SVGFontElement::SVGFontElement(const QualifiedName& tagName, Document& document)
    5144    : SVGElement(tagName, document)
     45    , SVGExternalResourcesRequired(this)
    5246{
    5347    ASSERT(hasTagName(SVGNames::fontTag));
    54     registerAnimatedPropertiesForSVGFontElement();
    5548}
    5649
  • trunk/Source/WebCore/svg/SVGFontElement.h

    r229694 r234620  
    33 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
    44 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    5354    bool rendererIsNeeded(const RenderStyle&) final { return false; }
    5455
    55     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFontElement)
    56         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    57     END_DECLARE_ANIMATED_PROPERTIES
     56    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFontElement, SVGElement, SVGExternalResourcesRequired>;
     57    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     58
     59    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    5860};
    5961
  • trunk/Source/WebCore/svg/SVGForeignObjectElement.cpp

    r229694 r234620  
    11/*
    2  * Copyright (C) 2006 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
    44 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
     
    3737WTF_MAKE_ISO_ALLOCATED_IMPL(SVGForeignObjectElement);
    3838
    39 // Animated property definitions
    40 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x)
    41 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::yAttr, Y, y)
    42 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::widthAttr, Width, width)
    43 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::heightAttr, Height, height)
    44 DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href)
    45 DEFINE_ANIMATED_BOOLEAN(SVGForeignObjectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    46 
    47 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
    52     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    53     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    54     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    55 END_REGISTER_ANIMATED_PROPERTIES
    56 
    5739inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document& document)
    5840    : SVGGraphicsElement(tagName, document)
    59     , m_x(LengthModeWidth)
    60     , m_y(LengthModeHeight)
    61     , m_width(LengthModeWidth)
    62     , m_height(LengthModeHeight)
     41    , SVGExternalResourcesRequired(this)
    6342{
    6443    ASSERT(hasTagName(SVGNames::foreignObjectTag));
    65     registerAnimatedPropertiesForSVGForeignObjectElement();
     44    registerAttributes();
    6645}
    6746
     
    7150}
    7251
    73 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName)
     52void SVGForeignObjectElement::registerAttributes()
    7453{
    75     static const auto supportedAttributes = makeNeverDestroyed([] {
    76         HashSet<QualifiedName> set;
    77         SVGLangSpace::addSupportedAttributes(set);
    78         SVGExternalResourcesRequired::addSupportedAttributes(set);
    79         set.add({ SVGNames::xAttr.get(), SVGNames::yAttr.get(), SVGNames::widthAttr.get(), SVGNames::heightAttr.get() });
    80         return set;
    81     }());
    82     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     54    auto& registry = attributeRegistry();
     55    if (!registry.isEmpty())
     56        return;
     57    registry.registerAttribute<SVGNames::xAttr, &SVGForeignObjectElement::m_x>();
     58    registry.registerAttribute<SVGNames::yAttr, &SVGForeignObjectElement::m_y>();
     59    registry.registerAttribute<SVGNames::widthAttr, &SVGForeignObjectElement::m_width>();
     60    registry.registerAttribute<SVGNames::heightAttr, &SVGForeignObjectElement::m_height>();
    8361}
    8462
     
    8866
    8967    if (name == SVGNames::xAttr)
    90         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     68        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    9169    else if (name == SVGNames::yAttr)
    92         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     70        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    9371    else if (name == SVGNames::widthAttr)
    94         setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     72        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    9573    else if (name == SVGNames::heightAttr)
    96         setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     74        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    9775
    9876    reportAttributeParsingError(parseError, name, value);
     
    10482void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
    10583{
    106     if (!isSupportedAttribute(attrName)) {
    107         SVGGraphicsElement::svgAttributeChanged(attrName);
    108         return;
    109     }
    110 
    111     InstanceInvalidationGuard guard(*this);
    112 
    113     if (attrName == SVGNames::widthAttr
    114         || attrName == SVGNames::heightAttr) {
     84    if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
    11585        invalidateSVGPresentationAttributeStyle();
    11686        return;
    11787    }
    11888
    119     if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
     89    if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) {
    12090        updateRelativeLengthsInformation();
     91        if (auto renderer = this->renderer())
     92            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     93        return;
     94    }
    12195
    122     if (auto renderer = this->renderer())
    123         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     96    SVGGraphicsElement::svgAttributeChanged(attrName);
     97    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    12498}
    12599
  • trunk/Source/WebCore/svg/SVGForeignObjectElement.h

    r229694 r234620  
    11/*
    2  * Copyright (C) 2006 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    3434    static Ref<SVGForeignObjectElement> create(const QualifiedName&, Document&);
    3535
     36    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     37    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     38    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
     39    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
     40
     41    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     42    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     43    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
     44    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
     45
    3646private:
    3747    SVGForeignObjectElement(const QualifiedName&, Document&);
    3848
    39     bool isValid() const final { return SVGTests::isValid(); }
    40     static bool isSupportedAttribute(const QualifiedName&);
     49    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGForeignObjectElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
     50    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     51    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     52    static void registerAttributes();
     53
     54    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4155    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    4256    void svgAttributeChanged(const QualifiedName&) final;
     
    4660    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    4761
     62    bool isValid() const final { return SVGTests::isValid(); }
    4863    bool selfHasRelativeLengths() const final { return true; }
    4964
    50     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGForeignObjectElement)
    51         DECLARE_ANIMATED_LENGTH(X, x)
    52         DECLARE_ANIMATED_LENGTH(Y, y)
    53         DECLARE_ANIMATED_LENGTH(Width, width)
    54         DECLARE_ANIMATED_LENGTH(Height, height)
    55         DECLARE_ANIMATED_STRING(Href, href)
    56         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    57     END_DECLARE_ANIMATED_PROPERTIES
     65    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     66    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
     67    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
     68    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
     69    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
    5870};
    5971
  • trunk/Source/WebCore/svg/SVGGElement.cpp

    r232178 r234620  
    22 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3334WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGElement);
    3435
    35 // Animated property definitions
    36 DEFINE_ANIMATED_BOOLEAN(SVGGElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    37 
    38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGElement)
    39     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    40     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    41 END_REGISTER_ANIMATED_PROPERTIES
    42 
    4336SVGGElement::SVGGElement(const QualifiedName& tagName, Document& document)
    4437    : SVGGraphicsElement(tagName, document)
     38    , SVGExternalResourcesRequired(this)
    4539{
    4640    ASSERT(hasTagName(SVGNames::gTag));
    47     registerAnimatedPropertiesForSVGGElement();
    4841}
    4942
     
    5851}
    5952
    60 bool SVGGElement::isSupportedAttribute(const QualifiedName& attrName)
    61 {
    62     static const auto supportedAttributes = makeNeverDestroyed([] {
    63         HashSet<QualifiedName> set;
    64         SVGLangSpace::addSupportedAttributes(set);
    65         SVGExternalResourcesRequired::addSupportedAttributes(set);
    66         return set;
    67     }());
    68     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
    69 }
    70 
    7153void SVGGElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    7254{
     
    7759void SVGGElement::svgAttributeChanged(const QualifiedName& attrName)
    7860{
    79     if (!isSupportedAttribute(attrName)) {
    80         SVGGraphicsElement::svgAttributeChanged(attrName);
    81         return;
    82     }
    83 
    84     InstanceInvalidationGuard guard(*this);
    85 
    86     if (auto renderer = this->renderer())
    87         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     61    SVGGraphicsElement::svgAttributeChanged(attrName);
     62    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    8863}
    8964
  • trunk/Source/WebCore/svg/SVGGElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3839    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    3940
    40     bool isValid() const final { return SVGTests::isValid(); }
     41    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
    4142
    42     static bool isSupportedAttribute(const QualifiedName&);
     43    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4344    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    4445    void svgAttributeChanged(const QualifiedName&) final;
    4546
     47    bool isValid() const final { return SVGTests::isValid(); }
    4648    bool rendererIsNeeded(const RenderStyle&) final;
    4749
    48     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGElement)
    49         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    50     END_DECLARE_ANIMATED_PROPERTIES
     50    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    5151};
    5252
  • trunk/Source/WebCore/svg/SVGGeometryElement.cpp

    r231955 r234620  
    2525
    2626#include "DOMPoint.h"
    27 #include "RenderSVGPath.h"
    28 #include "RenderSVGResource.h"
    2927#include "SVGDocumentExtensions.h"
    30 #include "SVGMPathElement.h"
    31 #include "SVGNames.h"
    3228#include "SVGPathUtilities.h"
    3329#include "SVGPoint.h"
    3430#include <wtf/IsoMallocInlines.h>
    35 #include <wtf/NeverDestroyed.h>
    3631
    3732namespace WebCore {
     
    3934WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGeometryElement);
    4035
    41 // Animated property definitions
    42 DEFINE_ANIMATED_NUMBER(SVGGeometryElement, SVGNames::pathLengthAttr, PathLength, pathLength)
    43 
    44 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGeometryElement)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength)
    46     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    47 END_REGISTER_ANIMATED_PROPERTIES
    48 
    4936SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& document)
    5037    : SVGGraphicsElement(tagName, document)
    5138{
    52     registerAnimatedPropertiesForSVGGeometryElement();
     39    registerAttributes();
    5340}
    5441
     
    10188}
    10289
    103 bool SVGGeometryElement::isSupportedAttribute(const QualifiedName& attrName)
     90void SVGGeometryElement::registerAttributes()
    10491{
    105     static const auto supportedAttributes = makeNeverDestroyed([] {
    106         HashSet<QualifiedName> set;
    107         SVGLangSpace::addSupportedAttributes(set);
    108         SVGExternalResourcesRequired::addSupportedAttributes(set);
    109         set.add({ SVGNames::pathLengthAttr.get() });
    110         return set;
    111     }());
    112     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     92    auto& registry = attributeRegistry();
     93    if (!registry.isEmpty())
     94        return;
     95    registry.registerAttribute<SVGNames::pathLengthAttr, &SVGGeometryElement::m_pathLength>();
    11396}
    11497
     
    11699{
    117100    if (name == SVGNames::pathLengthAttr) {
    118         setPathLengthBaseValue(value.toFloat());
    119         if (pathLengthBaseValue() < 0)
     101        m_pathLength.setValue(value.toFloat());
     102        if (m_pathLength.value() < 0)
    120103            document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed");
    121104        return;
     
    127110void SVGGeometryElement::svgAttributeChanged(const QualifiedName& attrName)
    128111{
    129     if (!isSupportedAttribute(attrName)) {
    130         SVGGraphicsElement::svgAttributeChanged(attrName);
     112    if (attrName == SVGNames::pathLengthAttr) {
     113        InstanceInvalidationGuard guard(*this);
     114        if (auto* renderer = this->renderer())
     115            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    131116        return;
    132117    }
    133118
    134     InstanceInvalidationGuard guard(*this);
    135 
    136     ASSERT_NOT_REACHED();
     119    SVGGraphicsElement::svgAttributeChanged(attrName);
    137120}
    138121
  • trunk/Source/WebCore/svg/SVGGeometryElement.h

    r231955 r234620  
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2018 Adobe Systems Incorporated. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    2324
    2425#include "Path.h"
    25 #include "SVGAnimatedBoolean.h"
    2626#include "SVGAnimatedNumber.h"
    27 #include "SVGExternalResourcesRequired.h"
    2827#include "SVGGraphicsElement.h"
    2928#include "SVGNames.h"
     
    4443    bool isPointInStroke(DOMPointInit&&);
    4544
     45    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGeometryElement, SVGGraphicsElement>;
     46    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     47
     48    auto pathLengthAnimated() { return m_pathLength.animatedProperty(attributeOwnerProxy()); }
     49
    4650protected:
    4751    SVGGeometryElement(const QualifiedName&, Document&);
    4852
    49     static bool isSupportedAttribute(const QualifiedName&);
    5053    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    5154    void svgAttributeChanged(const QualifiedName&) override;
    5255
    53     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGeometryElement)
    54         DECLARE_ANIMATED_NUMBER(PathLength, pathLength)
    55     END_DECLARE_ANIMATED_PROPERTIES
     56private:
     57    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
     58
     59    static void registerAttributes();
     60    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     61
     62    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     63    SVGAnimatedNumberAttribute m_pathLength;
    5664};
    5765
  • trunk/Source/WebCore/svg/SVGGlyphRefElement.cpp

    r229694 r234620  
    11/*
    22 * Copyright (C) 2011 Leo Yang <leoyang@webkit.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3435WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGlyphRefElement);
    3536
    36 // Animated property definitions
    37 DEFINE_ANIMATED_STRING(SVGGlyphRefElement, XLinkNames::hrefAttr, Href, href)
    38 
    39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGlyphRefElement)
    40     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    41     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    42 END_REGISTER_ANIMATED_PROPERTIES
    43 
    4437inline SVGGlyphRefElement::SVGGlyphRefElement(const QualifiedName& tagName, Document& document)
    4538    : SVGElement(tagName, document)
     39    , SVGURIReference(this)
    4640{
    4741    ASSERT(hasTagName(SVGNames::glyphRefTag));
    48     registerAnimatedPropertiesForSVGGlyphRefElement();
    4942}
    5043
  • trunk/Source/WebCore/svg/SVGGlyphRefElement.h

    r229694 r234620  
    11/*
    22 * Copyright (C) 2011 Leo Yang <leoyang@webkit.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    4647    SVGGlyphRefElement(const QualifiedName&, Document&);
    4748
     49    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGlyphRefElement, SVGElement, SVGURIReference>;
     50    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4851    void parseAttribute(const QualifiedName&, const AtomicString&) final;
     52
    4953    bool rendererIsNeeded(const RenderStyle&) final { return false; }
    50 
    51     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGlyphRefElement)
    52         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    53     END_DECLARE_ANIMATED_PROPERTIES
    5454
    5555    float m_x { 0 };
     
    5757    float m_dx { 0 };
    5858    float m_dy { 0 };
     59    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    5960};
    6061
  • trunk/Source/WebCore/svg/SVGGradientElement.cpp

    r230829 r234620  
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
    44 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    4041WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGradientElement);
    4142
    42 // Animated property definitions
    43 DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::spreadMethodAttr, SpreadMethod, spreadMethod, SVGSpreadMethodType)
    44 DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::gradientUnitsAttr, GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType)
    45 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAttr, GradientTransform, gradientTransform)
    46 DEFINE_ANIMATED_STRING(SVGGradientElement, XLinkNames::hrefAttr, Href, href)
    47 DEFINE_ANIMATED_BOOLEAN(SVGGradientElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    48 
    49 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGradientElement)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(spreadMethod)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(gradientUnits)
    52     REGISTER_LOCAL_ANIMATED_PROPERTY(gradientTransform)
    53     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    54     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    55     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    56 END_REGISTER_ANIMATED_PROPERTIES
    57  
    5843SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document& document)
    5944    : SVGElement(tagName, document)
    60     , m_spreadMethod(SVGSpreadMethodPad)
    61     , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
     45    , SVGExternalResourcesRequired(this)
     46    , SVGURIReference(this)
    6247{
    63     registerAnimatedPropertiesForSVGGradientElement();
     48    registerAttributes();
    6449}
    6550
    66 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName)
     51void SVGGradientElement::registerAttributes()
    6752{
    68     static const auto supportedAttributes = makeNeverDestroyed([] {
    69         HashSet<QualifiedName> set;
    70         SVGURIReference::addSupportedAttributes(set);
    71         SVGExternalResourcesRequired::addSupportedAttributes(set);
    72         set.add({ SVGNames::gradientUnitsAttr.get(), SVGNames::gradientTransformAttr.get(), SVGNames::spreadMethodAttr.get() });
    73         return set;
    74     }());
    75     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     53    auto& registry = attributeRegistry();
     54    if (!registry.isEmpty())
     55        return;
     56    registry.registerAttribute<SVGNames::spreadMethodAttr, SVGSpreadMethodType, &SVGGradientElement::m_spreadMethod>();
     57    registry.registerAttribute<SVGNames::gradientUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGGradientElement::m_gradientUnits>();
     58    registry.registerAttribute<SVGNames::gradientTransformAttr, &SVGGradientElement::m_gradientTransform>();
    7659}
    7760
     
    8164        auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
    8265        if (propertyValue > 0)
    83             setGradientUnitsBaseValue(propertyValue);
     66            m_gradientUnits.setValue(propertyValue);
    8467        return;
    8568    }
     
    8871        SVGTransformListValues newList;
    8972        newList.parse(value);
    90         detachAnimatedGradientTransformListWrappers(newList.size());
    91         setGradientTransformBaseValue(newList);
     73        m_gradientTransform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     74        m_gradientTransform.setValue(WTFMove(newList));
    9275        return;
    9376    }
     
    9679        auto propertyValue = SVGPropertyTraits<SVGSpreadMethodType>::fromString(value);
    9780        if (propertyValue > 0)
    98             setSpreadMethodBaseValue(propertyValue);
     81            m_spreadMethod.setValue(propertyValue);
    9982        return;
    10083    }
     
    10790void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName)
    10891{
    109     if (!isSupportedAttribute(attrName)) {
    110         SVGElement::svgAttributeChanged(attrName);
     92    if (isKnownAttribute(attrName)) {
     93        InstanceInvalidationGuard guard(*this);
     94        if (RenderObject* object = renderer())
     95            object->setNeedsLayout();
    11196        return;
    11297    }
    11398
    114     InstanceInvalidationGuard guard(*this);
    115    
    116     if (RenderObject* object = renderer())
    117         object->setNeedsLayout();
     99    SVGElement::svgAttributeChanged(attrName);
    118100}
    119101   
  • trunk/Source/WebCore/svg/SVGGradientElement.h

    r233122 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    7374};
    7475
    75 class SVGGradientElement : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired {
     76class SVGGradientElement : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference {
    7677    WTF_MAKE_ISO_ALLOCATED(SVGGradientElement);
    7778public:
     
    8485
    8586    Vector<Gradient::ColorStop> buildStops();
    86  
     87
     88    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGradientElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>;
     89    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     90
     91    SVGSpreadMethodType spreadMethod() const { return m_spreadMethod.currentValue(attributeOwnerProxy()); }
     92    SVGUnitTypes::SVGUnitType gradientUnits() const { return m_gradientUnits.currentValue(attributeOwnerProxy()); }
     93    const SVGTransformListValues& gradientTransform() const { return m_gradientTransform.currentValue(attributeOwnerProxy()); }
     94
     95    RefPtr<SVGAnimatedEnumeration> spreadMethodAnimated() { return m_spreadMethod.animatedProperty(attributeOwnerProxy()); }
     96    RefPtr<SVGAnimatedEnumeration> gradientUnitsAnimated() { return m_gradientUnits.animatedProperty(attributeOwnerProxy()); }
     97    RefPtr<SVGAnimatedTransformList> gradientTransformAnimated() { return m_gradientTransform.animatedProperty(attributeOwnerProxy()); }
     98
    8799protected:
    88100    SVGGradientElement(const QualifiedName&, Document&);
    89101
    90     static bool isSupportedAttribute(const QualifiedName&);
     102    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
    91103    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    92104    void svgAttributeChanged(const QualifiedName&) override;
     
    94106private:
    95107    bool needsPendingResourceHandling() const override { return false; }
    96 
    97108    void childrenChanged(const ChildChange&) override;
    98109
    99     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGradientElement)
    100         DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod, SVGSpreadMethodType)
    101         DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType)
    102         DECLARE_ANIMATED_TRANSFORM_LIST(GradientTransform, gradientTransform)
    103         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    104         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    105     END_DECLARE_ANIMATED_PROPERTIES
     110    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
     111    static void registerAttributes();
     112
     113    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     114    SVGAnimatedEnumerationAttribute<SVGSpreadMethodType> m_spreadMethod { SVGSpreadMethodPad };
     115    SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_gradientUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX };
     116    SVGAnimatedTransformListAttribute m_gradientTransform;
    106117};
    107118
  • trunk/Source/WebCore/svg/SVGGraphicsElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3738WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGraphicsElement);
    3839
    39 // Animated property definitions
    40 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGraphicsElement, SVGNames::transformAttr, Transform, transform)
    41 
    42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGraphicsElement)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(transform)
    44     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    45     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
    46 END_REGISTER_ANIMATED_PROPERTIES
    47 
    4840SVGGraphicsElement::SVGGraphicsElement(const QualifiedName& tagName, Document& document)
    4941    : SVGElement(tagName, document)
     42    , SVGTests(this)
    5043    , m_shouldIsolateBlending(false)
    5144{
    52     registerAnimatedPropertiesForSVGGraphicsElement();
     45    registerAttributes();
    5346}
    5447
     
    128121}
    129122
    130 bool SVGGraphicsElement::isSupportedAttribute(const QualifiedName& attrName)
     123void SVGGraphicsElement::registerAttributes()
    131124{
    132     static const auto supportedAttributes = makeNeverDestroyed([] {
    133         HashSet<QualifiedName> set;
    134         SVGTests::addSupportedAttributes(set);
    135         set.add(SVGNames::transformAttr);
    136         return set;
    137     }());
    138     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     125    auto& registry = attributeRegistry();
     126    if (!registry.isEmpty())
     127        return;
     128    registry.registerAttribute<SVGNames::transformAttr, &SVGGraphicsElement::m_transform>();
    139129}
    140130
     
    144134        SVGTransformListValues newList;
    145135        newList.parse(value);
    146         detachAnimatedTransformListWrappers(newList.size());
    147         setTransformBaseValue(newList);
     136        m_transform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     137        m_transform.setValue(newList);
    148138        return;
    149139    }
     
    155145void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName)
    156146{
    157     if (!isSupportedAttribute(attrName)) {
    158         SVGElement::svgAttributeChanged(attrName);
    159         return;
     147    if (isKnownAttribute(attrName)) {
     148        InstanceInvalidationGuard guard(*this);
     149
     150        auto renderer = this->renderer();
     151        if (!renderer)
     152            return;
     153
     154        if (attrName == SVGNames::transformAttr) {
     155            renderer->setNeedsTransformUpdate();
     156            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     157            return;
     158        }
    160159    }
    161160
    162     InstanceInvalidationGuard guard(*this);
    163 
    164     if (SVGTests::handleAttributeChange(this, attrName))
    165         return;
    166 
    167     auto renderer = this->renderer();
    168     if (!renderer)
    169         return;
    170 
    171     if (attrName == SVGNames::transformAttr) {
    172         renderer->setNeedsTransformUpdate();
    173         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    174         return;
    175     }
    176 
    177     ASSERT_NOT_REACHED();
     161    SVGElement::svgAttributeChanged(attrName);
     162    SVGTests::svgAttributeChanged(attrName);
    178163}
    179164
     
    211196}
    212197
    213 Ref<SVGStringList> SVGGraphicsElement::requiredFeatures()
    214 {
    215     return SVGTests::requiredFeatures(*this);
    216198}
    217 
    218 Ref<SVGStringList> SVGGraphicsElement::requiredExtensions()
    219 {
    220     return SVGTests::requiredExtensions(*this);
    221 }
    222 
    223 Ref<SVGStringList> SVGGraphicsElement::systemLanguage()
    224 {
    225     return SVGTests::systemLanguage(*this);
    226 }
    227 
    228 }
  • trunk/Source/WebCore/svg/SVGGraphicsElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    6364    size_t approximateMemoryCost() const override { return sizeof(*this); }
    6465
    65     // SVGTests
    66     Ref<SVGStringList> requiredFeatures();
    67     Ref<SVGStringList> requiredExtensions();
    68     Ref<SVGStringList> systemLanguage();
     66    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGraphicsElement, SVGElement, SVGTests>;
     67    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     68
     69    const auto& transform() const { return m_transform.currentValue(attributeOwnerProxy()); }
     70    auto transformAnimated() { return m_transform.animatedProperty(attributeOwnerProxy()); }
    6971
    7072protected:
     
    7678    void svgAttributeChanged(const QualifiedName&) override;
    7779
    78     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGraphicsElement)
    79         DECLARE_ANIMATED_TRANSFORM_LIST(Transform, transform)
    80     END_DECLARE_ANIMATED_PROPERTIES
    81 
    8280private:
    8381    bool isSVGGraphicsElement() const override { return true; }
    8482
    85     static bool isSupportedAttribute(const QualifiedName&);
     83    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
    8684
    87     // SVGTests
    88     void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); }
    89     void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); }
    90     void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); }
     85    static void registerAttributes();
     86    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
    9187
    9288    // Used by <animateMotion>
     
    9591    // Used to isolate blend operations caused by masking.
    9692    bool m_shouldIsolateBlending;
     93
     94    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     95    SVGAnimatedTransformListAttribute m_transform;
    9796};
    9897
  • trunk/Source/WebCore/svg/SVGImageElement.cpp

    r229694 r234620  
    44 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
    55 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
     6 * Copyright (C) 2018 Apple Inc. All rights reserved.
    67 *
    78 * This library is free software; you can redistribute it and/or
     
    3738WTF_MAKE_ISO_ALLOCATED_IMPL(SVGImageElement);
    3839
    39 // Animated property definitions
    40 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::xAttr, X, x)
    41 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::yAttr, Y, y)
    42 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::widthAttr, Width, width)
    43 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::heightAttr, Height, height)
    44 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGImageElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)
    45 DEFINE_ANIMATED_STRING(SVGImageElement, XLinkNames::hrefAttr, Href, href)
    46 DEFINE_ANIMATED_BOOLEAN(SVGImageElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    47 
    48 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGImageElement)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
    52     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
    53     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
    54     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    55     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    56     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    57 END_REGISTER_ANIMATED_PROPERTIES
    58 
    5940inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& document)
    6041    : SVGGraphicsElement(tagName, document)
    61     , m_x(LengthModeWidth)
    62     , m_y(LengthModeHeight)
    63     , m_width(LengthModeWidth)
    64     , m_height(LengthModeHeight)
     42    , SVGExternalResourcesRequired(this)
     43    , SVGURIReference(this)
    6544    , m_imageLoader(*this)
    6645{
    67     registerAnimatedPropertiesForSVGImageElement();
     46    registerAttributes();
    6847}
    6948
     
    8261}
    8362
    84 bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName)
     63void SVGImageElement::registerAttributes()
    8564{
    86     static const auto supportedAttributes = makeNeverDestroyed([] {
    87         HashSet<QualifiedName> set;
    88         SVGLangSpace::addSupportedAttributes(set);
    89         SVGExternalResourcesRequired::addSupportedAttributes(set);
    90         SVGURIReference::addSupportedAttributes(set);
    91         set.add({ SVGNames::xAttr.get(), SVGNames::yAttr.get(), SVGNames::widthAttr.get(), SVGNames::heightAttr.get(), SVGNames::preserveAspectRatioAttr.get() });
    92         return set;
    93     }());
    94     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     65    auto& registry = attributeRegistry();
     66    if (!registry.isEmpty())
     67        return;
     68    registry.registerAttribute<SVGNames::xAttr, &SVGImageElement::m_x>();
     69    registry.registerAttribute<SVGNames::yAttr, &SVGImageElement::m_y>();
     70    registry.registerAttribute<SVGNames::widthAttr, &SVGImageElement::m_width>();
     71    registry.registerAttribute<SVGNames::heightAttr, &SVGImageElement::m_height>();
     72    registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGImageElement::m_preserveAspectRatio>();
    9573}
    9674
     
    10078        SVGPreserveAspectRatioValue preserveAspectRatio;
    10179        preserveAspectRatio.parse(value);
    102         setPreserveAspectRatioBaseValue(preserveAspectRatio);
     80        m_preserveAspectRatio.setValue(preserveAspectRatio);
    10381        return;
    10482    }
     
    10785
    10886    if (name == SVGNames::xAttr)
    109         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     87        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    11088    else if (name == SVGNames::yAttr)
    111         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     89        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    11290    else if (name == SVGNames::widthAttr)
    113         setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     91        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
    11492    else if (name == SVGNames::heightAttr)
    115         setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
     93        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
    11694
    11795    reportAttributeParsingError(parseError, name, value);
     
    124102void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName)
    125103{
    126     if (!isSupportedAttribute(attrName)) {
    127         SVGGraphicsElement::svgAttributeChanged(attrName);
     104    if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) {
     105        InstanceInvalidationGuard guard(*this);
     106        updateRelativeLengthsInformation();
     107
     108        if (auto* renderer = this->renderer()) {
     109            if (downcast<RenderSVGImage>(*renderer).updateImageViewport())
     110                RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     111        }
    128112        return;
    129113    }
    130114
    131     InstanceInvalidationGuard guard(*this);
    132 
    133     if (attrName == SVGNames::widthAttr
    134         || attrName == SVGNames::heightAttr) {
     115    if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
     116        InstanceInvalidationGuard guard(*this);
    135117        invalidateSVGPresentationAttributeStyle();
    136118        return;
    137119    }
    138120
    139     bool isLengthAttribute = attrName == SVGNames::xAttr
    140                           || attrName == SVGNames::yAttr
    141                           || attrName == SVGNames::widthAttr
    142                           || attrName == SVGNames::heightAttr;
    143 
    144     if (isLengthAttribute)
    145         updateRelativeLengthsInformation();
     121    if (attrName == SVGNames::preserveAspectRatioAttr) {
     122        InstanceInvalidationGuard guard(*this);
     123        if (auto* renderer = this->renderer())
     124            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     125        return;
     126    }
    146127
    147128    if (SVGURIReference::isKnownAttribute(attrName)) {
     
    150131    }
    151132
    152     auto* renderer = this->renderer();
    153     if (!renderer)
    154         return;
    155 
    156     if (isLengthAttribute) {
    157         if (downcast<RenderSVGImage>(*renderer).updateImageViewport())
    158             RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    159         return;
    160     }
    161 
    162     if (attrName == SVGNames::preserveAspectRatioAttr
    163         || SVGLangSpace::isKnownAttribute(attrName)
    164         || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
    165         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    166         return;
    167     }
    168 
    169     ASSERT_NOT_REACHED();
     133    SVGGraphicsElement::svgAttributeChanged(attrName);
     134    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    170135}
    171136
     
    177142bool SVGImageElement::haveLoadedRequiredResources()
    178143{
    179     return !externalResourcesRequiredBaseValue() || !m_imageLoader.hasPendingActivity();
     144    return !externalResourcesRequired() || !m_imageLoader.hasPendingActivity();
    180145}
    181146
  • trunk/Source/WebCore/svg/SVGImageElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2122#pragma once
    2223
    23 #include "SVGAnimatedBoolean.h"
    2424#include "SVGAnimatedLength.h"
    2525#include "SVGAnimatedPreserveAspectRatio.h"
     
    3939    const AtomicString& imageSourceURL() const final;
    4040
     41    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     42    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     43    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
     44    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
     45    const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(attributeOwnerProxy()); }
     46
     47    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     48    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     49    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
     50    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
     51    RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(attributeOwnerProxy()); }
     52
    4153private:
    4254    SVGImageElement(const QualifiedName&, Document&);
    4355   
    44     bool isValid() const final { return SVGTests::isValid(); }
     56    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGImageElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
     57    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     58    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     59    static void registerAttributes();
    4560
    46     static bool isSupportedAttribute(const QualifiedName&);
     61    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4762    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    4863    void svgAttributeChanged(const QualifiedName&) final;
     
    5065    void didAttachRenderers() final;
    5166    InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final;
    52 
    5367    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    5468
    5569    void addSubresourceAttributeURLs(ListHashSet<URL>&) const final;
    56 
    5770    bool haveLoadedRequiredResources() final;
    5871
     72    bool isValid() const final { return SVGTests::isValid(); }
    5973    bool selfHasRelativeLengths() const final { return true; }
    6074    void didMoveToNewDocument(Document& oldDocument, Document& newDocument) final;
    6175
    62     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement)
    63         DECLARE_ANIMATED_LENGTH(X, x)
    64         DECLARE_ANIMATED_LENGTH(Y, y)
    65         DECLARE_ANIMATED_LENGTH(Width, width)
    66         DECLARE_ANIMATED_LENGTH(Height, height)
    67         DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
    68         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    69         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    70     END_DECLARE_ANIMATED_PROPERTIES
    71 
     76    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     77    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
     78    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
     79    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
     80    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
     81    SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio;
    7282    SVGImageLoader m_imageLoader;
    7383};
  • trunk/Source/WebCore/svg/SVGImageLoader.cpp

    r223728 r234620  
    4242        element().dispatchEvent(Event::create(eventNames().errorEvent, false, false));
    4343    else {
    44         if (downcast<SVGImageElement>(element()).externalResourcesRequiredBaseValue())
     44        if (downcast<SVGImageElement>(element()).externalResourcesRequired())
    4545            downcast<SVGImageElement>(ImageLoader::element()).sendSVGLoadEventIfPossible(true);
    4646    }
  • trunk/Source/WebCore/svg/SVGLangSpace.cpp

    r219595 r234620  
    22 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGLangSpace.h"
    2324
     25#include "RenderSVGResource.h"
     26#include "RenderSVGShape.h"
     27#include "SVGElement.h"
    2428#include "XMLNames.h"
    2529#include <wtf/NeverDestroyed.h>
     
    2731namespace WebCore {
    2832
    29 void SVGLangSpace::setXmllang(const AtomicString& xmlLang)
     33SVGLangSpace::SVGLangSpace(SVGElement* contextElement)
     34    : m_contextElement(*contextElement)
    3035{
    31     m_lang = xmlLang;
     36    registerAttributes();
    3237}
    3338
    34 const AtomicString& SVGLangSpace::xmlspace() const
     39void SVGLangSpace::registerAttributes()
    3540{
    36     if (!m_space) {
    37         static NeverDestroyed<const AtomicString> defaultString("default", AtomicString::ConstructFromLiteral);
     41    auto& registry = attributeRegistry();
     42    if (!registry.isEmpty())
     43        return;
     44    registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::langAttr, &SVGLangSpace::m_lang>());
     45    registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::spaceAttr, &SVGLangSpace::m_space>());
     46}
     47
     48const String& SVGLangSpace::xmlspace() const
     49{
     50    if (!m_space.value()) {
     51        static NeverDestroyed<String> defaultString("default");
    3852        return defaultString;
    3953    }
    40 
    41     return m_space;
    42 }
    43 
    44 void SVGLangSpace::setXmlspace(const AtomicString& xmlSpace)
    45 {
    46     m_space = xmlSpace;
     54    return m_space.value();
    4755}
    4856
     
    5563}
    5664
    57 bool SVGLangSpace::isKnownAttribute(const QualifiedName& attrName)
     65void SVGLangSpace::svgAttributeChanged(const QualifiedName& attrName)
    5866{
    59     return attrName.matches(XMLNames::langAttr) || attrName.matches(XMLNames::spaceAttr);
    60 }
     67    if (!isKnownAttribute(attrName))
     68        return;
    6169
    62 static void addWithAndWithoutXMLPrefix(HashSet<QualifiedName>& set, const QualifiedName& attributeName)
    63 {
    64     ASSERT(attributeName.prefix().isNull());
    65     set.add(attributeName);
    66     set.add({ xmlAtom(), attributeName.localName(), attributeName.namespaceURI() });
    67 }
    68 
    69 void SVGLangSpace::addSupportedAttributes(HashSet<QualifiedName>& set)
    70 {
    71     addWithAndWithoutXMLPrefix(set, XMLNames::langAttr);
    72     addWithAndWithoutXMLPrefix(set, XMLNames::spaceAttr);
     70    if (auto* renderer = downcast<RenderSVGShape>(m_contextElement.renderer())) {
     71        SVGElement::InstanceInvalidationGuard guard(m_contextElement);
     72        RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     73    }
    7374}
    7475
  • trunk/Source/WebCore/svg/SVGLangSpace.h

    r208668 r234620  
    22 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2223
    2324#include "QualifiedName.h"
     25#include "SVGAttributeOwnerProxyImpl.h"
    2426#include <wtf/HashSet.h>
    2527
    2628namespace WebCore {
    2729
     30class SVGElement;
     31
    2832class SVGLangSpace {
    2933public:
    30     const AtomicString& xmllang() const { return m_lang; }
    31     void setXmllang(const AtomicString& xmlLang);
     34    const String& xmllang() const { return m_lang.value(); }
     35    void setXmllang(const AtomicString& xmlLang) { m_lang.setValue(xmlLang); }
    3236
    33     const AtomicString& xmlspace() const;
    34     void setXmlspace(const AtomicString& xmlSpace);
     37    const String& xmlspace() const;
     38    void setXmlspace(const AtomicString& xmlSpace) { m_space.setValue(xmlSpace); }
    3539
    3640    void parseAttribute(const QualifiedName&, const AtomicString&);
    3741
    38     static bool isKnownAttribute(const QualifiedName&);
    39     static void addSupportedAttributes(HashSet<QualifiedName>&);
     42    void svgAttributeChanged(const QualifiedName&);
     43
     44    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLangSpace>;
     45    using AttributeRegistry = SVGAttributeRegistry<SVGLangSpace>;
     46    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     47    static bool isKnownAttribute(const QualifiedName& attributeName) { return attributeRegistry().isKnownAttribute(attributeName); }
     48
     49protected:
     50    SVGLangSpace(SVGElement* contextElement);
    4051
    4152private:
    42     AtomicString m_lang;
    43     AtomicString m_space;
     53    using SVGStringAttribute = SVGPropertyAttribute<String>;
     54    using SVGStringAttributeAccessor = SVGPropertyAttributeAccessor<SVGLangSpace, SVGStringAttribute>;
     55    static void registerAttributes();
     56
     57    SVGElement& m_contextElement;
     58    SVGStringAttribute m_lang;
     59    SVGStringAttribute m_space;
    4460};
    4561
  • trunk/Source/WebCore/svg/SVGLineElement.cpp

    r231955 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGLineElement.h"
    2324
    24 #include "FloatPoint.h"
    25 #include "RenderSVGPath.h"
    2625#include "RenderSVGResource.h"
    2726#include "SVGLengthValue.h"
    28 #include "SVGNames.h"
    2927#include <wtf/IsoMallocInlines.h>
    30 #include <wtf/NeverDestroyed.h>
    3128
    3229namespace WebCore {
     
    3431WTF_MAKE_ISO_ALLOCATED_IMPL(SVGLineElement);
    3532
    36 // Animated property definitions
    37 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x1Attr, X1, x1)
    38 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y1Attr, Y1, y1)
    39 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x2Attr, X2, x2)
    40 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y2Attr, Y2, y2)
    41 DEFINE_ANIMATED_BOOLEAN(SVGLineElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    42 
    43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLineElement)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(x1)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(y1)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(x2)
    47     REGISTER_LOCAL_ANIMATED_PROPERTY(y2)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    49     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
    50 END_REGISTER_ANIMATED_PROPERTIES
    51 
    5233inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document& document)
    5334    : SVGGeometryElement(tagName, document)
    54     , m_x1(LengthModeWidth)
    55     , m_y1(LengthModeHeight)
    56     , m_x2(LengthModeWidth)
    57     , m_y2(LengthModeHeight)
     35    , SVGExternalResourcesRequired(this)
    5836{
    5937    ASSERT(hasTagName(SVGNames::lineTag));
    60     registerAnimatedPropertiesForSVGLineElement();
     38    registerAttributes();
    6139}
    6240
     
    6644}
    6745
    68 bool SVGLineElement::isSupportedAttribute(const QualifiedName& attrName)
     46void SVGLineElement::registerAttributes()
    6947{
    70     static const auto supportedAttributes = makeNeverDestroyed([] {
    71         HashSet<QualifiedName> set;
    72         SVGLangSpace::addSupportedAttributes(set);
    73         SVGExternalResourcesRequired::addSupportedAttributes(set);
    74         set.add({ SVGNames::x1Attr.get(), SVGNames::x2Attr.get(), SVGNames::y1Attr.get(), SVGNames::y2Attr.get() });
    75         return set;
    76     }());
    77     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     48    auto& registry = attributeRegistry();
     49    if (!registry.isEmpty())
     50        return;
     51    registry.registerAttribute<SVGNames::x1Attr, &SVGLineElement::m_x1>();
     52    registry.registerAttribute<SVGNames::y1Attr, &SVGLineElement::m_y1>();
     53    registry.registerAttribute<SVGNames::x2Attr, &SVGLineElement::m_x2>();
     54    registry.registerAttribute<SVGNames::y2Attr, &SVGLineElement::m_y2>();
    7855}
    7956
     
    8360
    8461    if (name == SVGNames::x1Attr)
    85         setX1BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     62        m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    8663    else if (name == SVGNames::y1Attr)
    87         setY1BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     64        m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    8865    else if (name == SVGNames::x2Attr)
    89         setX2BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     66        m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    9067    else if (name == SVGNames::y2Attr)
    91         setY2BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     68        m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    9269
    9370    reportAttributeParsingError(parseError, name, value);
    9471
    95     SVGGraphicsElement::parseAttribute(name, value);
     72    SVGGeometryElement::parseAttribute(name, value);
    9673    SVGExternalResourcesRequired::parseAttribute(name, value);
    9774}
     
    9976void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName)
    10077{
    101     if (!isSupportedAttribute(attrName)) {
    102         SVGGraphicsElement::svgAttributeChanged(attrName);
     78    if (isKnownAttribute(attrName)) {
     79        InstanceInvalidationGuard guard(*this);
     80        updateRelativeLengthsInformation();
     81
     82        if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) {
     83            renderer->setNeedsShapeUpdate();
     84            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     85        }
    10386        return;
    10487    }
    10588
    106     InstanceInvalidationGuard guard(*this);
    107    
    108     bool isLengthAttribute = attrName == SVGNames::x1Attr
    109                           || attrName == SVGNames::y1Attr
    110                           || attrName == SVGNames::x2Attr
    111                           || attrName == SVGNames::y2Attr;
    112 
    113     if (isLengthAttribute)
    114         updateRelativeLengthsInformation();
    115 
    116     auto* renderer = downcast<RenderSVGShape>(this->renderer());
    117     if (!renderer)
    118         return;
    119 
    120     if (isLengthAttribute) {
    121         renderer->setNeedsShapeUpdate();
    122         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    123         return;
    124     }
    125 
    126     if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
    127         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    128         return;
    129     }
    130 
    131     ASSERT_NOT_REACHED();
     89    SVGGeometryElement::svgAttributeChanged(attrName);
     90    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    13291}
    13392
  • trunk/Source/WebCore/svg/SVGLineElement.h

    r231955 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2122#pragma once
    2223
    23 #include "SVGAnimatedBoolean.h"
    2424#include "SVGAnimatedLength.h"
    2525#include "SVGExternalResourcesRequired.h"
    2626#include "SVGGeometryElement.h"
     27#include "SVGNames.h"
    2728
    2829namespace WebCore {
     
    3334    static Ref<SVGLineElement> create(const QualifiedName&, Document&);
    3435
     36    const SVGLengthValue& x1() const { return m_x1.currentValue(attributeOwnerProxy()); }
     37    const SVGLengthValue& y1() const { return m_y1.currentValue(attributeOwnerProxy()); }
     38    const SVGLengthValue& x2() const { return m_x2.currentValue(attributeOwnerProxy()); }
     39    const SVGLengthValue& y2() const { return m_y2.currentValue(attributeOwnerProxy()); }
     40
     41    RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(attributeOwnerProxy()); }
     42    RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(attributeOwnerProxy()); }
     43    RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(attributeOwnerProxy()); }
     44    RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(attributeOwnerProxy()); }
     45
    3546private:
    3647    SVGLineElement(const QualifiedName&, Document&);
    37    
    38     bool isValid() const final { return SVGTests::isValid(); }
    3948
    40     static bool isSupportedAttribute(const QualifiedName&);
     49    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLineElement, SVGGeometryElement, SVGExternalResourcesRequired>;
     50    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     51    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     52    static void registerAttributes();
     53
     54    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4155    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    4256    void svgAttributeChanged(const QualifiedName&) final;
    4357
     58    bool isValid() const final { return SVGTests::isValid(); }
    4459    bool supportsMarkers() const final { return true; }
    45 
    4660    bool selfHasRelativeLengths() const final;
    4761
    48     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGLineElement)
    49         DECLARE_ANIMATED_LENGTH(X1, x1)
    50         DECLARE_ANIMATED_LENGTH(Y1, y1)
    51         DECLARE_ANIMATED_LENGTH(X2, x2)
    52         DECLARE_ANIMATED_LENGTH(Y2, y2)
    53         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    54     END_DECLARE_ANIMATED_PROPERTIES
     62    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     63    SVGAnimatedLengthAttribute m_x1 { LengthModeWidth };
     64    SVGAnimatedLengthAttribute m_y1 { LengthModeHeight };
     65    SVGAnimatedLengthAttribute m_x2 { LengthModeWidth };
     66    SVGAnimatedLengthAttribute m_y2 { LengthModeHeight };
    5567};
    5668
  • trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp

    r229694 r234620  
    55 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
    66 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     7 * Copyright (C) 2018 Apple Inc. All rights reserved.
    78 *
    89 * This library is free software; you can redistribute it and/or
     
    3940WTF_MAKE_ISO_ALLOCATED_IMPL(SVGLinearGradientElement);
    4041
    41 // Animated property definitions
    42 DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x1Attr, X1, x1)
    43 DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y1Attr, Y1, y1)
    44 DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x2Attr, X2, x2)
    45 DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y2Attr, Y2, y2)
    46 
    47 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLinearGradientElement)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(x1)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(y1)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(x2)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(y2)
    52     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGradientElement)
    53 END_REGISTER_ANIMATED_PROPERTIES
    54 
    5542inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document& document)
    5643    : SVGGradientElement(tagName, document)
    57     , m_x1(LengthModeWidth)
    58     , m_y1(LengthModeHeight)
    59     , m_x2(LengthModeWidth, "100%")
    60     , m_y2(LengthModeHeight)
    6144{
    6245    // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified.
    6346    ASSERT(hasTagName(SVGNames::linearGradientTag));
    64     registerAnimatedPropertiesForSVGLinearGradientElement();
     47    registerAttributes();
    6548}
    6649
     
    7053}
    7154
    72 bool SVGLinearGradientElement::isSupportedAttribute(const QualifiedName& attrName)
     55void SVGLinearGradientElement::registerAttributes()
    7356{
    74     static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> {
    75         SVGNames::x1Attr, SVGNames::x2Attr, SVGNames::y1Attr, SVGNames::y2Attr
    76     });
    77     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     57    auto& registry = attributeRegistry();
     58    if (!registry.isEmpty())
     59        return;
     60    registry.registerAttribute<SVGNames::x1Attr, &SVGLinearGradientElement::m_x1>();
     61    registry.registerAttribute<SVGNames::y1Attr, &SVGLinearGradientElement::m_y1>();
     62    registry.registerAttribute<SVGNames::x2Attr, &SVGLinearGradientElement::m_x2>();
     63    registry.registerAttribute<SVGNames::y2Attr, &SVGLinearGradientElement::m_y2>();
    7864}
    7965
     
    8369
    8470    if (name == SVGNames::x1Attr)
    85         setX1BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     71        m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    8672    else if (name == SVGNames::y1Attr)
    87         setY1BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     73        m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    8874    else if (name == SVGNames::x2Attr)
    89         setX2BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     75        m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    9076    else if (name == SVGNames::y2Attr)
    91         setY2BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     77        m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    9278
    9379    reportAttributeParsingError(parseError, name, value);
     
    9884void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName)
    9985{
    100     if (!isSupportedAttribute(attrName)) {
    101         SVGGradientElement::svgAttributeChanged(attrName);
     86    if (isKnownAttribute(attrName)) {
     87        InstanceInvalidationGuard guard(*this);
     88        updateRelativeLengthsInformation();
     89        if (RenderObject* object = renderer())
     90            object->setNeedsLayout();
    10291        return;
    10392    }
    10493
    105     InstanceInvalidationGuard guard(*this);
    106    
    107     updateRelativeLengthsInformation();
    108 
    109     if (RenderObject* object = renderer())
    110         object->setNeedsLayout();
     94    SVGGradientElement::svgAttributeChanged(attrName);
    11195}
    11296
  • trunk/Source/WebCore/svg/SVGLinearGradientElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3637    bool collectGradientAttributes(LinearGradientAttributes&);
    3738
     39    const SVGLengthValue& x1() const { return m_x1.currentValue(attributeOwnerProxy()); }
     40    const SVGLengthValue& y1() const { return m_y1.currentValue(attributeOwnerProxy()); }
     41    const SVGLengthValue& x2() const { return m_x2.currentValue(attributeOwnerProxy()); }
     42    const SVGLengthValue& y2() const { return m_y2.currentValue(attributeOwnerProxy()); }
     43
     44    RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(attributeOwnerProxy()); }
     45    RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(attributeOwnerProxy()); }
     46    RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(attributeOwnerProxy()); }
     47    RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(attributeOwnerProxy()); }
     48
    3849private:
    3950    SVGLinearGradientElement(const QualifiedName&, Document&);
    4051
    41     static bool isSupportedAttribute(const QualifiedName&);
     52    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLinearGradientElement, SVGGradientElement>;
     53    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     54    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     55    static void registerAttributes();
     56
     57    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4258    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    4359    void svgAttributeChanged(const QualifiedName&) override;
     
    4763    bool selfHasRelativeLengths() const override;
    4864
    49     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGLinearGradientElement)
    50         DECLARE_ANIMATED_LENGTH(X1, x1)
    51         DECLARE_ANIMATED_LENGTH(Y1, y1)
    52         DECLARE_ANIMATED_LENGTH(X2, x2)
    53         DECLARE_ANIMATED_LENGTH(Y2, y2)
    54     END_DECLARE_ANIMATED_PROPERTIES
     65    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     66    SVGAnimatedLengthAttribute m_x1 { LengthModeWidth };
     67    SVGAnimatedLengthAttribute m_y1 { LengthModeHeight };
     68    SVGAnimatedLengthAttribute m_x2 { LengthModeWidth, "100%" };
     69    SVGAnimatedLengthAttribute m_y2 { LengthModeHeight };
    5570};
    5671
  • trunk/Source/WebCore/svg/SVGMPathElement.cpp

    r229694 r234620  
    11/*
    22 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3233WTF_MAKE_ISO_ALLOCATED_IMPL(SVGMPathElement);
    3334
    34 // Animated property definitions
    35 DEFINE_ANIMATED_STRING(SVGMPathElement, XLinkNames::hrefAttr, Href, href)
    36 DEFINE_ANIMATED_BOOLEAN(SVGMPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    37 
    38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement)
    39     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    40     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    41 END_REGISTER_ANIMATED_PROPERTIES
    42 
    4335inline SVGMPathElement::SVGMPathElement(const QualifiedName& tagName, Document& document)
    4436    : SVGElement(tagName, document)
     37    , SVGExternalResourcesRequired(this)
     38    , SVGURIReference(this)
    4539{
    4640    ASSERT(hasTagName(SVGNames::mpathTag));
    47     registerAnimatedPropertiesForSVGMPathElement();
    4841}
    4942
     
    126119
    127120    SVGElement::svgAttributeChanged(attrName);
     121    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    128122}
    129123
  • trunk/Source/WebCore/svg/SVGMPathElement.h

    r229694 r234620  
    11/*
    22 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3132class SVGPathElement;
    3233
    33 class SVGMPathElement final : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired {
     34class SVGMPathElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference {
    3435    WTF_MAKE_ISO_ALLOCATED(SVGMPathElement);
    3536public:
     
    4546    SVGMPathElement(const QualifiedName&, Document&);
    4647
     48    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMPathElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>;
     49
     50    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     51    void parseAttribute(const QualifiedName&, const AtomicString&) final;
     52    void svgAttributeChanged(const QualifiedName&) final;
     53
    4754    void buildPendingResource() final;
    4855    void clearResourceReferences();
    4956    InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final;
    5057    void removedFromAncestor(RemovalType, ContainerNode&) final;
    51 
    52     void parseAttribute(const QualifiedName&, const AtomicString&) final;
    53     void svgAttributeChanged(const QualifiedName&) final;
    5458
    5559    bool rendererIsNeeded(const RenderStyle&) final { return false; }
     
    5862    void notifyParentOfPathChange(ContainerNode*);
    5963
    60     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMPathElement)
    61         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    62         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    63     END_DECLARE_ANIMATED_PROPERTIES
     64    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    6465};
    6566
  • trunk/Source/WebCore/svg/SVGMarkerElement.cpp

    r229694 r234620  
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
    44 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    3334WTF_MAKE_ISO_ALLOCATED_IMPL(SVGMarkerElement);
    3435
    35 // Define custom animated property 'orientType'.
    36 const SVGPropertyInfo* SVGMarkerElement::orientTypePropertyInfo()
    37 {
    38     static const SVGPropertyInfo* s_propertyInfo = 0;
    39     if (!s_propertyInfo) {
    40         s_propertyInfo = new SVGPropertyInfo(AnimatedEnumeration,
    41                                              PropertyIsReadWrite,
    42                                              SVGNames::orientAttr,
    43                                              orientTypeIdentifier(),
    44                                              &SVGMarkerElement::synchronizeOrientType,
    45                                              &SVGMarkerElement::lookupOrCreateOrientTypeWrapper);
    46     }
    47     return s_propertyInfo;
    48 }
    49 
    50 // Animated property definitions
    51 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::refXAttr, RefX, refX)
    52 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::refYAttr, RefY, refY)
    53 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerWidthAttr, MarkerWidth, markerWidth)
    54 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerHeightAttr, MarkerHeight, markerHeight)
    55 DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerUnits, markerUnits, SVGMarkerUnitsType)
    56 DEFINE_ANIMATED_ANGLE_AND_ENUMERATION(SVGMarkerElement, SVGNames::orientAttr, orientAngleIdentifier(), OrientAngle, orientAngle)
    57 DEFINE_ANIMATED_BOOLEAN(SVGMarkerElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    58 DEFINE_ANIMATED_RECT(SVGMarkerElement, SVGNames::viewBoxAttr, ViewBox, viewBox)
    59 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGMarkerElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)
    60 
    61 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMarkerElement)
    62     REGISTER_LOCAL_ANIMATED_PROPERTY(refX)
    63     REGISTER_LOCAL_ANIMATED_PROPERTY(refY)
    64     REGISTER_LOCAL_ANIMATED_PROPERTY(markerWidth)
    65     REGISTER_LOCAL_ANIMATED_PROPERTY(markerHeight)
    66     REGISTER_LOCAL_ANIMATED_PROPERTY(markerUnits)
    67     REGISTER_LOCAL_ANIMATED_PROPERTY(orientAngle)
    68     REGISTER_LOCAL_ANIMATED_PROPERTY(orientType)
    69     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    70     REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
    71     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
    72     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    73 END_REGISTER_ANIMATED_PROPERTIES
    74 
    7536inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document& document)
    7637    : SVGElement(tagName, document)
    77     , m_refX(LengthModeWidth)
    78     , m_refY(LengthModeHeight)
    79     , m_markerWidth(LengthModeWidth, "3")
    80     , m_markerHeight(LengthModeHeight, "3")
    81     , m_markerUnits(SVGMarkerUnitsStrokeWidth)
    82     , m_orientType(SVGMarkerOrientAngle)
     38    , SVGExternalResourcesRequired(this)
     39    , SVGFitToViewBox(this)
    8340{
    8441    // Spec: If the markerWidth/markerHeight attribute is not specified, the effect is as if a value of "3" were specified.
    8542    ASSERT(hasTagName(SVGNames::markerTag));
    86     registerAnimatedPropertiesForSVGMarkerElement();
     43    registerAttributes();
    8744}
    8845
     
    10966}
    11067
    111 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName)
     68void SVGMarkerElement::registerAttributes()
    11269{
    113     static const auto supportedAttributes = makeNeverDestroyed([] {
    114         HashSet<QualifiedName> set;
    115         SVGLangSpace::addSupportedAttributes(set);
    116         SVGExternalResourcesRequired::addSupportedAttributes(set);
    117         SVGFitToViewBox::addSupportedAttributes(set);
    118         set.add({
    119             SVGNames::markerUnitsAttr.get(),
    120             SVGNames::refXAttr.get(),
    121             SVGNames::refYAttr.get(),
    122             SVGNames::markerWidthAttr.get(),
    123             SVGNames::markerHeightAttr.get(),
    124             SVGNames::orientAttr.get(),
    125         });
    126         return set;
    127     }());
    128     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     70    auto& registry = attributeRegistry();
     71    if (!registry.isEmpty())
     72        return;
     73    registry.registerAttribute<SVGNames::refXAttr, &SVGMarkerElement::m_refX>();
     74    registry.registerAttribute<SVGNames::refYAttr, &SVGMarkerElement::m_refY>();
     75    registry.registerAttribute<SVGNames::markerWidthAttr, &SVGMarkerElement::m_markerWidth>();
     76    registry.registerAttribute<SVGNames::markerHeightAttr, &SVGMarkerElement::m_markerHeight>();
     77    registry.registerAttribute<SVGNames::markerUnitsAttr, SVGMarkerUnitsType, &SVGMarkerElement::m_markerUnits>();
     78    registry.registerAttribute(SVGAnimatedCustomAngleAttributeAccessor::singleton<SVGNames::orientAttr,
     79        &SVGMarkerElement::orientAngleIdentifier, &SVGMarkerElement::m_orientAngle,
     80        &SVGMarkerElement::orientTypeIdentifier, &SVGMarkerElement::m_orientType>());
    12981}
    13082
     
    13486        auto propertyValue = SVGPropertyTraits<SVGMarkerUnitsType>::fromString(value);
    13587        if (propertyValue > 0)
    136             setMarkerUnitsBaseValue(propertyValue);
     88            m_markerUnits.setValue(propertyValue);
    13789        return;
    13890    }
     
    14294        auto orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(value, angle);
    14395        if (orientType > 0)
    144             setOrientTypeBaseValue(orientType);
     96            m_orientType.setValue(orientType);
    14597        if (orientType == SVGMarkerOrientAngle)
    146             setOrientAngleBaseValue(angle);
     98            m_orientAngle.setValue(angle);
    14799        return;
    148100    }
     
    151103
    152104    if (name == SVGNames::refXAttr)
    153         setRefXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     105        m_refX.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    154106    else if (name == SVGNames::refYAttr)
    155         setRefYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     107        m_refY.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    156108    else if (name == SVGNames::markerWidthAttr)
    157         setMarkerWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     109        m_markerWidth.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    158110    else if (name == SVGNames::markerHeightAttr)
    159         setMarkerHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     111        m_markerHeight.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    160112
    161113    reportAttributeParsingError(parseError, name, value);
     
    163115    SVGElement::parseAttribute(name, value);
    164116    SVGExternalResourcesRequired::parseAttribute(name, value);
    165     SVGFitToViewBox::parseAttribute(this, name, value);
     117    SVGFitToViewBox::parseAttribute(name, value);
    166118}
    167119
    168120void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName)
    169121{
    170     if (!isSupportedAttribute(attrName)) {
    171         SVGElement::svgAttributeChanged(attrName);
     122    if (isKnownAttribute(attrName)) {
     123        InstanceInvalidationGuard guard(*this);
     124        if (isAnimatedLengthAttribute(attrName))
     125            updateRelativeLengthsInformation();
     126        if (RenderObject* object = renderer())
     127            object->setNeedsLayout();
     128        return;
     129    }
     130   
     131    if (SVGFitToViewBox::isKnownAttribute(attrName)) {
     132        if (RenderObject* object = renderer())
     133            object->setNeedsLayout();
    172134        return;
    173135    }
    174136
    175     InstanceInvalidationGuard guard(*this);
    176    
    177     if (attrName == SVGNames::refXAttr
    178         || attrName == SVGNames::refYAttr
    179         || attrName == SVGNames::markerWidthAttr
    180         || attrName == SVGNames::markerHeightAttr)
    181         updateRelativeLengthsInformation();
    182 
    183     if (RenderObject* object = renderer())
    184         object->setNeedsLayout();
     137    SVGElement::svgAttributeChanged(attrName);
     138    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    185139}
    186140
     
    198152void SVGMarkerElement::setOrient(SVGMarkerOrientType orientType, const SVGAngleValue& angle)
    199153{
    200     setOrientTypeBaseValue(orientType);
    201     setOrientAngleBaseValue(angle);
     154    m_orientType.setValue(orientType);
     155    m_orientAngle.setValue(angle);
    202156
    203157    // Mark orientAttr dirty - the next XML DOM access of that attribute kicks in synchronization.
    204     m_orientAngle.shouldSynchronize = true;
    205     m_orientType.shouldSynchronize = true;
     158    m_orientAngle.setShouldSynchronize(true);
     159    m_orientType.setShouldSynchronize(true);
    206160    invalidateSVGAttributes();
    207     svgAttributeChanged(orientAnglePropertyInfo()->attributeName);
     161    svgAttributeChanged(SVGNames::orientAttr);
    208162}
    209163
     
    231185}
    232186
    233 void SVGMarkerElement::synchronizeOrientType(SVGElement* contextElement)
    234 {
    235     ASSERT(contextElement);
    236     SVGMarkerElement& ownerType = downcast<SVGMarkerElement>(*contextElement);
    237     if (!ownerType.m_orientType.shouldSynchronize)
    238         return;
    239 
    240     static NeverDestroyed<AtomicString> autoString("auto", AtomicString::ConstructFromLiteral);
    241     static NeverDestroyed<AtomicString> autoStartReverseString("auto-start-reverse", AtomicString::ConstructFromLiteral);
    242 
    243     // If orient is not auto or auto-start-reverse, the previous call to synchronizeOrientAngle already set the orientAttr to the right angle.
    244     if (ownerType.m_orientType.value == SVGMarkerOrientAuto) {
    245         ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoString);
    246         return;
    247     }
    248 
    249     if (ownerType.m_orientType.value == SVGMarkerOrientAutoStartReverse)
    250         ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoStartReverseString);
    251187}
    252 
    253 Ref<SVGAnimatedProperty> SVGMarkerElement::lookupOrCreateOrientTypeWrapper(SVGElement* contextElement)
    254 {
    255     ASSERT(contextElement);
    256     SVGMarkerElement& ownerType = downcast<SVGMarkerElement>(*contextElement);
    257     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGMarkerElement, SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>, SVGMarkerOrientType>
    258         (&ownerType, orientTypePropertyInfo(), ownerType.m_orientType.value);
    259 }
    260 
    261 SVGMarkerOrientType& SVGMarkerElement::orientType() const
    262 {
    263     if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, SVGAnimatedEnumeration>(this, orientTypePropertyInfo())) {
    264         if (wrapper->isAnimating()) {
    265             ASSERT(wrapper->currentAnimatedValue() < SVGMarkerOrientMax);
    266             return reinterpret_cast<SVGMarkerOrientType&>(wrapper->currentAnimatedValue());
    267         }
    268     }
    269     return m_orientType.value;
    270 }
    271 
    272 Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated()
    273 {
    274     m_orientType.shouldSynchronize = true;
    275     return static_reference_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>>(lookupOrCreateOrientTypeWrapper(this));
    276 }
    277 
    278 }
  • trunk/Source/WebCore/svg/SVGMarkerElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    5859    void setOrientToAngle(SVGAngle&);
    5960
    60     static const SVGPropertyInfo* orientTypePropertyInfo();
     61    const SVGLengthValue& refX() const { return m_refX.currentValue(attributeOwnerProxy()); }
     62    const SVGLengthValue& refY() const { return m_refY.currentValue(attributeOwnerProxy()); }
     63    const SVGLengthValue& markerWidth() const { return m_markerWidth.currentValue(attributeOwnerProxy()); }
     64    const SVGLengthValue& markerHeight() const { return m_markerHeight.currentValue(attributeOwnerProxy()); }
     65    SVGMarkerUnitsType markerUnits() const { return m_markerUnits.currentValue(attributeOwnerProxy()); }
     66    const SVGAngleValue& orientAngle() const { return m_orientAngle.currentValue(attributeOwnerProxy()); }
     67    SVGMarkerOrientType orientType() const { return m_orientType.currentValue(attributeOwnerProxy()); }
     68
     69    RefPtr<SVGAnimatedLength> refXAnimated() { return m_refX.animatedProperty(attributeOwnerProxy()); }
     70    RefPtr<SVGAnimatedLength> refYAnimated() { return m_refY.animatedProperty(attributeOwnerProxy()); }
     71    RefPtr<SVGAnimatedLength> markerWidthAnimated() { return m_markerWidth.animatedProperty(attributeOwnerProxy()); }
     72    RefPtr<SVGAnimatedLength> markerHeightAnimated() { return m_markerHeight.animatedProperty(attributeOwnerProxy()); }
     73    RefPtr<SVGAnimatedEnumeration> markerUnitsAnimated() { return m_markerUnits.animatedProperty(attributeOwnerProxy()); }
     74    RefPtr<SVGAnimatedAngle> orientAngleAnimated() { return m_orientAngle.animatedProperty(attributeOwnerProxy()); }
     75    RefPtr<SVGAnimatedEnumeration> orientTypeAnimated() { return m_orientType.animatedProperty(attributeOwnerProxy()); }
    6176
    6277private:
    6378    SVGMarkerElement(const QualifiedName&, Document&);
    6479
    65     bool needsPendingResourceHandling() const override { return false; }
     80    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
     81    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     82    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     83    static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); }
     84    static void registerAttributes();
    6685
    67     static bool isSupportedAttribute(const QualifiedName&);
     86    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    6887    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    6988    void svgAttributeChanged(const QualifiedName&) override;
     
    7392    bool rendererIsNeeded(const RenderStyle&) override { return true; }
    7493
     94    bool needsPendingResourceHandling() const override { return false; }
     95
    7596    bool selfHasRelativeLengths() const override;
    7697
    7798    void setOrient(SVGMarkerOrientType, const SVGAngleValue&);
    7899
    79     void synchronizeOrientType();
    80 
    81100    static const AtomicString& orientTypeIdentifier();
    82101    static const AtomicString& orientAngleIdentifier();
    83  
    84     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMarkerElement)
    85         DECLARE_ANIMATED_LENGTH(RefX, refX)
    86         DECLARE_ANIMATED_LENGTH(RefY, refY)
    87         DECLARE_ANIMATED_LENGTH(MarkerWidth, markerWidth)
    88         DECLARE_ANIMATED_LENGTH(MarkerHeight, markerHeight)
    89         DECLARE_ANIMATED_ENUMERATION(MarkerUnits, markerUnits, SVGMarkerUnitsType)
    90         DECLARE_ANIMATED_ANGLE(OrientAngle, orientAngle)
    91         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    92         DECLARE_ANIMATED_RECT(ViewBox, viewBox)
    93         DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
    94     END_DECLARE_ANIMATED_PROPERTIES
    95  
    96 public:
    97     // Custom 'orientType' property.
    98     static void synchronizeOrientType(SVGElement* contextElement);
    99     static Ref<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
    100     SVGMarkerOrientType& orientType() const;
    101     SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }
    102     void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }
    103     Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();
    104102
    105 private:
    106     mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType;
     103    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     104
     105    class SVGAnimatedCustomOrientTypeAttribute : public SVGAnimatedEnumerationAttribute<SVGMarkerOrientType> {
     106    public:
     107        using Base = SVGAnimatedEnumerationAttribute<SVGMarkerOrientType>;
     108
     109        SVGAnimatedCustomOrientTypeAttribute(SVGMarkerOrientType baseValue)
     110            : Base(baseValue)
     111        {
     112        }
     113        void synchronize(Element& element, const QualifiedName& attributeName)
     114        {
     115            static const NeverDestroyed<String> autoString = MAKE_STATIC_STRING_IMPL("auto");
     116            static const NeverDestroyed<String> autoStartReverseString = MAKE_STATIC_STRING_IMPL("auto-start-reverse");
     117
     118            if (!shouldSynchronize())
     119                return;
     120            if (value() == SVGMarkerOrientAuto)
     121                element.setSynchronizedLazyAttribute(attributeName, autoString.get());
     122            else if (value() == SVGMarkerOrientAutoStartReverse)
     123                element.setSynchronizedLazyAttribute(attributeName, autoStartReverseString.get());
     124        }
     125    };
     126
     127    using SVGAnimatedCustomAngleAttributeAccessor = SVGAnimatedPairAttributeAccessor<SVGMarkerElement, SVGAnimatedAngleAttribute, AnimatedAngle, SVGAnimatedCustomOrientTypeAttribute, AnimatedEnumeration>;
     128
     129    SVGAnimatedLengthAttribute m_refX { LengthModeWidth };
     130    SVGAnimatedLengthAttribute m_refY { LengthModeHeight };
     131    SVGAnimatedLengthAttribute m_markerWidth { LengthModeWidth, "3" };
     132    SVGAnimatedLengthAttribute m_markerHeight { LengthModeHeight, "3" };
     133    SVGAnimatedEnumerationAttribute<SVGMarkerUnitsType> m_markerUnits { SVGMarkerUnitsStrokeWidth };
     134    SVGAnimatedAngleAttribute m_orientAngle;
     135    SVGAnimatedCustomOrientTypeAttribute m_orientType { SVGMarkerOrientAngle };
    107136};
    108137
  • trunk/Source/WebCore/svg/SVGMaskElement.cpp

    r229694 r234620  
    66 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
    77 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
     8 * Copyright (C) 2018 Apple Inc. All rights reserved.
    89 *
    910 * This library is free software; you can redistribute it and/or
     
    3940WTF_MAKE_ISO_ALLOCATED_IMPL(SVGMaskElement);
    4041
    41 // Animated property definitions
    42 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskUnitsAttr, MaskUnits, maskUnits, SVGUnitTypes::SVGUnitType)
    43 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskContentUnitsAttr, MaskContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType)
    44 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::xAttr, X, x)
    45 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::yAttr, Y, y)
    46 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::widthAttr, Width, width)
    47 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::heightAttr, Height, height)
    48 DEFINE_ANIMATED_BOOLEAN(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    49 
    50 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMaskElement)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(maskUnits)
    52     REGISTER_LOCAL_ANIMATED_PROPERTY(maskContentUnits)
    53     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    54     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    55     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
    56     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
    57     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    58     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    59     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
    60 END_REGISTER_ANIMATED_PROPERTIES
    61 
    6242inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document& document)
    6343    : SVGElement(tagName, document)
    64     , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
    65     , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
    66     , m_x(LengthModeWidth, "-10%")
    67     , m_y(LengthModeHeight, "-10%")
    68     , m_width(LengthModeWidth, "120%")
    69     , m_height(LengthModeHeight, "120%")
     44    , SVGExternalResourcesRequired(this)
     45    , SVGTests(this)
    7046{
    7147    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
    7248    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
    7349    ASSERT(hasTagName(SVGNames::maskTag));
    74     registerAnimatedPropertiesForSVGMaskElement();
     50    registerAttributes();
    7551}
    7652
     
    8056}
    8157
    82 bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName)
     58void SVGMaskElement::registerAttributes()
    8359{
    84     static const auto supportedAttributes = makeNeverDestroyed([] {
    85         HashSet<QualifiedName> set;
    86         SVGTests::addSupportedAttributes(set);
    87         SVGLangSpace::addSupportedAttributes(set);
    88         SVGExternalResourcesRequired::addSupportedAttributes(set);
    89         set.add({
    90             SVGNames::maskUnitsAttr.get(),
    91             SVGNames::maskContentUnitsAttr.get(),
    92             SVGNames::refYAttr.get(),
    93             SVGNames::xAttr.get(),
    94             SVGNames::yAttr.get(),
    95             SVGNames::widthAttr.get(),
    96             SVGNames::heightAttr.get(),
    97         });
    98         return set;
    99     }());
    100     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     60    auto& registry = attributeRegistry();
     61    if (!registry.isEmpty())
     62        return;
     63    registry.registerAttribute<SVGNames::xAttr, &SVGMaskElement::m_x>();
     64    registry.registerAttribute<SVGNames::yAttr, &SVGMaskElement::m_y>();
     65    registry.registerAttribute<SVGNames::widthAttr, &SVGMaskElement::m_width>();
     66    registry.registerAttribute<SVGNames::heightAttr, &SVGMaskElement::m_height>();
     67    registry.registerAttribute<SVGNames::maskUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskUnits>();
     68    registry.registerAttribute<SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskContentUnits>();
    10169}
    10270
     
    10674        auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
    10775        if (propertyValue > 0)
    108             setMaskUnitsBaseValue(propertyValue);
     76            m_maskUnits.setValue(propertyValue);
    10977        return;
    11078    }
     
    11280        auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
    11381        if (propertyValue > 0)
    114             setMaskContentUnitsBaseValue(propertyValue);
     82            m_maskContentUnits.setValue(propertyValue);
    11583        return;
    11684    }
     
    11987
    12088    if (name == SVGNames::xAttr)
    121         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     89        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    12290    else if (name == SVGNames::yAttr)
    123         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     91        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    12492    else if (name == SVGNames::widthAttr)
    125         setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     93        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    12694    else if (name == SVGNames::heightAttr)
    127         setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     95        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    12896
    12997    reportAttributeParsingError(parseError, name, value);
     
    136104void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
    137105{
    138     if (!isSupportedAttribute(attrName)) {
    139         SVGElement::svgAttributeChanged(attrName);
    140         return;
    141     }
    142 
    143     InstanceInvalidationGuard guard(*this);
    144 
    145     if (attrName == SVGNames::xAttr
    146         || attrName == SVGNames::yAttr
    147         || attrName == SVGNames::widthAttr
    148         || attrName == SVGNames::heightAttr) {
     106    if (isAnimatedLengthAttribute(attrName)) {
     107        InstanceInvalidationGuard guard(*this);
    149108        invalidateSVGPresentationAttributeStyle();
    150109        return;
    151110    }
    152111
    153     if (RenderObject* object = renderer())
    154         object->setNeedsLayout();
     112    if (isKnownAttribute(attrName)) {
     113        if (auto* renderer = this->renderer())
     114            renderer->setNeedsLayout();
     115        return;
     116    }
     117
     118    SVGElement::svgAttributeChanged(attrName);
     119    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    155120}
    156121
     
    171136}
    172137
    173 Ref<SVGStringList> SVGMaskElement::requiredFeatures()
    174 {
    175     return SVGTests::requiredFeatures(*this);
    176138}
    177 
    178 Ref<SVGStringList> SVGMaskElement::requiredExtensions()
    179 {
    180     return SVGTests::requiredExtensions(*this);
    181 }
    182 
    183 Ref<SVGStringList> SVGMaskElement::systemLanguage()
    184 {
    185     return SVGTests::systemLanguage(*this);
    186 }
    187 
    188 }
  • trunk/Source/WebCore/svg/SVGMaskElement.h

    r229694 r234620  
    11/*
    22 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3132namespace WebCore {
    3233
    33 class SVGMaskElement final : public SVGElement, public SVGTests, public SVGExternalResourcesRequired {
     34class SVGMaskElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGTests {
    3435    WTF_MAKE_ISO_ALLOCATED(SVGMaskElement);
    3536public:
    3637    static Ref<SVGMaskElement> create(const QualifiedName&, Document&);
    3738
    38     // SVGTests
    39     Ref<SVGStringList> requiredFeatures();
    40     Ref<SVGStringList> requiredExtensions();
    41     Ref<SVGStringList> systemLanguage();
     39    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     40    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     41    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
     42    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
     43    SVGUnitTypes::SVGUnitType maskUnits() const { return m_maskUnits.currentValue(attributeOwnerProxy()); }
     44    SVGUnitTypes::SVGUnitType maskContentUnits() const { return m_maskContentUnits.currentValue(attributeOwnerProxy()); }
     45
     46    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     47    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     48    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
     49    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
     50    RefPtr<SVGAnimatedEnumeration> maskUnitsAnimated() { return m_maskUnits.animatedProperty(attributeOwnerProxy()); }
     51    RefPtr<SVGAnimatedEnumeration> maskContentUnitsAnimated() { return m_maskContentUnits.animatedProperty(attributeOwnerProxy()); }
    4252
    4353private:
    4454    SVGMaskElement(const QualifiedName&, Document&);
    4555
    46     bool isValid() const final { return SVGTests::isValid(); }
    47     bool needsPendingResourceHandling() const final { return false; }
     56    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMaskElement, SVGElement, SVGExternalResourcesRequired, SVGTests>;
     57    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     58    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     59    static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); }
     60    static void registerAttributes();
    4861
    49     static bool isSupportedAttribute(const QualifiedName&);
     62    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    5063    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    5164    void svgAttributeChanged(const QualifiedName&) final;
     
    5467    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    5568
     69    bool isValid() const final { return SVGTests::isValid(); }
     70    bool needsPendingResourceHandling() const final { return false; }
    5671    bool selfHasRelativeLengths() const final { return true; }
    5772
    58     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMaskElement)
    59         DECLARE_ANIMATED_ENUMERATION(MaskUnits, maskUnits, SVGUnitTypes::SVGUnitType)
    60         DECLARE_ANIMATED_ENUMERATION(MaskContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType)
    61         DECLARE_ANIMATED_LENGTH(X, x)
    62         DECLARE_ANIMATED_LENGTH(Y, y)
    63         DECLARE_ANIMATED_LENGTH(Width, width)
    64         DECLARE_ANIMATED_LENGTH(Height, height)
    65         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    66     END_DECLARE_ANIMATED_PROPERTIES
    67 
    68     // SVGTests
    69     void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); }
    70     void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); }
    71     void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); }
     73    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     74    SVGAnimatedLengthAttribute m_x { LengthModeWidth, "-10%" };
     75    SVGAnimatedLengthAttribute m_y { LengthModeHeight, "-10%" };
     76    SVGAnimatedLengthAttribute m_width { LengthModeWidth, "120%" };
     77    SVGAnimatedLengthAttribute m_height { LengthModeHeight, "120%" };
     78    SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX };
     79    SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskContentUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE };
    7280};
    7381
  • trunk/Source/WebCore/svg/SVGPathElement.cpp

    r230829 r234620  
    5757WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPathElement);
    5858
    59 // Define custom animated property 'd'.
    60 const SVGPropertyInfo* SVGPathElement::dPropertyInfo()
    61 {
    62     static const SVGPropertyInfo* s_propertyInfo = nullptr;
    63     if (!s_propertyInfo) {
    64         s_propertyInfo = new SVGPropertyInfo(AnimatedPath,
    65             PropertyIsReadWrite,
    66             SVGNames::dAttr,
    67             SVGNames::dAttr->localName(),
    68             &SVGPathElement::synchronizeD,
    69             &SVGPathElement::lookupOrCreateDWrapper);
    70     }
    71     return s_propertyInfo;
    72 }
    73 
    74 // Animated property definitions
    75 DEFINE_ANIMATED_NUMBER(SVGPathElement, SVGNames::pathLengthAttr, PathLength, pathLength)
    76 DEFINE_ANIMATED_BOOLEAN(SVGPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    77 
    78 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPathElement)
    79     REGISTER_LOCAL_ANIMATED_PROPERTY(d)
    80     REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength)
    81     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    82     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
    83 END_REGISTER_ANIMATED_PROPERTIES
    84 
    8559inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& document)
    8660    : SVGGeometryElement(tagName, document)
    87     , m_pathSegList(PathSegUnalteredRole)
    88     , m_isAnimValObserved(false)
     61    , SVGExternalResourcesRequired(this)
    8962{
    9063    ASSERT(hasTagName(SVGNames::pathTag));
    91     registerAnimatedPropertiesForSVGPathElement();
     64    registerAttributes();
    9265}
    9366
     
    213186}
    214187
    215 bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName)
    216 {
    217     static const auto supportedAttributes = makeNeverDestroyed([] {
    218         HashSet<QualifiedName> set;
    219         SVGLangSpace::addSupportedAttributes(set);
    220         SVGExternalResourcesRequired::addSupportedAttributes(set);
    221         set.add({ SVGNames::dAttr.get(), SVGNames::pathLengthAttr.get() });
    222         return set;
    223     }());
    224     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     188void SVGPathElement::registerAttributes()
     189{
     190    auto& registry = attributeRegistry();
     191    if (!registry.isEmpty())
     192        return;
     193    registry.registerAttribute(SVGAnimatedCustomPathSegListAttributeAccessor::singleton<SVGNames::dAttr, &SVGPathElement::m_pathSegList>());
    225194}
    226195
     
    234203    }
    235204
    236     if (name == SVGNames::pathLengthAttr) {
    237         setPathLengthBaseValue(value.toFloat());
    238         if (pathLengthBaseValue() < 0)
    239             document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed");
    240         return;
    241     }
    242 
    243205    SVGGeometryElement::parseAttribute(name, value);
    244206    SVGExternalResourcesRequired::parseAttribute(name, value);
     
    247209void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName)
    248210{
    249     if (!isSupportedAttribute(attrName)) {
    250         SVGGeometryElement::svgAttributeChanged(attrName);
    251         return;
    252     }
    253 
    254     InstanceInvalidationGuard guard(*this);
    255 
    256     RenderSVGPath* renderer = downcast<RenderSVGPath>(this->renderer());
    257 
    258     if (attrName == SVGNames::dAttr) {
    259         if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo())->isAnimating()) {
    260             SVGPathSegListValues newList(PathSegUnalteredRole);
    261             buildSVGPathSegListValuesFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing);
    262             m_pathSegList.value = WTFMove(newList);
     211    if (isKnownAttribute(attrName)) {
     212        InstanceInvalidationGuard guard(*this);
     213
     214        RenderSVGPath* renderer = downcast<RenderSVGPath>(this->renderer());
     215        if (attrName == SVGNames::dAttr) {
     216            if (m_pathSegList.shouldSynchronize() && !lookupAnimatedProperty(m_pathSegList)->isAnimating()) {
     217                SVGPathSegListValues newList(PathSegUnalteredRole);
     218                buildSVGPathSegListValuesFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing);
     219                m_pathSegList.setValue(WTFMove(newList));
     220            }
     221
     222            if (renderer)
     223                renderer->setNeedsShapeUpdate();
     224            invalidateMPathDependencies();
    263225        }
    264226
    265227        if (renderer)
    266             renderer->setNeedsShapeUpdate();
    267 
    268         invalidateMPathDependencies();
    269     }
    270 
    271     if (renderer)
    272         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     228            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     229        return;
     230    }
     231
     232    SVGGeometryElement::svgAttributeChanged(attrName);
     233    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    273234}
    274235
     
    300261const SVGPathByteStream& SVGPathElement::pathByteStream() const
    301262{
    302     auto property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo());
     263    auto property = lookupAnimatedProperty(m_pathSegList);
    303264    if (!property || !property->isAnimating())
    304265        return m_pathByteStream;
    305266   
    306     SVGPathByteStream* animatedPathByteStream = static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property.get())->animatedPathByteStream();
    307     if (!animatedPathByteStream)
    308         return m_pathByteStream;
    309 
    310     return *animatedPathByteStream;
     267    if (auto* animatedPathByteStream = static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property.get())->animatedPathByteStream())
     268        return *animatedPathByteStream;
     269
     270    return m_pathByteStream;
    311271}
    312272   
     
    324284}
    325285
    326 Ref<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper(SVGElement* contextElement)
    327 {
    328     ASSERT(contextElement);
    329     SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement);
    330 
    331     if (auto property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(&ownerType, dPropertyInfo()))
    332         return *property;
    333 
    334     if (ownerType.m_pathSegList.value.isEmpty())
    335         buildSVGPathSegListValuesFromByteStream(ownerType.m_pathByteStream, ownerType, ownerType.m_pathSegList.value, UnalteredParsing);
    336 
    337     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegListValues>(&ownerType, dPropertyInfo(), ownerType.m_pathSegList.value);
    338 }
    339 
    340 void SVGPathElement::synchronizeD(SVGElement* contextElement)
    341 {
    342     ASSERT(contextElement);
    343     SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement);
    344     if (!ownerType.m_pathSegList.shouldSynchronize)
    345         return;
    346     ownerType.m_pathSegList.synchronize(&ownerType, dPropertyInfo()->attributeName, ownerType.m_pathSegList.value.valueAsString());
     286RefPtr<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper()
     287{
     288    return m_pathSegList.animatedProperty(attributeOwnerProxy());
    347289}
    348290
     
    351293    // m_pathSegList.shouldSynchronize is set to true when the 'd' wrapper for m_pathSegList
    352294    // is created and cached. We need to reset it back to false when this wrapper is deleted
    353     // so we can be sure if shouldSynchronize is true, SVGAnimatedProperty::lookupWrapper()
     295    // so we can be sure if shouldSynchronize is true, SVGAttributeAccessor::lookupAnimatedProperty()
    354296    // will return a valid cached 'd' wrapper for the m_pathSegList.
    355     m_pathSegList.shouldSynchronize = false;
     297    m_pathSegList.setShouldSynchronize(false);
    356298}
    357299
    358300Ref<SVGPathSegList> SVGPathElement::pathSegList()
    359301{
    360     m_pathSegList.shouldSynchronize = true;
    361     return static_reference_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->baseVal();
     302    return static_pointer_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper())->baseVal();
    362303}
    363304
     
    370311Ref<SVGPathSegList> SVGPathElement::animatedPathSegList()
    371312{
    372     m_pathSegList.shouldSynchronize = true;
    373313    m_isAnimValObserved = true;
    374     return static_reference_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->animVal();
     314    return static_pointer_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper())->animVal();
    375315}
    376316
     
    395335        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists!
    396336        break;
    397     case PathSegUnalteredRole:
     337    case PathSegUnalteredRole: {
     338        auto& pathSegList = m_pathSegList.value(false);
    398339        if (listModification == ListModificationAppend) {
    399             ASSERT(!m_pathSegList.value.isEmpty());
    400             appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last().copyRef(), m_pathByteStream, UnalteredParsing);
     340            ASSERT(!pathSegList.isEmpty());
     341            appendSVGPathByteStreamFromSVGPathSeg(pathSegList.last().copyRef(), m_pathByteStream, UnalteredParsing);
    401342        } else
    402             buildSVGPathByteStreamFromSVGPathSegListValues(m_pathSegList.value, m_pathByteStream, UnalteredParsing);
     343            buildSVGPathByteStreamFromSVGPathSegListValues(pathSegList, m_pathByteStream, UnalteredParsing);
    403344        m_cachedPath = std::nullopt;
    404345        break;
     346    }
    405347    case PathSegUndefinedRole:
    406348        return;
  • trunk/Source/WebCore/svg/SVGPathElement.h

    r232613 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2425#include "SVGAnimatedBoolean.h"
    2526#include "SVGAnimatedNumber.h"
     27#include "SVGAnimatedPath.h"
    2628#include "SVGExternalResourcesRequired.h"
    2729#include "SVGGeometryElement.h"
     
    9698    FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) final;
    9799
    98     static const SVGPropertyInfo* dPropertyInfo();
    99 
    100100    bool isAnimValObserved() const { return m_isAnimValObserved; }
    101101
     
    104104    size_t approximateMemoryCost() const final;
    105105
     106    const SVGPathSegListValues& pathSegList() const { return m_pathSegList.currentValue(attributeOwnerProxy()); }
     107    RefPtr<SVGAnimatedPathSegList> pathSegListAnimated() { return m_pathSegList.animatedProperty(attributeOwnerProxy()); }
     108
    106109private:
    107110    SVGPathElement(const QualifiedName&, Document&);
    108111
    109     bool isValid() const final { return SVGTests::isValid(); }
     112    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPathElement, SVGGeometryElement, SVGExternalResourcesRequired>;
     113    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     114    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     115    static void registerAttributes();
    110116
    111     static bool isSupportedAttribute(const QualifiedName&);
     117    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    112118    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    113119    void svgAttributeChanged(const QualifiedName&) final;
     120
     121    bool isValid() const final { return SVGTests::isValid(); }
    114122    bool supportsMarkers() const final { return true; }
    115 
    116     // Custom 'd' property
    117     static void synchronizeD(SVGElement* contextElement);
    118     static Ref<SVGAnimatedProperty> lookupOrCreateDWrapper(SVGElement* contextElement);
    119 
    120     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPathElement)
    121         DECLARE_ANIMATED_NUMBER(PathLength, pathLength)
    122         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    123     END_DECLARE_ANIMATED_PROPERTIES
     123    RefPtr<SVGAnimatedProperty> lookupOrCreateDWrapper();
    124124
    125125    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
     
    133133    SVGPathByteStream m_pathByteStream;
    134134    mutable std::optional<Path> m_cachedPath;
    135     mutable SVGSynchronizableAnimatedProperty<SVGPathSegListValues> m_pathSegList;
    136     bool m_isAnimValObserved;
     135    bool m_isAnimValObserved { false };
     136
     137    class SVGAnimatedCustomPathSegListAttribute : public SVGAnimatedPathSegListAttribute {
     138    public:
     139        SVGAnimatedCustomPathSegListAttribute(SVGPathElement& element)
     140            : SVGAnimatedPathSegListAttribute(PathSegUnalteredRole)
     141            , m_element(element)
     142        {
     143        }
     144
     145        SVGPathSegListValues& value(bool shouldBuildSegListValues = true)
     146        {
     147            if (shouldBuildSegListValues && m_property.isEmpty())
     148                buildSVGPathSegListValuesFromByteStream(m_element.m_pathByteStream, m_element, m_property, UnalteredParsing);
     149            return m_property;
     150        }
     151
     152    private:
     153        SVGPathElement& m_element;
     154    };
     155
     156    using SVGAnimatedCustomPathSegListAttributeAccessor = SVGAnimatedAttributeAccessor<SVGPathElement, SVGAnimatedCustomPathSegListAttribute, AnimatedPath>;
     157
     158    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     159    SVGAnimatedCustomPathSegListAttribute m_pathSegList { *this };
    137160};
    138161
  • trunk/Source/WebCore/svg/SVGPathSegListValues.h

    r229830 r234620  
    7878template<> struct SVGPropertyTraits<SVGPathSegListValues> {
    7979    static SVGPathSegListValues initialValue() { return SVGPathSegListValues(PathSegUndefinedRole); }
     80    static String toString(const SVGPathSegListValues& list) { return list.valueAsString(); }
    8081
    8182    using ListItemType = RefPtr<SVGPathSeg>;
  • trunk/Source/WebCore/svg/SVGPathSegWithContext.h

    r232613 r234620  
    2020#pragma once
    2121
    22 #include "SVGAnimatedPathSegListPropertyTearOff.h"
     22#include "SVGPathElement.h"
    2323
    2424namespace WebCore {
     
    4141            return nullptr;
    4242        case PathSegUnalteredRole:
    43             return SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(m_element.get(), SVGPathElement::dPropertyInfo());
     43            return m_element->pathSegListAnimated();
    4444        case PathSegNormalizedRole:
    4545            // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists!
  • trunk/Source/WebCore/svg/SVGPatternElement.cpp

    r229694 r234620  
    44 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
    55 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
     6 * Copyright (C) 2018 Apple Inc. All rights reserved.
    67 *
    78 * This library is free software; you can redistribute it and/or
     
    4647WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPatternElement);
    4748
    48 // Animated property definitions
    49 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::xAttr, X, x)
    50 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::yAttr, Y, y)
    51 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::widthAttr, Width, width)
    52 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::heightAttr, Height, height)
    53 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternUnitsAttr, PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType)
    54 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternContentUnitsAttr, PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType)
    55 DEFINE_ANIMATED_TRANSFORM_LIST(SVGPatternElement, SVGNames::patternTransformAttr, PatternTransform, patternTransform)
    56 DEFINE_ANIMATED_STRING(SVGPatternElement, XLinkNames::hrefAttr, Href, href)
    57 DEFINE_ANIMATED_BOOLEAN(SVGPatternElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    58 DEFINE_ANIMATED_RECT(SVGPatternElement, SVGNames::viewBoxAttr, ViewBox, viewBox)
    59 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGPatternElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)
    60 
    61 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement)
    62     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    63     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    64     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
    65     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
    66     REGISTER_LOCAL_ANIMATED_PROPERTY(patternUnits)
    67     REGISTER_LOCAL_ANIMATED_PROPERTY(patternContentUnits)
    68     REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform)
    69     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    70     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    71     REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
    72     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
    73     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    74     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
    75 END_REGISTER_ANIMATED_PROPERTIES
    76 
    7749inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document& document)
    7850    : SVGElement(tagName, document)
    79     , m_x(LengthModeWidth)
    80     , m_y(LengthModeHeight)
    81     , m_width(LengthModeWidth)
    82     , m_height(LengthModeHeight)
    83     , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
    84     , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
     51    , SVGExternalResourcesRequired(this)
     52    , SVGFitToViewBox(this)
     53    , SVGTests(this)
     54    , SVGURIReference(this)
    8555{
    8656    ASSERT(hasTagName(SVGNames::patternTag));
    87     registerAnimatedPropertiesForSVGPatternElement();
     57    registerAttributes();
    8858}
    8959
     
    9363}
    9464
    95 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName)
     65void SVGPatternElement::registerAttributes()
    9666{
    97     static const auto supportedAttributes = makeNeverDestroyed([] {
    98         HashSet<QualifiedName> set;
    99         SVGURIReference::addSupportedAttributes(set);
    100         SVGTests::addSupportedAttributes(set);
    101         SVGLangSpace::addSupportedAttributes(set);
    102         SVGExternalResourcesRequired::addSupportedAttributes(set);
    103         SVGFitToViewBox::addSupportedAttributes(set);
    104         set.add({
    105             SVGNames::patternUnitsAttr.get(), SVGNames::patternContentUnitsAttr.get(), SVGNames::patternTransformAttr.get(),
    106             SVGNames::xAttr.get(), SVGNames::yAttr.get(), SVGNames::widthAttr.get(), SVGNames::heightAttr.get(),
    107         });
    108         return set;
    109     }());
    110     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     67    auto& registry = attributeRegistry();
     68    if (!registry.isEmpty())
     69        return;
     70    registry.registerAttribute<SVGNames::xAttr, &SVGPatternElement::m_x>();
     71    registry.registerAttribute<SVGNames::yAttr, &SVGPatternElement::m_y>();
     72    registry.registerAttribute<SVGNames::widthAttr, &SVGPatternElement::m_width>();
     73    registry.registerAttribute<SVGNames::heightAttr, &SVGPatternElement::m_height>();
     74    registry.registerAttribute<SVGNames::patternUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternUnits>();
     75    registry.registerAttribute<SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternContentUnits>();
     76    registry.registerAttribute<SVGNames::patternTransformAttr, &SVGPatternElement::m_patternTransform>();
    11177}
    11278
     
    11682        auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
    11783        if (propertyValue > 0)
    118             setPatternUnitsBaseValue(propertyValue);
     84            m_patternUnits.setValue(propertyValue);
    11985        return;
    12086    }
     
    12288        auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
    12389        if (propertyValue > 0)
    124             setPatternContentUnitsBaseValue(propertyValue);
     90            m_patternContentUnits.setValue(propertyValue);
    12591        return;
    12692    }
     
    12894        SVGTransformListValues newList;
    12995        newList.parse(value);
    130         detachAnimatedPatternTransformListWrappers(newList.size());
    131         setPatternTransformBaseValue(newList);
     96        m_patternTransform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     97        m_patternTransform.setValue(WTFMove(newList));
    13298        return;
    13399    }
     
    136102
    137103    if (name == SVGNames::xAttr)
    138         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     104        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    139105    else if (name == SVGNames::yAttr)
    140         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     106        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    141107    else if (name == SVGNames::widthAttr)
    142         setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     108        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
    143109    else if (name == SVGNames::heightAttr)
    144         setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
     110        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
    145111
    146112    reportAttributeParsingError(parseError, name, value);
     
    150116    SVGTests::parseAttribute(name, value);
    151117    SVGExternalResourcesRequired::parseAttribute(name, value);
    152     SVGFitToViewBox::parseAttribute(this, name, value);
     118    SVGFitToViewBox::parseAttribute(name, value);
    153119}
    154120
    155121void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
    156122{
    157     if (!isSupportedAttribute(attrName)) {
    158         SVGElement::svgAttributeChanged(attrName);
    159         return;
    160     }
    161 
    162     InstanceInvalidationGuard guard(*this);
    163 
    164     if (attrName == SVGNames::xAttr
    165         || attrName == SVGNames::yAttr
    166         || attrName == SVGNames::widthAttr
    167         || attrName == SVGNames::heightAttr) {
     123    if (isAnimatedLengthAttribute(attrName)) {
     124        InstanceInvalidationGuard guard(*this);
    168125        invalidateSVGPresentationAttributeStyle();
    169126        return;
    170127    }
    171128
    172     if (RenderObject* object = renderer())
    173         object->setNeedsLayout();
     129    if (isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) {
     130        if (RenderObject* object = renderer())
     131            object->setNeedsLayout();
     132        return;
     133    }
     134
     135    SVGElement::svgAttributeChanged(attrName);
     136    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    174137}
    175138
     
    204167        attributes.setHeight(height());
    205168
    206     if (!attributes.hasViewBox() && hasAttribute(SVGNames::viewBoxAttr) && viewBoxIsValid())
     169    if (!attributes.hasViewBox() && hasAttribute(SVGNames::viewBoxAttr) && hasValidViewBox())
    207170        attributes.setViewBox(viewBox());
    208171
     
    233196}
    234197
    235 Ref<SVGStringList> SVGPatternElement::requiredFeatures()
    236 {
    237     return SVGTests::requiredFeatures(*this);
    238198}
    239 
    240 Ref<SVGStringList> SVGPatternElement::requiredExtensions()
    241 {
    242     return SVGTests::requiredExtensions(*this);
    243 }
    244 
    245 Ref<SVGStringList> SVGPatternElement::systemLanguage()
    246 {
    247     return SVGTests::systemLanguage(*this);
    248 }
    249 
    250 }
  • trunk/Source/WebCore/svg/SVGPatternElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3940struct PatternAttributes;
    4041 
    41 class SVGPatternElement final : public SVGElement, public SVGURIReference, public SVGTests, public SVGExternalResourcesRequired, public SVGFitToViewBox {
     42class SVGPatternElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGFitToViewBox, public SVGTests, public SVGURIReference {
    4243    WTF_MAKE_ISO_ALLOCATED(SVGPatternElement);
    4344public:
     
    4849    AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const final;
    4950
    50     // SVGTests
    51     Ref<SVGStringList> requiredFeatures();
    52     Ref<SVGStringList> requiredExtensions();
    53     Ref<SVGStringList> systemLanguage();
     51    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     52    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     53    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
     54    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
     55    SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits.currentValue(attributeOwnerProxy()); }
     56    SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternContentUnits.currentValue(attributeOwnerProxy()); }
     57    const SVGTransformListValues& patternTransform() const { return m_patternTransform.currentValue(attributeOwnerProxy()); }
     58
     59    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     60    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     61    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
     62    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
     63    RefPtr<SVGAnimatedEnumeration> patternUnitsAnimated() { return m_patternUnits.animatedProperty(attributeOwnerProxy()); }
     64    RefPtr<SVGAnimatedEnumeration> patternContentUnitsAnimated() { return m_patternContentUnits.animatedProperty(attributeOwnerProxy()); }
     65    RefPtr<SVGAnimatedTransformList> patternTransformAnimated() { return m_patternTransform.animatedProperty(attributeOwnerProxy()); }
    5466
    5567private:
    5668    SVGPatternElement(const QualifiedName&, Document&);
    57    
    58     bool isValid() const final { return SVGTests::isValid(); }
    59     bool needsPendingResourceHandling() const final { return false; }
    6069
    61     static bool isSupportedAttribute(const QualifiedName&);
     70    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPatternElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGTests, SVGURIReference>;
     71    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     72    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     73    static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); }
     74    static void registerAttributes();
     75
     76    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    6277    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    6378    void svgAttributeChanged(const QualifiedName&) final;
     
    6681    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    6782
     83    bool isValid() const final { return SVGTests::isValid(); }
     84    bool needsPendingResourceHandling() const final { return false; }
    6885    bool selfHasRelativeLengths() const final { return true; }
    6986
    70     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPatternElement)
    71         DECLARE_ANIMATED_LENGTH(X, x)
    72         DECLARE_ANIMATED_LENGTH(Y, y)
    73         DECLARE_ANIMATED_LENGTH(Width, width)
    74         DECLARE_ANIMATED_LENGTH(Height, height)
    75         DECLARE_ANIMATED_ENUMERATION(PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType)
    76         DECLARE_ANIMATED_ENUMERATION(PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType)
    77         DECLARE_ANIMATED_TRANSFORM_LIST(PatternTransform, patternTransform)
    78         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    79         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    80         DECLARE_ANIMATED_RECT(ViewBox, viewBox)
    81         DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
    82     END_DECLARE_ANIMATED_PROPERTIES
    83 
    84     // SVGTests
    85     void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); }
    86     void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); }
    87     void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); }
     87    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     88    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
     89    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
     90    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
     91    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
     92    SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX };
     93    SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternContentUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE };
     94    SVGAnimatedTransformListAttribute m_patternTransform;
    8895};
    8996
  • trunk/Source/WebCore/svg/SVGPointListValues.h

    r229417 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    4546    }
    4647    static std::optional<SVGPointListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return { }; }
    47     static String toString(const SVGPointListValues&) { ASSERT_NOT_REACHED(); return emptyString(); }
     48    static String toString(const SVGPointListValues& list) { return list.valueAsString(); }
    4849
    4950    using ListItemType = FloatPoint;
  • trunk/Source/WebCore/svg/SVGPolyElement.cpp

    r231955 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2526#include "RenderSVGPath.h"
    2627#include "RenderSVGResource.h"
    27 #include "SVGAnimatedPointList.h"
    2828#include "SVGDocumentExtensions.h"
    29 #include "SVGNames.h"
    3029#include "SVGParserUtilities.h"
    31 #include "SVGPoint.h"
    32 #include "SVGPointList.h"
    3330#include <wtf/IsoMallocInlines.h>
    3431
     
    3734WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPolyElement);
    3835
    39 // Define custom animated property 'points'.
    40 const SVGPropertyInfo* SVGPolyElement::pointsPropertyInfo()
     36SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document)
     37    : SVGGeometryElement(tagName, document)
     38    , SVGExternalResourcesRequired(this)
    4139{
    42     static const SVGPropertyInfo* s_propertyInfo = nullptr;
    43     if (!s_propertyInfo) {
    44         s_propertyInfo = new SVGPropertyInfo(AnimatedPoints,
    45             PropertyIsReadWrite,
    46             SVGNames::pointsAttr,
    47             SVGNames::pointsAttr->localName(),
    48             &SVGPolyElement::synchronizePoints,
    49             &SVGPolyElement::lookupOrCreatePointsWrapper);
    50     }
    51     return s_propertyInfo;
     40    registerAttributes();
    5241}
    5342
    54 // Animated property definitions
    55 DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    56 
    57 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement)
    58     REGISTER_LOCAL_ANIMATED_PROPERTY(points)
    59     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    60     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
    61 END_REGISTER_ANIMATED_PROPERTIES
    62 
    63 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document)
    64     : SVGGeometryElement(tagName, document)
     43void SVGPolyElement::registerAttributes()
    6544{
    66     registerAnimatedPropertiesForSVGPolyElement();   
     45    auto& registry = attributeRegistry();
     46    if (!registry.isEmpty())
     47        return;
     48    registry.registerAttribute<SVGNames::pointsAttr, &SVGPolyElement::m_points>();
    6749}
    6850
     
    7456            document().accessSVGExtensions().reportError("Problem parsing points=\"" + value + "\"");
    7557
    76         if (auto wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()))
    77             static_pointer_cast<SVGAnimatedPointList>(wrapper)->detachListWrappers(newList.size());
     58        if (auto wrapper = static_pointer_cast<SVGAnimatedPointList>(lookupAnimatedProperty(m_points)))
     59            wrapper->detachListWrappers(newList.size());
    7860
    79         m_points.value = WTFMove(newList);
     61        m_points.setValue(WTFMove(newList));
    8062        return;
    8163    }
    8264
    83     SVGGraphicsElement::parseAttribute(name, value);
     65    SVGGeometryElement::parseAttribute(name, value);
    8466    SVGExternalResourcesRequired::parseAttribute(name, value);
    8567}
     
    9678    }
    9779
    98     if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
    99         if (auto* renderer = downcast<RenderSVGPath>(this->renderer())) {
    100             InstanceInvalidationGuard guard(*this);
    101             RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    102         }
    103         return;
    104     }
    105 
    106     SVGGraphicsElement::svgAttributeChanged(attrName);
    107 }
    108 
    109 void SVGPolyElement::synchronizePoints(SVGElement* contextElement)
    110 {
    111     ASSERT(contextElement);
    112     SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement);
    113     if (!ownerType.m_points.shouldSynchronize)
    114         return;
    115     ownerType.m_points.synchronize(&ownerType, pointsPropertyInfo()->attributeName, ownerType.m_points.value.valueAsString());
    116 }
    117 
    118 Ref<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement)
    119 {
    120     ASSERT(contextElement);
    121     SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement);
    122     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPolyElement, SVGAnimatedPointList, SVGPointListValues>(&ownerType, pointsPropertyInfo(), ownerType.m_points.value);
     80    SVGGeometryElement::svgAttributeChanged(attrName);
     81    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    12382}
    12483
    12584Ref<SVGPointList> SVGPolyElement::points()
    12685{
    127     m_points.shouldSynchronize = true;
    128     return static_reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal();
     86    m_points.setShouldSynchronize(true);
     87    return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->baseVal();
    12988}
    13089
    13190Ref<SVGPointList> SVGPolyElement::animatedPoints()
    13291{
    133     m_points.shouldSynchronize = true;
    134     return static_reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal();
     92    m_points.setShouldSynchronize(true);
     93    return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->animVal();
    13594}
    13695
  • trunk/Source/WebCore/svg/SVGPolyElement.h

    r231955 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2122#pragma once
    2223
    23 #include "SVGAnimatedBoolean.h"
     24#include "SVGAnimatedPointList.h"
    2425#include "SVGExternalResourcesRequired.h"
    2526#include "SVGGeometryElement.h"
    2627#include "SVGNames.h"
    27 #include "SVGPointListValues.h"
    2828
    2929namespace WebCore {
     
    3535    Ref<SVGPointList> animatedPoints();
    3636
    37     SVGPointListValues& pointList() const { return m_points.value; }
    38 
    39     static const SVGPropertyInfo* pointsPropertyInfo();
     37    const SVGPointListValues& pointList() const { return m_points.value(); }
    4038
    4139    size_t approximateMemoryCost() const override;
     
    4543
    4644private:
    47     bool isValid() const override { return SVGTests::isValid(); }
     45    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPolyElement, SVGGeometryElement, SVGExternalResourcesRequired>;
     46    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     47    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     48    static void registerAttributes();
    4849
     50    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4951    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    5052    void svgAttributeChanged(const QualifiedName&) override;
    5153
     54    bool isValid() const override { return SVGTests::isValid(); }
    5255    bool supportsMarkers() const override { return true; }
    5356
    54     // Custom 'points' property
    55     static void synchronizePoints(SVGElement* contextElement);
    56     static Ref<SVGAnimatedProperty> lookupOrCreatePointsWrapper(SVGElement* contextElement);
    57 
    58     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPolyElement)
    59         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    60     END_DECLARE_ANIMATED_PROPERTIES
    61 
    62 protected:
    63     mutable SVGSynchronizableAnimatedProperty<SVGPointListValues> m_points;
     57    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     58    SVGAnimatedPointListAttribute m_points;
    6459};
    6560
  • trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp

    r228721 r234620  
    181181}
    182182
    183 void SVGPreserveAspectRatioValue::transformRect(FloatRect& destRect, FloatRect& srcRect)
     183void SVGPreserveAspectRatioValue::transformRect(FloatRect& destRect, FloatRect& srcRect) const
    184184{
    185185    if (m_align == SVG_PRESERVEASPECTRATIO_NONE)
  • trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.h

    r229417 r234620  
    6161    unsigned short meetOrSlice() const { return m_meetOrSlice; }
    6262
    63     void transformRect(FloatRect& destRect, FloatRect& srcRect);
     63    void transformRect(FloatRect& destRect, FloatRect& srcRect) const;
    6464
    6565    AffineTransform getCTM(float logicalX, float logicalY, float logicalWidth, float logicalHeight, float physicalWidth, float physicalHeight) const;
  • trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp

    r229694 r234620  
    55 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
    66 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
     7 * Copyright (C) 2018 Apple Inc. All rights reserved.
    78 *
    89 * This library is free software; you can redistribute it and/or
     
    3940WTF_MAKE_ISO_ALLOCATED_IMPL(SVGRadialGradientElement);
    4041
    41 // Animated property definitions
    42 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::cxAttr, Cx, cx)
    43 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::cyAttr, Cy, cy)
    44 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::rAttr, R, r)
    45 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::fxAttr, Fx, fx)
    46 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::fyAttr, Fy, fy)
    47 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::frAttr, Fr, fr)
    48 
    49 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRadialGradientElement)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(cx)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(cy)
    52     REGISTER_LOCAL_ANIMATED_PROPERTY(r)
    53     REGISTER_LOCAL_ANIMATED_PROPERTY(fx)
    54     REGISTER_LOCAL_ANIMATED_PROPERTY(fy)
    55     REGISTER_LOCAL_ANIMATED_PROPERTY(fr)
    56     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGradientElement)
    57 END_REGISTER_ANIMATED_PROPERTIES
    58 
    5942inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document& document)
    6043    : SVGGradientElement(tagName, document)
    61     , m_cx(LengthModeWidth, "50%")
    62     , m_cy(LengthModeHeight, "50%")
    63     , m_r(LengthModeOther, "50%")
    64     , m_fx(LengthModeWidth)
    65     , m_fy(LengthModeHeight)
    66     , m_fr(LengthModeOther, "0%")
    6744{
    6845    // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified.
    6946    ASSERT(hasTagName(SVGNames::radialGradientTag));
    70     registerAnimatedPropertiesForSVGRadialGradientElement();
     47    registerAttributes();
    7148}
    7249
     
    7653}
    7754
    78 bool SVGRadialGradientElement::isSupportedAttribute(const QualifiedName& attrName)
    79 {
    80     static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> {
    81         SVGNames::cxAttr.get(), SVGNames::cyAttr.get(), SVGNames::fxAttr.get(), SVGNames::fyAttr.get(), SVGNames::rAttr.get(), SVGNames::frAttr.get(),
    82     });
    83     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     55void SVGRadialGradientElement::registerAttributes()
     56{
     57    auto& registry = attributeRegistry();
     58    if (!registry.isEmpty())
     59        return;
     60    registry.registerAttribute<SVGNames::cxAttr, &SVGRadialGradientElement::m_cx>();
     61    registry.registerAttribute<SVGNames::cyAttr, &SVGRadialGradientElement::m_cy>();
     62    registry.registerAttribute<SVGNames::rAttr, &SVGRadialGradientElement::m_r>();
     63    registry.registerAttribute<SVGNames::fxAttr, &SVGRadialGradientElement::m_fx>();
     64    registry.registerAttribute<SVGNames::fyAttr, &SVGRadialGradientElement::m_fy>();
     65    registry.registerAttribute<SVGNames::frAttr, &SVGRadialGradientElement::m_fr>();
    8466}
    8567
     
    8971
    9072    if (name == SVGNames::cxAttr)
    91         setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     73        m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    9274    else if (name == SVGNames::cyAttr)
    93         setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     75        m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    9476    else if (name == SVGNames::rAttr)
    95         setRBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
     77        m_r.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
    9678    else if (name == SVGNames::fxAttr)
    97         setFxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     79        m_fx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    9880    else if (name == SVGNames::fyAttr)
    99         setFyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     81        m_fy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    10082    else if (name == SVGNames::frAttr)
    101         setFrBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
     83        m_fr.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
    10284
    10385    reportAttributeParsingError(parseError, name, value);
     
    10890void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName)
    10991{
    110     if (!isSupportedAttribute(attrName)) {
    111         SVGGradientElement::svgAttributeChanged(attrName);
     92    if (isKnownAttribute(attrName)) {
     93        InstanceInvalidationGuard guard(*this);
     94        updateRelativeLengthsInformation();
     95        if (RenderObject* object = renderer())
     96            object->setNeedsLayout();
    11297        return;
    11398    }
    11499
    115     InstanceInvalidationGuard guard(*this);
    116    
    117     updateRelativeLengthsInformation();
    118        
    119     if (RenderObject* object = renderer())
    120         object->setNeedsLayout();
     100    SVGGradientElement::svgAttributeChanged(attrName);
    121101}
    122102
  • trunk/Source/WebCore/svg/SVGRadialGradientElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3637    bool collectGradientAttributes(RadialGradientAttributes&);
    3738
     39    const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); }
     40    const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); }
     41    const SVGLengthValue& r() const { return m_r.currentValue(attributeOwnerProxy()); }
     42    const SVGLengthValue& fx() const { return m_fx.currentValue(attributeOwnerProxy()); }
     43    const SVGLengthValue& fy() const { return m_fy.currentValue(attributeOwnerProxy()); }
     44    const SVGLengthValue& fr() const { return m_fr.currentValue(attributeOwnerProxy()); }
     45
     46    RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); }
     47    RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); }
     48    RefPtr<SVGAnimatedLength> rAnimated() { return m_r.animatedProperty(attributeOwnerProxy()); }
     49    RefPtr<SVGAnimatedLength> fxAnimated() { return m_fx.animatedProperty(attributeOwnerProxy()); }
     50    RefPtr<SVGAnimatedLength> fyAnimated() { return m_fy.animatedProperty(attributeOwnerProxy()); }
     51    RefPtr<SVGAnimatedLength> frAnimated() { return m_fr.animatedProperty(attributeOwnerProxy()); }
     52
    3853private:
    3954    SVGRadialGradientElement(const QualifiedName&, Document&);
    4055
    41     static bool isSupportedAttribute(const QualifiedName&);
     56    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRadialGradientElement, SVGGradientElement>;
     57    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     58    static void registerAttributes();
     59
     60    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4261    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    4362    void svgAttributeChanged(const QualifiedName&) override;
     
    4766    bool selfHasRelativeLengths() const override;
    4867
    49     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGRadialGradientElement)
    50         DECLARE_ANIMATED_LENGTH(Cx, cx)
    51         DECLARE_ANIMATED_LENGTH(Cy, cy)
    52         DECLARE_ANIMATED_LENGTH(R, r)
    53         DECLARE_ANIMATED_LENGTH(Fx, fx)
    54         DECLARE_ANIMATED_LENGTH(Fy, fy)
    55         DECLARE_ANIMATED_LENGTH(Fr, fr)
    56     END_DECLARE_ANIMATED_PROPERTIES
     68    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     69    SVGAnimatedLengthAttribute m_cx { LengthModeWidth, "50%" };
     70    SVGAnimatedLengthAttribute m_cy { LengthModeHeight, "50%" };
     71    SVGAnimatedLengthAttribute m_r { LengthModeOther, "50%" };
     72    SVGAnimatedLengthAttribute m_fx { LengthModeWidth };
     73    SVGAnimatedLengthAttribute m_fy { LengthModeHeight };
     74    SVGAnimatedLengthAttribute m_fr { LengthModeOther, "0%" };
    5775};
    5876
  • trunk/Source/WebCore/svg/SVGRectElement.cpp

    r231955 r234620  
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    2324#include "SVGRectElement.h"
    2425
    25 #include "RenderSVGPath.h"
    2626#include "RenderSVGRect.h"
    2727#include "RenderSVGResource.h"
    28 #include "SVGLengthValue.h"
    29 #include "SVGNames.h"
    3028#include <wtf/IsoMallocInlines.h>
    3129
     
    3432WTF_MAKE_ISO_ALLOCATED_IMPL(SVGRectElement);
    3533
    36 // Animated property definitions
    37 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::xAttr, X, x)
    38 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::yAttr, Y, y)
    39 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::widthAttr, Width, width)
    40 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::heightAttr, Height, height)
    41 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::rxAttr, Rx, rx)
    42 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::ryAttr, Ry, ry)
    43 DEFINE_ANIMATED_BOOLEAN(SVGRectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    44 
    45 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRectElement)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    47     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    48     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(rx)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(ry)
    52     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    53     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
    54 END_REGISTER_ANIMATED_PROPERTIES
    55 
    5634inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document& document)
    5735    : SVGGeometryElement(tagName, document)
    58     , m_x(LengthModeWidth)
    59     , m_y(LengthModeHeight)
    60     , m_width(LengthModeWidth)
    61     , m_height(LengthModeHeight)
    62     , m_rx(LengthModeWidth)
    63     , m_ry(LengthModeHeight)
     36    , SVGExternalResourcesRequired(this)
    6437{
    6538    ASSERT(hasTagName(SVGNames::rectTag));
    66     registerAnimatedPropertiesForSVGRectElement();
     39    registerAttributes();
    6740}
    6841
     
    7245}
    7346
     47void SVGRectElement::registerAttributes()
     48{
     49    auto& registry = attributeRegistry();
     50    if (!registry.isEmpty())
     51        return;
     52    registry.registerAttribute<SVGNames::xAttr, &SVGRectElement::m_x>();
     53    registry.registerAttribute<SVGNames::yAttr, &SVGRectElement::m_y>();
     54    registry.registerAttribute<SVGNames::widthAttr, &SVGRectElement::m_width>();
     55    registry.registerAttribute<SVGNames::heightAttr, &SVGRectElement::m_height>();
     56    registry.registerAttribute<SVGNames::rxAttr, &SVGRectElement::m_rx>();
     57    registry.registerAttribute<SVGNames::ryAttr, &SVGRectElement::m_ry>();
     58}
     59
    7460void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    7561{
     
    7763
    7864    if (name == SVGNames::xAttr)
    79         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     65        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    8066    else if (name == SVGNames::yAttr)
    81         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     67        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    8268    else if (name == SVGNames::rxAttr)
    83         setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     69        m_rx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
    8470    else if (name == SVGNames::ryAttr)
    85         setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
     71        m_ry.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
    8672    else if (name == SVGNames::widthAttr)
    87         setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     73        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
    8874    else if (name == SVGNames::heightAttr)
    89         setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
     75        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
    9076
    9177    reportAttributeParsingError(parseError, name, value);
    9278
    93     SVGGraphicsElement::parseAttribute(name, value);
     79    SVGGeometryElement::parseAttribute(name, value);
    9480    SVGExternalResourcesRequired::parseAttribute(name, value);
    9581}
     
    9783void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
    9884{
    99     if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) {
     85    if (isKnownAttribute(attrName)) {
    10086        InstanceInvalidationGuard guard(*this);
    10187        invalidateSVGPresentationAttributeStyle();
     
    10389    }
    10490
    105     if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
    106         if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) {
    107             InstanceInvalidationGuard guard(*this);
    108             RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    109         }
    110         return;
    111     }
    112 
    113     SVGGraphicsElement::svgAttributeChanged(attrName);
     91    SVGGeometryElement::svgAttributeChanged(attrName);
     92    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    11493}
    11594
  • trunk/Source/WebCore/svg/SVGRectElement.h

    r231955 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3435    static Ref<SVGRectElement> create(const QualifiedName&, Document&);
    3536
     37    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     38    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     39    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
     40    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
     41    const SVGLengthValue& rx() const { return m_rx.currentValue(attributeOwnerProxy()); }
     42    const SVGLengthValue& ry() const { return m_ry.currentValue(attributeOwnerProxy()); }
     43
     44    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     45    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     46    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
     47    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
     48    RefPtr<SVGAnimatedLength> rxAnimated() { return m_rx.animatedProperty(attributeOwnerProxy()); }
     49    RefPtr<SVGAnimatedLength> ryAnimated() { return m_ry.animatedProperty(attributeOwnerProxy()); }
     50
    3651private:
    3752    SVGRectElement(const QualifiedName&, Document&);
    38    
    39     bool isValid() const final { return SVGTests::isValid(); }
    4053
     54    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRectElement, SVGGeometryElement, SVGExternalResourcesRequired>;
     55    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     56    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     57    static void registerAttributes();
     58
     59    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4160    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    4261    void svgAttributeChanged(const QualifiedName&) final;
    4362
     63    bool isValid() const final { return SVGTests::isValid(); }
    4464    bool selfHasRelativeLengths() const final { return true; }
    4565
    4666    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    4767
    48     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGRectElement)
    49         DECLARE_ANIMATED_LENGTH(X, x)
    50         DECLARE_ANIMATED_LENGTH(Y, y)
    51         DECLARE_ANIMATED_LENGTH(Width, width)
    52         DECLARE_ANIMATED_LENGTH(Height, height)
    53         DECLARE_ANIMATED_LENGTH(Rx, rx)
    54         DECLARE_ANIMATED_LENGTH(Ry, ry)
    55         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    56     END_DECLARE_ANIMATED_PROPERTIES
     68    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     69    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
     70    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
     71    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
     72    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
     73    SVGAnimatedLengthAttribute m_rx { LengthModeWidth };
     74    SVGAnimatedLengthAttribute m_ry { LengthModeHeight};
    5775};
    5876
  • trunk/Source/WebCore/svg/SVGSVGElement.cpp

    r233122 r234620  
    22 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2007-2017 Apple Inc. All rights reserved.
     4 * Copyright (C) 2007-2018 Apple Inc. All rights reserved.
    55 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
    66 *
     
    5353WTF_MAKE_ISO_ALLOCATED_IMPL(SVGSVGElement);
    5454
    55 // Animated property definitions
    56 DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::xAttr, X, x)
    57 DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::yAttr, Y, y)
    58 DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::widthAttr, Width, width)
    59 DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::heightAttr, Height, height)
    60 DEFINE_ANIMATED_BOOLEAN(SVGSVGElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    61 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSVGElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)
    62 DEFINE_ANIMATED_RECT(SVGSVGElement, SVGNames::viewBoxAttr, ViewBox, viewBox)
    63 
    64 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSVGElement)
    65     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    66     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    67     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
    68     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
    69     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    70     REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
    71     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
    72     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    73 END_REGISTER_ANIMATED_PROPERTIES
    74 
    7555inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& document)
    7656    : SVGGraphicsElement(tagName, document)
    77     , m_x(LengthModeWidth)
    78     , m_y(LengthModeHeight)
    79     , m_width(LengthModeWidth, "100%"_s)
    80     , m_height(LengthModeHeight, "100%"_s)
     57    , SVGExternalResourcesRequired(this)
     58    , SVGFitToViewBox(this)
    8159    , m_timeContainer(SMILTimeContainer::create(*this))
    8260{
    8361    ASSERT(hasTagName(SVGNames::svgTag));
    84     registerAnimatedPropertiesForSVGSVGElement();
     62    registerAttributes();
    8563    document.registerForDocumentSuspensionCallbacks(this);
    8664}
     
    215193}
    216194
     195void SVGSVGElement::registerAttributes()
     196{
     197    auto& registry = attributeRegistry();
     198    if (!registry.isEmpty())
     199        return;
     200    registry.registerAttribute<SVGNames::xAttr, &SVGSVGElement::m_x>();
     201    registry.registerAttribute<SVGNames::yAttr, &SVGSVGElement::m_y>();
     202    registry.registerAttribute<SVGNames::widthAttr, &SVGSVGElement::m_width>();
     203    registry.registerAttribute<SVGNames::heightAttr, &SVGSVGElement::m_height>();
     204}
     205
    217206void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    218207{
     
    253242
    254243    if (name == SVGNames::xAttr)
    255         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     244        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    256245    else if (name == SVGNames::yAttr)
    257         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     246        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    258247    else if (name == SVGNames::widthAttr) {
    259248        auto length = SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths);
     
    263252            length = SVGLengthValue(LengthModeWidth, "100%"_s);
    264253        }
    265         setWidthBaseValue(length);
     254        m_width.setValue(length);
    266255    } else if (name == SVGNames::heightAttr) {
    267256        auto length = SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths);
     
    271260            length = SVGLengthValue(LengthModeHeight, "100%"_s);
    272261        }
    273         setHeightBaseValue(length);
     262        m_height.setValue(length);
    274263    }
    275264
    276265    reportAttributeParsingError(parseError, name, value);
    277266
     267    SVGGraphicsElement::parseAttribute(name, value);
    278268    SVGExternalResourcesRequired::parseAttribute(name, value);
    279     SVGFitToViewBox::parseAttribute(this, name, value);
    280     SVGZoomAndPan::parseAttribute(*this, name, value);
    281     SVGGraphicsElement::parseAttribute(name, value);
     269    SVGFitToViewBox::parseAttribute(name, value);
     270    SVGZoomAndPan::parseAttribute(name, value);
    282271}
    283272
    284273void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
    285274{
    286     bool updateRelativeLengthsOrViewBox = false;
    287     if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) {
     275    if (isKnownAttribute(attrName)) {
     276        InstanceInvalidationGuard guard(*this);
    288277        invalidateSVGPresentationAttributeStyle();
    289         updateRelativeLengthsOrViewBox = true;
    290     }
    291 
    292     if (SVGFitToViewBox::isKnownAttribute(attrName)) {
    293         updateRelativeLengthsOrViewBox = true;
    294         if (auto* renderer = this->renderer())
    295             renderer->setNeedsTransformUpdate();
    296     }
    297 
    298     InstanceInvalidationGuard guard(*this);
    299 
    300     if (updateRelativeLengthsOrViewBox
    301         || SVGLangSpace::isKnownAttribute(attrName)
    302         || SVGExternalResourcesRequired::isKnownAttribute(attrName)
    303         || SVGZoomAndPan::isKnownAttribute(attrName)) {
     278
    304279        if (auto renderer = this->renderer())
    305280            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    306281        return;
    307282    }
     283   
     284    if (SVGFitToViewBox::isKnownAttribute(attrName)) {
     285        if (auto* renderer = this->renderer()) {
     286            renderer->setNeedsTransformUpdate();
     287            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     288        }
     289        return;
     290    }
    308291
    309292    SVGGraphicsElement::svgAttributeChanged(attrName);
     293    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    310294}
    311295
     
    635619
    636620    AffineTransform transform = SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_viewSpec->preserveAspectRatio(), viewWidth, viewHeight);
    637     m_viewSpec->transformBaseValue().concatenate(transform);
     621    m_viewSpec->transformValue().concatenate(transform);
    638622    return transform;
    639623}
     
    717701        if (auto* rootElement = findRootAnchor(m_currentViewFragmentIdentifier)) {
    718702            SVGViewSpec& view = rootElement->currentView();
    719             view.setViewBoxBaseValue(viewBox());
    720             view.setPreserveAspectRatioBaseValue(preserveAspectRatioBaseValue());
    721             view.setZoomAndPanBaseValue(zoomAndPan());
     703            view.setViewBox(viewBox());
     704            view.setPreserveAspectRatio(preserveAspectRatio());
     705            view.setZoomAndPan(zoomAndPan());
    722706            m_currentViewFragmentIdentifier = { };
    723707        }
     
    735719
    736720    if (viewElement.hasAttribute(SVGNames::viewBoxAttr))
    737         view.setViewBoxBaseValue(viewElement.viewBox());
     721        view.setViewBox(viewElement.viewBox());
    738722    else
    739         view.setViewBoxBaseValue(viewBox());
     723        view.setViewBox(viewBox());
    740724
    741725    if (viewElement.hasAttribute(SVGNames::preserveAspectRatioAttr))
    742         view.setPreserveAspectRatioBaseValue(viewElement.preserveAspectRatioBaseValue());
     726        view.setPreserveAspectRatio(viewElement.preserveAspectRatio());
    743727    else
    744         view.setPreserveAspectRatioBaseValue(preserveAspectRatioBaseValue());
     728        view.setPreserveAspectRatio(preserveAspectRatio());
    745729
    746730    if (viewElement.hasAttribute(SVGNames::zoomAndPanAttr))
    747         view.setZoomAndPanBaseValue(viewElement.zoomAndPan());
     731        view.setZoomAndPan(viewElement.zoomAndPan());
    748732    else
    749         view.setZoomAndPanBaseValue(zoomAndPan());
     733        view.setZoomAndPan(zoomAndPan());
    750734}
    751735
  • trunk/Source/WebCore/svg/SVGSVGElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2015 Apple Inc. All rights reserved.
     4 * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    4545class SVGSVGElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGFitToViewBox, public SVGZoomAndPan {
    4646    WTF_MAKE_ISO_ALLOCATED(SVGSVGElement);
    47 
    48     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement)
    49         DECLARE_ANIMATED_LENGTH(X, x)
    50         DECLARE_ANIMATED_LENGTH(Y, y)
    51         DECLARE_ANIMATED_LENGTH(Width, width)
    52         DECLARE_ANIMATED_LENGTH(Height, height)
    53         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    54         DECLARE_ANIMATED_RECT(ViewBox, viewBox)
    55         DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
    56     END_DECLARE_ANIMATED_PROPERTIES
    57 
    5847public: // DOM
    5948    const AtomicString& contentScriptType() const;
     
    7059    float screenPixelToMillimeterY() const;
    7160
    72     bool useCurrentView() const;
     61    bool useCurrentView() const { return m_useCurrentView; }
    7362    SVGViewSpec& currentView();
    7463
     
    7766
    7867    Ref<SVGPoint> currentTranslate();
    79     FloatPoint currentTranslateValue();
     68    FloatPoint currentTranslateValue() { return m_currentTranslate; }
    8069
    8170    unsigned suspendRedraw(unsigned maxWaitMilliseconds);
     
    10998    Element* getElementById(const AtomicString&);
    11099
    111     SVGZoomAndPanType zoomAndPan() const;
    112     void setZoomAndPan(unsigned short);
    113 
    114100public:
    115101    static Ref<SVGSVGElement> create(const QualifiedName&, Document&);
     
    121107    using SVGGraphicsElement::deref;
    122108
    123     SMILTimeContainer& timeContainer();
     109    SMILTimeContainer& timeContainer() { return m_timeContainer.get(); }
    124110
    125111    void setCurrentTranslate(const FloatPoint&); // Used to pan.
     
    134120    FloatRect currentViewBoxRect() const;
    135121
    136     bool hasEmptyViewBox() const;
    137122    AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
     123
     124    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     125    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     126    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
     127    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
     128
     129    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     130    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     131    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
     132    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
    138133
    139134private:
     
    141136    virtual ~SVGSVGElement();
    142137
     138    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSVGElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan>;
     139    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     140    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     141    static void registerAttributes();
     142
     143    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     144    void parseAttribute(const QualifiedName&, const AtomicString&) override;
     145    void svgAttributeChanged(const QualifiedName&) override;
     146    bool selfHasRelativeLengths() const override;
    143147    bool isValid() const override;
    144     void didMoveToNewDocument(Document& oldDocument, Document& newDocument) override;
    145     void parseAttribute(const QualifiedName&, const AtomicString&) override;
     148
    146149    bool rendererIsNeeded(const RenderStyle&) override;
    147150    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
    148151    InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override;
    149152    void removedFromAncestor(RemovalType, ContainerNode&) override;
    150     void svgAttributeChanged(const QualifiedName&) override;
    151     bool selfHasRelativeLengths() const override;
    152153    void prepareForDocumentSuspension() override;
    153154    void resumeFromDocumentSuspension() override;
     155    void didMoveToNewDocument(Document& oldDocument, Document& newDocument) override;
     156
    154157    AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override;
    155 
    156158    RefPtr<Frame> frameForCurrentScale() const;
    157159    void inheritViewAttributes(const SVGViewElement&);
     
    163165
    164166    bool m_useCurrentView { false };
    165     SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
    166167    Ref<SMILTimeContainer> m_timeContainer;
    167168    FloatPoint m_currentTranslate;
    168169    RefPtr<SVGViewSpec> m_viewSpec;
    169170    String m_currentViewFragmentIdentifier;
     171
     172    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     173    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
     174    SVGAnimatedLengthAttribute m_y { LengthModeHeight};
     175    SVGAnimatedLengthAttribute m_width { LengthModeWidth, "100%"_s };
     176    SVGAnimatedLengthAttribute m_height { LengthModeHeight, "100%"_s };
    170177};
    171178
    172 inline bool SVGSVGElement::useCurrentView() const
    173 {
    174     return m_useCurrentView;
    175 }
    176 
    177 inline FloatPoint SVGSVGElement::currentTranslateValue()
    178 {
    179     return m_currentTranslate;
    180 }
    181 
    182 inline SVGZoomAndPanType SVGSVGElement::zoomAndPan() const
    183 {
    184     return m_zoomAndPan;
    185 }
    186 
    187 inline void SVGSVGElement::setZoomAndPan(unsigned short zoomAndPan)
    188 {
    189     m_zoomAndPan = parseFromNumber(zoomAndPan);
    190 }
    191 
    192 inline SMILTimeContainer& SVGSVGElement::timeContainer()
    193 {
    194     return m_timeContainer.get();
    195 }
    196 
    197 inline bool SVGSVGElement::hasEmptyViewBox() const
    198 {
    199     return viewBoxIsValid() && viewBox().isEmpty();
    200 }
    201 
    202179} // namespace WebCore
  • trunk/Source/WebCore/svg/SVGScriptElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2526#include "Event.h"
    2627#include "SVGAnimatedStaticPropertyTearOff.h"
    27 #include "XLinkNames.h"
    2828#include <wtf/IsoMallocInlines.h>
    2929
     
    3232WTF_MAKE_ISO_ALLOCATED_IMPL(SVGScriptElement);
    3333
    34 // Animated property definitions
    35 DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href)
    36 DEFINE_ANIMATED_BOOLEAN(SVGScriptElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    37 
    38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement)
    39     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    40     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    41 END_REGISTER_ANIMATED_PROPERTIES
    42 
    4334inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document& document, bool wasInsertedByParser, bool alreadyStarted)
    4435    : SVGElement(tagName, document)
     36    , SVGExternalResourcesRequired(this)
     37    , SVGURIReference(this)
    4538    , ScriptElement(*this, wasInsertedByParser, alreadyStarted)
    4639    , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired)
    4740{
    4841    ASSERT(hasTagName(SVGNames::scriptTag));
    49     registerAnimatedPropertiesForSVGScriptElement();
    5042}
    5143
     
    7163    }
    7264
    73     SVGExternalResourcesRequired::handleAttributeChange(this, attrName);
    7465    SVGElement::svgAttributeChanged(attrName);
     66    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    7567}
    7668
     
    7971    SVGElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
    8072    if (insertionType.connectedToDocument)
    81         SVGExternalResourcesRequired::insertedIntoDocument(this);
     73        SVGExternalResourcesRequired::insertedIntoDocument();
    8274    return ScriptElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
    8375}
     
    9486}
    9587
    96 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const
    97 {
    98     return attribute.name() == sourceAttributeValue();
    99 }
    100 
    10188void SVGScriptElement::finishParsingChildren()
    10289{
     
    11198    addSubresourceURL(urls, document().completeURL(href()));
    11299}
    113 
    114 String SVGScriptElement::sourceAttributeValue() const
    115 {
    116     return href();
    117 }
    118 
    119 String SVGScriptElement::charsetAttributeValue() const
    120 {
    121     return String();
    122 }
    123 
    124 String SVGScriptElement::typeAttributeValue() const
    125 {
    126     return getAttribute(SVGNames::typeAttr).string();
    127 }
    128 
    129 String SVGScriptElement::languageAttributeValue() const
    130 {
    131     return String();
    132 }
    133 
    134 String SVGScriptElement::forAttributeValue() const
    135 {
    136     return String();
    137 }
    138 
    139 String SVGScriptElement::eventAttributeValue() const
    140 {
    141     return String();
    142 }
    143 
    144 bool SVGScriptElement::hasAsyncAttribute() const
    145 {
    146     return false;
    147 }
    148 
    149 bool SVGScriptElement::hasDeferAttribute() const
    150 {
    151     return false;
    152 }
    153 
    154 bool SVGScriptElement::hasNoModuleAttribute() const
    155 {
    156     return false;
    157 }
    158 
    159 bool SVGScriptElement::hasSourceAttribute() const
    160 {
    161     return hasAttribute(XLinkNames::hrefAttr);
    162 }
    163 
    164100Ref<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren(Document& targetDocument)
    165101{
     
    167103}
    168104
    169 #ifndef NDEBUG
    170 bool SVGScriptElement::filterOutAnimatableAttribute(const QualifiedName& name) const
    171 {
    172     return name == SVGNames::typeAttr;
    173105}
    174 #endif
    175 
    176 }
  • trunk/Source/WebCore/svg/SVGScriptElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2008-2017 Apple Inc. All rights reserved.
     4 * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    2828#include "SVGURIReference.h"
    2929#include "ScriptElement.h"
     30#include "XLinkNames.h"
    3031
    3132namespace WebCore {
    3233
    33 class SVGScriptElement final : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired, public ScriptElement {
     34class SVGScriptElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference, public ScriptElement {
    3435    WTF_MAKE_ISO_ALLOCATED(SVGScriptElement);
    3536public:
     
    4243    SVGScriptElement(const QualifiedName&, Document&, bool wasInsertedByParser, bool alreadyStarted);
    4344
     45    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGScriptElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>;
     46
     47    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4448    void parseAttribute(const QualifiedName&, const AtomicString&) final;
     49    void svgAttributeChanged(const QualifiedName&) final;
     50
    4551    InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final;
    4652    void didFinishInsertingNode() final;
    4753    void childrenChanged(const ChildChange&) final;
    4854
    49     void svgAttributeChanged(const QualifiedName&) final;
    50     bool isURLAttribute(const Attribute&) const final;
     55    bool isURLAttribute(const Attribute& attribute) const final { return attribute.name() == sourceAttributeValue(); }
    5156    void finishParsingChildren() final;
    52 
    5357    void addSubresourceAttributeURLs(ListHashSet<URL>&) const final;
    5458
    5559    bool haveLoadedRequiredResources() final { return SVGExternalResourcesRequired::haveLoadedRequiredResources(); }
    5660
    57     String sourceAttributeValue() const final;
    58     String charsetAttributeValue() const final;
    59     String typeAttributeValue() const final;
    60     String languageAttributeValue() const final;
    61     String forAttributeValue() const final;
    62     String eventAttributeValue() const final;
    63     bool hasAsyncAttribute() const final;
    64     bool hasDeferAttribute() const final;
    65     bool hasNoModuleAttribute() const final;
    66     bool hasSourceAttribute() const final;
     61    String sourceAttributeValue() const final { return href(); }
     62    String charsetAttributeValue() const final { return String(); }
     63    String typeAttributeValue() const final { return getAttribute(SVGNames::typeAttr).string(); }
     64    String languageAttributeValue() const final { return String(); }
     65    String forAttributeValue() const final { return String(); }
     66    String eventAttributeValue() const final { return String(); }
     67    bool hasAsyncAttribute() const final { return false; }
     68    bool hasDeferAttribute() const final { return false; }
     69    bool hasNoModuleAttribute() const final { return false; }
     70    bool hasSourceAttribute() const final { return hasAttribute(XLinkNames::hrefAttr); }
    6771
    68     void dispatchLoadEvent() final { SVGExternalResourcesRequired::dispatchLoadEvent(this); }
     72    void dispatchLoadEvent() final { SVGExternalResourcesRequired::dispatchLoadEvent(); }
    6973
    7074    Ref<Element> cloneElementWithoutAttributesAndChildren(Document&) final;
     
    7882
    7983#ifndef NDEBUG
    80     bool filterOutAnimatableAttribute(const QualifiedName&) const final;
     84    bool filterOutAnimatableAttribute(const QualifiedName& name) const final { return name == SVGNames::typeAttr; }
    8185#endif
    8286
    83     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement)
    84         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    85         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    86     END_DECLARE_ANIMATED_PROPERTIES
    87 
     87    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    8888    Timer m_svgLoadEventTimer;
    8989};
  • trunk/Source/WebCore/svg/SVGStopElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3334WTF_MAKE_ISO_ALLOCATED_IMPL(SVGStopElement);
    3435
    35 // Animated property definitions
    36 DEFINE_ANIMATED_NUMBER(SVGStopElement, SVGNames::offsetAttr, Offset, offset)
    37 
    38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGStopElement)
    39     REGISTER_LOCAL_ANIMATED_PROPERTY(offset)
    40     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    41 END_REGISTER_ANIMATED_PROPERTIES
    42 
    4336inline SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document& document)
    4437    : SVGElement(tagName, document)
    45     , m_offset(0)
    4638{
    4739    ASSERT(hasTagName(SVGNames::stopTag));
    48     registerAnimatedPropertiesForSVGStopElement();
     40    registerAttributes();
    4941}
    5042
     
    5446}
    5547
     48void SVGStopElement::registerAttributes()
     49{
     50    auto& registry = attributeRegistry();
     51    if (!registry.isEmpty())
     52        return;
     53    registry.registerAttribute<SVGNames::offsetAttr, &SVGStopElement::m_offset>();
     54}
     55
    5656void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    5757{
    5858    if (name == SVGNames::offsetAttr) {
    5959        if (value.endsWith('%'))
    60             setOffsetBaseValue(value.string().left(value.length() - 1).toFloat() / 100.0f);
     60            m_offset.setValue(value.string().left(value.length() - 1).toFloat() / 100.0f);
    6161        else
    62             setOffsetBaseValue(value.toFloat());
     62            m_offset.setValue(value.toFloat());
    6363        return;
    6464    }
  • trunk/Source/WebCore/svg/SVGStopElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3334    Color stopColorIncludingOpacity() const;
    3435
     36    float offset() { return m_offset.currentValue(attributeOwnerProxy()); }
     37    RefPtr<SVGAnimatedNumber> offsetAnimated() { return m_offset.animatedProperty(attributeOwnerProxy()); }
     38
    3539private:
    3640    SVGStopElement(const QualifiedName&, Document&);
    3741
     42    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGStopElement, SVGElement>;
     43    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     44    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     45    static void registerAttributes();
     46
     47    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    3848    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    3949    void svgAttributeChanged(const QualifiedName&) final;
     
    4454    bool rendererIsNeeded(const RenderStyle&) final;
    4555
    46     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGStopElement)
    47         DECLARE_ANIMATED_NUMBER(Offset, offset)
    48     END_DECLARE_ANIMATED_PROPERTIES
     56    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     57    SVGAnimatedNumberAttribute m_offset { 0 };
    4958};
    5059
  • trunk/Source/WebCore/svg/SVGStringListValues.h

    r208863 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2223
    2324#include "QualifiedName.h"
     25#include "SVGAttributeAccessor.h"
    2426#include "SVGPropertyTraits.h"
     27
    2528#include <wtf/Vector.h>
    2629
     
    2932class SVGElement;
    3033class SVGStringList;
     34class SVGStringListValues;
    3135
    3236template<typename T>
    3337class SVGPropertyTearOff;
     38
     39using SVGStringListValuesAttribute = SVGPropertyAttribute<SVGStringListValues>;
     40
     41template<typename OwnerType>
     42using SVGStringListValuesAttributeAccessor = SVGPropertyAttributeAccessor<OwnerType, SVGStringListValuesAttribute>;
    3443
    3544class SVGStringListValues final : public Vector<String> {
     
    5362
    5463template<> struct SVGPropertyTraits<SVGStringListValues> {
     64    static String toString(const SVGStringListValues& list) { return list.valueAsString(); }
     65
    5566    using ListItemType = String;
    5667    using ListItemTearOff = SVGPropertyTearOff<String>;
  • trunk/Source/WebCore/svg/SVGSwitchElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3132WTF_MAKE_ISO_ALLOCATED_IMPL(SVGSwitchElement);
    3233
    33 // Animated property definitions
    34 DEFINE_ANIMATED_BOOLEAN(SVGSwitchElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    35 
    36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSwitchElement)
    37     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    38     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    39 END_REGISTER_ANIMATED_PROPERTIES
    40 
    4134inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document& document)
    4235    : SVGGraphicsElement(tagName, document)
     36    , SVGExternalResourcesRequired(this)
    4337{
    4438    ASSERT(hasTagName(SVGNames::switchTag));
    45     registerAnimatedPropertiesForSVGSwitchElement();
    4639}
    4740
  • trunk/Source/WebCore/svg/SVGSwitchElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3435private:
    3536    SVGSwitchElement(const QualifiedName&, Document&);
    36    
     37
     38    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSwitchElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
     39    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     40
    3741    bool isValid() const final { return SVGTests::isValid(); }
    3842
     
    4044    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
    4145
    42     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSwitchElement)
    43         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    44     END_DECLARE_ANIMATED_PROPERTIES
     46    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    4547};
    4648
  • trunk/Source/WebCore/svg/SVGSymbolElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3132WTF_MAKE_ISO_ALLOCATED_IMPL(SVGSymbolElement);
    3233
    33 // Animated property definitions
    34 DEFINE_ANIMATED_BOOLEAN(SVGSymbolElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    35 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSymbolElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)
    36 DEFINE_ANIMATED_RECT(SVGSymbolElement, SVGNames::viewBoxAttr, ViewBox, viewBox)
    37 
    38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement)
    39     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    40     REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
    41     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
    42     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    43 END_REGISTER_ANIMATED_PROPERTIES
    44 
    4534inline SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document& document)
    4635    : SVGElement(tagName, document)
     36    , SVGExternalResourcesRequired(this)
     37    , SVGFitToViewBox(this)
    4738{
    4839    ASSERT(hasTagName(SVGNames::symbolTag));
    49     registerAnimatedPropertiesForSVGSymbolElement();
    5040}
    5141
     
    5949    SVGElement::parseAttribute(name, value);
    6050    SVGExternalResourcesRequired::parseAttribute(name, value);
    61     SVGFitToViewBox::parseAttribute(this, name, value);
     51    SVGFitToViewBox::parseAttribute(name, value);
    6252}
    6353
    6454void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName)
    6555{
    66     if (attrName == SVGNames::viewBoxAttr) {
    67         InstanceInvalidationGuard guard(*this);
    68         updateRelativeLengthsInformation();
    69         return;
    70     }
    71 
    7256    SVGElement::svgAttributeChanged(attrName);
     57    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    7358}
    7459
  • trunk/Source/WebCore/svg/SVGSymbolElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3839    SVGSymbolElement(const QualifiedName&, Document&);
    3940
     41    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSymbolElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
     42    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
     43
    4044    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    4145    void svgAttributeChanged(const QualifiedName&) override;
     
    4448    bool selfHasRelativeLengths() const override;
    4549
    46     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSymbolElement)
    47         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    48         DECLARE_ANIMATED_RECT(ViewBox, viewBox)
    49         DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
    50     END_DECLARE_ANIMATED_PROPERTIES
     50    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    5151};
    5252
  • trunk/Source/WebCore/svg/SVGTRefElement.cpp

    r233366 r234620  
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
    44 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    4344WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTRefElement);
    4445
    45 // Animated property definitions
    46 DEFINE_ANIMATED_STRING(SVGTRefElement, XLinkNames::hrefAttr, Href, href)
    47 
    48 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTRefElement)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    50     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextPositioningElement)
    51 END_REGISTER_ANIMATED_PROPERTIES
    52 
    5346Ref<SVGTRefElement> SVGTRefElement::create(const QualifiedName& tagName, Document& document)
    5447{
     
    132125inline SVGTRefElement::SVGTRefElement(const QualifiedName& tagName, Document& document)
    133126    : SVGTextPositioningElement(tagName, document)
     127    , SVGURIReference(this)
    134128    , m_targetListener(SVGTRefTargetEventListener::create(*this))
    135129{
    136130    ASSERT(hasTagName(SVGNames::trefTag));
    137     registerAnimatedPropertiesForSVGTRefElement();
    138131}
    139132
  • trunk/Source/WebCore/svg/SVGTRefElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3940    virtual ~SVGTRefElement();
    4041
     42    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTRefElement, SVGTextPositioningElement, SVGURIReference>;
     43
     44    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    4145    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    4246    void svgAttributeChanged(const QualifiedName&) override;
     
    5155
    5256    void clearTarget() override;
    53 
    5457    void updateReferencedText(Element*);
    55 
    5658    void detachTarget();
    57 
    5859    void buildPendingResource() override;
    5960
    60     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTRefElement)
    61         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    62     END_DECLARE_ANIMATED_PROPERTIES
    63 
     61    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    6462    Ref<SVGTRefTargetEventListener> m_targetListener;
    6563};
  • trunk/Source/WebCore/svg/SVGTests.cpp

    r225117 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2015-2016 Apple Inc. All right reserved.
     4 * Copyright (C) 2015-2018 Apple Inc. All right reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    2525#include "DOMImplementation.h"
    2626#include "HTMLNames.h"
     27#include "SVGAttributeOwnerProxy.h"
    2728#include "SVGElement.h"
    2829#include "SVGNames.h"
     
    107108}
    108109
    109 SVGTests::SVGTests()
    110     : m_requiredFeatures(requiredFeaturesAttr)
    111     , m_requiredExtensions(requiredExtensionsAttr)
    112     , m_systemLanguage(systemLanguageAttr)
    113 {
    114 }
    115 
    116 static SVGPropertyInfo createSVGTestPropertyInfo(const QualifiedName& attributeName, SVGPropertyInfo::SynchronizeProperty synchronizeFunction)
    117 {
    118     return { AnimatedUnknown, PropertyIsReadWrite, attributeName, attributeName.localName(), synchronizeFunction, nullptr };
    119 }
    120 
    121 static SVGAttributeToPropertyMap createSVGTextAttributeToPropertyMap()
    122 {
    123     typedef NeverDestroyed<const SVGPropertyInfo> Info;
    124 
    125     SVGAttributeToPropertyMap map;
    126 
    127     static Info requiredFeatures = createSVGTestPropertyInfo(requiredFeaturesAttr, SVGElement::synchronizeRequiredFeatures);
    128     map.addProperty(requiredFeatures.get());
    129 
    130     static Info requiredExtensions = createSVGTestPropertyInfo(requiredExtensionsAttr, SVGElement::synchronizeRequiredExtensions);
    131     map.addProperty(requiredExtensions.get());
    132 
    133     static Info systemLanguage = createSVGTestPropertyInfo(systemLanguageAttr, SVGElement::synchronizeSystemLanguage);
    134     map.addProperty(systemLanguage.get());
    135 
    136     return map;
    137 }
    138 
    139 const SVGAttributeToPropertyMap& SVGTests::attributeToPropertyMap()
    140 {
    141     static NeverDestroyed<SVGAttributeToPropertyMap> map = createSVGTextAttributeToPropertyMap();
    142     return map;
     110SVGTests::SVGTests(SVGElement* contextElement)
     111    : m_contextElement(*contextElement)
     112{
     113    registerAttributes();
     114}
     115
     116void SVGTests::registerAttributes()
     117{
     118    auto& registry = attributeRegistry();
     119    if (!registry.isEmpty())
     120        return;
     121    registry.registerAttribute<SVGNames::requiredFeaturesAttr, &SVGTests::m_requiredFeatures>();
     122    registry.registerAttribute<SVGNames::requiredExtensionsAttr, &SVGTests::m_requiredExtensions>();
     123    registry.registerAttribute<SVGNames::systemLanguageAttr, &SVGTests::m_systemLanguage>();
     124}
     125
     126SVGTests::AttributeRegistry& SVGTests::attributeRegistry()
     127{
     128    return AttributeOwnerProxy::attributeRegistry();
     129}
     130
     131bool SVGTests::isKnownAttribute(const QualifiedName& attributeName)
     132{
     133    return AttributeOwnerProxy::isKnownAttribute(attributeName);
    143134}
    144135
     
    155146bool SVGTests::isValid() const
    156147{
    157     for (auto& feature : m_requiredFeatures.value) {
     148    for (auto& feature : m_requiredFeatures.value()) {
    158149        if (feature.isEmpty() || !supportedSVGFeatures().contains(feature))
    159150            return false;
    160151    }
    161     for (auto& language : m_systemLanguage.value) {
     152    for (auto& language : m_systemLanguage.value()) {
    162153        if (language != defaultLanguage().substring(0, 2))
    163154            return false;
    164155    }
    165     for (auto& extension : m_requiredExtensions.value) {
     156    for (auto& extension : m_requiredExtensions.value()) {
    166157        if (!hasExtension(extension))
    167158            return false;
     
    173164{
    174165    if (attributeName == requiredFeaturesAttr)
    175         m_requiredFeatures.value.reset(value);
     166        m_requiredFeatures.value().reset(value);
    176167    if (attributeName == requiredExtensionsAttr)
    177         m_requiredExtensions.value.reset(value);
     168        m_requiredExtensions.value().reset(value);
    178169    if (attributeName == systemLanguageAttr)
    179         m_systemLanguage.value.reset(value);
    180 }
    181 
    182 bool SVGTests::isKnownAttribute(const QualifiedName& attributeName)
    183 {
    184     return attributeName == requiredFeaturesAttr
    185         || attributeName == requiredExtensionsAttr
    186         || attributeName == systemLanguageAttr;
    187 }
    188 
    189 bool SVGTests::handleAttributeChange(SVGElement* targetElement, const QualifiedName& attributeName)
    190 {
    191     ASSERT(targetElement);
    192     if (!isKnownAttribute(attributeName))
    193         return false;
    194     if (!targetElement->isConnected())
    195         return true;
    196     targetElement->invalidateStyleAndRenderersForSubtree();
    197     return true;
     170        m_systemLanguage.value().reset(value);
     171}
     172
     173void SVGTests::svgAttributeChanged(const QualifiedName& attrName)
     174{
     175    if (!isKnownAttribute(attrName))
     176        return;
     177
     178    if (!m_contextElement.isConnected())
     179        return;
     180    m_contextElement.invalidateStyleAndRenderersForSubtree();
    198181}
    199182
     
    205188}
    206189
    207 void SVGTests::synchronizeAttribute(SVGElement& contextElement, SVGSynchronizableAnimatedProperty<SVGStringListValues>& property, const QualifiedName& attributeName)
    208 {
    209     if (!property.shouldSynchronize)
    210         return;
    211     m_requiredFeatures.synchronize(&contextElement, attributeName, property.value.valueAsString());
    212 }
    213 
    214 void SVGTests::synchronizeRequiredFeatures(SVGElement& contextElement)
    215 {
    216     synchronizeAttribute(contextElement, m_requiredFeatures, requiredFeaturesAttr);
    217 }
    218 
    219 void SVGTests::synchronizeRequiredExtensions(SVGElement& contextElement)
    220 {
    221     synchronizeAttribute(contextElement, m_requiredExtensions, requiredExtensionsAttr);
    222 }
    223 
    224 void SVGTests::synchronizeSystemLanguage(SVGElement& contextElement)
    225 {
    226     synchronizeAttribute(contextElement, m_systemLanguage, systemLanguageAttr);
    227 }
    228 
    229 Ref<SVGStringList> SVGTests::requiredFeatures(SVGElement& contextElement)
    230 {
    231     m_requiredFeatures.shouldSynchronize = true;
    232     return SVGStringList::create(contextElement, m_requiredFeatures.value);
    233 }
    234 
    235 Ref<SVGStringList> SVGTests::requiredExtensions(SVGElement& contextElement)
    236 {
    237     m_requiredExtensions.shouldSynchronize = true;   
    238     return SVGStringList::create(contextElement, m_requiredExtensions.value);
    239 }
    240 
    241 Ref<SVGStringList> SVGTests::systemLanguage(SVGElement& contextElement)
    242 {
    243     m_systemLanguage.shouldSynchronize = true;
    244     return SVGStringList::create(contextElement, m_systemLanguage.value);
     190Ref<SVGStringList> SVGTests::requiredFeatures()
     191{
     192    m_requiredFeatures.setShouldSynchronize(true);
     193    return SVGStringList::create(m_contextElement, m_requiredFeatures.value());
     194}
     195
     196Ref<SVGStringList> SVGTests::requiredExtensions()
     197{
     198    m_requiredExtensions.setShouldSynchronize(true);
     199    return SVGStringList::create(m_contextElement, m_requiredExtensions.value());
     200}
     201
     202Ref<SVGStringList> SVGTests::systemLanguage()
     203{
     204    m_systemLanguage.setShouldSynchronize(true);
     205    return SVGStringList::create(m_contextElement, m_systemLanguage.value());
    245206}
    246207
  • trunk/Source/WebCore/svg/SVGTests.h

    r208863 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2010 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2122#pragma once
    2223
    23 #include "SVGAnimatedPropertyMacros.h"
     24#include "SVGAttribute.h"
    2425#include "SVGStringListValues.h"
    2526
     
    2930class SVGStringList;
    3031
     32template<typename OwnerType, typename... BaseTypes>
     33class SVGAttributeRegistry;
     34
     35template<typename OwnerType, typename... BaseTypes>
     36class SVGAttributeOwnerProxyImpl;
     37
    3138class SVGTests {
     39    WTF_MAKE_NONCOPYABLE(SVGTests);
    3240public:
    3341    static bool hasExtension(const String&);
    3442    bool isValid() const;
    3543
     44    using AttributeRegistry = SVGAttributeRegistry<SVGTests>;
     45    static AttributeRegistry& attributeRegistry();
     46    static bool isKnownAttribute(const QualifiedName& attributeName);
     47
    3648    void parseAttribute(const QualifiedName&, const AtomicString&);
     49    void svgAttributeChanged(const QualifiedName&);
    3750
    38     static bool isKnownAttribute(const QualifiedName&);
    3951    static void addSupportedAttributes(HashSet<QualifiedName>&);
    40 
    41     static bool handleAttributeChange(SVGElement*, const QualifiedName&);
    42 
    43     static const SVGAttributeToPropertyMap& attributeToPropertyMap();
    4452
    4553    WEBCORE_EXPORT static bool hasFeatureForLegacyBindings(const String& feature, const String& version);
    4654
     55    // These methods are called from DOM through the super classes.
     56    Ref<SVGStringList> requiredFeatures();
     57    Ref<SVGStringList> requiredExtensions();
     58    Ref<SVGStringList> systemLanguage();
     59
    4760protected:
    48     SVGTests();
    49 
    50     Ref<SVGStringList> requiredFeatures(SVGElement&);
    51     Ref<SVGStringList> requiredExtensions(SVGElement&);
    52     Ref<SVGStringList> systemLanguage(SVGElement&);
    53 
    54     void synchronizeRequiredFeatures(SVGElement&);
    55     void synchronizeRequiredExtensions(SVGElement&);
    56     void synchronizeSystemLanguage(SVGElement&);
     61    SVGTests(SVGElement* contextElement);
    5762
    5863private:
    59     void synchronizeAttribute(SVGElement& contextElement, SVGSynchronizableAnimatedProperty<SVGStringListValues>&, const QualifiedName& attributeName);
     64    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTests>;
     65    static void registerAttributes();
    6066
    61     SVGSynchronizableAnimatedProperty<SVGStringListValues> m_requiredFeatures;
    62     SVGSynchronizableAnimatedProperty<SVGStringListValues> m_requiredExtensions;
    63     SVGSynchronizableAnimatedProperty<SVGStringListValues> m_systemLanguage;
     67    SVGElement& m_contextElement;
     68    SVGStringListValuesAttribute m_requiredFeatures { SVGNames::requiredFeaturesAttr };
     69    SVGStringListValuesAttribute m_requiredExtensions { SVGNames::requiredExtensionsAttr };
     70    SVGStringListValuesAttribute m_systemLanguage { SVGNames::systemLanguageAttr };
    6471};
    6572
  • trunk/Source/WebCore/svg/SVGTextContentElement.cpp

    r231266 r234620  
    22 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    4344WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextContentElement);
    4445 
    45 // Define custom animated property 'textLength'.
    46 const SVGPropertyInfo* SVGTextContentElement::textLengthPropertyInfo()
    47 {
    48     static const SVGPropertyInfo* s_propertyInfo = nullptr;
    49     if (!s_propertyInfo) {
    50         s_propertyInfo = new SVGPropertyInfo(AnimatedLength,
    51             PropertyIsReadWrite,
    52             SVGNames::textLengthAttr,
    53             SVGNames::textLengthAttr->localName(),
    54             &SVGTextContentElement::synchronizeTextLength,
    55             &SVGTextContentElement::lookupOrCreateTextLengthWrapper);
    56     }
    57     return s_propertyInfo;
    58 }
    59 
    60 // Animated property definitions
    61 DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, LengthAdjust, lengthAdjust, SVGLengthAdjustType)
    62 DEFINE_ANIMATED_BOOLEAN(SVGTextContentElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    63 
    64 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextContentElement)
    65     REGISTER_LOCAL_ANIMATED_PROPERTY(textLength)
    66     REGISTER_LOCAL_ANIMATED_PROPERTY(lengthAdjust)
    67     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    68     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    69 END_REGISTER_ANIMATED_PROPERTIES
    70 
    7146SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Document& document)
    7247    : SVGGraphicsElement(tagName, document)
    73     , m_textLength(LengthModeOther)
    74     , m_specifiedTextLength(LengthModeOther)
    75     , m_lengthAdjust(SVGLengthAdjustSpacing)
    76 {
    77     registerAnimatedPropertiesForSVGTextContentElement();
    78 }
    79 
    80 void SVGTextContentElement::synchronizeTextLength(SVGElement* contextElement)
    81 {
    82     ASSERT(contextElement);
    83     SVGTextContentElement& ownerType = downcast<SVGTextContentElement>(*contextElement);
    84     if (!ownerType.m_textLength.shouldSynchronize)
    85         return;
    86     AtomicString value(SVGPropertyTraits<SVGLengthValue>::toString(ownerType.m_specifiedTextLength));
    87     ownerType.m_textLength.synchronize(&ownerType, textLengthPropertyInfo()->attributeName, value);
    88 }
    89 
    90 Ref<SVGAnimatedProperty> SVGTextContentElement::lookupOrCreateTextLengthWrapper(SVGElement* contextElement)
    91 {
    92     ASSERT(contextElement);
    93     SVGTextContentElement& ownerType = downcast<SVGTextContentElement>(*contextElement);
    94     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGTextContentElement, SVGAnimatedLength, SVGLengthValue>
    95         (&ownerType, textLengthPropertyInfo(), ownerType.m_textLength.value);
    96 }
    97 
    98 Ref<SVGAnimatedLength> SVGTextContentElement::textLengthAnimated()
    99 {
    100     static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther);
    101     if (m_specifiedTextLength == defaultTextLength)
    102         m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength());
    103 
    104     m_textLength.shouldSynchronize = true;
    105     return static_reference_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this));
     48    , SVGExternalResourcesRequired(this)
     49{
     50    registerAttributes();
    10651}
    10752
     
    192137
    193138    return { };
    194 }
    195 
    196 bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName)
    197 {
    198     static const auto supportedAttributes = makeNeverDestroyed([] {
    199         HashSet<QualifiedName> set;
    200         SVGLangSpace::addSupportedAttributes(set);
    201         SVGExternalResourcesRequired::addSupportedAttributes(set);
    202         set.add({ SVGNames::lengthAdjustAttr.get(), SVGNames::textLengthAttr.get() });
    203         return set;
    204     }());
    205     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
    206139}
    207140
     
    226159}
    227160
     161void SVGTextContentElement::registerAttributes()
     162{
     163    auto& registry = attributeRegistry();
     164    if (!registry.isEmpty())
     165        return;
     166    registry.registerAttribute(SVGAnimatedCustomLengthAttributeAccessor::singleton<SVGNames::textLengthAttr, &SVGTextContentElement::m_textLength>());
     167    registry.registerAttribute<SVGNames::lengthAdjustAttr, SVGLengthAdjustType, &SVGTextContentElement::m_lengthAdjust>();
     168}
     169
    228170void SVGTextContentElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    229171{
     
    233175        auto propertyValue = SVGPropertyTraits<SVGLengthAdjustType>::fromString(value);
    234176        if (propertyValue > 0)
    235             setLengthAdjustBaseValue(propertyValue);
     177            m_lengthAdjust.setValue(propertyValue);
    236178    } else if (name == SVGNames::textLengthAttr)
    237         m_textLength.value = SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths);
     179        m_textLength.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
    238180
    239181    reportAttributeParsingError(parseError, name, value);
     
    245187void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName)
    246188{
    247     if (!isSupportedAttribute(attrName)) {
    248         SVGGraphicsElement::svgAttributeChanged(attrName);
     189    if (isKnownAttribute(attrName)) {
     190        if (attrName == SVGNames::textLengthAttr)
     191            m_specifiedTextLength = m_textLength.value();
     192
     193        if (auto renderer = this->renderer()) {
     194            InstanceInvalidationGuard guard(*this);
     195            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     196        }
    249197        return;
    250198    }
    251199
    252     if (attrName == SVGNames::textLengthAttr)
    253         m_specifiedTextLength = m_textLength.value;
    254 
    255     if (auto renderer = this->renderer()) {
    256         InstanceInvalidationGuard guard(*this);
    257         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    258     }
     200    SVGGraphicsElement::svgAttributeChanged(attrName);
     201    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    259202}
    260203
  • trunk/Source/WebCore/svg/SVGTextContentElement.h

    r233122 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    8586
    8687    static SVGTextContentElement* elementFromRenderer(RenderObject*);
     88    const SVGLengthValue& specifiedTextLength() { return m_specifiedTextLength; }
    8789
    88     // textLength is not declared using the standard DECLARE_ANIMATED_LENGTH macro
    89     // as its getter needs special handling (return getComputedTextLength(), instead of m_textLength).
    90     SVGLengthValue& specifiedTextLength() { return m_specifiedTextLength; }
    91     Ref<SVGAnimatedLength> textLengthAnimated();
    92     static const SVGPropertyInfo* textLengthPropertyInfo();
     90    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
     91    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     92
     93    const SVGLengthValue& textLength() const { return m_textLength.currentValue(attributeOwnerProxy()); }
     94    SVGLengthAdjustType lengthAdjust() const { return m_lengthAdjust.currentValue(attributeOwnerProxy()); }
     95
     96    RefPtr<SVGAnimatedLength> textLengthAnimated() { return m_textLength.animatedProperty(attributeOwnerProxy()); }
     97    RefPtr<SVGAnimatedEnumeration> lengthAdjustAnimated() { return m_lengthAdjust.animatedProperty(attributeOwnerProxy()); }
    9398
    9499protected:
     
    106111private:
    107112    bool isTextContent() const final { return true; }
     113    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
    108114
    109     static bool isSupportedAttribute(const QualifiedName&);
     115    static void registerAttributes();
     116    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
    110117
    111     // Custom 'textLength' property
    112     static void synchronizeTextLength(SVGElement* contextElement);
    113     static Ref<SVGAnimatedProperty> lookupOrCreateTextLengthWrapper(SVGElement* contextElement);
    114     mutable SVGSynchronizableAnimatedProperty<SVGLengthValue> m_textLength;
    115     SVGLengthValue m_specifiedTextLength;
    116  
    117     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement)
    118         DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjustType)
    119         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    120     END_DECLARE_ANIMATED_PROPERTIES
     118    class SVGAnimatedCustomLengthAttribute : public SVGAnimatedLengthAttribute {
     119    public:
     120        using SVGAnimatedLengthAttribute::operator=;
     121
     122        SVGAnimatedCustomLengthAttribute(SVGTextContentElement& element, SVGLengthMode lengthMode)
     123            : SVGAnimatedLengthAttribute(lengthMode)
     124            , m_element(element)
     125        {
     126        }
     127
     128        void synchronize(Element&, const QualifiedName& attributeName)
     129        {
     130            if (!shouldSynchronize())
     131                return;
     132            String string(SVGPropertyTraits<SVGLengthValue>::toString(m_element.m_specifiedTextLength));
     133            static_cast<Element&>(m_element).setSynchronizedLazyAttribute(attributeName, string);
     134        }
     135
     136        RefPtr<SVGAnimatedLength> animatedProperty(const SVGAttributeOwnerProxy& attributeOwnerProxy)
     137        {
     138            static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther);
     139            if (m_element.m_specifiedTextLength == defaultTextLength)
     140                m_element.m_textLength.value().newValueSpecifiedUnits(LengthTypeNumber, m_element.getComputedTextLength());
     141
     142            setShouldSynchronize(true);
     143            return static_reference_cast<SVGAnimatedLength>(attributeOwnerProxy.lookupOrCreateAnimatedProperty(*this).releaseNonNull());
     144        }
     145
     146    private:
     147        SVGTextContentElement& m_element;
     148    };
     149
     150    using SVGAnimatedCustomLengthAttributeAccessor = SVGAnimatedAttributeAccessor<SVGTextContentElement, SVGAnimatedCustomLengthAttribute, AnimatedLength>;
     151
     152    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     153    SVGAnimatedCustomLengthAttribute m_textLength { *this, LengthModeOther };
     154    SVGAnimatedEnumerationAttribute<SVGLengthAdjustType> m_lengthAdjust { SVGLengthAdjustSpacing };
     155    SVGLengthValue m_specifiedTextLength { LengthModeOther };
    121156};
    122157
  • trunk/Source/WebCore/svg/SVGTextPathElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3435WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextPathElement);
    3536
    36 // Animated property definitions
    37 DEFINE_ANIMATED_LENGTH(SVGTextPathElement, SVGNames::startOffsetAttr, StartOffset, startOffset)
    38 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::methodAttr, Method, method, SVGTextPathMethodType)
    39 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::spacingAttr, Spacing, spacing, SVGTextPathSpacingType)
    40 DEFINE_ANIMATED_STRING(SVGTextPathElement, XLinkNames::hrefAttr, Href, href)
    41 
    42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPathElement)
    43     REGISTER_LOCAL_ANIMATED_PROPERTY(startOffset)
    44     REGISTER_LOCAL_ANIMATED_PROPERTY(method)
    45     REGISTER_LOCAL_ANIMATED_PROPERTY(spacing)
    46     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    47     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement)
    48 END_REGISTER_ANIMATED_PROPERTIES
    49 
    5037inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document& document)
    5138    : SVGTextContentElement(tagName, document)
    52     , m_startOffset(LengthModeOther)
    53     , m_method(SVGTextPathMethodAlign)
    54     , m_spacing(SVGTextPathSpacingExact)
     39    , SVGURIReference(this)
    5540{
    5641    ASSERT(hasTagName(SVGNames::textPathTag));
    57     registerAnimatedPropertiesForSVGTextPathElement();
     42    registerAttributes();
    5843}
    5944
     
    7358}
    7459
    75 bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName)
     60void SVGTextPathElement::registerAttributes()
    7661{
    77     static const auto supportedAttributes = makeNeverDestroyed([] {
    78         HashSet<QualifiedName> set;
    79         SVGURIReference::addSupportedAttributes(set);
    80         set.add({ SVGNames::startOffsetAttr.get(), SVGNames::methodAttr.get(), SVGNames::spacingAttr.get() });
    81         return set;
    82     }());
    83     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
     62    auto& registry = attributeRegistry();
     63    if (!registry.isEmpty())
     64        return;
     65    registry.registerAttribute<SVGNames::startOffsetAttr, &SVGTextPathElement::m_startOffset>();
     66    registry.registerAttribute<SVGNames::methodAttr, SVGTextPathMethodType, &SVGTextPathElement::m_method>();
     67    registry.registerAttribute<SVGNames::spacingAttr, SVGTextPathSpacingType, &SVGTextPathElement::m_spacing>();
    8468}
    8569
     
    8973
    9074    if (name == SVGNames::startOffsetAttr)
    91         setStartOffsetBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError));
     75        m_startOffset.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError));
    9276    else if (name == SVGNames::methodAttr) {
    9377        SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value);
    9478        if (propertyValue > 0)
    95             setMethodBaseValue(propertyValue);
     79            m_method.setValue(propertyValue);
    9680    } else if (name == SVGNames::spacingAttr) {
    9781        SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpacingType>::fromString(value);
    9882        if (propertyValue > 0)
    99             setSpacingBaseValue(propertyValue);
     83            m_spacing.setValue(propertyValue);
    10084    }
    10185
     
    10892void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName)
    10993{
    110     if (!isSupportedAttribute(attrName)) {
    111         SVGTextContentElement::svgAttributeChanged(attrName);
     94    if (isKnownAttribute(attrName)) {
     95        InstanceInvalidationGuard guard(*this);
     96
     97        if (attrName == SVGNames::startOffsetAttr)
     98            updateRelativeLengthsInformation();
     99
     100        if (auto renderer = this->renderer())
     101            RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    112102        return;
    113103    }
    114 
    115     InstanceInvalidationGuard guard(*this);
    116104
    117105    if (SVGURIReference::isKnownAttribute(attrName)) {
     
    120108    }
    121109
    122     if (attrName == SVGNames::startOffsetAttr)
    123         updateRelativeLengthsInformation();
    124 
    125     if (auto renderer = this->renderer())
    126         RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
     110    SVGTextContentElement::svgAttributeChanged(attrName);
    127111}
    128112
  • trunk/Source/WebCore/svg/SVGTextPathElement.h

    r233122 r234620  
    11/*
    22 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    111112    static Ref<SVGTextPathElement> create(const QualifiedName&, Document&);
    112113
     114    const SVGLengthValue& startOffset() const { return m_startOffset.currentValue(attributeOwnerProxy()); }
     115    SVGTextPathMethodType method() const { return m_method.currentValue(attributeOwnerProxy()); }
     116    SVGTextPathSpacingType spacing() const { return m_spacing.currentValue(attributeOwnerProxy()); }
     117
     118    RefPtr<SVGAnimatedLength> startOffsetAnimated() { return m_startOffset.animatedProperty(attributeOwnerProxy()); }
     119    RefPtr<SVGAnimatedEnumeration> methodAnimated() { return m_method.animatedProperty(attributeOwnerProxy()); }
     120    RefPtr<SVGAnimatedEnumeration> spacingAnimated() { return m_spacing.animatedProperty(attributeOwnerProxy()); }
     121
    113122protected:
    114123    void didFinishInsertingNode() override;
     
    116125private:
    117126    SVGTextPathElement(const QualifiedName&, Document&);
    118 
    119127    virtual ~SVGTextPathElement();
    120128
    121     void clearResourceReferences();
     129    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPathElement, SVGTextContentElement, SVGURIReference>;
     130    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     131    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     132    static void registerAttributes();
    122133
    123     void buildPendingResource() override;
    124     InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override;
    125     void removedFromAncestor(RemovalType, ContainerNode&) override;
    126 
    127     static bool isSupportedAttribute(const QualifiedName&);
     134    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    128135    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    129136    void svgAttributeChanged(const QualifiedName&) override;
     
    133140    bool rendererIsNeeded(const RenderStyle&) override;
    134141
     142    void clearResourceReferences();
     143    void buildPendingResource() override;
     144    InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override;
     145    void removedFromAncestor(RemovalType, ContainerNode&) override;
     146
    135147    bool selfHasRelativeLengths() const override;
    136  
    137     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPathElement)
    138         DECLARE_ANIMATED_LENGTH(StartOffset, startOffset)
    139         DECLARE_ANIMATED_ENUMERATION(Method, method, SVGTextPathMethodType)
    140         DECLARE_ANIMATED_ENUMERATION(Spacing, spacing, SVGTextPathSpacingType)
    141         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    142     END_DECLARE_ANIMATED_PROPERTIES
     148
     149    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     150    SVGAnimatedLengthAttribute m_startOffset { LengthModeOther };
     151    SVGAnimatedEnumerationAttribute<SVGTextPathMethodType> m_method { SVGTextPathMethodAlign };
     152    SVGAnimatedEnumerationAttribute<SVGTextPathSpacingType> m_spacing { SVGTextPathSpacingExact };
    143153};
    144154
  • trunk/Source/WebCore/svg/SVGTextPositioningElement.cpp

    r229694 r234620  
    33 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
    44 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
     5 * Copyright (C) 2018 Apple Inc. All rights reserved.
    56 *
    67 * This library is free software; you can redistribute it and/or
     
    3940WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextPositioningElement);
    4041
    41 // Animated property definitions
    42 DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::xAttr, X, x)
    43 DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::yAttr, Y, y)
    44 DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::dxAttr, Dx, dx)
    45 DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::dyAttr, Dy, dy)
    46 DEFINE_ANIMATED_NUMBER_LIST(SVGTextPositioningElement, SVGNames::rotateAttr, Rotate, rotate)
    47 
    48 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPositioningElement)
    49     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    50     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    51     REGISTER_LOCAL_ANIMATED_PROPERTY(dx)
    52     REGISTER_LOCAL_ANIMATED_PROPERTY(dy)
    53     REGISTER_LOCAL_ANIMATED_PROPERTY(rotate)
    54     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement)
    55 END_REGISTER_ANIMATED_PROPERTIES
    56 
    5742SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document& document)
    5843    : SVGTextContentElement(tagName, document)
    5944{
    60     registerAnimatedPropertiesForSVGTextPositioningElement();
     45    registerAttributes();
     46}
     47
     48void SVGTextPositioningElement::registerAttributes()
     49{
     50    auto& registry = attributeRegistry();
     51    if (!registry.isEmpty())
     52        return;
     53    registry.registerAttribute<SVGNames::xAttr, &SVGTextPositioningElement::m_x>();
     54    registry.registerAttribute<SVGNames::yAttr, &SVGTextPositioningElement::m_y>();
     55    registry.registerAttribute<SVGNames::dxAttr, &SVGTextPositioningElement::m_dx>();
     56    registry.registerAttribute<SVGNames::dyAttr, &SVGTextPositioningElement::m_dy>();
     57    registry.registerAttribute<SVGNames::rotateAttr, &SVGTextPositioningElement::m_rotate>();
    6158}
    6259
     
    6663        SVGLengthListValues newList;
    6764        newList.parse(value, LengthModeWidth);
    68         detachAnimatedXListWrappers(newList.size());
    69         setXBaseValue(newList);
     65        m_x.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     66        m_x.setValue(WTFMove(newList));
    7067        return;
    7168    }
     
    7471        SVGLengthListValues newList;
    7572        newList.parse(value, LengthModeHeight);
    76         detachAnimatedYListWrappers(newList.size());
    77         setYBaseValue(newList);
     73        m_y.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     74        m_y.setValue(WTFMove(newList));
    7875        return;
    7976    }
     
    8279        SVGLengthListValues newList;
    8380        newList.parse(value, LengthModeWidth);
    84         detachAnimatedDxListWrappers(newList.size());
    85         setDxBaseValue(newList);
     81        m_dx.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     82        m_dx.setValue(WTFMove(newList));
    8683        return;
    8784    }
     
    9087        SVGLengthListValues newList;
    9188        newList.parse(value, LengthModeHeight);
    92         detachAnimatedDyListWrappers(newList.size());
    93         setDyBaseValue(newList);
     89        m_dy.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     90        m_dy.setValue(WTFMove(newList));
    9491        return;
    9592    }
     
    9895        SVGNumberListValues newList;
    9996        newList.parse(value);
    100         detachAnimatedRotateListWrappers(newList.size());
    101         setRotateBaseValue(newList);
     97        m_rotate.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
     98        m_rotate.setValue(WTFMove(newList));
    10299        return;
    103100    }
     
    122119void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrName)
    123120{
    124     if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr || attrName == SVGNames::rotateAttr) {
     121    if (isKnownAttribute(attrName)) {
    125122        InstanceInvalidationGuard guard(*this);
    126123
  • trunk/Source/WebCore/svg/SVGTextPositioningElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3233    static SVGTextPositioningElement* elementFromRenderer(RenderBoxModelObject&);
    3334
     35    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPositioningElement, SVGTextContentElement>;
     36    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     37
     38    const SVGLengthListValues& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     39    const SVGLengthListValues& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     40    const SVGLengthListValues& dx() const { return m_dx.currentValue(attributeOwnerProxy()); }
     41    const SVGLengthListValues& dy() const { return m_dy.currentValue(attributeOwnerProxy()); }
     42    const SVGNumberListValues& rotate() const { return m_rotate.currentValue(attributeOwnerProxy()); }
     43
     44    RefPtr<SVGAnimatedLengthList> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     45    RefPtr<SVGAnimatedLengthList> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     46    RefPtr<SVGAnimatedLengthList> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); }
     47    RefPtr<SVGAnimatedLengthList> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); }
     48    RefPtr<SVGAnimatedNumberList> rotateAnimated() { return m_rotate.animatedProperty(attributeOwnerProxy()); }
     49
    3450protected:
    3551    SVGTextPositioningElement(const QualifiedName&, Document&);
     
    4258    void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) final;
    4359
    44     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPositioningElement)
    45         DECLARE_ANIMATED_LENGTH_LIST(X, x)
    46         DECLARE_ANIMATED_LENGTH_LIST(Y, y)
    47         DECLARE_ANIMATED_LENGTH_LIST(Dx, dx)
    48         DECLARE_ANIMATED_LENGTH_LIST(Dy, dy)
    49         DECLARE_ANIMATED_NUMBER_LIST(Rotate, rotate)
    50     END_DECLARE_ANIMATED_PROPERTIES
     60    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
     61
     62    static void registerAttributes();
     63    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     64
     65    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     66    SVGAnimatedLengthListAttribute m_x;
     67    SVGAnimatedLengthListAttribute m_y;
     68    SVGAnimatedLengthListAttribute m_dx;
     69    SVGAnimatedLengthListAttribute m_dy;
     70    SVGAnimatedNumberListAttribute m_rotate;
    5171};
    5272
  • trunk/Source/WebCore/svg/SVGURIReference.cpp

    r204247 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2425#include "Document.h"
    2526#include "Element.h"
     27#include "SVGAttributeOwnerProxy.h"
    2628#include "URL.h"
    2729#include "XLinkNames.h"
     
    2931namespace WebCore {
    3032
     33SVGURIReference::SVGURIReference(SVGElement* contextElement)
     34    : m_attributeOwnerProxy(std::make_unique<AttributeOwnerProxy>(*this, *contextElement))
     35{
     36    registerAttributes();
     37}
     38
     39void SVGURIReference::registerAttributes()
     40{
     41    auto& registry = attributeRegistry();
     42    if (!registry.isEmpty())
     43        return;
     44    registry.registerAttribute<XLinkNames::hrefAttr, &SVGURIReference::m_href>();
     45}
     46
     47SVGURIReference::AttributeRegistry& SVGURIReference::attributeRegistry()
     48{
     49    return AttributeOwnerProxy::attributeRegistry();
     50}
     51
     52bool SVGURIReference::isKnownAttribute(const QualifiedName& attributeName)
     53{
     54    return AttributeOwnerProxy::isKnownAttribute(attributeName);
     55}
     56
    3157void SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value)
    3258{
    3359    if (name.matches(XLinkNames::hrefAttr))
    34         setHrefBaseValue(value);
     60        m_href.setValue(value);
    3561}
    3662
    37 bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName)
     63const String& SVGURIReference::href() const
    3864{
    39     return attrName.matches(XLinkNames::hrefAttr);
     65    return m_href.currentValue(*m_attributeOwnerProxy);
     66}
     67
     68RefPtr<SVGAnimatedString> SVGURIReference::hrefAnimated()
     69{
     70    return m_href.animatedProperty(*m_attributeOwnerProxy);
    4071}
    4172
     
    99130}
    100131
    101 void SVGURIReference::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes)
    102 {
    103     supportedAttributes.add(XLinkNames::hrefAttr);
    104132}
    105 
    106 }
  • trunk/Source/WebCore/svg/SVGURIReference.h

    r223728 r234620  
    22 * Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2324#include "Document.h"
    2425#include "QualifiedName.h"
     26#include "SVGAnimatedString.h"
    2527
    2628namespace WebCore {
    2729
     30template<typename OwnerType, typename... BaseTypes>
     31class SVGAttributeRegistry;
     32
     33template<typename OwnerType, typename... BaseTypes>
     34class SVGAttributeOwnerProxyImpl;
     35
    2836class SVGURIReference {
     37    WTF_MAKE_NONCOPYABLE(SVGURIReference);
    2938public:
    3039    virtual ~SVGURIReference() = default;
    3140
    3241    void parseAttribute(const QualifiedName&, const AtomicString&);
    33     static bool isKnownAttribute(const QualifiedName&);
    34     static void addSupportedAttributes(HashSet<QualifiedName>&);
    3542
    3643    static String fragmentIdentifierFromIRIString(const String&, const Document&);
     
    4956    }
    5057
     58    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGURIReference>;
     59    using AttributeRegistry = SVGAttributeRegistry<SVGURIReference>;
     60    static AttributeRegistry& attributeRegistry();
     61
     62    const String& href() const;
     63    RefPtr<SVGAnimatedString> hrefAnimated();
     64
    5165protected:
    52     virtual String& hrefBaseValue() const = 0;
    53     virtual void setHrefBaseValue(const String&, const bool validValue = true) = 0;
     66    SVGURIReference(SVGElement* contextElement);
     67
     68    static bool isKnownAttribute(const QualifiedName& attributeName);
     69
     70private:
     71    static void registerAttributes();
     72
     73    std::unique_ptr<AttributeOwnerProxy> m_attributeOwnerProxy;
     74    SVGAnimatedStringAttribute m_href;
    5475};
    5576
  • trunk/Source/WebCore/svg/SVGUseElement.cpp

    r233366 r234620  
    66 * Copyright (C) 2012 University of Szeged
    77 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
    8  * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
     8 * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
    99 *
    1010 * This library is free software; you can redistribute it and/or
     
    4747WTF_MAKE_ISO_ALLOCATED_IMPL(SVGUseElement);
    4848
    49 DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::xAttr, X, x)
    50 DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::yAttr, Y, y)
    51 DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::widthAttr, Width, width)
    52 DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::heightAttr, Height, height)
    53 DEFINE_ANIMATED_STRING(SVGUseElement, XLinkNames::hrefAttr, Href, href)
    54 DEFINE_ANIMATED_BOOLEAN(SVGUseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    55 
    56 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGUseElement)
    57     REGISTER_LOCAL_ANIMATED_PROPERTY(x)
    58     REGISTER_LOCAL_ANIMATED_PROPERTY(y)
    59     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
    60     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
    61     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
    62     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    63     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
    64 END_REGISTER_ANIMATED_PROPERTIES
    65 
    6649inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& document)
    6750    : SVGGraphicsElement(tagName, document)
    68     , m_x(LengthModeWidth)
    69     , m_y(LengthModeHeight)
    70     , m_width(LengthModeWidth)
    71     , m_height(LengthModeHeight)
     51    , SVGExternalResourcesRequired(this)
     52    , SVGURIReference(this)
    7253    , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired)
    7354{
    7455    ASSERT(hasCustomStyleResolveCallbacks());
    7556    ASSERT(hasTagName(SVGNames::useTag));
    76     registerAnimatedPropertiesForSVGUseElement();
     57    registerAttributes();
    7758}
    7859
     
    8869}
    8970
     71void SVGUseElement::registerAttributes()
     72{
     73    auto& registry = attributeRegistry();
     74    if (!registry.isEmpty())
     75        return;
     76    registry.registerAttribute<SVGNames::xAttr, &SVGUseElement::m_x>();
     77    registry.registerAttribute<SVGNames::yAttr, &SVGUseElement::m_y>();
     78    registry.registerAttribute<SVGNames::widthAttr, &SVGUseElement::m_width>();
     79    registry.registerAttribute<SVGNames::heightAttr, &SVGUseElement::m_height>();
     80}
     81
    9082void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    9183{
     
    9385
    9486    if (name == SVGNames::xAttr)
    95         setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
     87        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
    9688    else if (name == SVGNames::yAttr)
    97         setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
     89        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
    9890    else if (name == SVGNames::widthAttr)
    99         setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
     91        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
    10092    else if (name == SVGNames::heightAttr)
    101         setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
     93        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
    10294
    10395    reportAttributeParsingError(parseError, name, value);
     
    114106        if (m_shadowTreeNeedsUpdate)
    115107            document().addSVGUseElement(*this);
    116         SVGExternalResourcesRequired::insertedIntoDocument(this);
     108        SVGExternalResourcesRequired::insertedIntoDocument();
    117109        invalidateShadowTree();
    118110        // FIXME: Move back the call to updateExternalDocument() here once notifyFinished is made always async.
     
    157149        // will be transferred to the generated 'svg'. If attributes width and/or height are not specified,
    158150        // the generated 'svg' element will use values of 100% for these attributes.
    159         shadowElement.setAttribute(SVGNames::widthAttr, (widthIsValid() && width().valueInSpecifiedUnits()) ? AtomicString(width().valueAsString()) : "100%");
    160         shadowElement.setAttribute(SVGNames::heightAttr, (heightIsValid() && height().valueInSpecifiedUnits()) ? AtomicString(height().valueAsString()) : "100%");
     151        shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? AtomicString(width().valueAsString()) : "100%");
     152        shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? AtomicString(height().valueAsString()) : "100%");
    161153    } else if (is<SVGSVGElement>(shadowElement)) {
    162154        // Spec (<use> on <svg>): If attributes width and/or height are provided on the 'use' element, then these
    163155        // values will override the corresponding attributes on the 'svg' in the generated tree.
    164156        auto correspondingElement = makeRefPtr(shadowElement.correspondingElement());
    165         shadowElement.setAttribute(SVGNames::widthAttr, (widthIsValid() && width().valueInSpecifiedUnits()) ? AtomicString(width().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom()));
    166         shadowElement.setAttribute(SVGNames::heightAttr, (heightIsValid() && height().valueInSpecifiedUnits()) ? AtomicString(height().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom()));
     157        shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? AtomicString(width().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom()));
     158        shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? AtomicString(height().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom()));
    167159    }
    168160}
     
    172164    InstanceInvalidationGuard guard(*this);
    173165
    174     if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
     166    if (isKnownAttribute(attrName)) {
    175167        updateRelativeLengthsInformation();
    176168        if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
     
    184176    }
    185177
    186     if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName))
    187         return;
    188 
    189178    if (SVGURIReference::isKnownAttribute(attrName)) {
    190179        updateExternalDocument();
     
    193182    }
    194183
    195     if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
     184    if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName))
    196185        invalidateShadowTree();
    197         return;
    198     }
    199186
    200187    SVGGraphicsElement::svgAttributeChanged(attrName);
     188    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
    201189}
    202190
     
    573561        dispatchEvent(Event::create(eventNames().errorEvent, false, false));
    574562    else if (!resource.wasCanceled())
    575         SVGExternalResourcesRequired::dispatchLoadEvent(this);
     563        SVGExternalResourcesRequired::dispatchLoadEvent();
    576564}
    577565
  • trunk/Source/WebCore/svg/SVGUseElement.h

    r233324 r234620  
    22 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
    4  * Copyright (C) 2015 Apple Inc. All rights reserved.
     4 * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    3737class SVGUseElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGURIReference, private CachedSVGDocumentClient {
    3838    WTF_MAKE_ISO_ALLOCATED(SVGUseElement);
    39 
    40     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGUseElement)
    41         DECLARE_ANIMATED_LENGTH(X, x)
    42         DECLARE_ANIMATED_LENGTH(Y, y)
    43         DECLARE_ANIMATED_LENGTH(Width, width)
    44         DECLARE_ANIMATED_LENGTH(Height, height)
    45         DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)
    46         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    47     END_DECLARE_ANIMATED_PROPERTIES
    48 
    4939public:
    5040    static Ref<SVGUseElement> create(const QualifiedName&, Document&);
     
    5747    RenderElement* rendererClipChild() const;
    5848
     49    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
     50    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
     51    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
     52    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
     53
     54    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
     55    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
     56    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
     57    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
     58
    5959private:
    6060    SVGUseElement(const QualifiedName&, Document&);
     
    6565    void removedFromAncestor(RemovalType, ContainerNode&) override;
    6666    void buildPendingResource() override;
     67
     68    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGUseElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
     69    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     70    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     71    static void registerAttributes();
     72
     73    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    6774    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    6875    void svgAttributeChanged(const QualifiedName&) override;
     76
    6977    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
    7078    Path toClipPath() override;
     
    93101    void invalidateDependentShadowTrees();
    94102
     103    AttributeOwnerProxy m_attributeOwnerProxy { *this };
     104    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
     105    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
     106    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
     107    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
     108
    95109    bool m_haveFiredLoadEvent { false };
    96110    bool m_shadowTreeNeedsUpdate { true };
  • trunk/Source/WebCore/svg/SVGValue.h

    r229417 r234620  
    3636#include "SVGPointListValues.h"
    3737#include "SVGPreserveAspectRatioValue.h"
    38 #include "SVGPropertyInfo.h"
    3938#include "SVGPropertyTraits.h"
    4039#include "SVGTransformListValues.h"
  • trunk/Source/WebCore/svg/SVGViewElement.cpp

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3031WTF_MAKE_ISO_ALLOCATED_IMPL(SVGViewElement);
    3132
    32 // Animated property definitions
    33 DEFINE_ANIMATED_BOOLEAN(SVGViewElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
    34 DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox)
    35 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)
    36 
    37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement)
    38     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
    39     REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
    40     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
    41     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
    42 END_REGISTER_ANIMATED_PROPERTIES
    43 
    4433inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document& document)
    4534    : SVGElement(tagName, document)
    46     , m_zoomAndPan(SVGZoomAndPanMagnify)
     35    , SVGExternalResourcesRequired(this)
     36    , SVGFitToViewBox(this)
    4737    , m_viewTarget(SVGNames::viewTargetAttr)
    4838{
    4939    ASSERT(hasTagName(SVGNames::viewTag));
    50     registerAnimatedPropertiesForSVGViewElement();
    5140}
    5241
     
    6655        m_viewTarget.reset(value);
    6756
     57    SVGElement::parseAttribute(name, value);
    6858    SVGExternalResourcesRequired::parseAttribute(name, value);
    69     SVGFitToViewBox::parseAttribute(this, name, value);
    70     SVGZoomAndPan::parseAttribute(*this, name, value);
    71     SVGElement::parseAttribute(name, value);
     59    SVGFitToViewBox::parseAttribute(name, value);
     60    SVGZoomAndPan::parseAttribute(name, value);
    7261}
    7362
  • trunk/Source/WebCore/svg/SVGViewElement.h

    r229694 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2122#pragma once
    2223
    23 #include "SVGAnimatedBoolean.h"
    24 #include "SVGAnimatedPreserveAspectRatio.h"
    25 #include "SVGAnimatedRect.h"
    2624#include "SVGElement.h"
    2725#include "SVGExternalResourcesRequired.h"
    2826#include "SVGFitToViewBox.h"
    29 #include "SVGStringListValues.h"
    3027#include "SVGZoomAndPan.h"
    3128
     
    4340
    4441    Ref<SVGStringList> viewTarget();
    45     SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
    46     void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); }
    4742
    4843private:
     
    5045
    5146    // FIXME: svgAttributeChanged missing.
     47    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGViewElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan>;
     48    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
    5249    void parseAttribute(const QualifiedName&, const AtomicString&) final;
    5350
    5451    bool rendererIsNeeded(const RenderStyle&) final { return false; }
    5552
    56     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGViewElement)
    57         DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
    58         DECLARE_ANIMATED_RECT(ViewBox, viewBox)
    59         DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
    60     END_DECLARE_ANIMATED_PROPERTIES
    61 
    62     SVGZoomAndPanType m_zoomAndPan;
     53    AttributeOwnerProxy m_attributeOwnerProxy { *this };
    6354    SVGStringListValues m_viewTarget;
    6455};
  • trunk/Source/WebCore/svg/SVGViewSpec.cpp

    r219856 r234620  
    11/*
    22 * Copyright (C) 2007, 2010 Rob Buis <buis@kde.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3233namespace WebCore {
    3334
    34 // Define custom animated property 'viewBox'.
    35 const SVGPropertyInfo* SVGViewSpec::viewBoxPropertyInfo()
     35SVGViewSpec::SVGViewSpec(SVGElement& contextElement)
     36    : SVGFitToViewBox(&contextElement, PropertyIsReadOnly)
     37    , m_contextElement(&contextElement)
     38    , m_attributeOwnerProxy(*this, contextElement)
    3639{
    37     static const SVGPropertyInfo* s_propertyInfo = nullptr;
    38     if (!s_propertyInfo) {
    39         s_propertyInfo = new SVGPropertyInfo(AnimatedRect,
    40                                              PropertyIsReadOnly,
    41                                              SVGNames::viewBoxAttr,
    42                                              viewBoxIdentifier(),
    43                                              0,
    44                                              0);
    45     }
    46     return s_propertyInfo;
     40    registerAttributes();
    4741}
    4842
    49 // Define custom animated property 'preserveAspectRatio'.
    50 const SVGPropertyInfo* SVGViewSpec::preserveAspectRatioPropertyInfo()
     43void SVGViewSpec::registerAttributes()
    5144{
    52     static const SVGPropertyInfo* s_propertyInfo = nullptr;
    53     if (!s_propertyInfo) {
    54         s_propertyInfo = new SVGPropertyInfo(AnimatedPreserveAspectRatio,
    55                                              PropertyIsReadOnly,
    56                                              SVGNames::preserveAspectRatioAttr,
    57                                              preserveAspectRatioIdentifier(),
    58                                              0,
    59                                              0);
    60     }
    61     return s_propertyInfo;
    62 }
    63 
    64 
    65 // Define custom non-animated property 'transform'.
    66 const SVGPropertyInfo* SVGViewSpec::transformPropertyInfo()
    67 {
    68     static const SVGPropertyInfo* s_propertyInfo = nullptr;
    69     if (!s_propertyInfo) {
    70         s_propertyInfo = new SVGPropertyInfo(AnimatedTransformList,
    71                                              PropertyIsReadOnly,
    72                                              SVGNames::transformAttr,
    73                                              transformIdentifier(),
    74                                              0,
    75                                              0);
    76     }
    77     return s_propertyInfo;
    78 }
    79 
    80 SVGViewSpec::SVGViewSpec(SVGElement& contextElement)
    81     : m_contextElement(&contextElement)
    82 {
    83 }
    84 
    85 const AtomicString& SVGViewSpec::viewBoxIdentifier()
    86 {
    87     static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecViewBoxAttribute", AtomicString::ConstructFromLiteral);
    88     return s_identifier;
    89 }
    90 
    91 const AtomicString& SVGViewSpec::preserveAspectRatioIdentifier()
    92 {
    93     static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecPreserveAspectRatioAttribute", AtomicString::ConstructFromLiteral);
    94     return s_identifier;
    95 }
    96 
    97 const AtomicString& SVGViewSpec::transformIdentifier()
    98 {
    99     static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecTransformAttribute", AtomicString::ConstructFromLiteral);
    100     return s_identifier;
    101 }
    102 
    103 ExceptionOr<void> SVGViewSpec::setZoomAndPan(unsigned short)
    104 {
    105     // SVGViewSpec and all of its content is read-only.
    106     return Exception { NoModificationAllowedError };
    107 }
    108 
    109 String SVGViewSpec::transformString() const
    110 {
    111     return SVGPropertyTraits<SVGTransformListValues>::toString(m_transform);
    112 }
    113 
    114 String SVGViewSpec::viewBoxString() const
    115 {
    116     return SVGPropertyTraits<FloatRect>::toString(m_viewBox);
    117 }
    118 
    119 String SVGViewSpec::preserveAspectRatioString() const
    120 {
    121     return SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString(m_preserveAspectRatio);
     45    auto& registry = attributeRegistry();
     46    if (!registry.isEmpty())
     47        return;
     48    registry.registerAttribute<SVGNames::transformAttr, &SVGViewSpec::m_transform>();
    12249}
    12350
     
    13764        return nullptr;
    13865    // Return the animVal here, as its readonly by default - which is exactly what we want here.
    139     return static_reference_cast<SVGAnimatedTransformList>(lookupOrCreateTransformWrapper(this))->animVal();
    140 }
    141 
    142 RefPtr<SVGAnimatedRect> SVGViewSpec::viewBoxAnimated()
    143 {
    144     if (!m_contextElement)
    145         return nullptr;
    146     return static_reference_cast<SVGAnimatedRect>(lookupOrCreateViewBoxWrapper(this));
    147 }
    148 
    149 RefPtr<SVGAnimatedPreserveAspectRatio> SVGViewSpec::preserveAspectRatioAnimated()
    150 {
    151     if (!m_contextElement)
    152         return nullptr;
    153     return static_reference_cast<SVGAnimatedPreserveAspectRatio>(lookupOrCreatePreserveAspectRatioWrapper(this));
    154 }
    155 
    156 Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateViewBoxWrapper(SVGViewSpec* ownerType)
    157 {
    158     ASSERT(ownerType);
    159     ASSERT(ownerType->m_contextElement);
    160     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, FloatRect>(ownerType->m_contextElement, viewBoxPropertyInfo(), ownerType->m_viewBox);
    161 }
    162 
    163 Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* ownerType)
    164 {
    165     ASSERT(ownerType);
    166     ASSERT(ownerType->m_contextElement);
    167     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatioValue>(ownerType->m_contextElement, preserveAspectRatioPropertyInfo(), ownerType->m_preserveAspectRatio);
    168 }
    169 
    170 Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateTransformWrapper(SVGViewSpec* ownerType)
    171 {
    172     ASSERT(ownerType);
    173     ASSERT(ownerType->m_contextElement);
    174     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedTransformList, SVGTransformListValues>(ownerType->m_contextElement, transformPropertyInfo(), ownerType->m_transform);
     66    return m_transform.animatedProperty(m_attributeOwnerProxy)->animVal();
    17567}
    17668
    17769void SVGViewSpec::reset()
    17870{
    179     m_zoomAndPan = SVGZoomAndPanMagnify;
    180     m_transform.clear();
    181     m_viewBox = { };
    182     m_preserveAspectRatio = { };
    18371    m_viewTargetString = emptyString();
     72    m_transform.resetValue();
     73    SVGFitToViewBox::reset();
     74    SVGZoomAndPan::reset();
    18475}
    18576
     
    214105                currViewSpec++;
    215106                FloatRect viewBox;
    216                 if (!SVGFitToViewBox::parseViewBox(&m_contextElement->document(), currViewSpec, end, viewBox, false))
     107                if (!SVGFitToViewBox::parseViewBox(currViewSpec, end, viewBox, false))
    217108                    return false;
    218                 setViewBoxBaseValue(viewBox);
     109                setViewBox(viewBox);
    219110                if (currViewSpec >= end || *currViewSpec != ')')
    220111                    return false;
     
    238129                return false;
    239130            currViewSpec++;
    240             if (!parse(currViewSpec, end, m_zoomAndPan))
     131            if (!SVGZoomAndPan::parseZoomAndPan(currViewSpec, end))
    241132                return false;
    242133            if (currViewSpec >= end || *currViewSpec != ')')
     
    252143            if (!preserveAspectRatio.parse(currViewSpec, end, false))
    253144                return false;
    254             setPreserveAspectRatioBaseValue(preserveAspectRatio);
     145            setPreserveAspectRatio(preserveAspectRatio);
    255146            if (currViewSpec >= end || *currViewSpec != ')')
    256147                return false;
     
    262153                return false;
    263154            currViewSpec++;
    264             SVGTransformable::parseTransformAttribute(m_transform, currViewSpec, end, SVGTransformable::DoNotClearList);
     155            SVGTransformable::parseTransformAttribute(m_transform.value(), currViewSpec, end, SVGTransformable::DoNotClearList);
    265156            if (currViewSpec >= end || *currViewSpec != ')')
    266157                return false;
  • trunk/Source/WebCore/svg/SVGViewSpec.h

    r208863 r234620  
    11/*
    22 * Copyright (C) 2007 Rob Buis <buis@kde.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    3132class SVGTransformList;
    3233
    33 class SVGViewSpec final : public RefCounted<SVGViewSpec>, public SVGZoomAndPan, public SVGFitToViewBox {
     34class SVGViewSpec final : public RefCounted<SVGViewSpec>, public SVGFitToViewBox, public SVGZoomAndPan {
    3435public:
    3536    static Ref<SVGViewSpec> create(SVGElement& contextElement)
     
    4041    bool parseViewSpec(const String&);
    4142    void reset();
     43    void resetContextElement() { m_contextElement = nullptr; }
    4244
    4345    SVGElement* viewTarget() const;
    44 
    45     String transformString() const;
    46     String viewBoxString() const;
    47     String preserveAspectRatioString() const;
    4846    const String& viewTargetString() const { return m_viewTargetString; }
    4947
    50     SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
    51     ExceptionOr<void> setZoomAndPan(unsigned short);
    52     void setZoomAndPanBaseValue(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); }
    53 
    54     void resetContextElement() { m_contextElement = nullptr; }
    55 
    56     // Custom non-animated 'transform' property.
     48    String transformString() const { return m_transform.toString(); }
    5749    RefPtr<SVGTransformList> transform();
    58     SVGTransformListValues transformBaseValue() const { return m_transform; }
    59 
    60     // Custom animated 'viewBox' property.
    61     RefPtr<SVGAnimatedRect> viewBoxAnimated();
    62     FloatRect& viewBox() { return m_viewBox; }
    63     void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; }
    64 
    65     // Custom animated 'preserveAspectRatio' property.
    66     RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated();
    67     SVGPreserveAspectRatioValue& preserveAspectRatio() { return m_preserveAspectRatio; }
    68     void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; }
     50    SVGTransformListValues transformValue() const { return m_transform.value(); }
    6951
    7052private:
    7153    explicit SVGViewSpec(SVGElement&);
    7254
    73     static const SVGPropertyInfo* transformPropertyInfo();
    74     static const SVGPropertyInfo* viewBoxPropertyInfo();
    75     static const SVGPropertyInfo* preserveAspectRatioPropertyInfo();
     55    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGViewSpec, SVGFitToViewBox, SVGZoomAndPan>;
     56    static void registerAttributes();
    7657
    77     static const AtomicString& transformIdentifier();
    78     static const AtomicString& viewBoxIdentifier();
    79     static const AtomicString& preserveAspectRatioIdentifier();
    80 
    81     static Ref<SVGAnimatedProperty> lookupOrCreateTransformWrapper(SVGViewSpec* contextElement);
    82     static Ref<SVGAnimatedProperty> lookupOrCreateViewBoxWrapper(SVGViewSpec* contextElement);
    83     static Ref<SVGAnimatedProperty> lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* contextElement);
     58    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
     59    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
    8460
    8561    SVGElement* m_contextElement;
    86     SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
    87     SVGTransformListValues m_transform;
    88     FloatRect m_viewBox;
    89     SVGPreserveAspectRatioValue m_preserveAspectRatio;
    9062    String m_viewTargetString;
     63    AttributeOwnerProxy m_attributeOwnerProxy;
     64    SVGAnimatedTransformListAttribute m_transform;
    9165};
    9266
  • trunk/Source/WebCore/svg/SVGViewSpec.idl

    r222429 r234620  
    11/*
    22 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3637    readonly attribute DOMString transformString;
    3738    readonly attribute DOMString viewTargetString;
    38 
    39     // SVGZoomAndPan
    40     attribute unsigned short zoomAndPan;
    4139};
    4240
    4341SVGViewSpec implements SVGFitToViewBox;
     42SVGViewSpec implements SVGZoomAndPan;
  • trunk/Source/WebCore/svg/SVGZoomAndPan.cpp

    r179982 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGZoomAndPan.h"
    2324
    24 #include "SVGParserUtilities.h"
    25 
    2625namespace WebCore {
    2726
    28 bool SVGZoomAndPan::parse(const UChar*& start, const UChar* end, SVGZoomAndPanType& zoomAndPan)
     27SVGZoomAndPan::SVGZoomAndPan()
     28{
     29    registerAttributes();
     30}
     31
     32void SVGZoomAndPan::registerAttributes()
     33{
     34    auto& registry = attributeRegistry();
     35    if (!registry.isEmpty())
     36        return;
     37    registry.registerAttribute<SVGNames::zoomAndPanAttr, &SVGZoomAndPan::m_zoomAndPan>();
     38}
     39
     40bool SVGZoomAndPan::parseZoomAndPan(const UChar*& start, const UChar* end)
    2941{
    3042    static const UChar disable[] = { 'd', 'i', 's', 'a', 'b', 'l', 'e' };
    3143    if (skipString(start, end, disable, WTF_ARRAY_LENGTH(disable))) {
    32         zoomAndPan = SVGZoomAndPanDisable;
     44        m_zoomAndPan.setValue(SVGZoomAndPanDisable);
    3345        return true;
    3446    }
     47
    3548    static const UChar magnify[] = { 'm', 'a', 'g', 'n', 'i', 'f', 'y' };
    3649    if (skipString(start, end, magnify, WTF_ARRAY_LENGTH(magnify))) {
    37         zoomAndPan = SVGZoomAndPanMagnify;
     50        m_zoomAndPan.setValue(SVGZoomAndPanMagnify);
    3851        return true;
    3952    }
     53
    4054    return false;
    4155}
    4256
    43 SVGZoomAndPanType SVGZoomAndPan::parseAttributeValue(const AtomicString& value)
     57void SVGZoomAndPan::parseAttribute(const QualifiedName& attributeName, const AtomicString& value)
    4458{
    45     if (value == "disable")
    46         return SVGZoomAndPanDisable;
    47     if (value == "magnify")
    48         return SVGZoomAndPanMagnify;
    49     return SVGZoomAndPanUnknown;
     59    if (attributeName != SVGNames::zoomAndPanAttr)
     60        return;
     61    m_zoomAndPan.setValue(SVGPropertyTraits<SVGZoomAndPanType>::fromString(value));
    5062}
    5163
  • trunk/Source/WebCore/svg/SVGZoomAndPan.h

    r208668 r234620  
    22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
    33 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
     4 * Copyright (C) 2018 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2324#include "QualifiedName.h"
    2425#include "SVGNames.h"
     26#include "SVGZoomAndPanType.h"
    2527
    2628namespace WebCore {
    2729
    28 enum SVGZoomAndPanType { SVGZoomAndPanUnknown, SVGZoomAndPanDisable, SVGZoomAndPanMagnify };
    29 
    3030class SVGZoomAndPan {
     31    WTF_MAKE_NONCOPYABLE(SVGZoomAndPan);
    3132public:
    3233    // Forward declare enumerations in the W3C naming scheme, for IDL generation.
     
    3738    };
    3839
    39     static bool isKnownAttribute(const QualifiedName&);
     40    SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan.value(); }
     41    void setZoomAndPan(SVGZoomAndPanType zoomAndPan) { m_zoomAndPan.setValue(zoomAndPan); }
     42    ExceptionOr<void> setZoomAndPan(unsigned) { return Exception { NoModificationAllowedError }; }
     43    void reset() { m_zoomAndPan.setValue(SVGZoomAndPanMagnify); }
    4044
    41     static SVGZoomAndPanType parseFromNumber(unsigned short);
     45    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGZoomAndPan>;
     46    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
    4247
    43     static bool parse(const UChar*& start, const UChar* end, SVGZoomAndPanType&);
    44     template<class DerivedClass> static void parseAttribute(DerivedClass&, const QualifiedName&, const AtomicString& value);
     48    void parseAttribute(const QualifiedName&, const AtomicString&);
     49
     50protected:
     51    SVGZoomAndPan();
     52
     53    static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
     54    bool parseZoomAndPan(const UChar*&, const UChar*);
    4555
    4656private:
    47     static SVGZoomAndPanType parseAttributeValue(const AtomicString&);
     57    static void registerAttributes();
     58
     59    SVGPropertyAttribute<SVGZoomAndPanType> m_zoomAndPan;
    4860};
    4961
    50 inline bool SVGZoomAndPan::isKnownAttribute(const QualifiedName& name)
    51 {
    52     return name == SVGNames::zoomAndPanAttr;
    53 }
    54 
    55 inline SVGZoomAndPanType SVGZoomAndPan::parseFromNumber(unsigned short number)
    56 {
    57     if (number > SVGZoomAndPanMagnify)
    58         return SVGZoomAndPanUnknown;
    59     return static_cast<SVGZoomAndPanType>(number);
    60 }
    61 
    62 template<class DerivedClass> void SVGZoomAndPan::parseAttribute(DerivedClass& element, const QualifiedName& name, const AtomicString& value)
    63 {
    64     if (name == SVGNames::zoomAndPanAttr)
    65         element.setZoomAndPan(parseAttributeValue(value));
    66 }
    67 
    6862} // namespace WebCore
  • trunk/Source/WebCore/svg/SVGZoomAndPanType.h

    r234619 r234620  
    2626#pragma once
    2727
    28 #include "Color.h"
    29 #include "FloatRect.h"
    30 #include "SVGAngleValue.h"
    31 #include "SVGLengthListValues.h"
    32 #include "SVGLengthValue.h"
    33 #include "SVGMarkerTypes.h"
    34 #include "SVGNumberListValues.h"
    35 #include "SVGPathByteStream.h"
    36 #include "SVGPointListValues.h"
    37 #include "SVGPreserveAspectRatioValue.h"
    38 #include "SVGPropertyInfo.h"
     28#include "SVGAttributeAccessor.h"
    3929#include "SVGPropertyTraits.h"
    40 #include "SVGTransformListValues.h"
    41 
    42 #include <wtf/Variant.h>
    4330
    4431namespace WebCore {
    4532
    46 using SVGValueVariant = Variant<
    47     std::pair<SVGAngleValue, unsigned>*,
    48     bool*,
    49     Color*,
    50     unsigned*,
    51     int*,
    52     std::pair<int, int>*,
    53     SVGLengthValue*,
    54     SVGLengthListValues*,
    55     float*,
    56     SVGNumberListValues*,
    57     std::pair<float, float>*,
    58     SVGPathByteStream*,
    59     SVGPointListValues*,
    60     SVGPreserveAspectRatioValue*,
    61     FloatRect*,
    62     String*,
    63     SVGTransformListValues*
    64 >;
     33enum SVGZoomAndPanType {
     34    SVGZoomAndPanUnknown,
     35    SVGZoomAndPanDisable,
     36    SVGZoomAndPanMagnify
     37};
    6538
    66 } // namespace WebCore
     39using SVGZoomAndPanTypeAttribute = SVGPropertyAttribute<SVGZoomAndPanType>;
     40
     41template<typename OwnerType>
     42using SVGZoomAndPanTypeAttributeAccessor = SVGPropertyAttributeAccessor<OwnerType, SVGZoomAndPanTypeAttribute>;
     43
     44template<>
     45struct SVGPropertyTraits<SVGZoomAndPanType> {
     46    static SVGZoomAndPanType initialValue() { return SVGZoomAndPanMagnify; }
     47    static String toString(SVGZoomAndPanType) { return emptyString(); }
     48    static SVGZoomAndPanType fromString(const String& value)
     49    {
     50        if (value == "disable")
     51            return SVGZoomAndPanDisable;
     52        if (value == "magnify")
     53            return SVGZoomAndPanMagnify;
     54        return SVGZoomAndPanUnknown;
     55    }
     56};
     57
     58}
  • trunk/Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h

    r219831 r234620  
    2828class SVGAnimatedEnumerationPropertyTearOff final : public SVGAnimatedStaticPropertyTearOff<unsigned> {
    2929public:
     30    using ContentType = EnumType;
     31
    3032    const unsigned& baseVal() final
    3133    {
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp

    r234619 r234620  
    2424 */
    2525
    26 #pragma once
     26#include "config.h"
     27#include "SVGAnimatedPathSegListPropertyTearOff.h"
    2728
    28 #include "Color.h"
    29 #include "FloatRect.h"
    30 #include "SVGAngleValue.h"
    31 #include "SVGLengthListValues.h"
    32 #include "SVGLengthValue.h"
    33 #include "SVGMarkerTypes.h"
    34 #include "SVGNumberListValues.h"
    35 #include "SVGPathByteStream.h"
    36 #include "SVGPointListValues.h"
    37 #include "SVGPreserveAspectRatioValue.h"
    38 #include "SVGPropertyInfo.h"
    39 #include "SVGPropertyTraits.h"
    40 #include "SVGTransformListValues.h"
    41 
    42 #include <wtf/Variant.h>
     29#include "SVGPathElement.h"
    4330
    4431namespace WebCore {
    4532
    46 using SVGValueVariant = Variant<
    47     std::pair<SVGAngleValue, unsigned>*,
    48     bool*,
    49     Color*,
    50     unsigned*,
    51     int*,
    52     std::pair<int, int>*,
    53     SVGLengthValue*,
    54     SVGLengthListValues*,
    55     float*,
    56     SVGNumberListValues*,
    57     std::pair<float, float>*,
    58     SVGPathByteStream*,
    59     SVGPointListValues*,
    60     SVGPreserveAspectRatioValue*,
    61     FloatRect*,
    62     String*,
    63     SVGTransformListValues*
    64 >;
     33SVGAnimatedPathSegListPropertyTearOff::SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegListValues& values)
     34    : Base(contextElement, attributeName, animatedPropertyType, values)
     35{
     36    ASSERT(contextElement);
     37    ASSERT(is<SVGPathElement>(contextElement));
     38}
    6539
    66 } // namespace WebCore
     40SVGAnimatedPathSegListPropertyTearOff::~SVGAnimatedPathSegListPropertyTearOff()
     41{
     42    downcast<SVGPathElement>(contextElement())->animatedPropertyWillBeDeleted();
     43}
     44
     45void SVGAnimatedPathSegListPropertyTearOff::animValDidChange()
     46{
     47    ASSERT(m_animatedPathByteStream);
     48    auto pathElement = makeRefPtr(downcast<SVGPathElement>(contextElement()));
     49
     50    // If the animVal is observed from JS, we have to update it on each animation step.
     51    // This is an expensive operation and only done if someone actually observes the animatedPathSegList() while an animation is running.
     52    if (pathElement->isAnimValObserved()) {
     53        auto& animatedList = currentAnimatedValue();
     54        animatedList.clear();
     55        buildSVGPathSegListValuesFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing);
     56    }
     57
     58    Base::animValDidChange();
     59}
     60
     61}
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h

    r232613 r234620  
    11/*
    22 * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved.
     3 * Copyright (C) 2018 Apple Inc. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2223#include "SVGAnimatedListPropertyTearOff.h"
    2324#include "SVGPathByteStream.h"
    24 #include "SVGPathElement.h"
    2525#include "SVGPathSegList.h"
    2626#include "SVGPathUtilities.h"
     
    8888    }
    8989
    90     void animValDidChange()
    91     {
    92         ASSERT(m_animatedPathByteStream);
    93         auto pathElement = makeRefPtr(downcast<SVGPathElement>(contextElement()));
    94 
    95         // If the animVal is observed from JS, we have to update it on each animation step.
    96         // This is an expensive operation and only done, if someone actually observes the animatedPathSegList() while an animation is running.
    97         if (pathElement->isAnimValObserved()) {
    98             auto& animatedList = currentAnimatedValue();
    99             animatedList.clear();
    100             buildSVGPathSegListValuesFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing);
    101         }
    102 
    103         Base::animValDidChange();
    104     }
     90    void animValDidChange();
    10591
    10692    SVGPathByteStream* animatedPathByteStream() const { return m_animatedPathByteStream; }
    10793
    10894private:
    109     SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegListValues& values)
    110         : Base(contextElement, attributeName, animatedPropertyType, values)
    111         , m_animatedPathByteStream(nullptr)
    112     {
    113         ASSERT(contextElement);
    114         ASSERT(is<SVGPathElement>(contextElement));
    115     }
     95    SVGAnimatedPathSegListPropertyTearOff(SVGElement*, const QualifiedName&, AnimatedPropertyType, SVGPathSegListValues&);
     96    virtual ~SVGAnimatedPathSegListPropertyTearOff();
    11697
    117     virtual ~SVGAnimatedPathSegListPropertyTearOff()
    118     {
    119         downcast<SVGPathElement>(contextElement())->animatedPropertyWillBeDeleted();
    120     }
    121 
    122     SVGPathByteStream* m_animatedPathByteStream;
     98    SVGPathByteStream* m_animatedPathByteStream { nullptr };
    12399};
    124100
  • trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp

    r197967 r234620  
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
    33 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
    4  * Copyright (C) 2016 Apple Inc. All rights reserved.
     4 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    3131    , m_attributeName(attributeName)
    3232    , m_animatedPropertyType(animatedPropertyType)
    33     , m_isReadOnly(false)
    3433{
    3534}
     
    3736SVGAnimatedProperty::~SVGAnimatedProperty()
    3837{
     38    // Assure that animationEnded() was called, if animationStarted() was called before.
     39    ASSERT(!isAnimating());
     40
    3941    // Remove wrapper from cache.
    40     for (auto& cache : *animatedPropertyCache()) {
     42    for (auto& cache : animatedPropertyCache()) {
    4143        if (cache.value == this) {
    42             animatedPropertyCache()->remove(cache.key);
    43             break;
     44            animatedPropertyCache().remove(cache.key);
     45            return;
    4446        }
    4547    }
    4648
    47     // Assure that animationEnded() was called, if animationStarted() was called before.
    48     ASSERT(!isAnimating());
     49    RELEASE_ASSERT_NOT_REACHED();
    4950}
    5051
     
    5960}
    6061
    61 SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache()
    62 {
    63     static Cache* s_cache = new Cache;
    64     return s_cache;
    65 }
    66 
    6762} // namespace WebCore
  • trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.h

    r226993 r234620  
    22 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
    33 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
    4  * Copyright (C) 2016 Apple Inc. All rights reserved.
     4 * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    2222#pragma once
    2323
     24#include "QualifiedName.h"
    2425#include "SVGAnimatedPropertyDescription.h"
    25 #include "SVGPropertyInfo.h"
     26#include "SVGAnimatedPropertyType.h"
    2627#include <wtf/RefCounted.h>
    2728
     
    3334class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty> {
    3435public:
     36    virtual ~SVGAnimatedProperty();
     37    virtual bool isAnimating() const { return false; }
     38    virtual bool isAnimatedListTearOff() const { return false; }
     39
    3540    SVGElement* contextElement() const { return m_contextElement.get(); }
    3641    const QualifiedName& attributeName() const { return m_attributeName; }
     
    4146    void commitChange();
    4247
    43     virtual bool isAnimating() const { return false; }
    44     virtual bool isAnimatedListTearOff() const { return false; }
     48    template<typename TearOffType, typename PropertyType, AnimatedPropertyType animatedType>
     49    static RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(SVGElement& element, const QualifiedName& attributeName, const AtomicString& identifier, PropertyType& property, AnimatedPropertyState animatedState)
     50    {
     51        SVGAnimatedPropertyDescription key(&element, identifier);
    4552
    46     // Caching facilities.
    47     typedef HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> Cache;
     53        auto result = animatedPropertyCache().add(key, nullptr);
     54        if (!result.isNewEntry)
     55            return result.iterator->value;
    4856
    49     virtual ~SVGAnimatedProperty();
    50 
    51     template<typename OwnerType, typename TearOffType, typename PropertyType>
    52     static Ref<TearOffType> lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType& property)
    53     {
    54         ASSERT(info);
    55         SVGAnimatedPropertyDescription key(element, info->propertyIdentifier);
    56 
    57         auto result = animatedPropertyCache()->add(key, nullptr);
    58         if (!result.isNewEntry)
    59             return static_cast<TearOffType&>(*result.iterator->value);
    60 
    61         Ref<SVGAnimatedProperty> wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property);
    62         if (info->animatedPropertyState == PropertyIsReadOnly)
     57        auto wrapper = TearOffType::create(&element, attributeName, animatedType, property);
     58        if (animatedState == PropertyIsReadOnly)
    6359            wrapper->setIsReadOnly();
    6460
    65         // Cache the raw pointer but return a Ref<>. This will break the cyclic reference
     61        // Cache the raw pointer but return a RefPtr<>. This will break the cyclic reference
    6662        // between SVGAnimatedProperty and SVGElement once the property pointer is not needed.
    6763        result.iterator->value = wrapper.ptr();
    68         return static_reference_cast<TearOffType>(wrapper);
     64        return static_reference_cast<SVGAnimatedProperty>(wrapper);
    6965    }
    7066
    71     template<typename OwnerType, typename TearOffType>
    72     static RefPtr<TearOffType> lookupWrapper(OwnerType* element, const SVGPropertyInfo* info)
     67    static RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGElement& element, const AtomicString& identifier)
    7368    {
    74         ASSERT(info);
    75         SVGAnimatedPropertyDescription key(element, info->propertyIdentifier);
    76         return static_cast<TearOffType*>(animatedPropertyCache()->get(key));
    77     }
    78 
    79     template<typename OwnerType, typename TearOffType>
    80     static RefPtr<TearOffType> lookupWrapper(const OwnerType* element, const SVGPropertyInfo* info)
    81     {
    82         return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(element), info);
     69        SVGAnimatedPropertyDescription key(const_cast<SVGElement*>(&element), identifier);
     70        return animatedPropertyCache().get(key);
    8371    }
    8472
     
    8775
    8876private:
    89     static Cache* animatedPropertyCache();
     77    // Caching facilities.
     78    using Cache = HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits>;
     79    static Cache& animatedPropertyCache()
     80    {
     81        static NeverDestroyed<Cache> cache;
     82        return cache;
     83    }
    9084
    9185    RefPtr<SVGElement> m_contextElement;
     
    9488
    9589protected:
    96     bool m_isReadOnly;
     90    bool m_isReadOnly { false };
    9791};
    9892
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyType.h

    r234619 r234620  
    11/*
    2  * Copyright (C) 2006 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
    26 interface SVGAElement : SVGGraphicsElement {
    27     [ImplementedAs=svgTarget] readonly attribute SVGAnimatedString target;
     26#pragma once
     27
     28namespace WebCore {
     29
     30enum AnimatedPropertyState {
     31    PropertyIsReadWrite,
     32    PropertyIsReadOnly
    2833};
    2934
    30 SVGAElement implements SVGExternalResourcesRequired;
    31 SVGAElement implements SVGURIReference;
     35enum AnimatedPropertyType {
     36    AnimatedPropertyTypeMin = 0,
     37    AnimatedAngle = AnimatedPropertyTypeMin,
     38    AnimatedBoolean,
     39    AnimatedColor,
     40    AnimatedEnumeration,
     41    AnimatedInteger,
     42    AnimatedIntegerOptionalInteger,
     43    AnimatedLength,
     44    AnimatedLengthList,
     45    AnimatedNumber,
     46    AnimatedNumberList,
     47    AnimatedNumberOptionalNumber,
     48    AnimatedPath,
     49    AnimatedPoints,
     50    AnimatedPreserveAspectRatio,
     51    AnimatedRect,
     52    AnimatedString,
     53    AnimatedTransformList,
     54    AnimatedPropertyTypeMax,
     55    AnimatedUnknown = AnimatedPropertyTypeMax
     56};
     57
     58}
  • trunk/Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h

    r234619 r234620  
    2626#pragma once
    2727
    28 #include "Color.h"
    29 #include "FloatRect.h"
    30 #include "SVGAngleValue.h"
    31 #include "SVGLengthListValues.h"
    32 #include "SVGLengthValue.h"
    33 #include "SVGMarkerTypes.h"
    34 #include "SVGNumberListValues.h"
    35 #include "SVGPathByteStream.h"
    36 #include "SVGPointListValues.h"
    37 #include "SVGPreserveAspectRatioValue.h"
    38 #include "SVGPropertyInfo.h"
    39 #include "SVGPropertyTraits.h"
    40 #include "SVGTransformListValues.h"
    41 
    42 #include <wtf/Variant.h>
     28#include "SVGAnimatedPropertyType.h"
    4329
    4430namespace WebCore {
    4531
    46 using SVGValueVariant = Variant<
    47     std::pair<SVGAngleValue, unsigned>*,
    48     bool*,
    49     Color*,
    50     unsigned*,
    51     int*,
    52     std::pair<int, int>*,
    53     SVGLengthValue*,
    54     SVGLengthListValues*,
    55     float*,
    56     SVGNumberListValues*,
    57     std::pair<float, float>*,
    58     SVGPathByteStream*,
    59     SVGPointListValues*,
    60     SVGPreserveAspectRatioValue*,
    61     FloatRect*,
    62     String*,
    63     SVGTransformListValues*
    64 >;
     32class SVGAnimatedProperty;
     33class SVGAttribute;
     34class SVGElement;
    6535
    66 } // namespace WebCore
     36class SVGAttributeOwnerProxy {
     37public:
     38    SVGAttributeOwnerProxy(SVGElement& element)
     39        : m_element(element)
     40    {
     41    }
     42
     43    virtual ~SVGAttributeOwnerProxy() = default;
     44
     45    SVGElement& element() const { return m_element; }
     46
     47    virtual void synchronizeAttributes() const = 0;
     48    virtual void synchronizeAttribute(const QualifiedName&) const = 0;
     49
     50    virtual Vector<AnimatedPropertyType> animatedTypes(const QualifiedName&) const = 0;
     51
     52    virtual RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(const SVGAttribute&) const = 0;
     53    virtual RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGAttribute&) const = 0;
     54    virtual Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(const QualifiedName&) const = 0;
     55
     56protected:
     57    SVGElement& m_element;
     58};
     59
     60}
Note: See TracChangeset for help on using the changeset viewer.