WebKit Bugzilla
Attachment 346611 Details for
Bug 186751
: Remove the SVG elements' attributes macros
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for EWS
186751-all-4.patch (text/plain), 697.89 KB, created by
Said Abou-Hallawa
on 2018-08-05 21:31:07 PDT
(
hide
)
Description:
Patch for EWS
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-08-05 21:31:07 PDT
Size:
697.89 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3d89b3c517f..01325ea0e70 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,777 @@ >+2018-08-05 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Remove the SVG elements' attributes macros >+ https://bugs.webkit.org/show_bug.cgi?id=186751 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Patch for EWS to ensure all the ports build and all the tests pass. >+ >+ * 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. >+ > 2018-08-05 Ms2ger <Ms2ger@igalia.com> > > [GStreamer] Remove unsound assertions in MediaPlayerPrivateGStreamerBase. >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index bae20c525bd..5487ca5d585 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -2274,9 +2274,8 @@ svg/graphics/filters/SVGFEImage.cpp > svg/graphics/filters/SVGFilter.cpp > svg/graphics/filters/SVGFilterBuilder.cpp > >+svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp > svg/properties/SVGAnimatedProperty.cpp >-svg/properties/SVGAttributeToPropertyMap.cpp >-svg/properties/SVGPropertyInfo.cpp > > workers/AbstractWorker.cpp > workers/DedicatedWorkerGlobalScope.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index cee8d7ef7c3..06e8a7dfae7 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -232,7 +232,6 @@ > 081668D4125603BF006F25DE /* SVGTextChunkBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081668D2125603BF006F25DE /* SVGTextChunkBuilder.h */; }; > 081668DA125603D5006F25DE /* SVGTextLayoutEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 081668D8125603D5006F25DE /* SVGTextLayoutEngine.h */; }; > 081AA8DA1111237E002AB06E /* SVGElementRareData.h in Headers */ = {isa = PBXBuildFile; fileRef = 081AA8D91111237E002AB06E /* SVGElementRareData.h */; }; >- 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 081EBF3B0FD34F4100DA7559 /* SVGFilterBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */; }; > 0823D159127AD6AC000EBC95 /* SVGAnimatedInteger.h in Headers */ = {isa = PBXBuildFile; fileRef = 0823D158127AD6AC000EBC95 /* SVGAnimatedInteger.h */; }; > 08250939128BD4D800E2ED8E /* SVGAnimatedTransformList.h in Headers */ = {isa = PBXBuildFile; fileRef = 08250938128BD4D800E2ED8E /* SVGAnimatedTransformList.h */; }; >@@ -264,9 +263,7 @@ > 0885067F11DA045B00182B98 /* PaintInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0885067D11DA045B00182B98 /* PaintInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 0885068011DA045B00182B98 /* PaintPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0885067E11DA045B00182B98 /* PaintPhase.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 088A0E04126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */; }; >- 088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- 088A0E07126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */; }; > 088A0E09126EF1DB00978F7A /* SVGListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */; }; > 088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0E01126EF1DB00978F7A /* SVGProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -292,7 +289,6 @@ > 08F2F00A1213E61700DCEC48 /* RenderImageResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 08F2F0081213E61700DCEC48 /* RenderImageResource.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 08F859D51463F9CD0067D933 /* SVGImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 08F859D31463F9CD0067D933 /* SVGImageCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 08F859D51463F9CD0067D934 /* SVGImageForContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 08F859D31463F9CD0067D934 /* SVGImageForContainer.h */; }; >- 08FB3F8413BC754C0099FC18 /* SVGAttributeToPropertyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 08FE0BC5127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FE0BC4127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h */; }; > 0AFDAC3D10F5448C00E1F3D2 /* PluginViewBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AFDAC3C10F5448C00E1F3D2 /* PluginViewBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 0B90561A0F2578BF0095FF6A /* DocumentThreadableLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B9056160F2578BE0095FF6A /* DocumentThreadableLoader.h */; settings = {ATTRIBUTES = (); }; }; >@@ -1712,6 +1708,7 @@ > 53ED3FDE167A88E7006762E6 /* JSInternalSettingsGenerated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53ED3FDC167A88E7006762E6 /* JSInternalSettingsGenerated.cpp */; }; > 53ED3FDF167A88E7006762E6 /* JSInternalSettingsGenerated.h in Headers */ = {isa = PBXBuildFile; fileRef = 53ED3FDD167A88E7006762E6 /* JSInternalSettingsGenerated.h */; }; > 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 55346AF121150FAF0059BCDD /* SVGAttributeOwnerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5546757B1FD212A9003B10B0 /* ImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 554675781FD1FC1A003B10B0 /* ImageSource.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5550CB421E955E3C00111AA0 /* ImageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5550CB411E955E3C00111AA0 /* ImageTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 555130011E7CCCCB00A69E38 /* DecodingOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 555130001E7CCCCA00A69E38 /* DecodingOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -1721,6 +1718,12 @@ > 55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 55EC9599206AA7A0007DD0A9 /* PaintFrequencyTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 55FA7FF5210FB6B1005AEFE7 /* SVGAttributeAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 55FA7FF7210FBE3E005AEFE7 /* SVGAttributeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */; }; >+ 55FA7FFB2110ECD7005AEFE7 /* SVGZoomAndPanType.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 55FA7FFF21110E6E005AEFE7 /* SVGAnimatedPropertyType.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 55FA8001211113EE005AEFE7 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5704405A1E53936200356601 /* JSAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 570440591E53936200356601 /* JSAesCbcCfbParams.h */; }; > 5706A6961DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */; }; > 5706A6981DDE5E4600A03B14 /* JSRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6971DDE5E4600A03B14 /* JSRsaOaepParams.h */; }; >@@ -5450,7 +5453,6 @@ > 081668D7125603D5006F25DE /* SVGTextLayoutEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextLayoutEngine.cpp; sourceTree = "<group>"; }; > 081668D8125603D5006F25DE /* SVGTextLayoutEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutEngine.h; sourceTree = "<group>"; }; > 081AA8D91111237E002AB06E /* SVGElementRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElementRareData.h; sourceTree = "<group>"; }; >- 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyInfo.h; sourceTree = "<group>"; }; > 081EBF380FD34F4100DA7559 /* SVGFilterBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFilterBuilder.cpp; sourceTree = "<group>"; }; > 081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFilterBuilder.h; sourceTree = "<group>"; }; > 0823D158127AD6AC000EBC95 /* SVGAnimatedInteger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedInteger.h; sourceTree = "<group>"; }; >@@ -5499,7 +5501,6 @@ > 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedListPropertyTearOff.h; sourceTree = "<group>"; }; > 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedProperty.h; sourceTree = "<group>"; }; > 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyDescription.h; sourceTree = "<group>"; }; >- 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyMacros.h; sourceTree = "<group>"; }; > 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyTearOff.h; sourceTree = "<group>"; }; > 088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGListPropertyTearOff.h; sourceTree = "<group>"; }; > 088A0E01126EF1DB00978F7A /* SVGProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGProperty.h; sourceTree = "<group>"; }; >@@ -5533,8 +5534,6 @@ > 08F859D21463F9CD0067D934 /* SVGImageForContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGImageForContainer.cpp; sourceTree = "<group>"; }; > 08F859D31463F9CD0067D933 /* SVGImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageCache.h; sourceTree = "<group>"; }; > 08F859D31463F9CD0067D934 /* SVGImageForContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageForContainer.h; sourceTree = "<group>"; }; >- 08FB17C013BC7E9100040086 /* SVGAttributeToPropertyMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAttributeToPropertyMap.cpp; sourceTree = "<group>"; }; >- 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeToPropertyMap.h; sourceTree = "<group>"; }; > 08FE0BC4127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPreserveAspectRatio.h; sourceTree = "<group>"; }; > 0AFDAC3C10F5448C00E1F3D2 /* PluginViewBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginViewBase.h; sourceTree = "<group>"; }; > 0B8C56D30F28627F000502E1 /* HTTPHeaderMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderMap.cpp; sourceTree = "<group>"; }; >@@ -8379,6 +8378,8 @@ > 550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; > 55137B2C20379E550001004B /* SVGMarkerTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerTypes.h; sourceTree = "<group>"; }; > 55137B34203CEB710001004B /* SVGValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGValue.h; sourceTree = "<group>"; }; >+ 55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeOwnerProxy.h; sourceTree = "<group>"; }; >+ 55346AFA2117FFAF0059BCDD /* SVGAttributeOwnerProxyImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeOwnerProxyImpl.h; sourceTree = "<group>"; }; > 554675771FD1FC1A003B10B0 /* ImageSource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageSource.cpp; sourceTree = "<group>"; }; > 554675781FD1FC1A003B10B0 /* ImageSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageSource.h; sourceTree = "<group>"; }; > 5550CB411E955E3C00111AA0 /* ImageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageTypes.h; sourceTree = "<group>"; }; >@@ -8394,6 +8395,12 @@ > 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UTIRegistry.h; sourceTree = "<group>"; }; > 55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; }; > 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaintFrequencyTracker.h; sourceTree = "<group>"; }; >+ 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttribute.h; sourceTree = "<group>"; }; >+ 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeAccessor.h; sourceTree = "<group>"; }; >+ 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeRegistry.h; sourceTree = "<group>"; }; >+ 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGZoomAndPanType.h; sourceTree = "<group>"; }; >+ 55FA7FFC2110F813005AEFE7 /* SVGAnimatedPathSegListPropertyTearOff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPathSegListPropertyTearOff.cpp; sourceTree = "<group>"; }; >+ 55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyType.h; sourceTree = "<group>"; }; > 570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; }; > 570440591E53936200356601 /* JSAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcCfbParams.h; sourceTree = "<group>"; }; > 5704405B1E53937900356601 /* JSAesCbcCfbParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesCbcCfbParams.cpp; sourceTree = "<group>"; }; >@@ -12543,7 +12550,6 @@ > B51A2F4017D7D5DA0072517A /* ImageQualityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageQualityController.cpp; sourceTree = "<group>"; }; > B5320D69122A24E9002D1440 /* FontPlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontPlatformData.h; sourceTree = "<group>"; }; > B5320D6A122A24E9002D1440 /* FontPlatformDataCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FontPlatformDataCocoa.mm; sourceTree = "<group>"; }; >- B543B85617EB758F003BE93A /* SVGPropertyInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPropertyInfo.cpp; sourceTree = "<group>"; }; > B562DB5E17D3CD560010AF96 /* HTMLElementTypeHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HTMLElementTypeHelpers.h; sourceTree = "<group>"; }; > B562DB5F17D3CD560010AF96 /* SVGElementTypeHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGElementTypeHelpers.h; sourceTree = "<group>"; }; > B56576E417DA599F00A56BDC /* JSMainThreadExecStateInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecStateInstrumentation.h; sourceTree = "<group>"; }; >@@ -15458,22 +15464,24 @@ > children = ( > 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */, > 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */, >+ 55FA7FFC2110F813005AEFE7 /* SVGAnimatedPathSegListPropertyTearOff.cpp */, > 089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */, > 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */, > 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */, > 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */, >- 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */, > 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */, >+ 55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */, > 08525E621278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h */, > 085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */, >- 08FB17C013BC7E9100040086 /* SVGAttributeToPropertyMap.cpp */, >- 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */, >+ 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */, >+ 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */, >+ 55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */, >+ 55346AFA2117FFAF0059BCDD /* SVGAttributeOwnerProxyImpl.h */, >+ 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */, > 0810764312828556007C63BA /* SVGListProperty.h */, > 088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */, > 08CA3D4312894A3800FFF260 /* SVGMatrixTearOff.h */, > 088A0E01126EF1DB00978F7A /* SVGProperty.h */, >- B543B85617EB758F003BE93A /* SVGPropertyInfo.cpp */, >- 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */, > 088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */, > 088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */, > 0880F70D1282B46D00948505 /* SVGStaticListPropertyTearOff.h */, >@@ -23489,6 +23497,7 @@ > B222795F0D00BF210071B782 /* SVGZoomAndPan.cpp */, > B22279600D00BF210071B782 /* SVGZoomAndPan.h */, > B22279610D00BF210071B782 /* SVGZoomAndPan.idl */, >+ 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */, > B2E4EC940D00C22B00432643 /* SVGZoomEvent.cpp */, > B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */, > B2E4EC960D00C22B00432643 /* SVGZoomEvent.idl */, >@@ -28566,6 +28575,7 @@ > 142011B70A003133008303F9 /* JSCSSStyleDeclaration.h in Headers */, > AD726FED16DA1171003A4E6D /* JSCSSStyleDeclarationCustom.h in Headers */, > BC46C2070C0DDCA10020CFC3 /* JSCSSStyleRule.h in Headers */, >+ 55346AF121150FAF0059BCDD /* SVGAttributeOwnerProxy.h in Headers */, > BCC5BE010C0E93110011C2DB /* JSCSSStyleSheet.h in Headers */, > FC54D05816A7676E00575E4D /* JSCSSSupportsRule.h in Headers */, > 9BD4E9171C462872005065BC /* JSCustomElementInterface.h in Headers */, >@@ -30442,10 +30452,10 @@ > 089A8E07128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h in Headers */, > 43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */, > 08FE0BC5127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h in Headers */, >- 088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */, >+ 55FA8001211113EE005AEFE7 /* SVGAnimatedProperty.h in Headers */, > 088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */, >- 088A0E07126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h in Headers */, > 088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */, >+ 55FA7FFF21110E6E005AEFE7 /* SVGAnimatedPropertyType.h in Headers */, > 08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */, > 08525E631278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h in Headers */, > 084DB59B128008CC002A6D64 /* SVGAnimatedString.h in Headers */, >@@ -30459,7 +30469,9 @@ > B22279950D00BF220071B782 /* SVGAnimateTransformElement.h in Headers */, > B22279980D00BF220071B782 /* SVGAnimationElement.h in Headers */, > 439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */, >- 08FB3F8413BC754C0099FC18 /* SVGAttributeToPropertyMap.h in Headers */, >+ 55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */, >+ 55FA7FF5210FB6B1005AEFE7 /* SVGAttributeAccessor.h in Headers */, >+ 55FA7FF7210FBE3E005AEFE7 /* SVGAttributeRegistry.h in Headers */, > B222799C0D00BF220071B782 /* SVGCircleElement.h in Headers */, > B222799F0D00BF220071B782 /* SVGClipPathElement.h in Headers */, > B22279A50D00BF220071B782 /* SVGComponentTransferFunctionElement.h in Headers */, >@@ -30602,7 +30614,6 @@ > B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */, > B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */, > 088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */, >- 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */, > 088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */, > 088A0E0C126EF1DB00978F7A /* SVGPropertyTraits.h in Headers */, > B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */, >@@ -30663,6 +30674,7 @@ > B2227AF30D00BF220071B782 /* SVGViewSpec.h in Headers */, > 8485228B1190173C006EDC7F /* SVGVKernElement.h in Headers */, > B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */, >+ 55FA7FFB2110ECD7005AEFE7 /* SVGZoomAndPanType.h in Headers */, > B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */, > 46ECB6381FD0A3C80088E5AD /* SWClientConnection.h in Headers */, > 46658DC91FA24B8700F7DD54 /* SWContextManager.h in Headers */, >diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp >index 5948119862e..0acf8183a08 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp >+++ b/Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp >@@ -115,7 +115,7 @@ AffineTransform RenderSVGResourceMarker::markerTransformation(const FloatPoint& > void RenderSVGResourceMarker::draw(PaintInfo& paintInfo, const AffineTransform& transform) > { > // An empty viewBox disables rendering. >- if (markerElement().hasAttribute(SVGNames::viewBoxAttr) && markerElement().viewBoxIsValid() && markerElement().viewBox().isEmpty()) >+ if (markerElement().hasAttribute(SVGNames::viewBoxAttr) && markerElement().hasEmptyViewBox()) > return; > > PaintInfo info(paintInfo); >diff --git a/Source/WebCore/svg/SVGAElement.cpp b/Source/WebCore/svg/SVGAElement.cpp >index 92f21045e2a..cc3c09f763b 100644 >--- a/Source/WebCore/svg/SVGAElement.cpp >+++ b/Source/WebCore/svg/SVGAElement.cpp >@@ -2,7 +2,7 @@ > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> > * Copyright (C) 2007 Eric Seidel <eric@webkit.org> >- * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -46,23 +46,13 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGAElement, SVGNames::targetAttr, SVGTarget, svgTarget) >-DEFINE_ANIMATED_STRING(SVGAElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGAElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(svgTarget) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGAElement::SVGAElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >+ , SVGExternalResourcesRequired(this) >+ , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::aTag)); >- registerAnimatedPropertiesForSVGAElement(); >+ registerAttributes(); > } > > Ref<SVGAElement> SVGAElement::create(const QualifiedName& tagName, Document& document) >@@ -81,10 +71,18 @@ String SVGAElement::title() const > return SVGElement::title(); > } > >+void SVGAElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::targetAttr, &SVGAElement::m_target>(); >+} >+ > void SVGAElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::targetAttr) { >- setSVGTargetBaseValue(value); >+ m_target.setValue(value); > return; > } > >@@ -102,9 +100,11 @@ void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) > InstanceInvalidationGuard guard(*this); > invalidateStyleForSubtree(); > } >+ return; > } > > SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGAElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGAElement.h b/Source/WebCore/svg/SVGAElement.h >index 254212e6486..d41ad0b3522 100644 >--- a/Source/WebCore/svg/SVGAElement.h >+++ b/Source/WebCore/svg/SVGAElement.h >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> > * Copyright (C) 2007 Eric Seidel <eric@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,32 +22,36 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGraphicsElement.h" > #include "SVGURIReference.h" > > namespace WebCore { > >-class SVGAElement final : public SVGGraphicsElement, public SVGURIReference, public SVGExternalResourcesRequired { >+class SVGAElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGURIReference { > WTF_MAKE_ISO_ALLOCATED(SVGAElement); > public: > static Ref<SVGAElement> create(const QualifiedName&, Document&); > >+ String target() const final { return m_target.currentValue(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedString> targetAnimated() { return m_target.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGAElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- >- String title() const final; >- String target() const final { return svgTarget(); } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static void registerAttributes(); > >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > bool childShouldCreateRenderer(const Node&) const final; > >+ bool isValid() const final { return SVGTests::isValid(); } >+ String title() const final; > void defaultEventHandler(Event&) final; > > bool supportsFocus() const final; >@@ -58,13 +63,8 @@ private: > > bool willRespondToMouseClickEvents() final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAElement) >- // This declaration used to define a non-virtual "String& target() const" method, that clashes with "virtual String Element::target() const". >- // That's why it has been renamed to "svgTarget", the CodeGenerators take care of calling svgTargetAnimated() instead of targetAnimated(), see CodeGenerator.pm. >- DECLARE_ANIMATED_STRING(SVGTarget, svgTarget) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_target; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGAElement.idl b/Source/WebCore/svg/SVGAElement.idl >index 3ede6dc9cb6..28795aad4ed 100644 >--- a/Source/WebCore/svg/SVGAElement.idl >+++ b/Source/WebCore/svg/SVGAElement.idl >@@ -24,7 +24,7 @@ > */ > > interface SVGAElement : SVGGraphicsElement { >- [ImplementedAs=svgTarget] readonly attribute SVGAnimatedString target; >+ readonly attribute SVGAnimatedString target; > }; > > SVGAElement implements SVGExternalResourcesRequired; >diff --git a/Source/WebCore/svg/SVGAltGlyphElement.cpp b/Source/WebCore/svg/SVGAltGlyphElement.cpp >index 8ea4763974c..782b245ad1b 100644 >--- a/Source/WebCore/svg/SVGAltGlyphElement.cpp >+++ b/Source/WebCore/svg/SVGAltGlyphElement.cpp >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >- * Copyright (C) 2008 Apple Inc. All rights reserved. >+ * Copyright (C) 2008-2018 Apple Inc. All rights reserved. > * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. > * > * This library is free software; you can redistribute it and/or >@@ -37,19 +37,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAltGlyphElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGAltGlyphElement, XLinkNames::hrefAttr, Href, href) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAltGlyphElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextPositioningElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGAltGlyphElement::SVGAltGlyphElement(const QualifiedName& tagName, Document& document) > : SVGTextPositioningElement(tagName, document) >+ , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::altGlyphTag)); >- registerAnimatedPropertiesForSVGAltGlyphElement(); > } > > Ref<SVGAltGlyphElement> SVGAltGlyphElement::create(const QualifiedName& tagName, Document& document) >diff --git a/Source/WebCore/svg/SVGAltGlyphElement.h b/Source/WebCore/svg/SVGAltGlyphElement.h >index 4cd32e45a5f..3b4e861a301 100644 >--- a/Source/WebCore/svg/SVGAltGlyphElement.h >+++ b/Source/WebCore/svg/SVGAltGlyphElement.h >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >- * Copyright (C) 2008 Apple Inc. All rights reserved. >+ * Copyright (C) 2008-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -45,12 +45,13 @@ public: > private: > SVGAltGlyphElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAltGlyphElement, SVGTextPositioningElement, SVGURIReference>; >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } >+ > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; > bool childShouldCreateRenderer(const Node&) const override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAltGlyphElement) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGAnimatedAngle.h b/Source/WebCore/svg/SVGAnimatedAngle.h >index 521178ba940..d4915683f61 100644 >--- a/Source/WebCore/svg/SVGAnimatedAngle.h >+++ b/Source/WebCore/svg/SVGAnimatedAngle.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -22,21 +23,15 @@ > #include "SVGAngle.h" > #include "SVGAnimatedPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttribute.h" > > namespace WebCore { > >-using SVGAnimatedAngle = SVGAnimatedPropertyTearOff<SVGAngle>; >- >-// Helper macros to declare/define a SVGAnimatedAngle object. SVGAnimatedAngle is only used in the SVG DOM for SVGMarkerElement. >-#define DECLARE_ANIMATED_ANGLE(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedAngle, SVGAngleValue, UpperProperty, LowerProperty, ) >- >-// Only used for SVGMarkerElements orientAttr, which maps to SVGAnimatedAngle orientAngle and SVGAnimatedEnumeration orientType. >-#define DEFINE_ANIMATED_ANGLE_AND_ENUMERATION(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedAngle, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) >- > class SVGAnimationElement; > >+using SVGAnimatedAngle = SVGAnimatedPropertyTearOff<SVGAngle>; >+using SVGAnimatedAngleAttribute = SVGAnimatedAttribute<SVGAnimatedAngle>; >+ > class SVGAnimatedAngleAnimator final : public SVGAnimatedTypeAnimator { > public: > SVGAnimatedAngleAnimator(SVGAnimationElement*, SVGElement*); >diff --git a/Source/WebCore/svg/SVGAnimatedBoolean.h b/Source/WebCore/svg/SVGAnimatedBoolean.h >index eddd1e758cf..875909f076b 100644 >--- a/Source/WebCore/svg/SVGAnimatedBoolean.h >+++ b/Source/WebCore/svg/SVGAnimatedBoolean.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,22 +22,17 @@ > > #include "SVGAnimatedStaticPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > > namespace WebCore { > >-typedef SVGAnimatedStaticPropertyTearOff<bool> SVGAnimatedBoolean; >- >-// Helper macros to declare/define a SVGAnimatedBoolean object >-#define DECLARE_ANIMATED_BOOLEAN(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedBoolean, bool, UpperProperty, LowerProperty, ) >- >-#define DECLARE_ANIMATED_BOOLEAN_OVERRIDE(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedBoolean, bool, UpperProperty, LowerProperty, override) >+class SVGAnimationElement; > >-#define DEFINE_ANIMATED_BOOLEAN(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedBoolean, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+using SVGAnimatedBoolean = SVGAnimatedStaticPropertyTearOff<bool>; >+using SVGAnimatedBooleanAttribute = SVGAnimatedAttribute<SVGAnimatedBoolean>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedBooleanAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedBooleanAttribute, AnimatedBoolean>; > > class SVGAnimatedBooleanAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedEnumeration.h b/Source/WebCore/svg/SVGAnimatedEnumeration.h >index 59cd19da1d6..488ab897390 100644 >--- a/Source/WebCore/svg/SVGAnimatedEnumeration.h >+++ b/Source/WebCore/svg/SVGAnimatedEnumeration.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -20,19 +21,20 @@ > #pragma once > > #include "SVGAnimatedEnumerationPropertyTearOff.h" >-#include "SVGAnimatedPropertyMacros.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > > namespace WebCore { > >-typedef SVGAnimatedStaticPropertyTearOff<unsigned> SVGAnimatedEnumeration; >+class SVGAnimationElement; > >-// Helper macros to declare/define a SVGAnimatedEnumeration object >-#define DECLARE_ANIMATED_ENUMERATION(UpperProperty, LowerProperty, EnumType) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedEnumerationPropertyTearOff<EnumType>, EnumType, UpperProperty, LowerProperty, ) >+using SVGAnimatedEnumeration = SVGAnimatedStaticPropertyTearOff<unsigned>; > >-#define DEFINE_ANIMATED_ENUMERATION(OwnerType, DOMAttribute, UpperProperty, LowerProperty, EnumType) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedEnumeration, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+template<typename EnumType> >+using SVGAnimatedEnumerationAttribute = SVGAnimatedAttribute<SVGAnimatedEnumerationPropertyTearOff<EnumType>>; >+ >+template<typename OwnerType, typename EnumType> >+using SVGAnimatedEnumerationAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedEnumerationAttribute<EnumType>, AnimatedEnumeration>; > > class SVGAnimatedEnumerationAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedInteger.h b/Source/WebCore/svg/SVGAnimatedInteger.h >index da5f441d865..1c234876bda 100644 >--- a/Source/WebCore/svg/SVGAnimatedInteger.h >+++ b/Source/WebCore/svg/SVGAnimatedInteger.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -19,25 +20,22 @@ > > #pragma once > >-#include "SVGAnimatedPropertyMacros.h" > #include "SVGAnimatedStaticPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > > namespace WebCore { > >-typedef SVGAnimatedStaticPropertyTearOff<int> SVGAnimatedInteger; >- >-// Helper macros to declare/define a SVGAnimatedInteger object >-#define DECLARE_ANIMATED_INTEGER(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedInteger, int, UpperProperty, LowerProperty, ) >+class SVGAnimationElement; > >-#define DEFINE_ANIMATED_INTEGER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedInteger, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+using SVGAnimatedInteger = SVGAnimatedStaticPropertyTearOff<int>; >+using SVGAnimatedIntegerAttribute = SVGAnimatedAttribute<SVGAnimatedInteger>; > >-#define DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedIntegerOptionalInteger, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) >+template<typename OwnerType> >+using SVGAnimatedIntegerAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedIntegerAttribute, AnimatedInteger>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedOptionalIntegerAttributeAccessor = SVGAnimatedOptionalAttributeAccessor<OwnerType, SVGAnimatedIntegerAttribute, AnimatedIntegerOptionalInteger>; > > class SVGAnimatedIntegerAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedLength.h b/Source/WebCore/svg/SVGAnimatedLength.h >index fa4ca6e912e..1004ec5d9d6 100644 >--- a/Source/WebCore/svg/SVGAnimatedLength.h >+++ b/Source/WebCore/svg/SVGAnimatedLength.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,20 +22,18 @@ > > #include "SVGAnimatedPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > #include "SVGLength.h" > > namespace WebCore { > >-using SVGAnimatedLength = SVGAnimatedPropertyTearOff<SVGLength>; >- >-// Helper macros to declare/define a SVGAnimatedLength object >-#define DECLARE_ANIMATED_LENGTH(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedLength, SVGLengthValue, UpperProperty, LowerProperty, ) >+class SVGAnimationElement; > >-#define DEFINE_ANIMATED_LENGTH(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedLength, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+using SVGAnimatedLength = SVGAnimatedPropertyTearOff<SVGLength>; >+using SVGAnimatedLengthAttribute = SVGAnimatedAttribute<SVGAnimatedLength>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedLengthAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedLengthAttribute, AnimatedLength>; > > class SVGAnimatedLengthAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedLengthList.h b/Source/WebCore/svg/SVGAnimatedLengthList.h >index 5ecf542bbd6..165bc48ae64 100644 >--- a/Source/WebCore/svg/SVGAnimatedLengthList.h >+++ b/Source/WebCore/svg/SVGAnimatedLengthList.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,21 +22,19 @@ > > #include "SVGAnimatedListPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > #include "SVGLength.h" > #include "SVGLengthList.h" > > namespace WebCore { > >-using SVGAnimatedLengthList = SVGAnimatedListPropertyTearOff<SVGLengthListValues>; >- >-// Helper macros to declare/define a SVGAnimatedLengthList object >-#define DECLARE_ANIMATED_LENGTH_LIST(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedLengthList, SVGLengthListValues, UpperProperty, LowerProperty) >+class SVGAnimationElement; > >-#define DEFINE_ANIMATED_LENGTH_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedLengthList, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+using SVGAnimatedLengthList = SVGAnimatedListPropertyTearOff<SVGLengthListValues>; >+using SVGAnimatedLengthListAttribute = SVGAnimatedAttributeList<SVGAnimatedLengthList>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedLengthListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedLengthListAttribute, AnimatedLengthList>; > > class SVGAnimatedLengthListAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedNumber.h b/Source/WebCore/svg/SVGAnimatedNumber.h >index 0e19d4d3e66..da3d96b4034 100644 >--- a/Source/WebCore/svg/SVGAnimatedNumber.h >+++ b/Source/WebCore/svg/SVGAnimatedNumber.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -19,25 +20,22 @@ > > #pragma once > >-#include "SVGAnimatedPropertyMacros.h" > #include "SVGAnimatedStaticPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > > namespace WebCore { > >-typedef SVGAnimatedStaticPropertyTearOff<float> SVGAnimatedNumber; >- >-// Helper macros to declare/define a SVGAnimatedNumber object >-#define DECLARE_ANIMATED_NUMBER(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedNumber, float, UpperProperty, LowerProperty, ) >+class SVGAnimationElement; > >-#define DEFINE_ANIMATED_NUMBER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedNumber, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+using SVGAnimatedNumber = SVGAnimatedStaticPropertyTearOff<float>; >+using SVGAnimatedNumberAttribute = SVGAnimatedAttribute<SVGAnimatedNumber>; > >-#define DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedNumberOptionalNumber, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) >+template<typename OwnerType> >+using SVGAnimatedNumberAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedNumberAttribute, AnimatedNumber>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedOptionalNumberAttributeAccessor = SVGAnimatedOptionalAttributeAccessor<OwnerType, SVGAnimatedNumberAttribute, AnimatedNumberOptionalNumber>; > > class SVGAnimatedNumberAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedNumberList.h b/Source/WebCore/svg/SVGAnimatedNumberList.h >index 58025ea94e9..bf7c1fe8eb5 100644 >--- a/Source/WebCore/svg/SVGAnimatedNumberList.h >+++ b/Source/WebCore/svg/SVGAnimatedNumberList.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,21 +22,19 @@ > > #include "SVGAnimatedListPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > #include "SVGNumber.h" > #include "SVGNumberList.h" > > namespace WebCore { > >-using SVGAnimatedNumberList = SVGAnimatedListPropertyTearOff<SVGNumberListValues>; >- >-// Helper macros to declare/define a SVGAnimatedNumberList object >-#define DECLARE_ANIMATED_NUMBER_LIST(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedNumberList, SVGNumberListValues, UpperProperty, LowerProperty) >+class SVGAnimationElement; > >-#define DEFINE_ANIMATED_NUMBER_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedNumberList, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+using SVGAnimatedNumberList = SVGAnimatedListPropertyTearOff<SVGNumberListValues>; >+using SVGAnimatedNumberListAttribute = SVGAnimatedAttributeList<SVGAnimatedNumberList>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedNumberListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedNumberListAttribute, AnimatedNumberList>; > > class SVGAnimatedNumberListAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedPath.h b/Source/WebCore/svg/SVGAnimatedPath.h >index 7feb70f0214..b864ed32bb4 100644 >--- a/Source/WebCore/svg/SVGAnimatedPath.h >+++ b/Source/WebCore/svg/SVGAnimatedPath.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2011, 2012. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -19,12 +20,17 @@ > > #pragma once > >+#include "SVGAnimatedPathSegListPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > > namespace WebCore { > > class SVGAnimationElement; > >+using SVGAnimatedPathSegList = SVGAnimatedPathSegListPropertyTearOff; >+using SVGAnimatedPathSegListAttribute = SVGAnimatedAttributeList<SVGAnimatedPathSegList>; >+ > class SVGAnimatedPathAnimator final : public SVGAnimatedTypeAnimator { > public: > SVGAnimatedPathAnimator(SVGAnimationElement*, SVGElement*); >diff --git a/Source/WebCore/svg/SVGAnimatedPointList.h b/Source/WebCore/svg/SVGAnimatedPointList.h >index 2090e827de6..1e773e1c98d 100644 >--- a/Source/WebCore/svg/SVGAnimatedPointList.h >+++ b/Source/WebCore/svg/SVGAnimatedPointList.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2011. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -25,9 +26,13 @@ > > namespace WebCore { > >+class SVGAnimationElement; >+ > using SVGAnimatedPointList = SVGAnimatedListPropertyTearOff<SVGPointListValues>; >+using SVGAnimatedPointListAttribute = SVGAnimatedAttributeList<SVGAnimatedPointList>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedPointListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedPointListAttribute, AnimatedPoints>; > > class SVGAnimatedPointListAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h b/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h >index fa66feb8dd3..2699d9d0747 100644 >--- a/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h >+++ b/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,23 +22,18 @@ > > #include "SVGAnimatedPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > #include "SVGPreserveAspectRatio.h" > > namespace WebCore { > >-template<typename T> >-class SVGPropertyTearOff; >+class SVGAnimationElement; > > using SVGAnimatedPreserveAspectRatio = SVGAnimatedPropertyTearOff<SVGPreserveAspectRatio>; >+using SVGAnimatedPreserveAspectRatioAttribute = SVGAnimatedAttribute<SVGAnimatedPreserveAspectRatio>; > >-// Helper macros to declare/define a SVGAnimatedPreserveAspectRatio object >-#define DECLARE_ANIMATED_PRESERVEASPECTRATIO(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatioValue, UpperProperty, LowerProperty, ) >- >-#define DEFINE_ANIMATED_PRESERVEASPECTRATIO(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedPreserveAspectRatio, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >- >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedPreserveAspectRatioAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedPreserveAspectRatioAttribute, AnimatedPreserveAspectRatio>; > > class SVGAnimatedPreserveAspectRatioAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedRect.h b/Source/WebCore/svg/SVGAnimatedRect.h >index 95e7386bca6..8b26dce4f4c 100644 >--- a/Source/WebCore/svg/SVGAnimatedRect.h >+++ b/Source/WebCore/svg/SVGAnimatedRect.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -19,25 +20,21 @@ > > #pragma once > >-#include "SVGAnimatedPropertyMacros.h" > #include "SVGAnimatedPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > #include "SVGRect.h" > > namespace WebCore { > >+class SVGAnimationElement; > class SVGRect; > > using SVGAnimatedRect = SVGAnimatedPropertyTearOff<SVGRect>; >+using SVGAnimatedRectAttribute = SVGAnimatedAttribute<SVGAnimatedRect>; > >-// Helper macros to declare/define a SVGAnimatedRect object >-#define DECLARE_ANIMATED_RECT(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedRect, FloatRect, UpperProperty, LowerProperty, ) >- >-#define DEFINE_ANIMATED_RECT(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedRect, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >- >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedRectAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedRectAttribute, AnimatedRect>; > > class SVGAnimatedRectAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedString.h b/Source/WebCore/svg/SVGAnimatedString.h >index 86d0422854c..10987316f07 100644 >--- a/Source/WebCore/svg/SVGAnimatedString.h >+++ b/Source/WebCore/svg/SVGAnimatedString.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -19,25 +20,19 @@ > > #pragma once > >-#include "SVGAnimatedPropertyMacros.h" > #include "SVGAnimatedStaticPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > > namespace WebCore { > >-typedef SVGAnimatedStaticPropertyTearOff<String> SVGAnimatedString; >- >-// Helper macros to declare/define a SVGAnimatedString object >-#define DECLARE_ANIMATED_STRING(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedString, String, UpperProperty, LowerProperty, ) >- >-#define DECLARE_ANIMATED_STRING_OVERRIDE(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedString, String, UpperProperty, LowerProperty, override) >+class SVGAnimationElement; > >-#define DEFINE_ANIMATED_STRING(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedString, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+using SVGAnimatedString = SVGAnimatedStaticPropertyTearOff<String>; >+using SVGAnimatedStringAttribute = SVGAnimatedAttribute<SVGAnimatedString>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedStringAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedStringAttribute, AnimatedString>; > > class SVGAnimatedStringAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedTransformList.h b/Source/WebCore/svg/SVGAnimatedTransformList.h >index e3a3a0f9345..0b169f5c9ba 100644 >--- a/Source/WebCore/svg/SVGAnimatedTransformList.h >+++ b/Source/WebCore/svg/SVGAnimatedTransformList.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,20 +22,18 @@ > > #include "SVGAnimatedTransformListPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > #include "SVGTransformList.h" > > namespace WebCore { > >-using SVGAnimatedTransformList = SVGAnimatedTransformListPropertyTearOff; >- >-// Helper macros to declare/define a SVGAnimatedTransformList object >-#define DECLARE_ANIMATED_TRANSFORM_LIST(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedTransformList, SVGTransformListValues, UpperProperty, LowerProperty) >+class SVGAnimationElement; > >-#define DEFINE_ANIMATED_TRANSFORM_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedTransformList, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+using SVGAnimatedTransformList = SVGAnimatedTransformListPropertyTearOff; >+using SVGAnimatedTransformListAttribute = SVGAnimatedAttributeList<SVGAnimatedTransformList>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedTransformListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedTransformListAttribute, AnimatedTransformList>; > > class SVGAnimatedTransformListAnimator final : public SVGAnimatedTypeAnimator { > public: >diff --git a/Source/WebCore/svg/SVGAnimatedTypeAnimator.cpp b/Source/WebCore/svg/SVGAnimatedTypeAnimator.cpp >index cddb191f6e2..dcf9c44b6cb 100644 >--- a/Source/WebCore/svg/SVGAnimatedTypeAnimator.cpp >+++ b/Source/WebCore/svg/SVGAnimatedTypeAnimator.cpp >@@ -22,7 +22,6 @@ > #include "config.h" > #include "SVGAnimatedTypeAnimator.h" > >-#include "SVGAttributeToPropertyMap.h" > #include "SVGElement.h" > > namespace WebCore { >@@ -56,16 +55,14 @@ SVGElementAnimatedPropertyList SVGAnimatedTypeAnimator::findAnimatedPropertiesFo > if (!SVGAnimatedType::supportsAnimVal(m_type)) > return result; > >- auto& propertyMap = targetElement.localAttributeToPropertyMap(); >- auto targetProperties = propertyMap.properties(targetElement, attributeName); >- >+ auto targetProperties = targetElement.lookupOrCreateAnimatedProperties(attributeName); > if (targetProperties.isEmpty()) > return result; > > result.append(SVGElementAnimatedProperties { &targetElement, WTFMove(targetProperties) }); > > for (SVGElement* instance : targetElement.instances()) >- result.append(SVGElementAnimatedProperties { instance, propertyMap.properties(*instance, attributeName) }); >+ result.append(SVGElementAnimatedProperties { instance, instance->lookupOrCreateAnimatedProperties(attributeName) }); > > #if !ASSERT_DISABLED > for (auto& animatedProperties : result) { >diff --git a/Source/WebCore/svg/SVGAnimationElement.cpp b/Source/WebCore/svg/SVGAnimationElement.cpp >index 0f91cd2e793..3f25808f8c4 100644 >--- a/Source/WebCore/svg/SVGAnimationElement.cpp >+++ b/Source/WebCore/svg/SVGAnimationElement.cpp >@@ -47,18 +47,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAnimationElement); > >-// Animated property definitions >-DEFINE_ANIMATED_BOOLEAN(SVGAnimationElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAnimationElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document& document) > : SVGSMILElement(tagName, document) >+ , SVGExternalResourcesRequired(this) >+ , SVGTests(this) > { >- registerAnimatedPropertiesForSVGAnimationElement(); > } > > static void parseKeyTimes(const String& parse, Vector<float>& result, bool verifyOrder) >@@ -691,19 +684,4 @@ void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target) > m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attributeType() == AttributeType::CSS && !isTargetAttributeCSSProperty(target, attributeName()); > } > >-Ref<SVGStringList> SVGAnimationElement::requiredFeatures() >-{ >- return SVGTests::requiredFeatures(*this); >-} >- >-Ref<SVGStringList> SVGAnimationElement::requiredExtensions() >-{ >- return SVGTests::requiredExtensions(*this); >-} >- >-Ref<SVGStringList> SVGAnimationElement::systemLanguage() >-{ >- return SVGTests::systemLanguage(*this); >-} >- > } >diff --git a/Source/WebCore/svg/SVGAnimationElement.h b/Source/WebCore/svg/SVGAnimationElement.h >index 7668f1872dd..bfe230c5df6 100644 >--- a/Source/WebCore/svg/SVGAnimationElement.h >+++ b/Source/WebCore/svg/SVGAnimationElement.h >@@ -52,7 +52,7 @@ enum AnimatedPropertyValueType { RegularPropertyValue, CurrentColorValue, Inheri > > enum class CalcMode { Discrete, Linear, Paced, Spline }; > >-class SVGAnimationElement : public SVGSMILElement, public SVGTests, public SVGExternalResourcesRequired { >+class SVGAnimationElement : public SVGSMILElement, public SVGExternalResourcesRequired, public SVGTests { > WTF_MAKE_ISO_ALLOCATED(SVGAnimationElement); > public: > float getStartTime() const; >@@ -146,14 +146,13 @@ public: > animatedNumber = number; > } > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >- > protected: > SVGAnimationElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAnimationElement, SVGElement, SVGExternalResourcesRequired, SVGTests>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ > void computeCSSPropertyValue(SVGElement*, CSSPropertyID, String& value); > virtual void determinePropertyValueTypes(const String& from, const String& to); > virtual void resetAnimatedPropertyType(); >@@ -208,15 +207,6 @@ private: > void applyAnimatedValue(ShouldApplyAnimation, SVGElement* targetElement, const QualifiedName& attributeName, SVGAnimatedType*); > void adjustForInheritance(SVGElement* targetElement, const QualifiedName& attributeName, String&); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAnimationElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >- >- // SVGTests >- void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } >- void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } >- void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } >- > void setCalcMode(const AtomicString&); > > bool m_animationValid { false }; >@@ -231,6 +221,7 @@ private: > bool m_hasInvalidCSSAttributeType { false }; > CalcMode m_calcMode { CalcMode::Linear }; > AnimationMode m_animationMode { NoAnimation }; >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGCircleElement.cpp b/Source/WebCore/svg/SVGCircleElement.cpp >index 2928653690f..ef3daa6a88f 100644 >--- a/Source/WebCore/svg/SVGCircleElement.cpp >+++ b/Source/WebCore/svg/SVGCircleElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,40 +22,20 @@ > #include "config.h" > #include "SVGCircleElement.h" > >-#include "FloatPoint.h" > #include "RenderSVGEllipse.h" >-#include "RenderSVGPath.h" > #include "RenderSVGResource.h" >-#include "SVGLengthValue.h" >-#include "SVGNames.h" > #include <wtf/IsoMallocInlines.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGCircleElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cxAttr, Cx, cx) >-DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cyAttr, Cy, cy) >-DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::rAttr, R, r) >-DEFINE_ANIMATED_BOOLEAN(SVGCircleElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCircleElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(cx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(cy) >- REGISTER_LOCAL_ANIMATED_PROPERTY(r) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document& document) > : SVGGeometryElement(tagName, document) >- , m_cx(LengthModeWidth) >- , m_cy(LengthModeHeight) >- , m_r(LengthModeOther) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::circleTag)); >- registerAnimatedPropertiesForSVGCircleElement(); >+ registerAttributes(); > } > > Ref<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagName, Document& document) >@@ -62,41 +43,43 @@ Ref<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagName, Doc > return adoptRef(*new SVGCircleElement(tagName, document)); > } > >+void SVGCircleElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::cxAttr, &SVGCircleElement::m_cx>(); >+ registry.registerAttribute<SVGNames::cyAttr, &SVGCircleElement::m_cy>(); >+ registry.registerAttribute<SVGNames::rAttr, &SVGCircleElement::m_r>(); >+} >+ > void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; > > if (name == SVGNames::cxAttr) >- setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::cyAttr) >- setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::rAttr) >- setRBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); >+ m_r.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >- SVGGraphicsElement::parseAttribute(name, value); >+ SVGGeometryElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); > } > > void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) > { >- SVGGraphicsElement::svgAttributeChanged(attrName); >- >- if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || attrName == SVGNames::rAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidateSVGPresentationAttributeStyle(); > return; > } > >- auto* renderer = downcast<RenderSVGShape>(this->renderer()); >- if (!renderer) >- return; >- >- if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >- InstanceInvalidationGuard guard(*this); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- } >+ SVGGeometryElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGCircleElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGCircleElement.h b/Source/WebCore/svg/SVGCircleElement.h >index ac3bbb152a1..65c7b465b51 100644 >--- a/Source/WebCore/svg/SVGCircleElement.h >+++ b/Source/WebCore/svg/SVGCircleElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -20,10 +21,10 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedLength.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGeometryElement.h" >+#include "SVGNames.h" > > namespace WebCore { > >@@ -32,24 +33,35 @@ class SVGCircleElement final : public SVGGeometryElement, public SVGExternalReso > public: > static Ref<SVGCircleElement> create(const QualifiedName&, Document&); > >+ const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& r() const { return m_r.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> rAnimated() { return m_r.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGCircleElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCircleElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool selfHasRelativeLengths() const final { return true; } > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGCircleElement) >- DECLARE_ANIMATED_LENGTH(Cx, cx) >- DECLARE_ANIMATED_LENGTH(Cy, cy) >- DECLARE_ANIMATED_LENGTH(R, r) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_cx { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_cy { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_r { LengthModeOther }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGClipPathElement.cpp b/Source/WebCore/svg/SVGClipPathElement.cpp >index 0fa276a63e7..bdd35d7a808 100644 >--- a/Source/WebCore/svg/SVGClipPathElement.cpp >+++ b/Source/WebCore/svg/SVGClipPathElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> > * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -33,22 +34,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGClipPathElement); > >-// Animated property definitions >-DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, ClipPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) >-DEFINE_ANIMATED_BOOLEAN(SVGClipPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(clipPathUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >- , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::clipPathTag)); >- registerAnimatedPropertiesForSVGClipPathElement(); >+ registerAttributes(); > } > > Ref<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& tagName, Document& document) >@@ -56,16 +47,12 @@ Ref<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& tagName, > return adoptRef(*new SVGClipPathElement(tagName, document)); > } > >-bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGClipPathElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add(SVGNames::clipPathUnitsAttr); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGClipPathElement::m_clipPathUnits>(); > } > > void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -73,7 +60,7 @@ void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS > if (name == SVGNames::clipPathUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setClipPathUnitsBaseValue(propertyValue); >+ m_clipPathUnits.setValue(propertyValue); > return; > } > >@@ -83,15 +70,16 @@ void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > void SVGClipPathElement::childrenChanged(const ChildChange& change) >diff --git a/Source/WebCore/svg/SVGClipPathElement.h b/Source/WebCore/svg/SVGClipPathElement.h >index a11c49f42ff..63b6bde0e24 100644 >--- a/Source/WebCore/svg/SVGClipPathElement.h >+++ b/Source/WebCore/svg/SVGClipPathElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -35,24 +36,30 @@ class SVGClipPathElement final : public SVGGraphicsElement, public SVGExternalRe > public: > static Ref<SVGClipPathElement> create(const QualifiedName&, Document&); > >+ SVGUnitTypes::SVGUnitType clipPathUnits() const { return m_clipPathUnits.currentValue(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> clipPathUnitsAnimated() { return m_clipPathUnits.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGClipPathElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- bool supportsFocus() const final { return false; } >- bool needsPendingResourceHandling() const final { return false; } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGClipPathElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > void childrenChanged(const ChildChange&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } >+ bool supportsFocus() const final { return false; } >+ bool needsPendingResourceHandling() const final { return false; } >+ > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGClipPathElement) >- DECLARE_ANIMATED_ENUMERATION(ClipPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_clipPathUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp b/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp >index 198e6352fb7..4e2032bb217 100644 >--- a/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp >+++ b/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -31,47 +32,24 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGComponentTransferFunctionElement); > >-// Animated property definitions >-DEFINE_ANIMATED_ENUMERATION(SVGComponentTransferFunctionElement, SVGNames::typeAttr, Type, type, ComponentTransferType) >-DEFINE_ANIMATED_NUMBER_LIST(SVGComponentTransferFunctionElement, SVGNames::tableValuesAttr, TableValues, tableValues) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::slopeAttr, Slope, slope) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::interceptAttr, Intercept, intercept) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::amplitudeAttr, Amplitude, amplitude) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::exponentAttr, Exponent, exponent) >-DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::offsetAttr, Offset, offset) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(type) >- REGISTER_LOCAL_ANIMATED_PROPERTY(tableValues) >- REGISTER_LOCAL_ANIMATED_PROPERTY(slope) >- REGISTER_LOCAL_ANIMATED_PROPERTY(intercept) >- REGISTER_LOCAL_ANIMATED_PROPERTY(amplitude) >- REGISTER_LOCAL_ANIMATED_PROPERTY(exponent) >- REGISTER_LOCAL_ANIMATED_PROPERTY(offset) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_type(FECOMPONENTTRANSFER_TYPE_IDENTITY) >- , m_slope(1) >- , m_amplitude(1) >- , m_exponent(1) > { >- registerAnimatedPropertiesForSVGComponentTransferFunctionElement(); >+ registerAttributes(); > } > >-bool SVGComponentTransferFunctionElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGComponentTransferFunctionElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> { >- SVGNames::typeAttr, >- SVGNames::tableValuesAttr, >- SVGNames::slopeAttr, >- SVGNames::interceptAttr, >- SVGNames::amplitudeAttr, >- SVGNames::exponentAttr, >- SVGNames::offsetAttr, >- }); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::typeAttr, ComponentTransferType, &SVGComponentTransferFunctionElement::m_type>(); >+ registry.registerAttribute<SVGNames::tableValuesAttr, &SVGComponentTransferFunctionElement::m_tableValues>(); >+ registry.registerAttribute<SVGNames::slopeAttr, &SVGComponentTransferFunctionElement::m_slope>(); >+ registry.registerAttribute<SVGNames::interceptAttr, &SVGComponentTransferFunctionElement::m_intercept>(); >+ registry.registerAttribute<SVGNames::amplitudeAttr, &SVGComponentTransferFunctionElement::m_amplitude>(); >+ registry.registerAttribute<SVGNames::exponentAttr, &SVGComponentTransferFunctionElement::m_exponent>(); >+ registry.registerAttribute<SVGNames::offsetAttr, &SVGComponentTransferFunctionElement::m_offset>(); > } > > void SVGComponentTransferFunctionElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -79,40 +57,40 @@ void SVGComponentTransferFunctionElement::parseAttribute(const QualifiedName& na > if (name == SVGNames::typeAttr) { > ComponentTransferType propertyValue = SVGPropertyTraits<ComponentTransferType>::fromString(value); > if (propertyValue > 0) >- setTypeBaseValue(propertyValue); >+ m_type.setValue(propertyValue); > return; > } > > if (name == SVGNames::tableValuesAttr) { > SVGNumberListValues newList; > newList.parse(value); >- detachAnimatedTableValuesListWrappers(newList.size()); >- setTableValuesBaseValue(newList); >+ m_tableValues.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_tableValues.setValue(WTFMove(newList)); > return; > } > > if (name == SVGNames::slopeAttr) { >- setSlopeBaseValue(value.toFloat()); >+ m_slope.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::interceptAttr) { >- setInterceptBaseValue(value.toFloat()); >+ m_intercept.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::amplitudeAttr) { >- setAmplitudeBaseValue(value.toFloat()); >+ m_amplitude.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::exponentAttr) { >- setExponentBaseValue(value.toFloat()); >+ m_exponent.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::offsetAttr) { >- setOffsetBaseValue(value.toFloat()); >+ m_offset.setValue(value.toFloat()); > return; > } > >@@ -121,27 +99,26 @@ void SVGComponentTransferFunctionElement::parseAttribute(const QualifiedName& na > > void SVGComponentTransferFunctionElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ invalidateFilterPrimitiveParent(this); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- invalidateFilterPrimitiveParent(this); >+ SVGElement::svgAttributeChanged(attrName); > } > > ComponentTransferFunction SVGComponentTransferFunctionElement::transferFunction() const > { >- ComponentTransferFunction func; >- func.type = type(); >- func.slope = slope(); >- func.intercept = intercept(); >- func.amplitude = amplitude(); >- func.exponent = exponent(); >- func.offset = offset(); >- func.tableValues = tableValues(); >- return func; >+ return { >+ type(), >+ slope(), >+ intercept(), >+ amplitude(), >+ exponent(), >+ offset(), >+ tableValues() >+ }; > } > > } >diff --git a/Source/WebCore/svg/SVGComponentTransferFunctionElement.h b/Source/WebCore/svg/SVGComponentTransferFunctionElement.h >index 701ca05b63a..9f46becdfb4 100644 >--- a/Source/WebCore/svg/SVGComponentTransferFunctionElement.h >+++ b/Source/WebCore/svg/SVGComponentTransferFunctionElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -74,26 +75,45 @@ class SVGComponentTransferFunctionElement : public SVGElement { > public: > ComponentTransferFunction transferFunction() const; > >+ ComponentTransferType type() const { return m_type.currentValue(attributeOwnerProxy()); } >+ const SVGNumberListValues& tableValues() const { return m_tableValues.currentValue(attributeOwnerProxy()); } >+ float slope() const { return m_slope.currentValue(attributeOwnerProxy()); } >+ float intercept() const { return m_intercept.currentValue(attributeOwnerProxy()); } >+ float amplitude() const { return m_amplitude.currentValue(attributeOwnerProxy()); } >+ float exponent() const { return m_exponent.currentValue(attributeOwnerProxy()); } >+ float offset() const { return m_offset.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumberList> tableValuesAnimated() { return m_tableValues.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> slopeAnimated() { return m_slope.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> interceptAnimated() { return m_intercept.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> amplitudeAnimated() { return m_amplitude.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> exponentAnimated() { return m_exponent.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> offsetAnimated() { return m_offset.animatedProperty(attributeOwnerProxy()); } >+ > protected: > SVGComponentTransferFunctionElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGComponentTransferFunctionElement, SVGElement>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > > bool rendererIsNeeded(const RenderStyle&) override { return false; } > > private: >- static bool isSupportedAttribute(const QualifiedName&); >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement) >- DECLARE_ANIMATED_ENUMERATION(Type, type, ComponentTransferType) >- DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues) >- DECLARE_ANIMATED_NUMBER(Slope, slope) >- DECLARE_ANIMATED_NUMBER(Intercept, intercept) >- DECLARE_ANIMATED_NUMBER(Amplitude, amplitude) >- DECLARE_ANIMATED_NUMBER(Exponent, exponent) >- DECLARE_ANIMATED_NUMBER(Offset, offset) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedEnumerationAttribute<ComponentTransferType> m_type { FECOMPONENTTRANSFER_TYPE_IDENTITY }; >+ SVGAnimatedNumberListAttribute m_tableValues; >+ SVGAnimatedNumberAttribute m_slope { 1 }; >+ SVGAnimatedNumberAttribute m_intercept; >+ SVGAnimatedNumberAttribute m_amplitude { 1 }; >+ SVGAnimatedNumberAttribute m_exponent { 1 }; >+ SVGAnimatedNumberAttribute m_offset; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGCursorElement.cpp b/Source/WebCore/svg/SVGCursorElement.cpp >index 070bfde8d05..8dd70f2bee8 100644 >--- a/Source/WebCore/svg/SVGCursorElement.cpp >+++ b/Source/WebCore/svg/SVGCursorElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -33,27 +34,14 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGCursorElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_STRING(SVGCursorElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGCursorElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_x(LengthModeWidth) >- , m_y(LengthModeHeight) >+ , SVGExternalResourcesRequired(this) >+ , SVGTests(this) >+ , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::cursorTag)); >- registerAnimatedPropertiesForSVGCursorElement(); >+ registerAttributes(); > } > > Ref<SVGCursorElement> SVGCursorElement::create(const QualifiedName& tagName, Document& document) >@@ -67,17 +55,13 @@ SVGCursorElement::~SVGCursorElement() > client->cursorElementRemoved(*this); > } > >-bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGCursorElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGTests::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- SVGURIReference::addSupportedAttributes(set); >- set.add({ SVGNames::xAttr.get(), SVGNames::yAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGCursorElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGCursorElement::m_y>(); > } > > void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -85,9 +69,9 @@ void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicStr > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > >@@ -109,14 +93,14 @@ void SVGCursorElement::removeClient(CSSCursorImageValue& value) > > void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ for (auto& client : m_clients) >+ client->cursorElementChanged(*this); > return; > } > >- InstanceInvalidationGuard guard(*this); >- for (auto& client : m_clients) >- client->cursorElementChanged(*this); >+ SVGElement::svgAttributeChanged(attrName); > } > > void SVGCursorElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const >@@ -126,19 +110,4 @@ void SVGCursorElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const > addSubresourceURL(urls, document().completeURL(href())); > } > >-Ref<SVGStringList> SVGCursorElement::requiredFeatures() >-{ >- return SVGTests::requiredFeatures(*this); >-} >- >-Ref<SVGStringList> SVGCursorElement::requiredExtensions() >-{ >- return SVGTests::requiredExtensions(*this); >-} >- >-Ref<SVGStringList> SVGCursorElement::systemLanguage() >-{ >- return SVGTests::systemLanguage(*this); >-} >- > } >diff --git a/Source/WebCore/svg/SVGCursorElement.h b/Source/WebCore/svg/SVGCursorElement.h >index 37eebb0c8ee..2a71c62c0b6 100644 >--- a/Source/WebCore/svg/SVGCursorElement.h >+++ b/Source/WebCore/svg/SVGCursorElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -32,7 +33,7 @@ namespace WebCore { > > class CSSCursorImageValue; > >-class SVGCursorElement final : public SVGElement, public SVGTests, public SVGExternalResourcesRequired, public SVGURIReference { >+class SVGCursorElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGTests, public SVGURIReference { > WTF_MAKE_ISO_ALLOCATED(SVGCursorElement); > public: > static Ref<SVGCursorElement> create(const QualifiedName&, Document&); >@@ -42,36 +43,32 @@ public: > void addClient(CSSCursorImageValue&); > void removeClient(CSSCursorImageValue&); > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } > > private: > SVGCursorElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCursorElement, SVGElement, SVGExternalResourcesRequired, SVGTests, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool rendererIsNeeded(const RenderStyle&) final { return false; } > > void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGCursorElement) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >- >- // SVGTests >- void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } >- void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } >- void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } >- >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight }; > HashSet<CSSCursorImageValue*> m_clients; > }; > >diff --git a/Source/WebCore/svg/SVGDefsElement.cpp b/Source/WebCore/svg/SVGDefsElement.cpp >index c6a0f3dcba9..acbe55e183b 100644 >--- a/Source/WebCore/svg/SVGDefsElement.cpp >+++ b/Source/WebCore/svg/SVGDefsElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -29,19 +30,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGDefsElement); > >-// Animated property definitions >-DEFINE_ANIMATED_BOOLEAN(SVGDefsElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGDefsElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGDefsElement::SVGDefsElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::defsTag)); >- registerAnimatedPropertiesForSVGDefsElement(); > } > > Ref<SVGDefsElement> SVGDefsElement::create(const QualifiedName& tagName, Document& document) >diff --git a/Source/WebCore/svg/SVGDefsElement.h b/Source/WebCore/svg/SVGDefsElement.h >index 64495fd4d6b..df3c0403ecf 100644 >--- a/Source/WebCore/svg/SVGDefsElement.h >+++ b/Source/WebCore/svg/SVGDefsElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -34,14 +35,15 @@ public: > private: > SVGDefsElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGDefsElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } >+ > bool isValid() const final; > bool supportsFocus() const final { return false; } > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGDefsElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp >index 55898ee34ca..1b7214bf990 100644 >--- a/Source/WebCore/svg/SVGElement.cpp >+++ b/Source/WebCore/svg/SVGElement.cpp >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> >- * Copyright (C) 2008-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2008-2018 Apple Inc. All rights reserved. > * Copyright (C) 2008 Alp Toker <alp@atoker.com> > * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> > * Copyright (C) 2013 Samsung Electronics. All rights reserved. >@@ -64,13 +64,6 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGElement, HTMLNames::classAttr, ClassName, className) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(className) >-END_REGISTER_ANIMATED_PROPERTIES >- > static NEVER_INLINE HashMap<AtomicStringImpl*, CSSPropertyID> createAttributeNameToCSSPropertyIDMap() > { > using namespace HTMLNames; >@@ -282,8 +275,9 @@ static inline const HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyT > > SVGElement::SVGElement(const QualifiedName& tagName, Document& document) > : StyledElement(tagName, document, CreateSVGElement) >+ , SVGLangSpace(this) > { >- registerAnimatedPropertiesForSVGElement(); >+ registerAttributes(); > } > > SVGElement::~SVGElement() >@@ -458,10 +452,18 @@ void SVGElement::setCorrespondingElement(SVGElement* correspondingElement) > correspondingElement->ensureSVGRareData().instances().add(this); > } > >+void SVGElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<HTMLNames::classAttr, &SVGElement::m_className>(); >+} >+ > void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == HTMLNames::classAttr) { >- setClassNameBaseValue(value); >+ m_className.setValue(value); > return; > } > >@@ -484,7 +486,7 @@ void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& v > > Vector<AnimatedPropertyType> SVGElement::animatedPropertyTypesForAttribute(const QualifiedName& attributeName) > { >- auto types = localAttributeToPropertyMap().types(attributeName); >+ auto types = animatedTypes(attributeName); > if (!types.isEmpty()) > return types; > >@@ -695,7 +697,7 @@ void SVGElement::synchronizeAllAnimatedSVGAttribute(SVGElement* svgElement) > ASSERT(svgElement->elementData()); > ASSERT(svgElement->elementData()->animatedSVGAttributesAreDirty()); > >- svgElement->localAttributeToPropertyMap().synchronizeProperties(*svgElement); >+ svgElement->synchronizeAttributes(); > svgElement->elementData()->setAnimatedSVGAttributesAreDirty(false); > } > >@@ -708,25 +710,7 @@ void SVGElement::synchronizeAnimatedSVGAttribute(const QualifiedName& name) cons > if (name == anyQName()) > synchronizeAllAnimatedSVGAttribute(nonConstThis); > else >- nonConstThis->localAttributeToPropertyMap().synchronizeProperty(*nonConstThis, name); >-} >- >-void SVGElement::synchronizeRequiredFeatures(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- contextElement->synchronizeRequiredFeatures(); >-} >- >-void SVGElement::synchronizeRequiredExtensions(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- contextElement->synchronizeRequiredExtensions(); >-} >- >-void SVGElement::synchronizeSystemLanguage(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- contextElement->synchronizeSystemLanguage(); >+ nonConstThis->synchronizeAttribute(name); > } > > std::optional<ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*) >@@ -939,7 +923,7 @@ bool SVGElement::isAnimatableCSSProperty(const QualifiedName& attributeName) > > bool SVGElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attributeName) > { >- return !localAttributeToPropertyMap().types(attributeName).isEmpty(); >+ return !animatedTypes(attributeName).isEmpty(); > } > > bool SVGElement::isPresentationAttribute(const QualifiedName& name) const >@@ -956,11 +940,6 @@ void SVGElement::collectStyleForPresentationAttribute(const QualifiedName& name, > addPropertyToPresentationAttributeStyle(style, propertyID, value); > } > >-bool SVGElement::isKnownAttribute(const QualifiedName& attrName) >-{ >- return attrName == HTMLNames::idAttr; >-} >- > void SVGElement::svgAttributeChanged(const QualifiedName& attrName) > { > CSSPropertyID propId = cssPropertyIdForSVGAttributeName(attrName); >@@ -985,6 +964,8 @@ void SVGElement::svgAttributeChanged(const QualifiedName& attrName) > invalidateInstances(); > return; > } >+ >+ SVGLangSpace::svgAttributeChanged(attrName); > } > > Node::InsertedIntoAncestorResult SVGElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree) >diff --git a/Source/WebCore/svg/SVGElement.h b/Source/WebCore/svg/SVGElement.h >index e3d13587431..cf60b8dcdb7 100644 >--- a/Source/WebCore/svg/SVGElement.h >+++ b/Source/WebCore/svg/SVGElement.h >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >- * Copyright (C) 2009-2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2009-2018 Apple Inc. All rights reserved. > * Copyright (C) 2013 Samsung Electronics. All rights reserved. > * > * This library is free software; you can redistribute it and/or >@@ -23,11 +23,11 @@ > #pragma once > > #include "SVGAnimatedString.h" >+#include "SVGAttributeOwnerProxy.h" > #include "SVGLangSpace.h" > #include "SVGLocatable.h" > #include "SVGNames.h" > #include "SVGParsingError.h" >-#include "SVGPropertyInfo.h" > #include "StyledElement.h" > #include <wtf/HashMap.h> > #include <wtf/HashSet.h> >@@ -38,7 +38,6 @@ class AffineTransform; > class CSSStyleDeclaration; > class DeprecatedCSSOMValue; > class Document; >-class SVGAttributeToPropertyMap; > class SVGDocumentExtensions; > class SVGElementRareData; > class SVGSVGElement; >@@ -57,7 +56,6 @@ public: > String title() const override; > static bool isAnimatableCSSProperty(const QualifiedName&); > bool isPresentationAttributeWithSVGDOM(const QualifiedName&); >- bool isKnownAttribute(const QualifiedName&); > RefPtr<DeprecatedCSSOMValue> getPresentationAttribute(const String& name); > virtual bool supportsMarkers() const { return false; } > bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); } >@@ -109,14 +107,6 @@ public: > > std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; > >- static void synchronizeRequiredFeatures(SVGElement* contextElement); >- static void synchronizeRequiredExtensions(SVGElement* contextElement); >- static void synchronizeSystemLanguage(SVGElement* contextElement); >- >- virtual void synchronizeRequiredFeatures() { } >- virtual void synchronizeRequiredExtensions() { } >- virtual void synchronizeSystemLanguage() { } >- > static QualifiedName animatableAttributeForName(const AtomicString&); > #ifndef NDEBUG > bool isAnimatableAttribute(const QualifiedName&) const; >@@ -138,6 +128,29 @@ public: > void callClearTarget() { clearTarget(); } > > class InstanceUpdateBlocker; >+ class InstanceInvalidationGuard; >+ >+ // The definition of the owner proxy has to match the class inheritance but we are interested in the SVG objects only. >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGElement, SVGLangSpace>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ // A super class will override this function to return its owner proxy. The attributes of the super class will >+ // be accessible through the registry of the owner proxy. >+ virtual const SVGAttributeOwnerProxy& attributeOwnerProxy() const { return m_attributeOwnerProxy; } >+ >+ // Helper functions which return info for the super class' attributes. >+ void synchronizeAttribute(const QualifiedName& name) { attributeOwnerProxy().synchronizeAttribute(name); } >+ void synchronizeAttributes() { attributeOwnerProxy().synchronizeAttributes(); } >+ Vector<AnimatedPropertyType> animatedTypes(const QualifiedName& attributeName) const { return attributeOwnerProxy().animatedTypes(attributeName); } >+ RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGAttribute& attribute) const { return attributeOwnerProxy().lookupAnimatedProperty(attribute); } >+ RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(const SVGAttribute& attribute) { return attributeOwnerProxy().lookupOrCreateAnimatedProperty(attribute); } >+ Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(const QualifiedName& name) { return attributeOwnerProxy().lookupOrCreateAnimatedProperties(name); } >+ >+ // These are needed for the RenderTree, animation and DOM. >+ const auto& className() const { return m_className.currentValue(attributeOwnerProxy()); } >+ auto classNameAnimated() { return m_className.animatedProperty(attributeOwnerProxy()); } > > protected: > SVGElement(const QualifiedName&, Document&); >@@ -169,8 +182,6 @@ protected: > > void willRecalcStyle(Style::Change) override; > >- class InstanceInvalidationGuard; >- > private: > const RenderStyle* computedStyle(PseudoId = PseudoId::None) final; > >@@ -189,10 +200,8 @@ private: > > HashSet<SVGElement*> m_elementsWithRelativeLengths; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES_BASE(SVGElement) >- DECLARE_ANIMATED_STRING(ClassName, className) >- END_DECLARE_ANIMATED_PROPERTIES >- >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_className; > }; > > class SVGElement::InstanceInvalidationGuard { >diff --git a/Source/WebCore/svg/SVGEllipseElement.cpp b/Source/WebCore/svg/SVGEllipseElement.cpp >index 96a6774535e..0a54b1875d8 100644 >--- a/Source/WebCore/svg/SVGEllipseElement.cpp >+++ b/Source/WebCore/svg/SVGEllipseElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,43 +22,20 @@ > #include "config.h" > #include "SVGEllipseElement.h" > >-#include "FloatPoint.h" > #include "RenderSVGEllipse.h" >-#include "RenderSVGPath.h" > #include "RenderSVGResource.h" >-#include "SVGLengthValue.h" >-#include "SVGNames.h" > #include <wtf/IsoMallocInlines.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGEllipseElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cxAttr, Cx, cx) >-DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cyAttr, Cy, cy) >-DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx) >-DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry) >-DEFINE_ANIMATED_BOOLEAN(SVGEllipseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(cx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(cy) >- REGISTER_LOCAL_ANIMATED_PROPERTY(rx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(ry) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document& document) > : SVGGeometryElement(tagName, document) >- , m_cx(LengthModeWidth) >- , m_cy(LengthModeHeight) >- , m_rx(LengthModeWidth) >- , m_ry(LengthModeHeight) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::ellipseTag)); >- registerAnimatedPropertiesForSVGEllipseElement(); >+ registerAttributes(); > } > > Ref<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tagName, Document& document) >@@ -65,42 +43,46 @@ Ref<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tagName, D > return adoptRef(*new SVGEllipseElement(tagName, document)); > } > >+void SVGEllipseElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::cxAttr, &SVGEllipseElement::m_cx>(); >+ registry.registerAttribute<SVGNames::cyAttr, &SVGEllipseElement::m_cy>(); >+ registry.registerAttribute<SVGNames::rxAttr, &SVGEllipseElement::m_rx>(); >+ registry.registerAttribute<SVGNames::ryAttr, &SVGEllipseElement::m_ry>(); >+} >+ > void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; > > if (name == SVGNames::cxAttr) >- setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::cyAttr) >- setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::rxAttr) >- setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); >+ m_rx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::ryAttr) >- setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); >+ m_ry.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >- SVGGraphicsElement::parseAttribute(name, value); >+ SVGGeometryElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); > } > > void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidateSVGPresentationAttributeStyle(); > return; > } > >- if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >- if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) { >- InstanceInvalidationGuard guard(*this); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- } >- return; >- } >- >- SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGGeometryElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGEllipseElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGEllipseElement.h b/Source/WebCore/svg/SVGEllipseElement.h >index 2570327ffd6..9daaea8cf8b 100644 >--- a/Source/WebCore/svg/SVGEllipseElement.h >+++ b/Source/WebCore/svg/SVGEllipseElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -20,10 +21,10 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedLength.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGeometryElement.h" >+#include "SVGNames.h" > > namespace WebCore { > >@@ -32,25 +33,38 @@ class SVGEllipseElement final : public SVGGeometryElement, public SVGExternalRes > public: > static Ref<SVGEllipseElement> create(const QualifiedName&, Document&); > >+ const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& rx() const { return m_rx.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& ry() const { return m_ry.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> rxAnimated() { return m_rx.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> ryAnimated() { return m_ry.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGEllipseElement(const QualifiedName&, Document&); >- >- bool isValid() const final { return SVGTests::isValid(); } > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGEllipseElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool selfHasRelativeLengths() const final { return true; } > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGEllipseElement) >- DECLARE_ANIMATED_LENGTH(Cx, cx) >- DECLARE_ANIMATED_LENGTH(Cy, cy) >- DECLARE_ANIMATED_LENGTH(Rx, rx) >- DECLARE_ANIMATED_LENGTH(Ry, ry) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_cx { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_cy { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_rx { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_ry { LengthModeHeight }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGExternalResourcesRequired.cpp b/Source/WebCore/svg/SVGExternalResourcesRequired.cpp >index b0d38ecaa92..3a1e56dd623 100644 >--- a/Source/WebCore/svg/SVGExternalResourcesRequired.cpp >+++ b/Source/WebCore/svg/SVGExternalResourcesRequired.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -26,49 +27,59 @@ > > namespace WebCore { > >-void SVGExternalResourcesRequired::parseAttribute(const QualifiedName& name, const AtomicString& value) >+SVGExternalResourcesRequired::SVGExternalResourcesRequired(SVGElement* contextElement) >+ : m_contextElement(*contextElement) > { >- if (name == SVGNames::externalResourcesRequiredAttr) >- setExternalResourcesRequiredBaseValue(value == "true"); >+ registerAttributes(); > } > >-bool SVGExternalResourcesRequired::isKnownAttribute(const QualifiedName& attrName) >+void SVGExternalResourcesRequired::registerAttributes() > { >- return attrName == SVGNames::externalResourcesRequiredAttr; >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::externalResourcesRequiredAttr, &SVGEllipseElement::m_externalResourcesRequired>(); > } > >-void SVGExternalResourcesRequired::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes) >+void SVGExternalResourcesRequired::parseAttribute(const QualifiedName& name, const AtomicString& value) > { >- supportedAttributes.add(SVGNames::externalResourcesRequiredAttr); >+ if (name == SVGNames::externalResourcesRequiredAttr) >+ setExternalResourcesRequired(value == "true"); > } > >-bool SVGExternalResourcesRequired::handleAttributeChange(SVGElement* targetElement, const QualifiedName& attrName) >+void SVGExternalResourcesRequired::svgAttributeChanged(const QualifiedName& attrName) > { >- ASSERT(targetElement); > if (!isKnownAttribute(attrName)) >- return false; >- if (!targetElement->isConnected()) >- return true; >+ return; >+ if (!m_contextElement.isConnected()) >+ return; > > // Handle dynamic updates of the 'externalResourcesRequired' attribute. Only possible case: changing from 'true' to 'false' > // causes an immediate dispatch of the SVGLoad event. If the attribute value was 'false' before inserting the script element > // in the document, the SVGLoad event has already been dispatched. >- if (!externalResourcesRequiredBaseValue() && !haveFiredLoadEvent() && !isParserInserted()) { >+ if (!externalResourcesRequired() && !haveFiredLoadEvent() && !isParserInserted()) { > setHaveFiredLoadEvent(true); >- ASSERT(targetElement->haveLoadedRequiredResources()); > >- targetElement->sendSVGLoadEventIfPossible(); >+ ASSERT(m_contextElement.haveLoadedRequiredResources()); >+ m_contextElement.sendSVGLoadEventIfPossible(); > } > >- return true; >+ auto* renderer = m_contextElement.renderer(); >+ if (renderer && is<RenderSVGShape>(renderer)) { >+ SVGElement::InstanceInvalidationGuard guard(m_contextElement); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > } > >-void SVGExternalResourcesRequired::dispatchLoadEvent(SVGElement* targetElement) >+void SVGExternalResourcesRequired::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes) > { >- bool externalResourcesRequired = externalResourcesRequiredBaseValue(); >+ supportedAttributes.add(SVGNames::externalResourcesRequiredAttr); >+} > >+void SVGExternalResourcesRequired::dispatchLoadEvent() >+{ > if (isParserInserted()) >- ASSERT(externalResourcesRequired != haveFiredLoadEvent()); >+ ASSERT(externalResourcesRequired() != haveFiredLoadEvent()); > else if (haveFiredLoadEvent()) > return; > >@@ -76,40 +87,40 @@ void SVGExternalResourcesRequired::dispatchLoadEvent(SVGElement* targetElement) > // HTML fires the 'load' event after it sucessfully loaded a remote resource, otherwise an error event. > // SVG fires the SVGLoad event immediately after parsing the <script> element, if externalResourcesRequired > // is set to 'false', otherwise it dispatches the 'SVGLoad' event just after loading the remote resource. >- if (!externalResourcesRequired) >+ if (!externalResourcesRequired()) > return; > > ASSERT(!haveFiredLoadEvent()); > > // Dispatch SVGLoad event > setHaveFiredLoadEvent(true); >- ASSERT(targetElement->haveLoadedRequiredResources()); >+ ASSERT(m_contextElement.haveLoadedRequiredResources()); > >- targetElement->sendSVGLoadEventIfPossible(); >+ m_contextElement.sendSVGLoadEventIfPossible(); > } > >-void SVGExternalResourcesRequired::insertedIntoDocument(SVGElement* targetElement) >+void SVGExternalResourcesRequired::insertedIntoDocument() > { > if (isParserInserted()) > return; > > // Eventually send SVGLoad event now for the dynamically inserted script element. >- if (externalResourcesRequiredBaseValue()) >+ if (externalResourcesRequired()) > return; > setHaveFiredLoadEvent(true); >- targetElement->sendSVGLoadEventIfPossibleAsynchronously(); >+ m_contextElement.sendSVGLoadEventIfPossibleAsynchronously(); > } > > void SVGExternalResourcesRequired::finishParsingChildren() > { > // A SVGLoad event has been fired by SVGElement::finishParsingChildren. >- if (!externalResourcesRequiredBaseValue()) >+ if (!externalResourcesRequired()) > setHaveFiredLoadEvent(true); > } > > bool SVGExternalResourcesRequired::haveLoadedRequiredResources() const > { >- return !externalResourcesRequiredBaseValue() || haveFiredLoadEvent(); >+ return !externalResourcesRequired() || haveFiredLoadEvent(); > } > > } >diff --git a/Source/WebCore/svg/SVGExternalResourcesRequired.h b/Source/WebCore/svg/SVGExternalResourcesRequired.h >index 675c5450cfe..d25507ad07e 100644 >--- a/Source/WebCore/svg/SVGExternalResourcesRequired.h >+++ b/Source/WebCore/svg/SVGExternalResourcesRequired.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,6 +22,7 @@ > #pragma once > > #include "QualifiedName.h" >+#include "SVGAttributeOwnerProxyImpl.h" > #include <wtf/HashSet.h> > > namespace WebCore { >@@ -33,29 +35,43 @@ class SVGElement; > // states that externalResourcesRequired cannot be animated, the animVal will always be the same as the baseVal. > // FIXME: When implementing animVal support, make sure that animVal==baseVal for externalResourcesRequired > class SVGExternalResourcesRequired { >+ WTF_MAKE_NONCOPYABLE(SVGExternalResourcesRequired); > public: > virtual ~SVGExternalResourcesRequired() = default; > > void parseAttribute(const QualifiedName&, const AtomicString&); >+ void svgAttributeChanged(const QualifiedName&); > >- static bool isKnownAttribute(const QualifiedName&); > static void addSupportedAttributes(HashSet<QualifiedName>&); > >- bool handleAttributeChange(SVGElement*, const QualifiedName&); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ auto externalResourcesRequiredAnimated() { return m_externalResourcesRequired.animatedProperty(attributeOwnerProxy()); } >+ >+ bool externalResourcesRequired() const { return m_externalResourcesRequired.value(); } >+ void setExternalResourcesRequired(bool externalResourcesRequired) { m_externalResourcesRequired.setValue(externalResourcesRequired); } > > protected: >- // These types look a bit awkward, but have to match the generic types of the SVGAnimatedProperty macros. >- virtual void setExternalResourcesRequiredBaseValue(const bool&, const bool validValue = true) = 0; >- virtual bool& externalResourcesRequiredBaseValue() const = 0; >+ SVGExternalResourcesRequired(SVGElement* contextElement); >+ >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } > > virtual void setHaveFiredLoadEvent(bool) { } > virtual bool isParserInserted() const { return false; } > virtual bool haveFiredLoadEvent() const { return false; } > >- void dispatchLoadEvent(SVGElement*); >- void insertedIntoDocument(SVGElement*); >+ void dispatchLoadEvent(); >+ void insertedIntoDocument(); > void finishParsingChildren(); > bool haveLoadedRequiredResources() const; >+ >+private: >+ static void registerAttributes(); >+ AttributeOwnerProxy attributeOwnerProxy() { return { *this, m_contextElement }; } >+ >+ SVGElement& m_contextElement; >+ SVGAnimatedBooleanAttribute m_externalResourcesRequired; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEBlendElement.cpp b/Source/WebCore/svg/SVGFEBlendElement.cpp >index 3b4a1105ec4..c7fbed3daed 100644 >--- a/Source/WebCore/svg/SVGFEBlendElement.cpp >+++ b/Source/WebCore/svg/SVGFEBlendElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -32,24 +33,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEBlendElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::in2Attr, In2, in2) >-DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode, BlendMode) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEBlendElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in2) >- REGISTER_LOCAL_ANIMATED_PROPERTY(mode) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_mode(BlendModeNormal) > { > ASSERT(hasTagName(SVGNames::feBlendTag)); >- registerAnimatedPropertiesForSVGFEBlendElement(); >+ registerAttributes(); > } > > Ref<SVGFEBlendElement> SVGFEBlendElement::create(const QualifiedName& tagName, Document& document) >@@ -57,22 +45,32 @@ Ref<SVGFEBlendElement> SVGFEBlendElement::create(const QualifiedName& tagName, D > return adoptRef(*new SVGFEBlendElement(tagName, document)); > } > >+void SVGFEBlendElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEBlendElement::m_in1>(); >+ registry.registerAttribute<SVGNames::in2Attr, &SVGFEBlendElement::m_in2>(); >+ registry.registerAttribute<SVGNames::modeAttr, BlendMode, &SVGFEBlendElement::m_mode>(); >+} >+ > void SVGFEBlendElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::modeAttr) { > BlendMode mode = BlendModeNormal; > if (parseBlendMode(value, mode)) >- setModeBaseValue(mode); >+ m_mode.setValue(mode); > return; > } > > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::in2Attr) { >- setIn2BaseValue(value); >+ m_in2.setValue(value); > return; > } > >diff --git a/Source/WebCore/svg/SVGFEBlendElement.h b/Source/WebCore/svg/SVGFEBlendElement.h >index 8f86f1eb6e6..32a48c6ff84 100644 >--- a/Source/WebCore/svg/SVGFEBlendElement.h >+++ b/Source/WebCore/svg/SVGFEBlendElement.h >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -45,19 +46,33 @@ class SVGFEBlendElement final : public SVGFilterPrimitiveStandardAttributes { > public: > static Ref<SVGFEBlendElement> create(const QualifiedName&, Document&); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ String in2() const { return m_in2.currentValue(attributeOwnerProxy()); } >+ BlendMode mode() const { return m_mode.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> modeAnimated() { return m_mode.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEBlendElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEBlendElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; > void svgAttributeChanged(const QualifiedName&) override; >+ > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEBlendElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_STRING(In2, in2) >- DECLARE_ANIMATED_ENUMERATION(Mode, mode, BlendMode) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedStringAttribute m_in2; >+ SVGAnimatedEnumerationAttribute<BlendMode> m_mode { BlendModeNormal }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEColorMatrixElement.cpp b/Source/WebCore/svg/SVGFEColorMatrixElement.cpp >index 249667dac22..515d32ffbcd 100644 >--- a/Source/WebCore/svg/SVGFEColorMatrixElement.cpp >+++ b/Source/WebCore/svg/SVGFEColorMatrixElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,24 +31,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEColorMatrixElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEColorMatrixElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_ENUMERATION(SVGFEColorMatrixElement, SVGNames::typeAttr, Type, type, ColorMatrixType) >-DEFINE_ANIMATED_NUMBER_LIST(SVGFEColorMatrixElement, SVGNames::valuesAttr, Values, values) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEColorMatrixElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(type) >- REGISTER_LOCAL_ANIMATED_PROPERTY(values) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_type(FECOLORMATRIX_TYPE_MATRIX) > { > ASSERT(hasTagName(SVGNames::feColorMatrixTag)); >- registerAnimatedPropertiesForSVGFEColorMatrixElement(); >+ registerAttributes(); > } > > Ref<SVGFEColorMatrixElement> SVGFEColorMatrixElement::create(const QualifiedName& tagName, Document& document) >@@ -55,25 +43,35 @@ Ref<SVGFEColorMatrixElement> SVGFEColorMatrixElement::create(const QualifiedName > return adoptRef(*new SVGFEColorMatrixElement(tagName, document)); > } > >+void SVGFEColorMatrixElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEColorMatrixElement::m_in1>(); >+ registry.registerAttribute<SVGNames::typeAttr, ColorMatrixType, &SVGFEColorMatrixElement::m_type>(); >+ registry.registerAttribute<SVGNames::valuesAttr, &SVGFEColorMatrixElement::m_values>(); >+} >+ > void SVGFEColorMatrixElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::typeAttr) { > auto propertyValue = SVGPropertyTraits<ColorMatrixType>::fromString(value); > if (propertyValue > 0) >- setTypeBaseValue(propertyValue); >+ m_type.setValue(propertyValue); > return; > } > > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::valuesAttr) { > SVGNumberListValues newList; > newList.parse(value); >- detachAnimatedValuesListWrappers(newList.size()); >- setValuesBaseValue(newList); >+ m_values.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_values.setValue(WTFMove(newList)); > return; > } > >diff --git a/Source/WebCore/svg/SVGFEColorMatrixElement.h b/Source/WebCore/svg/SVGFEColorMatrixElement.h >index 2c5dafbc1b3..47688ec869d 100644 >--- a/Source/WebCore/svg/SVGFEColorMatrixElement.h >+++ b/Source/WebCore/svg/SVGFEColorMatrixElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -69,19 +70,33 @@ class SVGFEColorMatrixElement final : public SVGFilterPrimitiveStandardAttribute > public: > static Ref<SVGFEColorMatrixElement> create(const QualifiedName&, Document&); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ ColorMatrixType type() const { return m_type.currentValue(attributeOwnerProxy()); } >+ const SVGNumberListValues& values() const { return m_values.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumberList> valuesAnimated() { return m_values.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEColorMatrixElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEColorMatrixElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEColorMatrixElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_ENUMERATION(Type, type, ColorMatrixType) >- DECLARE_ANIMATED_NUMBER_LIST(Values, values) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedEnumerationAttribute<ColorMatrixType> m_type { FECOLORMATRIX_TYPE_MATRIX }; >+ SVGAnimatedNumberListAttribute m_values; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEComponentTransferElement.cpp b/Source/WebCore/svg/SVGFEComponentTransferElement.cpp >index f74c622d934..57faf3b4630 100644 >--- a/Source/WebCore/svg/SVGFEComponentTransferElement.cpp >+++ b/Source/WebCore/svg/SVGFEComponentTransferElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -35,19 +36,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEComponentTransferElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEComponentTransferElement, SVGNames::inAttr, In1, in1) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEComponentTransferElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEComponentTransferElement::SVGFEComponentTransferElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) > { > ASSERT(hasTagName(SVGNames::feComponentTransferTag)); >- registerAnimatedPropertiesForSVGFEComponentTransferElement(); >+ registerAttributes(); > } > > Ref<SVGFEComponentTransferElement> SVGFEComponentTransferElement::create(const QualifiedName& tagName, Document& document) >@@ -55,10 +48,18 @@ Ref<SVGFEComponentTransferElement> SVGFEComponentTransferElement::create(const Q > return adoptRef(*new SVGFEComponentTransferElement(tagName, document)); > } > >+void SVGFEComponentTransferElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEComponentTransferElement::m_in1>(); >+} >+ > void SVGFEComponentTransferElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > >diff --git a/Source/WebCore/svg/SVGFEComponentTransferElement.h b/Source/WebCore/svg/SVGFEComponentTransferElement.h >index 84ee6e14477..bd62b3481c5 100644 >--- a/Source/WebCore/svg/SVGFEComponentTransferElement.h >+++ b/Source/WebCore/svg/SVGFEComponentTransferElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -29,16 +30,24 @@ class SVGFEComponentTransferElement final : public SVGFilterPrimitiveStandardAtt > public: > static Ref<SVGFEComponentTransferElement> create(const QualifiedName&, Document&); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEComponentTransferElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEComponentTransferElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static void registerAttributes(); >+ > // FIXME: svgAttributeChanged missing. >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >+ > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEComponentTransferElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFECompositeElement.cpp b/Source/WebCore/svg/SVGFECompositeElement.cpp >index aba3e411570..a10e3a721cf 100644 >--- a/Source/WebCore/svg/SVGFECompositeElement.cpp >+++ b/Source/WebCore/svg/SVGFECompositeElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,32 +31,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFECompositeElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::in2Attr, In2, in2) >-DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, SVGOperator, svgOperator, CompositeOperationType) >-DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k1Attr, K1, k1) >-DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k2Attr, K2, k2) >-DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k3Attr, K3, k3) >-DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k4Attr, K4, k4) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFECompositeElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in2) >- REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator) >- REGISTER_LOCAL_ANIMATED_PROPERTY(k1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(k2) >- REGISTER_LOCAL_ANIMATED_PROPERTY(k3) >- REGISTER_LOCAL_ANIMATED_PROPERTY(k4) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_svgOperator(FECOMPOSITE_OPERATOR_OVER) > { > ASSERT(hasTagName(SVGNames::feCompositeTag)); >- registerAnimatedPropertiesForSVGFECompositeElement(); >+ registerAttributes(); > } > > Ref<SVGFECompositeElement> SVGFECompositeElement::create(const QualifiedName& tagName, Document& document) >@@ -63,42 +43,56 @@ Ref<SVGFECompositeElement> SVGFECompositeElement::create(const QualifiedName& ta > return adoptRef(*new SVGFECompositeElement(tagName, document)); > } > >+void SVGFECompositeElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFECompositeElement::m_in1>(); >+ registry.registerAttribute<SVGNames::in2Attr, &SVGFECompositeElement::m_in2>(); >+ registry.registerAttribute<SVGNames::operatorAttr, CompositeOperationType, &SVGFECompositeElement::m_svgOperator>(); >+ registry.registerAttribute<SVGNames::k1Attr, &SVGFECompositeElement::m_k1>(); >+ registry.registerAttribute<SVGNames::k2Attr, &SVGFECompositeElement::m_k2>(); >+ registry.registerAttribute<SVGNames::k3Attr, &SVGFECompositeElement::m_k3>(); >+ registry.registerAttribute<SVGNames::k4Attr, &SVGFECompositeElement::m_k4>(); >+} >+ > void SVGFECompositeElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::operatorAttr) { > CompositeOperationType propertyValue = SVGPropertyTraits<CompositeOperationType>::fromString(value); > if (propertyValue > 0) >- setSVGOperatorBaseValue(propertyValue); >+ m_svgOperator.setValue(propertyValue); > return; > } > > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::in2Attr) { >- setIn2BaseValue(value); >+ m_in2.setValue(value); > return; > } > > if (name == SVGNames::k1Attr) { >- setK1BaseValue(value.toFloat()); >+ m_k1.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::k2Attr) { >- setK2BaseValue(value.toFloat()); >+ m_k2.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::k3Attr) { >- setK3BaseValue(value.toFloat()); >+ m_k3.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::k4Attr) { >- setK4BaseValue(value.toFloat()); >+ m_k4.setValue(value.toFloat()); > return; > } > >diff --git a/Source/WebCore/svg/SVGFECompositeElement.h b/Source/WebCore/svg/SVGFECompositeElement.h >index 9836a1be84b..a123cc6a714 100644 >--- a/Source/WebCore/svg/SVGFECompositeElement.h >+++ b/Source/WebCore/svg/SVGFECompositeElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -84,23 +85,45 @@ class SVGFECompositeElement final : public SVGFilterPrimitiveStandardAttributes > public: > static Ref<SVGFECompositeElement> create(const QualifiedName&, Document&); > >+ String in1() { return m_in1.currentValue(attributeOwnerProxy()); } >+ String in2() { return m_in2.currentValue(attributeOwnerProxy()); } >+ CompositeOperationType svgOperator() const { return m_svgOperator.currentValue(attributeOwnerProxy()); } >+ float k1() const { return m_k1.currentValue(attributeOwnerProxy()); } >+ float k2() const { return m_k2.currentValue(attributeOwnerProxy()); } >+ float k3() const { return m_k3.currentValue(attributeOwnerProxy()); } >+ float k4() const { return m_k4.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> svgOperatorAnimated() { return m_svgOperator.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> k1Animated() { return m_k1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> k2Animated() { return m_k2.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> k3Animated() { return m_k3.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> k4Animated() { return m_k4.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFECompositeElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFECompositeElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFECompositeElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_STRING(In2, in2) >- DECLARE_ANIMATED_ENUMERATION(SVGOperator, svgOperator, CompositeOperationType) >- DECLARE_ANIMATED_NUMBER(K1, k1) >- DECLARE_ANIMATED_NUMBER(K2, k2) >- DECLARE_ANIMATED_NUMBER(K3, k3) >- DECLARE_ANIMATED_NUMBER(K4, k4) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedStringAttribute m_in2; >+ SVGAnimatedEnumerationAttribute<CompositeOperationType> m_svgOperator { FECOMPOSITE_OPERATOR_OVER }; >+ SVGAnimatedNumberAttribute m_k1; >+ SVGAnimatedNumberAttribute m_k2; >+ SVGAnimatedNumberAttribute m_k3; >+ SVGAnimatedNumberAttribute m_k4; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp b/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp >index d0fb611057f..e63b3237a55 100644 >--- a/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp >+++ b/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -34,42 +35,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEConvolveMatrixElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEConvolveMatrixElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderXIdentifier(), OrderX, orderX) >-DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderYIdentifier(), OrderY, orderY) >-DEFINE_ANIMATED_NUMBER_LIST(SVGFEConvolveMatrixElement, SVGNames::kernelMatrixAttr, KernelMatrix, kernelMatrix) >-DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::divisorAttr, Divisor, divisor) >-DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::biasAttr, Bias, bias) >-DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, TargetX, targetX) >-DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, TargetY, targetY) >-DEFINE_ANIMATED_ENUMERATION(SVGFEConvolveMatrixElement, SVGNames::edgeModeAttr, EdgeMode, edgeMode, EdgeModeType) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY) >-DEFINE_ANIMATED_BOOLEAN(SVGFEConvolveMatrixElement, SVGNames::preserveAlphaAttr, PreserveAlpha, preserveAlpha) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(orderX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(orderY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelMatrix) >- REGISTER_LOCAL_ANIMATED_PROPERTY(divisor) >- REGISTER_LOCAL_ANIMATED_PROPERTY(bias) >- REGISTER_LOCAL_ANIMATED_PROPERTY(targetX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(targetY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(edgeMode) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAlpha) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_edgeMode(EDGEMODE_DUPLICATE) > { > ASSERT(hasTagName(SVGNames::feConvolveMatrixTag)); >- registerAnimatedPropertiesForSVGFEConvolveMatrixElement(); >+ registerAttributes(); > } > > Ref<SVGFEConvolveMatrixElement> SVGFEConvolveMatrixElement::create(const QualifiedName& tagName, Document& document) >@@ -101,18 +71,39 @@ const AtomicString& SVGFEConvolveMatrixElement::orderYIdentifier() > return s_identifier; > } > >+void SVGFEConvolveMatrixElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEConvolveMatrixElement::m_in1>(); >+ registry.registerAttribute<SVGNames::orderAttr, >+ &SVGFEConvolveMatrixElement::orderXIdentifier, &SVGFEConvolveMatrixElement::m_orderX, >+ &SVGFEConvolveMatrixElement::orderYIdentifier, &SVGFEConvolveMatrixElement::m_orderY>(); >+ registry.registerAttribute<SVGNames::kernelMatrixAttr, &SVGFEConvolveMatrixElement::m_kernelMatrix>(); >+ registry.registerAttribute<SVGNames::divisorAttr, &SVGFEConvolveMatrixElement::m_divisor>(); >+ registry.registerAttribute<SVGNames::biasAttr, &SVGFEConvolveMatrixElement::m_bias>(); >+ registry.registerAttribute<SVGNames::targetXAttr, &SVGFEConvolveMatrixElement::m_targetX>(); >+ registry.registerAttribute<SVGNames::targetYAttr, &SVGFEConvolveMatrixElement::m_targetY>(); >+ registry.registerAttribute<SVGNames::edgeModeAttr, EdgeModeType, &SVGFEConvolveMatrixElement::m_edgeMode>(); >+ registry.registerAttribute<SVGNames::kernelUnitLengthAttr, >+ &SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthX, >+ &SVGFEConvolveMatrixElement::kernelUnitLengthYIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthY>(); >+ registry.registerAttribute<SVGNames::preserveAlphaAttr, &SVGFEConvolveMatrixElement::m_preserveAlpha>(); >+} >+ > void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::orderAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y) && x >= 1 && y >= 1) { >- setOrderXBaseValue(x); >- setOrderYBaseValue(y); >+ m_orderX.setValue(x); >+ m_orderY.setValue(y); > } else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing order=\"" + value + "\". Filtered element will not be displayed."); > return; >@@ -121,7 +112,7 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const > if (name == SVGNames::edgeModeAttr) { > EdgeModeType propertyValue = SVGPropertyTraits<EdgeModeType>::fromString(value); > if (propertyValue > 0) >- setEdgeModeBaseValue(propertyValue); >+ m_edgeMode.setValue(propertyValue); > else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing edgeMode=\"" + value + "\". Filtered element will not be displayed."); > return; >@@ -130,40 +121,40 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const > if (name == SVGNames::kernelMatrixAttr) { > SVGNumberListValues newList; > newList.parse(value); >- detachAnimatedKernelMatrixListWrappers(newList.size()); >- setKernelMatrixBaseValue(newList); >+ m_kernelMatrix.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_kernelMatrix.setValue(WTFMove(newList)); > return; > } > > if (name == SVGNames::divisorAttr) { > float divisor = value.toFloat(); > if (divisor) >- setDivisorBaseValue(divisor); >+ m_divisor.setValue(divisor); > else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing divisor=\"" + value + "\". Filtered element will not be displayed."); > return; > } > > if (name == SVGNames::biasAttr) { >- setBiasBaseValue(value.toFloat()); >+ m_bias.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::targetXAttr) { >- setTargetXBaseValue(value.string().toUIntStrict()); >+ m_targetX.setValue(value.string().toUIntStrict()); > return; > } > > if (name == SVGNames::targetYAttr) { >- setTargetYBaseValue(value.string().toUIntStrict()); >+ m_targetY.setValue(value.string().toUIntStrict()); > return; > } > > if (name == SVGNames::kernelUnitLengthAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y) && x > 0 && y > 0) { >- setKernelUnitLengthXBaseValue(x); >- setKernelUnitLengthYBaseValue(y); >+ m_kernelUnitLengthX.setValue(x); >+ m_kernelUnitLengthY.setValue(y); > } else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing kernelUnitLength=\"" + value + "\". Filtered element will not be displayed."); > return; >@@ -171,9 +162,9 @@ void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const > > if (name == SVGNames::preserveAlphaAttr) { > if (value == "true") >- setPreserveAlphaBaseValue(true); >+ m_preserveAlpha.setValue(true); > else if (value == "false") >- setPreserveAlphaBaseValue(false); >+ m_preserveAlpha.setValue(false); > else > document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value + "\". Filtered element will not be displayed."); > return; >@@ -192,11 +183,11 @@ bool SVGFEConvolveMatrixElement::setFilterEffectAttribute(FilterEffect* effect, > if (attrName == SVGNames::biasAttr) > return convolveMatrix->setBias(bias()); > if (attrName == SVGNames::targetXAttr) >- return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); >+ return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); > if (attrName == SVGNames::targetYAttr) >- return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); >+ return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); > if (attrName == SVGNames::kernelUnitLengthAttr) >- return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY())); >+ return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY())); > if (attrName == SVGNames::preserveAlphaAttr) > return convolveMatrix->setPreserveAlpha(preserveAlpha()); > >@@ -206,15 +197,15 @@ bool SVGFEConvolveMatrixElement::setFilterEffectAttribute(FilterEffect* effect, > > void SVGFEConvolveMatrixElement::setOrder(float x, float y) > { >- setOrderXBaseValue(x); >- setOrderYBaseValue(y); >+ m_orderX.setValue(x); >+ m_orderY.setValue(y); > invalidate(); > } > > void SVGFEConvolveMatrixElement::setKernelUnitLength(float x, float y) > { >- setKernelUnitLengthXBaseValue(x); >- setKernelUnitLengthYBaseValue(y); >+ m_kernelUnitLengthX.setValue(x); >+ m_kernelUnitLengthY.setValue(y); > invalidate(); > } > >diff --git a/Source/WebCore/svg/SVGFEConvolveMatrixElement.h b/Source/WebCore/svg/SVGFEConvolveMatrixElement.h >index 6d25881dd7b..6f731749a32 100644 >--- a/Source/WebCore/svg/SVGFEConvolveMatrixElement.h >+++ b/Source/WebCore/svg/SVGFEConvolveMatrixElement.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -32,6 +33,7 @@ namespace WebCore { > template<> > struct SVGPropertyTraits<EdgeModeType> { > static unsigned highestEnumValue() { return EDGEMODE_NONE; } >+ static EdgeModeType initialValue() { return EDGEMODE_NONE; } > > static String toString(EdgeModeType type) > { >@@ -70,12 +72,45 @@ public: > void setOrder(float orderX, float orderY); > void setKernelUnitLength(float kernelUnitLengthX, float kernelUnitLengthY); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ int orderX() const { return m_orderX.currentValue(attributeOwnerProxy()); } >+ int orderY() const { return m_orderY.currentValue(attributeOwnerProxy()); } >+ const SVGNumberListValues& kernelMatrix() const { return m_kernelMatrix.currentValue(attributeOwnerProxy()); } >+ float divisor() const { return m_divisor.currentValue(attributeOwnerProxy()); } >+ float bias() const { return m_bias.currentValue(attributeOwnerProxy()); } >+ int targetX() const { return m_targetX.currentValue(attributeOwnerProxy()); } >+ int targetY() const { return m_targetY.currentValue(attributeOwnerProxy()); } >+ EdgeModeType edgeMode() const { return m_edgeMode.currentValue(attributeOwnerProxy()); } >+ float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); } >+ float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); } >+ bool preserveAlpha() const { return m_preserveAlpha.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedInteger> orderXAnimated() { return m_orderX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedInteger> orderYAnimated() { return m_orderY.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumberList> kernelMatrixAnimated() { return m_kernelMatrix.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> divisorAnimated() { return m_divisor.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> biasAnimated() { return m_bias.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedInteger> targetXAnimated() { return m_targetX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedInteger> targetYAnimated() { return m_targetY.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> edgeModeAnimated() { return m_edgeMode.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedBoolean> preserveAlphaAnimated() { return m_preserveAlpha.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEConvolveMatrixElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEConvolveMatrixElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > > static const AtomicString& orderXIdentifier(); >@@ -83,20 +118,19 @@ private: > static const AtomicString& kernelUnitLengthXIdentifier(); > static const AtomicString& kernelUnitLengthYIdentifier(); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_INTEGER(OrderX, orderX) >- DECLARE_ANIMATED_INTEGER(OrderY, orderY) >- DECLARE_ANIMATED_NUMBER_LIST(KernelMatrix, kernelMatrix) >- DECLARE_ANIMATED_NUMBER(Divisor, divisor) >- DECLARE_ANIMATED_NUMBER(Bias, bias) >- DECLARE_ANIMATED_INTEGER(TargetX, targetX) >- DECLARE_ANIMATED_INTEGER(TargetY, targetY) >- DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode, EdgeModeType) >- DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) >- DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) >- DECLARE_ANIMATED_BOOLEAN(PreserveAlpha, preserveAlpha) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedIntegerAttribute m_orderX; >+ SVGAnimatedIntegerAttribute m_orderY; >+ SVGAnimatedNumberListAttribute m_kernelMatrix; >+ SVGAnimatedNumberAttribute m_divisor; >+ SVGAnimatedNumberAttribute m_bias; >+ SVGAnimatedIntegerAttribute m_targetX; >+ SVGAnimatedIntegerAttribute m_targetY; >+ SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { EDGEMODE_DUPLICATE }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthX; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthY; >+ SVGAnimatedBooleanAttribute m_preserveAlpha; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp >index 3ea3b16e762..b9b023ac006 100644 >--- a/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp >+++ b/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -33,29 +34,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEDiffuseLightingElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEDiffuseLightingElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_NUMBER(SVGFEDiffuseLightingElement, SVGNames::diffuseConstantAttr, DiffuseConstant, diffuseConstant) >-DEFINE_ANIMATED_NUMBER(SVGFEDiffuseLightingElement, SVGNames::surfaceScaleAttr, SurfaceScale, surfaceScale) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDiffuseLightingElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(diffuseConstant) >- REGISTER_LOCAL_ANIMATED_PROPERTY(surfaceScale) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_diffuseConstant(1) >- , m_surfaceScale(1) > { > ASSERT(hasTagName(SVGNames::feDiffuseLightingTag)); >- registerAnimatedPropertiesForSVGFEDiffuseLightingElement(); >+ registerAttributes(); > } > > Ref<SVGFEDiffuseLightingElement> SVGFEDiffuseLightingElement::create(const QualifiedName& tagName, Document& document) >@@ -75,28 +58,41 @@ const AtomicString& SVGFEDiffuseLightingElement::kernelUnitLengthYIdentifier() > return s_identifier; > } > >+void SVGFEDiffuseLightingElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEDiffuseLightingElement::m_in1>(); >+ registry.registerAttribute<SVGNames::diffuseConstantAttr, &SVGFEDiffuseLightingElement::m_diffuseConstant>(); >+ registry.registerAttribute<SVGNames::surfaceScaleAttr, &SVGFEDiffuseLightingElement::m_surfaceScale>(); >+ registry.registerAttribute<SVGNames::kernelUnitLengthAttr, >+ &SVGFEDiffuseLightingElement::kernelUnitLengthXIdentifier, &SVGFEDiffuseLightingElement::m_kernelUnitLengthX, >+ &SVGFEDiffuseLightingElement::kernelUnitLengthYIdentifier, &SVGFEDiffuseLightingElement::m_kernelUnitLengthY>(); >+} >+ > void SVGFEDiffuseLightingElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::surfaceScaleAttr) { >- setSurfaceScaleBaseValue(value.toFloat()); >+ m_surfaceScale.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::diffuseConstantAttr) { >- setDiffuseConstantBaseValue(value.toFloat()); >+ m_diffuseConstant.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::kernelUnitLengthAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y)) { >- setKernelUnitLengthXBaseValue(x); >- setKernelUnitLengthYBaseValue(y); >+ m_kernelUnitLengthX.setValue(x); >+ m_kernelUnitLengthY.setValue(y); > } > return; > } >diff --git a/Source/WebCore/svg/SVGFEDiffuseLightingElement.h b/Source/WebCore/svg/SVGFEDiffuseLightingElement.h >index 48fbfc27a23..0b8ae8b01ef 100644 >--- a/Source/WebCore/svg/SVGFEDiffuseLightingElement.h >+++ b/Source/WebCore/svg/SVGFEDiffuseLightingElement.h >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> > * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -35,24 +36,42 @@ public: > static Ref<SVGFEDiffuseLightingElement> create(const QualifiedName&, Document&); > void lightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ float diffuseConstant() const { return m_diffuseConstant.currentValue(attributeOwnerProxy()); } >+ float surfaceScale() const { return m_surfaceScale.currentValue(attributeOwnerProxy()); } >+ float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); } >+ float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> diffuseConstantAnimated() { return m_diffuseConstant.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> surfaceScaleAnimated() { return m_surfaceScale.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEDiffuseLightingElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEDiffuseLightingElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > > static const AtomicString& kernelUnitLengthXIdentifier(); > static const AtomicString& kernelUnitLengthYIdentifier(); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDiffuseLightingElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_NUMBER(DiffuseConstant, diffuseConstant) >- DECLARE_ANIMATED_NUMBER(SurfaceScale, surfaceScale) >- DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) >- DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedNumberAttribute m_diffuseConstant { 1 }; >+ SVGAnimatedNumberAttribute m_surfaceScale { 1 }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthX; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthY; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp b/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp >index 2b48e843025..435fc701df6 100644 >--- a/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp >+++ b/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -29,29 +30,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEDisplacementMapElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::in2Attr, In2, in2) >-DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, XChannelSelector, xChannelSelector, ChannelSelectorType) >-DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, YChannelSelector, yChannelSelector, ChannelSelectorType) >-DEFINE_ANIMATED_NUMBER(SVGFEDisplacementMapElement, SVGNames::scaleAttr, Scale, scale) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in2) >- REGISTER_LOCAL_ANIMATED_PROPERTY(xChannelSelector) >- REGISTER_LOCAL_ANIMATED_PROPERTY(yChannelSelector) >- REGISTER_LOCAL_ANIMATED_PROPERTY(scale) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_xChannelSelector(CHANNEL_A) >- , m_yChannelSelector(CHANNEL_A) > { > ASSERT(hasTagName(SVGNames::feDisplacementMapTag)); >- registerAnimatedPropertiesForSVGFEDisplacementMapElement(); >+ registerAttributes(); > } > > Ref<SVGFEDisplacementMapElement> SVGFEDisplacementMapElement::create(const QualifiedName& tagName, Document& document) >@@ -59,34 +42,46 @@ Ref<SVGFEDisplacementMapElement> SVGFEDisplacementMapElement::create(const Quali > return adoptRef(*new SVGFEDisplacementMapElement(tagName, document)); > } > >+void SVGFEDisplacementMapElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEDisplacementMapElement::m_in1>(); >+ registry.registerAttribute<SVGNames::in2Attr, &SVGFEDisplacementMapElement::m_in2>(); >+ registry.registerAttribute<SVGNames::xChannelSelectorAttr, ChannelSelectorType, &SVGFEDisplacementMapElement::m_xChannelSelector>(); >+ registry.registerAttribute<SVGNames::yChannelSelectorAttr, ChannelSelectorType, &SVGFEDisplacementMapElement::m_yChannelSelector>(); >+ registry.registerAttribute<SVGNames::scaleAttr, &SVGFEDisplacementMapElement::m_scale>(); >+} >+ > void SVGFEDisplacementMapElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::xChannelSelectorAttr) { > auto propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); > if (propertyValue > 0) >- setXChannelSelectorBaseValue(propertyValue); >+ m_xChannelSelector.setValue(propertyValue); > return; > } > > if (name == SVGNames::yChannelSelectorAttr) { > auto propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); > if (propertyValue > 0) >- setYChannelSelectorBaseValue(propertyValue); >+ m_yChannelSelector.setValue(propertyValue); > return; > } > > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::in2Attr) { >- setIn2BaseValue(value); >+ m_in2.setValue(value); > return; > } > > if (name == SVGNames::scaleAttr) { >- setScaleBaseValue(value.toFloat()); >+ m_scale.setValue(value.toFloat()); > return; > } > >diff --git a/Source/WebCore/svg/SVGFEDisplacementMapElement.h b/Source/WebCore/svg/SVGFEDisplacementMapElement.h >index 15f8be7e31a..51bed53df66 100644 >--- a/Source/WebCore/svg/SVGFEDisplacementMapElement.h >+++ b/Source/WebCore/svg/SVGFEDisplacementMapElement.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -69,22 +70,40 @@ public: > static Ref<SVGFEDisplacementMapElement> create(const QualifiedName&, Document&); > > static ChannelSelectorType stringToChannel(const String&); >- >+ >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ String in2() const { return m_in2.currentValue(attributeOwnerProxy()); } >+ ChannelSelectorType xChannelSelector() const { return m_xChannelSelector.currentValue(attributeOwnerProxy()); } >+ ChannelSelectorType yChannelSelector() const { return m_yChannelSelector.currentValue(attributeOwnerProxy()); } >+ float scale() const { return m_scale.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> xChannelSelectorAnimated() { return m_xChannelSelector.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> yChannelSelectorAnimated() { return m_yChannelSelector.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> scaleAnimated() { return m_scale.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEDisplacementMapElement(const QualifiedName& tagName, Document&); >- >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEDisplacementMapElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; > void svgAttributeChanged(const QualifiedName&) override; >+ >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_STRING(In2, in2) >- DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector, ChannelSelectorType) >- DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector, ChannelSelectorType) >- DECLARE_ANIMATED_NUMBER(Scale, scale) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedStringAttribute m_in2; >+ SVGAnimatedEnumerationAttribute<ChannelSelectorType> m_xChannelSelector { CHANNEL_A }; >+ SVGAnimatedEnumerationAttribute<ChannelSelectorType> m_yChannelSelector { CHANNEL_A }; >+ SVGAnimatedNumberAttribute m_scale; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEDropShadowElement.cpp b/Source/WebCore/svg/SVGFEDropShadowElement.cpp >index cc4bba11601..550f65e2743 100644 >--- a/Source/WebCore/svg/SVGFEDropShadowElement.cpp >+++ b/Source/WebCore/svg/SVGFEDropShadowElement.cpp >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2011. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -31,31 +32,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEDropShadowElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEDropShadowElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_NUMBER(SVGFEDropShadowElement, SVGNames::dxAttr, Dx, dx) >-DEFINE_ANIMATED_NUMBER(SVGFEDropShadowElement, SVGNames::dyAttr, Dy, dy) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDropShadowElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), StdDeviationX, stdDeviationX) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDropShadowElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), StdDeviationY, stdDeviationY) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDropShadowElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(dx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(dy) >- REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationY) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEDropShadowElement::SVGFEDropShadowElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_dx(2) >- , m_dy(2) >- , m_stdDeviationX(2) >- , m_stdDeviationY(2) > { > ASSERT(hasTagName(SVGNames::feDropShadowTag)); >- registerAnimatedPropertiesForSVGFEDropShadowElement(); >+ registerAttributes(); > } > > Ref<SVGFEDropShadowElement> SVGFEDropShadowElement::create(const QualifiedName& tagName, Document& document) >@@ -77,34 +58,47 @@ const AtomicString& SVGFEDropShadowElement::stdDeviationYIdentifier() > > void SVGFEDropShadowElement::setStdDeviation(float x, float y) > { >- setStdDeviationXBaseValue(x); >- setStdDeviationYBaseValue(y); >+ m_stdDeviationX.setValue(x); >+ m_stdDeviationY.setValue(y); > invalidate(); > } > >+void SVGFEDropShadowElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEDropShadowElement::m_in1>(); >+ registry.registerAttribute<SVGNames::dxAttr, &SVGFEDropShadowElement::m_dx>(); >+ registry.registerAttribute<SVGNames::dyAttr, &SVGFEDropShadowElement::m_dy>(); >+ registry.registerAttribute<SVGNames::stdDeviationAttr, >+ &SVGFEDropShadowElement::stdDeviationXIdentifier, &SVGFEDropShadowElement::m_stdDeviationX, >+ &SVGFEDropShadowElement::stdDeviationYIdentifier, &SVGFEDropShadowElement::m_stdDeviationY>(); >+} >+ > void SVGFEDropShadowElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::stdDeviationAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y)) { >- setStdDeviationXBaseValue(x); >- setStdDeviationYBaseValue(y); >+ m_stdDeviationX.setValue(x); >+ m_stdDeviationY.setValue(y); > } > return; > } > > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::dxAttr) { >- setDxBaseValue(value.toFloat()); >+ m_dx.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::dyAttr) { >- setDyBaseValue(value.toFloat()); >+ m_dy.setValue(value.toFloat()); > return; > } > >@@ -113,7 +107,7 @@ void SVGFEDropShadowElement::parseAttribute(const QualifiedName& name, const Ato > > void SVGFEDropShadowElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidate(); > return; >diff --git a/Source/WebCore/svg/SVGFEDropShadowElement.h b/Source/WebCore/svg/SVGFEDropShadowElement.h >index dc5302bcbc4..366219e02c6 100644 >--- a/Source/WebCore/svg/SVGFEDropShadowElement.h >+++ b/Source/WebCore/svg/SVGFEDropShadowElement.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2011. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -24,31 +25,49 @@ > #include "SVGFilterPrimitiveStandardAttributes.h" > > namespace WebCore { >- >+ > class SVGFEDropShadowElement final : public SVGFilterPrimitiveStandardAttributes { > WTF_MAKE_ISO_ALLOCATED(SVGFEDropShadowElement); > public: > static Ref<SVGFEDropShadowElement> create(const QualifiedName&, Document&); > > void setStdDeviation(float stdDeviationX, float stdDeviationY); >- >+ >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ float dx() const { return m_dx.currentValue(attributeOwnerProxy()); } >+ float dy() const { return m_dy.currentValue(attributeOwnerProxy()); } >+ float stdDeviationX() const { return m_stdDeviationX.currentValue(attributeOwnerProxy()); } >+ float stdDeviationY() const { return m_stdDeviationY.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> stdDeviationXAnimated() { return m_stdDeviationX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> stdDeviationYAnimated() { return m_stdDeviationY.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEDropShadowElement(const QualifiedName&, Document&); >- >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEDropShadowElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; >- >+ > static const AtomicString& stdDeviationXIdentifier(); > static const AtomicString& stdDeviationYIdentifier(); >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDropShadowElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_NUMBER(Dx, dx) >- DECLARE_ANIMATED_NUMBER(Dy, dy) >- DECLARE_ANIMATED_NUMBER(StdDeviationX, stdDeviationX) >- DECLARE_ANIMATED_NUMBER(StdDeviationY, stdDeviationY) >- END_DECLARE_ANIMATED_PROPERTIES >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedNumberAttribute m_dx { 2 }; >+ SVGAnimatedNumberAttribute m_dy { 2 }; >+ SVGAnimatedNumberAttribute m_stdDeviationX { 2 }; >+ SVGAnimatedNumberAttribute m_stdDeviationY { 2 }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp b/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp >index bd3f8a44288..933187e6d04 100644 >--- a/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp >+++ b/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -31,26 +32,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEGaussianBlurElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEGaussianBlurElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), StdDeviationX, stdDeviationX) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), StdDeviationY, stdDeviationY) >-DEFINE_ANIMATED_ENUMERATION(SVGFEGaussianBlurElement, SVGNames::edgeModeAttr, EdgeMode, edgeMode, EdgeModeType) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEGaussianBlurElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(edgeMode) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_edgeMode(EDGEMODE_NONE) > { > ASSERT(hasTagName(SVGNames::feGaussianBlurTag)); >- registerAnimatedPropertiesForSVGFEGaussianBlurElement(); >+ registerAttributes(); > } > > Ref<SVGFEGaussianBlurElement> SVGFEGaussianBlurElement::create(const QualifiedName& tagName, Document& document) >@@ -72,31 +58,43 @@ const AtomicString& SVGFEGaussianBlurElement::stdDeviationYIdentifier() > > void SVGFEGaussianBlurElement::setStdDeviation(float x, float y) > { >- setStdDeviationXBaseValue(x); >- setStdDeviationYBaseValue(y); >+ m_stdDeviationX.setValue(x); >+ m_stdDeviationY.setValue(y); > invalidate(); > } > >+void SVGFEGaussianBlurElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEGaussianBlurElement::m_in1>(); >+ registry.registerAttribute<SVGNames::stdDeviationAttr, >+ &SVGFEGaussianBlurElement::stdDeviationXIdentifier, &SVGFEGaussianBlurElement::m_stdDeviationX, >+ &SVGFEGaussianBlurElement::stdDeviationYIdentifier, &SVGFEGaussianBlurElement::m_stdDeviationY>(); >+ registry.registerAttribute<SVGNames::edgeModeAttr, EdgeModeType, &SVGFEGaussianBlurElement::m_edgeMode>(); >+} >+ > void SVGFEGaussianBlurElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::stdDeviationAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y)) { >- setStdDeviationXBaseValue(x); >- setStdDeviationYBaseValue(y); >+ m_stdDeviationX.setValue(x); >+ m_stdDeviationY.setValue(y); > } > return; > } > > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::edgeModeAttr) { > auto propertyValue = SVGPropertyTraits<EdgeModeType>::fromString(value); > if (propertyValue > 0) >- setEdgeModeBaseValue(propertyValue); >+ m_edgeMode.setValue(propertyValue); > else > document().accessSVGExtensions().reportWarning("feGaussianBlur: problem parsing edgeMode=\"" + value + "\". Filtered element will not be displayed."); > return; >@@ -107,7 +105,7 @@ void SVGFEGaussianBlurElement::parseAttribute(const QualifiedName& name, const A > > void SVGFEGaussianBlurElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr || attrName == SVGNames::edgeModeAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidate(); > return; >diff --git a/Source/WebCore/svg/SVGFEGaussianBlurElement.h b/Source/WebCore/svg/SVGFEGaussianBlurElement.h >index 5a271cc23ca..93b61aca46a 100644 >--- a/Source/WebCore/svg/SVGFEGaussianBlurElement.h >+++ b/Source/WebCore/svg/SVGFEGaussianBlurElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -35,22 +36,38 @@ public: > > void setStdDeviation(float stdDeviationX, float stdDeviationY); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ float stdDeviationX() const { return m_stdDeviationX.currentValue(attributeOwnerProxy()); } >+ float stdDeviationY() const { return m_stdDeviationY.currentValue(attributeOwnerProxy()); } >+ EdgeModeType edgeMode() const { return m_edgeMode.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> stdDeviationXAnimated() { return m_stdDeviationX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> stdDeviationYAnimated() { return m_stdDeviationY.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> edgeModeAnimated() { return m_edgeMode.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEGaussianBlurElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEGaussianBlurElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > > static const AtomicString& stdDeviationXIdentifier(); > static const AtomicString& stdDeviationYIdentifier(); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEGaussianBlurElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_NUMBER(StdDeviationX, stdDeviationX) >- DECLARE_ANIMATED_NUMBER(StdDeviationY, stdDeviationY) >- DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode, EdgeModeType) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedNumberAttribute m_stdDeviationX; >+ SVGAnimatedNumberAttribute m_stdDeviationY; >+ SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { EDGEMODE_NONE }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEImageElement.cpp b/Source/WebCore/svg/SVGFEImageElement.cpp >index 0cd3d9be70e..3a41928a28e 100644 >--- a/Source/WebCore/svg/SVGFEImageElement.cpp >+++ b/Source/WebCore/svg/SVGFEImageElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> > * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -38,23 +39,13 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEImageElement); > >-// Animated property definitions >-DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) >-DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGFEImageElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >+ , SVGExternalResourcesRequired(this) >+ , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::feImageTag)); >- registerAnimatedPropertiesForSVGFEImageElement(); >+ registerAttributes(); > } > > Ref<SVGFEImageElement> SVGFEImageElement::create(const QualifiedName& tagName, Document& document) >@@ -122,12 +113,20 @@ void SVGFEImageElement::buildPendingResource() > invalidate(); > } > >+void SVGFEImageElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGFEImageElement::m_preserveAspectRatio>(); >+} >+ > void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::preserveAspectRatioAttr) { > SVGPreserveAspectRatioValue preserveAspectRatio; > preserveAspectRatio.parse(value); >- setPreserveAspectRatioBaseValue(preserveAspectRatio); >+ m_preserveAspectRatio.setValue(preserveAspectRatio); > return; > } > >diff --git a/Source/WebCore/svg/SVGFEImageElement.h b/Source/WebCore/svg/SVGFEImageElement.h >index 2249a855d7d..6c4fd6350b9 100644 >--- a/Source/WebCore/svg/SVGFEImageElement.h >+++ b/Source/WebCore/svg/SVGFEImageElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -31,7 +32,7 @@ > > namespace WebCore { > >-class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes, public SVGURIReference, public SVGExternalResourcesRequired, public CachedImageClient { >+class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes, public SVGExternalResourcesRequired, public SVGURIReference, public CachedImageClient { > WTF_MAKE_ISO_ALLOCATED(SVGFEImageElement); > public: > static Ref<SVGFEImageElement> create(const QualifiedName&, Document&); >@@ -40,16 +41,26 @@ public: > > bool hasSingleSecurityOrigin() const; > >+ const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEImageElement(const QualifiedName&, Document&); > >- void didFinishInsertingNode() override; >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEImageElement, SVGFilterPrimitiveStandardAttributes, SVGExternalResourcesRequired, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; >- void notifyFinished(CachedResource&) final; > >+ void notifyFinished(CachedResource&) final; > void addSubresourceAttributeURLs(ListHashSet<URL>&) const override; >+ >+ void didFinishInsertingNode() override; >+ > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > > void clearResourceReferences(); >@@ -59,12 +70,8 @@ private: > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; > void removedFromAncestor(RemovalType, ContainerNode&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEImageElement) >- DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >- >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio; > CachedResourceHandle<CachedImage> m_cachedImage; > }; > >diff --git a/Source/WebCore/svg/SVGFELightElement.cpp b/Source/WebCore/svg/SVGFELightElement.cpp >index 9c9530c34ec..891fedd98d5 100644 >--- a/Source/WebCore/svg/SVGFELightElement.cpp >+++ b/Source/WebCore/svg/SVGFELightElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -39,36 +40,10 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFELightElement); > >-// Animated property definitions >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::azimuthAttr, Azimuth, azimuth) >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::elevationAttr, Elevation, elevation) >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::zAttr, Z, z) >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtXAttr, PointsAtX, pointsAtX) >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtYAttr, PointsAtY, pointsAtY) >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtZAttr, PointsAtZ, pointsAtZ) >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::specularExponentAttr, SpecularExponent, specularExponent) >-DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::limitingConeAngleAttr, LimitingConeAngle, limitingConeAngle) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFELightElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(azimuth) >- REGISTER_LOCAL_ANIMATED_PROPERTY(elevation) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(z) >- REGISTER_LOCAL_ANIMATED_PROPERTY(pointsAtX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(pointsAtY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(pointsAtZ) >- REGISTER_LOCAL_ANIMATED_PROPERTY(specularExponent) >- REGISTER_LOCAL_ANIMATED_PROPERTY(limitingConeAngle) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGFELightElement::SVGFELightElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_specularExponent(1) > { >- registerAnimatedPropertiesForSVGFELightElement(); >+ registerAttributes(); > } > > SVGFELightElement* SVGFELightElement::findLightElement(const SVGElement* svgElement) >@@ -80,55 +55,72 @@ SVGFELightElement* SVGFELightElement::findLightElement(const SVGElement* svgElem > return nullptr; > } > >+void SVGFELightElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::azimuthAttr, &SVGFELightElement::m_azimuth>(); >+ registry.registerAttribute<SVGNames::elevationAttr, &SVGFELightElement::m_elevation>(); >+ registry.registerAttribute<SVGNames::xAttr, &SVGFELightElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGFELightElement::m_y>(); >+ registry.registerAttribute<SVGNames::zAttr, &SVGFELightElement::m_z>(); >+ registry.registerAttribute<SVGNames::pointsAtXAttr, &SVGFELightElement::m_pointsAtX>(); >+ registry.registerAttribute<SVGNames::pointsAtYAttr, &SVGFELightElement::m_pointsAtY>(); >+ registry.registerAttribute<SVGNames::pointsAtZAttr, &SVGFELightElement::m_pointsAtZ>(); >+ registry.registerAttribute<SVGNames::specularExponentAttr, &SVGFELightElement::m_specularExponent>(); >+ registry.registerAttribute<SVGNames::limitingConeAngleAttr, &SVGFELightElement::m_limitingConeAngle>(); >+} >+ > void SVGFELightElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::azimuthAttr) { >- setAzimuthBaseValue(value.toFloat()); >+ m_azimuth.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::elevationAttr) { >- setElevationBaseValue(value.toFloat()); >+ m_elevation.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::xAttr) { >- setXBaseValue(value.toFloat()); >+ m_x.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::yAttr) { >- setYBaseValue(value.toFloat()); >+ m_y.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::zAttr) { >- setZBaseValue(value.toFloat()); >+ m_z.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::pointsAtXAttr) { >- setPointsAtXBaseValue(value.toFloat()); >+ m_pointsAtX.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::pointsAtYAttr) { >- setPointsAtYBaseValue(value.toFloat()); >+ m_pointsAtY.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::pointsAtZAttr) { >- setPointsAtZBaseValue(value.toFloat()); >+ m_pointsAtZ.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::specularExponentAttr) { >- setSpecularExponentBaseValue(value.toFloat()); >+ m_specularExponent.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::limitingConeAngleAttr) { >- setLimitingConeAngleBaseValue(value.toFloat()); >+ m_limitingConeAngle.setValue(value.toFloat()); > return; > } > >@@ -137,11 +129,7 @@ void SVGFELightElement::parseAttribute(const QualifiedName& name, const AtomicSt > > void SVGFELightElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::azimuthAttr || attrName == SVGNames::elevationAttr >- || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::zAttr >- || attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAttr || attrName == SVGNames::pointsAtZAttr >- || attrName == SVGNames::specularExponentAttr || attrName == SVGNames::limitingConeAngleAttr) { >- >+ if (isKnownAttribute(attrName)) { > auto parent = makeRefPtr(parentElement()); > if (!parent) > return; >diff --git a/Source/WebCore/svg/SVGFELightElement.h b/Source/WebCore/svg/SVGFELightElement.h >index 91b17fa79d3..84a678ffb0e 100644 >--- a/Source/WebCore/svg/SVGFELightElement.h >+++ b/Source/WebCore/svg/SVGFELightElement.h >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -35,28 +36,55 @@ public: > virtual Ref<LightSource> lightSource(SVGFilterBuilder&) const = 0; > static SVGFELightElement* findLightElement(const SVGElement*); > >+ float azimuth() const { return m_azimuth.currentValue(attributeOwnerProxy()); } >+ float elevation() const { return m_elevation.currentValue(attributeOwnerProxy()); } >+ float x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ float y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ float z() const { return m_z.currentValue(attributeOwnerProxy()); } >+ float pointsAtX() const { return m_pointsAtX.currentValue(attributeOwnerProxy()); } >+ float pointsAtY() const { return m_pointsAtY.currentValue(attributeOwnerProxy()); } >+ float pointsAtZ() const { return m_pointsAtZ.currentValue(attributeOwnerProxy()); } >+ float specularExponent() const { return m_specularExponent.currentValue(attributeOwnerProxy()); } >+ float limitingConeAngle() const { return m_limitingConeAngle.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedNumber> azimuthAnimated() { return m_azimuth.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> elevationAnimated() { return m_elevation.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> zAnimated() { return m_z.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> pointsAtXAnimated() { return m_pointsAtX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> pointsAtYAnimated() { return m_pointsAtY.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> pointsAtZAnimated() { return m_pointsAtZ.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> specularExponentAnimated() { return m_specularExponent.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> limitingConeAngleAnimated() { return m_limitingConeAngle.animatedProperty(attributeOwnerProxy()); } >+ > protected: > SVGFELightElement(const QualifiedName&, Document&); > > bool rendererIsNeeded(const RenderStyle&) override { return false; } > > private: >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFELightElement, SVGElement>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > void childrenChanged(const ChildChange&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFELightElement) >- DECLARE_ANIMATED_NUMBER(Azimuth, azimuth) >- DECLARE_ANIMATED_NUMBER(Elevation, elevation) >- DECLARE_ANIMATED_NUMBER(X, x) >- DECLARE_ANIMATED_NUMBER(Y, y) >- DECLARE_ANIMATED_NUMBER(Z, z) >- DECLARE_ANIMATED_NUMBER(PointsAtX, pointsAtX) >- DECLARE_ANIMATED_NUMBER(PointsAtY, pointsAtY) >- DECLARE_ANIMATED_NUMBER(PointsAtZ, pointsAtZ) >- DECLARE_ANIMATED_NUMBER(SpecularExponent, specularExponent) >- DECLARE_ANIMATED_NUMBER(LimitingConeAngle, limitingConeAngle) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedNumberAttribute m_azimuth; >+ SVGAnimatedNumberAttribute m_elevation; >+ SVGAnimatedNumberAttribute m_x; >+ SVGAnimatedNumberAttribute m_y; >+ SVGAnimatedNumberAttribute m_z; >+ SVGAnimatedNumberAttribute m_pointsAtX; >+ SVGAnimatedNumberAttribute m_pointsAtY; >+ SVGAnimatedNumberAttribute m_pointsAtZ; >+ SVGAnimatedNumberAttribute m_specularExponent { 1 }; >+ SVGAnimatedNumberAttribute m_limitingConeAngle; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEMergeNodeElement.cpp b/Source/WebCore/svg/SVGFEMergeNodeElement.cpp >index c738ccfdcf5..69cdef0a52b 100644 >--- a/Source/WebCore/svg/SVGFEMergeNodeElement.cpp >+++ b/Source/WebCore/svg/SVGFEMergeNodeElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -31,18 +32,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEMergeNodeElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEMergeNodeElement, SVGNames::inAttr, In1, in1) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMergeNodeElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEMergeNodeElement::SVGFEMergeNodeElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) > { > ASSERT(hasTagName(SVGNames::feMergeNodeTag)); >- registerAnimatedPropertiesForSVGFEMergeNodeElement(); >+ registerAttributes(); > } > > Ref<SVGFEMergeNodeElement> SVGFEMergeNodeElement::create(const QualifiedName& tagName, Document& document) >@@ -50,10 +44,18 @@ Ref<SVGFEMergeNodeElement> SVGFEMergeNodeElement::create(const QualifiedName& ta > return adoptRef(*new SVGFEMergeNodeElement(tagName, document)); > } > >+void SVGFEMergeNodeElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEMergeNodeElement::m_in1>(); >+} >+ > void SVGFEMergeNodeElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > >diff --git a/Source/WebCore/svg/SVGFEMergeNodeElement.h b/Source/WebCore/svg/SVGFEMergeNodeElement.h >index 621c5dba964..9c554ee1125 100644 >--- a/Source/WebCore/svg/SVGFEMergeNodeElement.h >+++ b/Source/WebCore/svg/SVGFEMergeNodeElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,16 +31,25 @@ class SVGFEMergeNodeElement final : public SVGElement { > public: > static Ref<SVGFEMergeNodeElement> create(const QualifiedName&, Document&); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEMergeNodeElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEMergeNodeElement, SVGElement>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; >+ > bool rendererIsNeeded(const RenderStyle&) final { return false; } > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMergeNodeElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEMorphologyElement.cpp b/Source/WebCore/svg/SVGFEMorphologyElement.cpp >index acb3aca0294..fcbc63b62e6 100644 >--- a/Source/WebCore/svg/SVGFEMorphologyElement.cpp >+++ b/Source/WebCore/svg/SVGFEMorphologyElement.cpp >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,26 +31,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEMorphologyElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEMorphologyElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_ENUMERATION(SVGFEMorphologyElement, SVGNames::operatorAttr, SVGOperator, svgOperator, MorphologyOperatorType) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusXIdentifier(), RadiusX, radiusX) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusYIdentifier(), RadiusY, radiusY) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMorphologyElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator) >- REGISTER_LOCAL_ANIMATED_PROPERTY(radiusX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(radiusY) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEMorphologyElement::SVGFEMorphologyElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_svgOperator(FEMORPHOLOGY_OPERATOR_ERODE) > { > ASSERT(hasTagName(SVGNames::feMorphologyTag)); >- registerAnimatedPropertiesForSVGFEMorphologyElement(); >+ registerAttributes(); > } > > Ref<SVGFEMorphologyElement> SVGFEMorphologyElement::create(const QualifiedName& tagName, Document& document) >@@ -71,30 +57,42 @@ const AtomicString& SVGFEMorphologyElement::radiusYIdentifier() > > void SVGFEMorphologyElement::setRadius(float x, float y) > { >- setRadiusXBaseValue(x); >- setRadiusYBaseValue(y); >+ m_radiusX.setValue(x); >+ m_radiusY.setValue(y); > invalidate(); > } > >+void SVGFEMorphologyElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEMorphologyElement::m_in1>(); >+ registry.registerAttribute<SVGNames::operatorAttr, MorphologyOperatorType, &SVGFEMorphologyElement::m_svgOperator>(); >+ registry.registerAttribute<SVGNames::radiusAttr, >+ &SVGFEMorphologyElement::radiusXIdentifier, &SVGFEMorphologyElement::m_radiusX, >+ &SVGFEMorphologyElement::radiusYIdentifier, &SVGFEMorphologyElement::m_radiusY>(); >+} >+ > void SVGFEMorphologyElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::operatorAttr) { > MorphologyOperatorType propertyValue = SVGPropertyTraits<MorphologyOperatorType>::fromString(value); > if (propertyValue > 0) >- setSVGOperatorBaseValue(propertyValue); >+ m_svgOperator.setValue(propertyValue); > return; > } > > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::radiusAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y)) { >- setRadiusXBaseValue(x); >- setRadiusYBaseValue(y); >+ m_radiusX.setValue(x); >+ m_radiusY.setValue(y); > } > return; > } >diff --git a/Source/WebCore/svg/SVGFEMorphologyElement.h b/Source/WebCore/svg/SVGFEMorphologyElement.h >index d66bbbfc9a2..af6f15e8f73 100644 >--- a/Source/WebCore/svg/SVGFEMorphologyElement.h >+++ b/Source/WebCore/svg/SVGFEMorphologyElement.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -62,23 +63,39 @@ public: > > void setRadius(float radiusX, float radiusY); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ MorphologyOperatorType svgOperator() const { return m_svgOperator.currentValue(attributeOwnerProxy()); } >+ float radiusX() const { return m_radiusX.currentValue(attributeOwnerProxy()); } >+ float radiusY() const { return m_radiusY.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> svgOperatorAnimated() { return m_svgOperator.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> radiusXAnimated() { return m_radiusX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> radiusYAnimated() { return m_radiusY.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEMorphologyElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEMorphologyElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > > static const AtomicString& radiusXIdentifier(); > static const AtomicString& radiusYIdentifier(); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMorphologyElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_ENUMERATION(SVGOperator, svgOperator, MorphologyOperatorType) >- DECLARE_ANIMATED_NUMBER(RadiusX, radiusX) >- DECLARE_ANIMATED_NUMBER(RadiusY, radiusY) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedEnumerationAttribute<MorphologyOperatorType> m_svgOperator { FEMORPHOLOGY_OPERATOR_ERODE }; >+ SVGAnimatedNumberAttribute m_radiusX; >+ SVGAnimatedNumberAttribute m_radiusY; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFEOffsetElement.cpp b/Source/WebCore/svg/SVGFEOffsetElement.cpp >index 9d7b865289f..28236984f41 100644 >--- a/Source/WebCore/svg/SVGFEOffsetElement.cpp >+++ b/Source/WebCore/svg/SVGFEOffsetElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -31,23 +32,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEOffsetElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFEOffsetElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_NUMBER(SVGFEOffsetElement, SVGNames::dxAttr, Dx, dx) >-DEFINE_ANIMATED_NUMBER(SVGFEOffsetElement, SVGNames::dyAttr, Dy, dy) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEOffsetElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(dx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(dy) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) > { > ASSERT(hasTagName(SVGNames::feOffsetTag)); >- registerAnimatedPropertiesForSVGFEOffsetElement(); >+ registerAttributes(); > } > > Ref<SVGFEOffsetElement> SVGFEOffsetElement::create(const QualifiedName& tagName, Document& document) >@@ -55,20 +44,30 @@ Ref<SVGFEOffsetElement> SVGFEOffsetElement::create(const QualifiedName& tagName, > return adoptRef(*new SVGFEOffsetElement(tagName, document)); > } > >+void SVGFEOffsetElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFEOffsetElement::m_in1>(); >+ registry.registerAttribute<SVGNames::dxAttr, &SVGFEOffsetElement::m_dx>(); >+ registry.registerAttribute<SVGNames::dyAttr, &SVGFEOffsetElement::m_dy>(); >+} >+ > void SVGFEOffsetElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::dxAttr) { >- setDxBaseValue(value.toFloat()); >+ m_dx.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::dyAttr) { >- setDyBaseValue(value.toFloat()); >+ m_dy.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > >@@ -77,7 +76,7 @@ void SVGFEOffsetElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGFEOffsetElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::inAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidate(); > return; >diff --git a/Source/WebCore/svg/SVGFEOffsetElement.h b/Source/WebCore/svg/SVGFEOffsetElement.h >index 906cf8805ee..bdb0e4f0b8f 100644 >--- a/Source/WebCore/svg/SVGFEOffsetElement.h >+++ b/Source/WebCore/svg/SVGFEOffsetElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,18 +31,32 @@ class SVGFEOffsetElement final : public SVGFilterPrimitiveStandardAttributes { > public: > static Ref<SVGFEOffsetElement> create(const QualifiedName&, Document&); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ float dx() const { return m_dx.currentValue(attributeOwnerProxy()); } >+ float dy() const { return m_dy.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFEOffsetElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEOffsetElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEOffsetElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_NUMBER(Dx, dx) >- DECLARE_ANIMATED_NUMBER(Dy, dy) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedNumberAttribute m_dx; >+ SVGAnimatedNumberAttribute m_dy; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFESpecularLightingElement.cpp b/Source/WebCore/svg/SVGFESpecularLightingElement.cpp >index b0454c21209..3a2f4d23f97 100644 >--- a/Source/WebCore/svg/SVGFESpecularLightingElement.cpp >+++ b/Source/WebCore/svg/SVGFESpecularLightingElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -34,32 +35,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFESpecularLightingElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFESpecularLightingElement, SVGNames::inAttr, In1, in1) >-DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::specularConstantAttr, SpecularConstant, specularConstant) >-DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::specularExponentAttr, SpecularExponent, specularExponent) >-DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::surfaceScaleAttr, SurfaceScale, surfaceScale) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFESpecularLightingElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(specularConstant) >- REGISTER_LOCAL_ANIMATED_PROPERTY(specularExponent) >- REGISTER_LOCAL_ANIMATED_PROPERTY(surfaceScale) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFESpecularLightingElement::SVGFESpecularLightingElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_specularConstant(1) >- , m_specularExponent(1) >- , m_surfaceScale(1) > { > ASSERT(hasTagName(SVGNames::feSpecularLightingTag)); >- registerAnimatedPropertiesForSVGFESpecularLightingElement(); >+ registerAttributes(); > } > > Ref<SVGFESpecularLightingElement> SVGFESpecularLightingElement::create(const QualifiedName& tagName, Document& document) >@@ -79,33 +59,47 @@ const AtomicString& SVGFESpecularLightingElement::kernelUnitLengthYIdentifier() > return s_identifier; > } > >+void SVGFESpecularLightingElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFESpecularLightingElement::m_in1>(); >+ registry.registerAttribute<SVGNames::specularConstantAttr, &SVGFESpecularLightingElement::m_specularConstant>(); >+ registry.registerAttribute<SVGNames::specularExponentAttr, &SVGFESpecularLightingElement::m_specularExponent>(); >+ registry.registerAttribute<SVGNames::surfaceScaleAttr, &SVGFESpecularLightingElement::m_surfaceScale>(); >+ registry.registerAttribute<SVGNames::kernelUnitLengthAttr, >+ &SVGFESpecularLightingElement::kernelUnitLengthXIdentifier, &SVGFESpecularLightingElement::m_kernelUnitLengthX, >+ &SVGFESpecularLightingElement::kernelUnitLengthYIdentifier, &SVGFESpecularLightingElement::m_kernelUnitLengthY>(); >+} >+ > void SVGFESpecularLightingElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > > if (name == SVGNames::surfaceScaleAttr) { >- setSurfaceScaleBaseValue(value.toFloat()); >+ m_surfaceScale.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::specularConstantAttr) { >- setSpecularConstantBaseValue(value.toFloat()); >+ m_specularConstant.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::specularExponentAttr) { >- setSpecularExponentBaseValue(value.toFloat()); >+ m_specularExponent.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::kernelUnitLengthAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y)) { >- setKernelUnitLengthXBaseValue(x); >- setKernelUnitLengthYBaseValue(y); >+ m_kernelUnitLengthX.setValue(x); >+ m_kernelUnitLengthY.setValue(y); > } > return; > } >diff --git a/Source/WebCore/svg/SVGFESpecularLightingElement.h b/Source/WebCore/svg/SVGFESpecularLightingElement.h >index fed1ce448e5..7cedaf8599b 100644 >--- a/Source/WebCore/svg/SVGFESpecularLightingElement.h >+++ b/Source/WebCore/svg/SVGFESpecularLightingElement.h >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -34,25 +35,45 @@ public: > static Ref<SVGFESpecularLightingElement> create(const QualifiedName&, Document&); > void lightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ float specularConstant() const { return m_specularConstant.currentValue(attributeOwnerProxy()); } >+ float specularExponent() const { return m_specularExponent.currentValue(attributeOwnerProxy()); } >+ float surfaceScale() const { return m_surfaceScale.currentValue(attributeOwnerProxy()); } >+ float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); } >+ float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> specularConstantAnimated() { return m_specularConstant.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> specularExponentAnimated() { return m_specularExponent.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> surfaceScaleAnimated() { return m_surfaceScale.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFESpecularLightingElement(const QualifiedName&, Document&); >- >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFESpecularLightingElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > > static const AtomicString& kernelUnitLengthXIdentifier(); > static const AtomicString& kernelUnitLengthYIdentifier(); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFESpecularLightingElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- DECLARE_ANIMATED_NUMBER(SpecularConstant, specularConstant) >- DECLARE_ANIMATED_NUMBER(SpecularExponent, specularExponent) >- DECLARE_ANIMATED_NUMBER(SurfaceScale, surfaceScale) >- DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) >- DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; >+ SVGAnimatedNumberAttribute m_specularConstant { 1 }; >+ SVGAnimatedNumberAttribute m_specularExponent { 1 }; >+ SVGAnimatedNumberAttribute m_surfaceScale { 1 }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthX; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthY; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFETileElement.cpp b/Source/WebCore/svg/SVGFETileElement.cpp >index eda6d0e1dd0..3f3879d7e66 100644 >--- a/Source/WebCore/svg/SVGFETileElement.cpp >+++ b/Source/WebCore/svg/SVGFETileElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -32,19 +33,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFETileElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGFETileElement, SVGNames::inAttr, In1, in1) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETileElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(in1) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFETileElement::SVGFETileElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) > { > ASSERT(hasTagName(SVGNames::feTileTag)); >- registerAnimatedPropertiesForSVGFETileElement(); >+ registerAttributes(); > } > > Ref<SVGFETileElement> SVGFETileElement::create(const QualifiedName& tagName, Document& document) >@@ -52,10 +45,18 @@ Ref<SVGFETileElement> SVGFETileElement::create(const QualifiedName& tagName, Doc > return adoptRef(*new SVGFETileElement(tagName, document)); > } > >+void SVGFETileElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::inAttr, &SVGFETileElement::m_in1>(); >+} >+ > void SVGFETileElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::inAttr) { >- setIn1BaseValue(value); >+ m_in1.setValue(value); > return; > } > >diff --git a/Source/WebCore/svg/SVGFETileElement.h b/Source/WebCore/svg/SVGFETileElement.h >index 6ea0a7aa4f6..754df40991e 100644 >--- a/Source/WebCore/svg/SVGFETileElement.h >+++ b/Source/WebCore/svg/SVGFETileElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -29,16 +30,25 @@ class SVGFETileElement final : public SVGFilterPrimitiveStandardAttributes { > public: > static Ref<SVGFETileElement> create(const QualifiedName&, Document&); > >+ String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFETileElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFETileElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFETileElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedStringAttribute m_in1; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFETurbulenceElement.cpp b/Source/WebCore/svg/SVGFETurbulenceElement.cpp >index 1a15d9c73dd..6b76b847935 100644 >--- a/Source/WebCore/svg/SVGFETurbulenceElement.cpp >+++ b/Source/WebCore/svg/SVGFETurbulenceElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -29,32 +30,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFETurbulenceElement); > >-// Animated property definitions >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyXIdentifier(), BaseFrequencyX, baseFrequencyX) >-DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyYIdentifier(), BaseFrequencyY, baseFrequencyY) >-DEFINE_ANIMATED_INTEGER(SVGFETurbulenceElement, SVGNames::numOctavesAttr, NumOctaves, numOctaves) >-DEFINE_ANIMATED_NUMBER(SVGFETurbulenceElement, SVGNames::seedAttr, Seed, seed) >-DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, StitchTiles, stitchTiles, SVGStitchOptions) >-DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::typeAttr, Type, type, TurbulenceType) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETurbulenceElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(baseFrequencyX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(baseFrequencyY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(numOctaves) >- REGISTER_LOCAL_ANIMATED_PROPERTY(seed) >- REGISTER_LOCAL_ANIMATED_PROPERTY(stitchTiles) >- REGISTER_LOCAL_ANIMATED_PROPERTY(type) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFETurbulenceElement::SVGFETurbulenceElement(const QualifiedName& tagName, Document& document) > : SVGFilterPrimitiveStandardAttributes(tagName, document) >- , m_numOctaves(1) >- , m_stitchTiles(SVG_STITCHTYPE_NOSTITCH) >- , m_type(TurbulenceType::Turbulence) > { > ASSERT(hasTagName(SVGNames::feTurbulenceTag)); >- registerAnimatedPropertiesForSVGFETurbulenceElement(); >+ registerAttributes(); > } > > Ref<SVGFETurbulenceElement> SVGFETurbulenceElement::create(const QualifiedName& tagName, Document& document) >@@ -74,38 +54,52 @@ const AtomicString& SVGFETurbulenceElement::baseFrequencyYIdentifier() > return s_identifier; > } > >+void SVGFETurbulenceElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::baseFrequencyAttr, >+ &SVGFETurbulenceElement::baseFrequencyXIdentifier, &SVGFETurbulenceElement::m_baseFrequencyX, >+ &SVGFETurbulenceElement::baseFrequencyYIdentifier, &SVGFETurbulenceElement::m_baseFrequencyY>(); >+ registry.registerAttribute<SVGNames::numOctavesAttr, &SVGFETurbulenceElement::m_numOctaves>(); >+ registry.registerAttribute<SVGNames::seedAttr, &SVGFETurbulenceElement::m_seed>(); >+ registry.registerAttribute<SVGNames::stitchTilesAttr, SVGStitchOptions, &SVGFETurbulenceElement::m_stitchTiles>(); >+ registry.registerAttribute<SVGNames::typeAttr, TurbulenceType, &SVGFETurbulenceElement::m_type>(); >+} >+ > void SVGFETurbulenceElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::typeAttr) { > TurbulenceType propertyValue = SVGPropertyTraits<TurbulenceType>::fromString(value); > if (propertyValue != TurbulenceType::Unknown) >- setTypeBaseValue(propertyValue); >+ m_type.setValue(propertyValue); > return; > } > > if (name == SVGNames::stitchTilesAttr) { > SVGStitchOptions propertyValue = SVGPropertyTraits<SVGStitchOptions>::fromString(value); > if (propertyValue > 0) >- setStitchTilesBaseValue(propertyValue); >+ m_stitchTiles.setValue(propertyValue); > return; > } > > if (name == SVGNames::baseFrequencyAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y)) { >- setBaseFrequencyXBaseValue(x); >- setBaseFrequencyYBaseValue(y); >+ m_baseFrequencyX.setValue(x); >+ m_baseFrequencyY.setValue(y); > } > return; > } > > if (name == SVGNames::seedAttr) { >- setSeedBaseValue(value.toFloat()); >+ m_seed.setValue(value.toFloat()); > return; > } > > if (name == SVGNames::numOctavesAttr) { >- setNumOctavesBaseValue(value.string().toUIntStrict()); >+ m_numOctaves.setValue(value.string().toUIntStrict()); > return; > } > >@@ -124,7 +118,7 @@ bool SVGFETurbulenceElement::setFilterEffectAttribute(FilterEffect* effect, cons > if (attrName == SVGNames::seedAttr) > return turbulence->setSeed(seed()); > if (attrName == SVGNames::numOctavesAttr) >- return turbulence->setNumOctaves(numOctaves()); >+ return turbulence->setNumOctaves(numOctaves()); > > ASSERT_NOT_REACHED(); > return false; >@@ -132,7 +126,7 @@ bool SVGFETurbulenceElement::setFilterEffectAttribute(FilterEffect* effect, cons > > void SVGFETurbulenceElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::baseFrequencyAttr || attrName == SVGNames::numOctavesAttr || attrName == SVGNames::seedAttr || attrName == SVGNames::stitchTilesAttr || attrName == SVGNames::typeAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > primitiveAttributeChanged(attrName); > return; >diff --git a/Source/WebCore/svg/SVGFETurbulenceElement.h b/Source/WebCore/svg/SVGFETurbulenceElement.h >index 4f3a096a1c7..a0f5488d600 100644 >--- a/Source/WebCore/svg/SVGFETurbulenceElement.h >+++ b/Source/WebCore/svg/SVGFETurbulenceElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -97,25 +98,45 @@ class SVGFETurbulenceElement final : public SVGFilterPrimitiveStandardAttributes > public: > static Ref<SVGFETurbulenceElement> create(const QualifiedName&, Document&); > >+ float baseFrequencyX() const { return m_baseFrequencyX.currentValue(attributeOwnerProxy()); } >+ float baseFrequencyY() const { return m_baseFrequencyY.currentValue(attributeOwnerProxy()); } >+ int numOctaves() const { return m_numOctaves.currentValue(attributeOwnerProxy()); } >+ float seed() const { return m_seed.currentValue(attributeOwnerProxy()); } >+ SVGStitchOptions stitchTiles() const { return m_stitchTiles.currentValue(attributeOwnerProxy()); } >+ TurbulenceType type() const { return m_type.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedNumber> baseFrequencyXAnimated() { return m_baseFrequencyX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> baseFrequencyYAnimated() { return m_baseFrequencyY.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedInteger> numOctavesAnimated() { return m_numOctaves.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> seedAnimated() { return m_seed.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> stitchTilesAnimated() { return m_stitchTiles.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFETurbulenceElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFETurbulenceElement, SVGFilterPrimitiveStandardAttributes>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; > void svgAttributeChanged(const QualifiedName&) override; >+ >+ bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > > static const AtomicString& baseFrequencyXIdentifier(); > static const AtomicString& baseFrequencyYIdentifier(); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFETurbulenceElement) >- DECLARE_ANIMATED_NUMBER(BaseFrequencyX, baseFrequencyX) >- DECLARE_ANIMATED_NUMBER(BaseFrequencyY, baseFrequencyY) >- DECLARE_ANIMATED_INTEGER(NumOctaves, numOctaves) >- DECLARE_ANIMATED_NUMBER(Seed, seed) >- DECLARE_ANIMATED_ENUMERATION(StitchTiles, stitchTiles, SVGStitchOptions) >- DECLARE_ANIMATED_ENUMERATION(Type, type, TurbulenceType) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedNumberAttribute m_baseFrequencyX; >+ SVGAnimatedNumberAttribute m_baseFrequencyY; >+ SVGAnimatedIntegerAttribute m_numOctaves { 1 }; >+ SVGAnimatedNumberAttribute m_seed; >+ SVGAnimatedEnumerationAttribute<SVGStitchOptions> m_stitchTiles { SVG_STITCHTYPE_NOSTITCH }; >+ SVGAnimatedEnumerationAttribute<TurbulenceType> m_type { TurbulenceType::Turbulence }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFilterElement.cpp b/Source/WebCore/svg/SVGFilterElement.cpp >index f648ba96a4f..f5a208a6a20 100644 >--- a/Source/WebCore/svg/SVGFilterElement.cpp >+++ b/Source/WebCore/svg/SVGFilterElement.cpp >@@ -5,6 +5,7 @@ > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> > * Copyright (C) Research In Motion Limited 2010. All rights reserved. > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -38,44 +39,15 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFilterElement); > >-// Animated property definitions >-DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::filterUnitsAttr, FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType) >-DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::primitiveUnitsAttr, PrimitiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType) >-DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, filterResXIdentifier(), FilterResX, filterResX) >-DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, filterResYIdentifier(), FilterResY, filterResY) >-DEFINE_ANIMATED_STRING(SVGFilterElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGFilterElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(filterUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(primitiveUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(filterResX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(filterResY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) >- , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) >- , m_x(LengthModeWidth, "-10%") >- , m_y(LengthModeHeight, "-10%") >- , m_width(LengthModeWidth, "120%") >- , m_height(LengthModeHeight, "120%") >+ , SVGExternalResourcesRequired(this) >+ , SVGURIReference(this) > { > // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified. > // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified. > ASSERT(hasTagName(SVGNames::filterTag)); >- registerAnimatedPropertiesForSVGFilterElement(); >+ registerAttributes(); > } > > Ref<SVGFilterElement> SVGFilterElement::create(const QualifiedName& tagName, Document& document) >@@ -97,32 +69,27 @@ const AtomicString& SVGFilterElement::filterResYIdentifier() > > void SVGFilterElement::setFilterRes(unsigned filterResX, unsigned filterResY) > { >- setFilterResXBaseValue(filterResX); >- setFilterResYBaseValue(filterResY); >+ m_filterResX.setValue(filterResX); >+ m_filterResY.setValue(filterResY); > > if (RenderObject* object = renderer()) > object->setNeedsLayout(); > } > >-bool SVGFilterElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGFilterElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGURIReference::addSupportedAttributes(set); >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ >- SVGNames::filterUnitsAttr.get(), >- SVGNames::primitiveUnitsAttr.get(), >- SVGNames::xAttr.get(), >- SVGNames::yAttr.get(), >- SVGNames::widthAttr.get(), >- SVGNames::heightAttr.get(), >- SVGNames::filterResAttr.get(), >- }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::filterUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_filterUnits>(); >+ registry.registerAttribute<SVGNames::primitiveUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_primitiveUnits>(); >+ registry.registerAttribute<SVGNames::xAttr, &SVGFilterElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGFilterElement::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGFilterElement::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGFilterElement::m_height>(); >+ registry.registerAttribute<SVGNames::filterResAttr, >+ &SVGFilterElement::filterResXIdentifier, &SVGFilterElement::m_filterResX, >+ &SVGFilterElement::filterResYIdentifier, &SVGFilterElement::m_filterResY>(); > } > > void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -132,24 +99,24 @@ void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr > if (name == SVGNames::filterUnitsAttr) { > SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setFilterUnitsBaseValue(propertyValue); >+ m_filterUnits.setValue(propertyValue); > } else if (name == SVGNames::primitiveUnitsAttr) { > SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setPrimitiveUnitsBaseValue(propertyValue); >+ m_primitiveUnits.setValue(propertyValue); > } else if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::heightAttr) >- setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::filterResAttr) { > float x, y; > if (parseNumberOptionalNumber(value, x, y)) { >- setFilterResXBaseValue(x); >- setFilterResYBaseValue(y); >+ m_filterResX.setValue(x); >+ m_filterResY.setValue(y); > } > } > >@@ -162,20 +129,20 @@ void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr > > void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isAnimatedLengthAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ invalidateSVGPresentationAttributeStyle(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { >- invalidateSVGPresentationAttributeStyle(); >+ if (isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) { >+ if (auto* renderer = this->renderer()) >+ renderer->setNeedsLayout(); > return; > } > >- if (auto* renderer = this->renderer()) >- renderer->setNeedsLayout(); >+ SVGElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > void SVGFilterElement::childrenChanged(const ChildChange& change) >diff --git a/Source/WebCore/svg/SVGFilterElement.h b/Source/WebCore/svg/SVGFilterElement.h >index 725fef7decf..77ec8ea016d 100644 >--- a/Source/WebCore/svg/SVGFilterElement.h >+++ b/Source/WebCore/svg/SVGFilterElement.h >@@ -3,6 +3,7 @@ > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -22,7 +23,6 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedEnumeration.h" > #include "SVGAnimatedInteger.h" > #include "SVGAnimatedLength.h" >@@ -33,23 +33,47 @@ > > namespace WebCore { > >-class SVGFilterElement final : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired { >+class SVGFilterElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference { > WTF_MAKE_ISO_ALLOCATED(SVGFilterElement); > public: > static Ref<SVGFilterElement> create(const QualifiedName&, Document&); > > void setFilterRes(unsigned filterResX, unsigned filterResY); > >+ SVGUnitTypes::SVGUnitType filterUnits() const { return m_filterUnits.currentValue(attributeOwnerProxy()); } >+ SVGUnitTypes::SVGUnitType primitiveUnits() const { return m_primitiveUnits.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >+ int filterResX() const { return m_filterResX.currentValue(attributeOwnerProxy()); } >+ int filterResY() const { return m_filterResY.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedEnumeration> filterUnitsAnimated() { return m_filterUnits.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> primitiveUnitsAnimated() { return m_primitiveUnits.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedInteger> filterResXAnimated() { return m_filterResX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedInteger> filterResYAnimated() { return m_filterResY.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGFilterElement(const QualifiedName&, Document&); > >- bool needsPendingResourceHandling() const final { return false; } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFilterElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > void childrenChanged(const ChildChange&) final; > >+ bool needsPendingResourceHandling() const final { return false; } >+ > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > bool childShouldCreateRenderer(const Node&) const final; > >@@ -58,18 +82,15 @@ private: > static const AtomicString& filterResXIdentifier(); > static const AtomicString& filterResYIdentifier(); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFilterElement) >- DECLARE_ANIMATED_ENUMERATION(FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType) >- DECLARE_ANIMATED_ENUMERATION(PrimitiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_INTEGER(FilterResX, filterResX) >- DECLARE_ANIMATED_INTEGER(FilterResY, filterResY) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_filterUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_primitiveUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth, "-10%" }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight, "-10%" }; >+ SVGAnimatedLengthAttribute m_width { LengthModeWidth, "120%" }; >+ SVGAnimatedLengthAttribute m_height { LengthModeHeight, "120%" }; >+ SVGAnimatedIntegerAttribute m_filterResX; >+ SVGAnimatedIntegerAttribute m_filterResY; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp >index 5b20fe074e3..88806fb972f 100644 >--- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp >+++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -24,11 +25,7 @@ > > #include "FilterEffect.h" > #include "RenderSVGResourceFilterPrimitive.h" >-#include "SVGElement.h" > #include "SVGFilterBuilder.h" >-#include "SVGLengthValue.h" >-#include "SVGNames.h" >-#include "SVGUnitTypes.h" > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> > >@@ -36,44 +33,22 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFilterPrimitiveStandardAttributes); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_STRING(SVGFilterPrimitiveStandardAttributes, SVGNames::resultAttr, Result, result) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(result) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_x(LengthModeWidth, "0%") >- , m_y(LengthModeHeight, "0%") >- , m_width(LengthModeWidth, "100%") >- , m_height(LengthModeHeight, "100%") > { >- // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified. >- // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified. >- registerAnimatedPropertiesForSVGFilterPrimitiveStandardAttributes(); >+ registerAttributes(); > } > >-bool SVGFilterPrimitiveStandardAttributes::isSupportedAttribute(const QualifiedName& attrName) >+void SVGFilterPrimitiveStandardAttributes::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> { >- SVGNames::xAttr.get(), >- SVGNames::yAttr.get(), >- SVGNames::widthAttr.get(), >- SVGNames::heightAttr.get(), >- SVGNames::resultAttr.get(), >- }); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGFilterPrimitiveStandardAttributes::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGFilterPrimitiveStandardAttributes::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGFilterPrimitiveStandardAttributes::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGFilterPrimitiveStandardAttributes::m_height>(); >+ registry.registerAttribute<SVGNames::resultAttr, &SVGFilterPrimitiveStandardAttributes::m_result>(); > } > > void SVGFilterPrimitiveStandardAttributes::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -81,15 +56,15 @@ void SVGFilterPrimitiveStandardAttributes::parseAttribute(const QualifiedName& n > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::heightAttr) >- setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::resultAttr) >- setResultBaseValue(value); >+ m_result.setValue(value); > > reportAttributeParsingError(parseError, name, value); > >@@ -105,13 +80,13 @@ bool SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute(FilterEffect > > void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ invalidate(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- invalidate(); >+ SVGElement::svgAttributeChanged(attrName); > } > > void SVGFilterPrimitiveStandardAttributes::childrenChanged(const ChildChange& change) >diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h >index 2e1590c1a0b..e0946f552ea 100644 >--- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h >+++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -25,6 +26,7 @@ > #include "SVGAnimatedLength.h" > #include "SVGAnimatedString.h" > #include "SVGElement.h" >+#include "SVGNames.h" > #include <wtf/RefPtr.h> > > namespace WebCore { >@@ -42,6 +44,21 @@ public: > // Returns true, if the new value is different from the old one. > virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFilterPrimitiveStandardAttributes, SVGElement>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >+ const String& result() const { return m_result.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedString> resultAnimated() { return m_result.animatedProperty(attributeOwnerProxy()); } >+ > protected: > SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document&); > >@@ -53,21 +70,26 @@ protected: > void primitiveAttributeChanged(const QualifiedName& attributeName); > > private: >+ static void registerAttributes(); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ > bool isFilterEffect() const override { return true; } > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; > bool rendererIsNeeded(const RenderStyle&) override; > bool childShouldCreateRenderer(const Node&) const override { return false; } > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_STRING(Result, result) >- END_DECLARE_ANIMATED_PROPERTIES >+ // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified. >+ // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified. >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth, "0%" }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight, "0%" }; >+ SVGAnimatedLengthAttribute m_width { LengthModeWidth, "100%" }; >+ SVGAnimatedLengthAttribute m_height { LengthModeHeight, "100%" }; >+ SVGAnimatedStringAttribute m_result; > }; > > void invalidateFilterPrimitiveParent(SVGElement*); >diff --git a/Source/WebCore/svg/SVGFitToViewBox.cpp b/Source/WebCore/svg/SVGFitToViewBox.cpp >index 770f1f41966..b769e5b0ccf 100644 >--- a/Source/WebCore/svg/SVGFitToViewBox.cpp >+++ b/Source/WebCore/svg/SVGFitToViewBox.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -25,6 +26,7 @@ > #include "Document.h" > #include "FloatRect.h" > #include "SVGDocumentExtensions.h" >+#include "SVGElement.h" > #include "SVGNames.h" > #include "SVGParserUtilities.h" > #include "SVGPreserveAspectRatioValue.h" >@@ -32,14 +34,68 @@ > > namespace WebCore { > >-bool SVGFitToViewBox::parseViewBox(Document* doc, const String& s, FloatRect& viewBox) >+SVGFitToViewBox::SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState animatedState) >+ : m_attributeOwnerProxy(*this, *contextElement, animatedState) > { >- auto upconvertedCharacters = StringView(s).upconvertedCharacters(); >+ registerAttributes(); >+} >+ >+void SVGFitToViewBox::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::viewBoxAttr, &SVGFitToViewBox::m_viewBox>(); >+ registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGFitToViewBox::m_preserveAspectRatio>(); >+} >+ >+void SVGFitToViewBox::setViewBox(const FloatRect& viewBox) >+{ >+ m_viewBox.setValue(viewBox); >+ m_isViewBoxValid = true; >+} >+ >+void SVGFitToViewBox::resetViewBox() >+{ >+ m_viewBox.resetValue(); >+ m_isViewBoxValid = false; >+} >+ >+void SVGFitToViewBox::reset() >+{ >+ resetViewBox(); >+ resetPreserveAspectRatio(); >+} >+ >+bool SVGFitToViewBox::parseAttribute(const QualifiedName& name, const AtomicString& value) >+{ >+ if (name == SVGNames::viewBoxAttr) { >+ FloatRect viewBox; >+ if (!value.isNull() && parseViewBox(value, viewBox)) >+ setViewBox(viewBox); >+ else >+ resetViewBox(); >+ return true; >+ } >+ >+ if (name == SVGNames::preserveAspectRatioAttr) { >+ SVGPreserveAspectRatioValue preserveAspectRatio; >+ preserveAspectRatio.parse(value); >+ setPreserveAspectRatio(preserveAspectRatio); >+ return true; >+ } >+ >+ return false; >+} >+ >+bool SVGFitToViewBox::parseViewBox(const AtomicString& value, FloatRect& viewBox) >+{ >+ auto upconvertedCharacters = StringView(value).upconvertedCharacters(); > const UChar* characters = upconvertedCharacters; >- return parseViewBox(doc, characters, characters + s.length(), viewBox, true); >+ return parseViewBox(characters, characters + value.length(), viewBox); > } > >-bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate) >+bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate) > { > String str(c, end - c); > >@@ -50,30 +106,36 @@ bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* > float width = 0.0f; > float height = 0.0f; > bool valid = parseNumber(c, end, x) && parseNumber(c, end, y) && parseNumber(c, end, width) && parseNumber(c, end, height, false); >- if (!validate) { >- viewBox = FloatRect(x, y, width, height); >- return true; >- } >- if (!valid) { >- doc->accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); >- return false; >- } > >- if (width < 0.0) { // check that width is positive >- doc->accessSVGExtensions().reportError("A negative value for ViewBox width is not allowed"); >- return false; >- } >- if (height < 0.0) { // check that height is positive >- doc->accessSVGExtensions().reportError("A negative value for ViewBox height is not allowed"); >- return false; >- } >- skipOptionalSVGSpaces(c, end); >- if (c < end) { // nothing should come after the last, fourth number >- doc->accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); >- return false; >+ if (validate) { >+ Document& document = m_attributeOwnerProxy.element().document(); >+ >+ if (!valid) { >+ document.accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); >+ return false; >+ } >+ >+ // Check that width is positive. >+ if (width < 0.0) { >+ document.accessSVGExtensions().reportError("A negative value for ViewBox width is not allowed"); >+ return false; >+ } >+ >+ // Check that height is positive. >+ if (height < 0.0) { >+ document.accessSVGExtensions().reportError("A negative value for ViewBox height is not allowed"); >+ return false; >+ } >+ >+ // Nothing should come after the last, fourth number. >+ skipOptionalSVGSpaces(c, end); >+ if (c < end) { >+ document.accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); >+ return false; >+ } > } > >- viewBox = FloatRect(x, y, width, height); >+ viewBox = { x, y, width, height }; > return true; > } > >@@ -85,15 +147,4 @@ AffineTransform SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBox > return preserveAspectRatio.getCTM(viewBoxRect.x(), viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), viewWidth, viewHeight); > } > >-bool SVGFitToViewBox::isKnownAttribute(const QualifiedName& attrName) >-{ >- return attrName == SVGNames::viewBoxAttr || attrName == SVGNames::preserveAspectRatioAttr; >-} >- >-void SVGFitToViewBox::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes) >-{ >- supportedAttributes.add(SVGNames::viewBoxAttr); >- supportedAttributes.add(SVGNames::preserveAspectRatioAttr); >-} >- > } >diff --git a/Source/WebCore/svg/SVGFitToViewBox.h b/Source/WebCore/svg/SVGFitToViewBox.h >index 10cd608f58e..f51a7e9cada 100644 >--- a/Source/WebCore/svg/SVGFitToViewBox.h >+++ b/Source/WebCore/svg/SVGFitToViewBox.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -22,6 +23,7 @@ > > #include "FloatRect.h" > #include "QualifiedName.h" >+#include "SVGAttributeRegistry.h" > #include "SVGNames.h" > #include "SVGPreserveAspectRatio.h" > #include <wtf/HashSet.h> >@@ -29,40 +31,50 @@ > namespace WebCore { > > class AffineTransform; >-class Document; > > class SVGFitToViewBox { >+ WTF_MAKE_NONCOPYABLE(SVGFitToViewBox); > public: > static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatioValue&, float viewWidth, float viewHeight); > >- static bool isKnownAttribute(const QualifiedName&); >- static void addSupportedAttributes(HashSet<QualifiedName>&); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFitToViewBox>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } > >- template<class SVGElementTarget> >- static bool parseAttribute(SVGElementTarget* target, const QualifiedName& name, const AtomicString& value) >- { >- ASSERT(target); >- if (name == SVGNames::viewBoxAttr) { >- FloatRect viewBox; >- bool valueIsValid = !value.isNull() && parseViewBox(&target->document(), value, viewBox); >- target->setViewBoxBaseValue(viewBox, valueIsValid); >- return true; >- } >+ const FloatRect& viewBox() const { return m_viewBox.currentValue(m_attributeOwnerProxy); } >+ const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(m_attributeOwnerProxy); } > >- if (name == SVGNames::preserveAspectRatioAttr) { >- SVGPreserveAspectRatioValue preserveAspectRatio; >- preserveAspectRatio.parse(value); >- target->setPreserveAspectRatioBaseValue(preserveAspectRatio); >- return true; >- } >+ RefPtr<SVGAnimatedRect> viewBoxAnimated() { return m_viewBox.animatedProperty(m_attributeOwnerProxy); } >+ RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(m_attributeOwnerProxy); } > >- return false; >- } >+ void setViewBox(const FloatRect&); >+ void resetViewBox(); > >- static bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); >+ void setPreserveAspectRatio(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio.setValue(preserveAspectRatio); } >+ void resetPreserveAspectRatio() { m_preserveAspectRatio.resetValue(); } >+ >+ String viewBoxString() const { return m_viewBox.toString(); } >+ String preserveAspectRatioString() const { return m_preserveAspectRatio.toString(); } >+ >+ bool hasValidViewBox() const { return m_isViewBoxValid; } >+ bool hasEmptyViewBox() const { return m_isViewBoxValid && viewBox().isEmpty(); } >+ >+protected: >+ SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState = PropertyIsReadWrite); >+ >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ >+ void reset(); >+ bool parseAttribute(const QualifiedName&, const AtomicString&); >+ bool parseViewBox(const AtomicString& value, FloatRect& viewBox); >+ bool parseViewBox(const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); > > private: >- static bool parseViewBox(Document*, const String&, FloatRect&); >+ static void registerAttributes(); >+ >+ AttributeOwnerProxy m_attributeOwnerProxy; >+ SVGAnimatedRectAttribute m_viewBox; >+ SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio; >+ bool m_isViewBoxValid { false }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGFontElement.cpp b/Source/WebCore/svg/SVGFontElement.cpp >index 84b71e9de13..6855d834426 100644 >--- a/Source/WebCore/svg/SVGFontElement.cpp >+++ b/Source/WebCore/svg/SVGFontElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2007 Eric Seidel <eric@webkit.org> > * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -39,19 +40,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFontElement); > >-// Animated property definitions >-DEFINE_ANIMATED_BOOLEAN(SVGFontElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFontElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGFontElement::SVGFontElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::fontTag)); >- registerAnimatedPropertiesForSVGFontElement(); > } > > Ref<SVGFontElement> SVGFontElement::create(const QualifiedName& tagName, Document& document) >diff --git a/Source/WebCore/svg/SVGFontElement.h b/Source/WebCore/svg/SVGFontElement.h >index 9c8b807f054..82a432abf2f 100644 >--- a/Source/WebCore/svg/SVGFontElement.h >+++ b/Source/WebCore/svg/SVGFontElement.h >@@ -2,6 +2,7 @@ > * Copyright (C) 2007 Eric Seidel <eric@webkit.org> > * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -52,9 +53,10 @@ private: > > bool rendererIsNeeded(const RenderStyle&) final { return false; } > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFontElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFontElement, SVGElement, SVGExternalResourcesRequired>; >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGForeignObjectElement.cpp b/Source/WebCore/svg/SVGForeignObjectElement.cpp >index 08aab8269c3..0492077230e 100644 >--- a/Source/WebCore/svg/SVGForeignObjectElement.cpp >+++ b/Source/WebCore/svg/SVGForeignObjectElement.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2006 Apple Inc. All rights reserved. >+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved. > * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. > * >@@ -36,33 +36,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGForeignObjectElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGForeignObjectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >- , m_x(LengthModeWidth) >- , m_y(LengthModeHeight) >- , m_width(LengthModeWidth) >- , m_height(LengthModeHeight) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::foreignObjectTag)); >- registerAnimatedPropertiesForSVGForeignObjectElement(); >+ registerAttributes(); > } > > Ref<SVGForeignObjectElement> SVGForeignObjectElement::create(const QualifiedName& tagName, Document& document) >@@ -70,16 +49,15 @@ Ref<SVGForeignObjectElement> SVGForeignObjectElement::create(const QualifiedName > return adoptRef(*new SVGForeignObjectElement(tagName, document)); > } > >-bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGForeignObjectElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ SVGNames::xAttr.get(), SVGNames::yAttr.get(), SVGNames::widthAttr.get(), SVGNames::heightAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGForeignObjectElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGForeignObjectElement::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGForeignObjectElement::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGForeignObjectElement::m_height>(); > } > > void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -87,13 +65,13 @@ void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::heightAttr) >- setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > >@@ -103,24 +81,20 @@ void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const At > > void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >- return; >- } >- >- InstanceInvalidationGuard guard(*this); >- >- if (attrName == SVGNames::widthAttr >- || attrName == SVGNames::heightAttr) { >+ if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { > invalidateSVGPresentationAttributeStyle(); > return; > } > >- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) >+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) { > updateRelativeLengthsInformation(); >+ if (auto renderer = this->renderer()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ return; >+ } > >- if (auto renderer = this->renderer()) >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGForeignObjectElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGForeignObjectElement.h b/Source/WebCore/svg/SVGForeignObjectElement.h >index ac0e832691a..306e1170ef9 100644 >--- a/Source/WebCore/svg/SVGForeignObjectElement.h >+++ b/Source/WebCore/svg/SVGForeignObjectElement.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2006 Apple Inc. All rights reserved. >+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -33,11 +33,25 @@ class SVGForeignObjectElement final : public SVGGraphicsElement, public SVGExter > public: > static Ref<SVGForeignObjectElement> create(const QualifiedName&, Document&); > >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGForeignObjectElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGForeignObjectElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >@@ -45,16 +59,14 @@ private: > bool childShouldCreateRenderer(const Node&) const final; > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool selfHasRelativeLengths() const final { return true; } > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGForeignObjectElement) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_STRING(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { LengthModeHeight }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGGElement.cpp b/Source/WebCore/svg/SVGGElement.cpp >index a4d3c3a00c1..7df6ea6dcf2 100644 >--- a/Source/WebCore/svg/SVGGElement.cpp >+++ b/Source/WebCore/svg/SVGGElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -32,19 +33,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGElement); > >-// Animated property definitions >-DEFINE_ANIMATED_BOOLEAN(SVGGElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGGElement::SVGGElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::gTag)); >- registerAnimatedPropertiesForSVGGElement(); > } > > Ref<SVGGElement> SVGGElement::create(const QualifiedName& tagName, Document& document) >@@ -57,17 +50,6 @@ Ref<SVGGElement> SVGGElement::create(Document& document) > return create(SVGNames::gTag, document); > } > >-bool SVGGElement::isSupportedAttribute(const QualifiedName& attrName) >-{ >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >-} >- > void SVGGElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGGraphicsElement::parseAttribute(name, value); >@@ -76,15 +58,8 @@ void SVGGElement::parseAttribute(const QualifiedName& name, const AtomicString& > > void SVGGElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >- return; >- } >- >- InstanceInvalidationGuard guard(*this); >- >- if (auto renderer = this->renderer()) >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGGElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGGElement.h b/Source/WebCore/svg/SVGGElement.h >index a5e75ae0d08..ba3acc3c62e 100644 >--- a/Source/WebCore/svg/SVGGElement.h >+++ b/Source/WebCore/svg/SVGGElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -37,17 +38,16 @@ private: > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >- bool isValid() const final { return SVGTests::isValid(); } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGElement, SVGGraphicsElement, SVGExternalResourcesRequired>; > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool rendererIsNeeded(const RenderStyle&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGGeometryElement.cpp b/Source/WebCore/svg/SVGGeometryElement.cpp >index 86a4544cd19..72dd3f13598 100644 >--- a/Source/WebCore/svg/SVGGeometryElement.cpp >+++ b/Source/WebCore/svg/SVGGeometryElement.cpp >@@ -24,32 +24,19 @@ > #include "SVGGeometryElement.h" > > #include "DOMPoint.h" >-#include "RenderSVGPath.h" >-#include "RenderSVGResource.h" > #include "SVGDocumentExtensions.h" >-#include "SVGMPathElement.h" >-#include "SVGNames.h" > #include "SVGPathUtilities.h" > #include "SVGPoint.h" > #include <wtf/IsoMallocInlines.h> >-#include <wtf/NeverDestroyed.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGeometryElement); > >-// Animated property definitions >-DEFINE_ANIMATED_NUMBER(SVGGeometryElement, SVGNames::pathLengthAttr, PathLength, pathLength) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGeometryElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) > { >- registerAnimatedPropertiesForSVGGeometryElement(); >+ registerAttributes(); > } > > float SVGGeometryElement::getTotalLength() const >@@ -100,23 +87,19 @@ bool SVGGeometryElement::isPointInStroke(DOMPointInit&& pointInit) > return renderer->isPointInStroke(point); > } > >-bool SVGGeometryElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGGeometryElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ SVGNames::pathLengthAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::pathLengthAttr, &SVGGeometryElement::m_pathLength>(); > } > > void SVGGeometryElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::pathLengthAttr) { >- setPathLengthBaseValue(value.toFloat()); >- if (pathLengthBaseValue() < 0) >+ m_pathLength.setValue(value.toFloat()); >+ if (m_pathLength.value() < 0) > document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed"); > return; > } >@@ -126,14 +109,14 @@ void SVGGeometryElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGGeometryElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >+ if (attrName == SVGNames::pathLengthAttr) { >+ InstanceInvalidationGuard guard(*this); >+ if (auto* renderer = this->renderer()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- ASSERT_NOT_REACHED(); >+ SVGGraphicsElement::svgAttributeChanged(attrName); > } > > } >diff --git a/Source/WebCore/svg/SVGGeometryElement.h b/Source/WebCore/svg/SVGGeometryElement.h >index 92d86458c54..8ad251e06fa 100644 >--- a/Source/WebCore/svg/SVGGeometryElement.h >+++ b/Source/WebCore/svg/SVGGeometryElement.h >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> > * Copyright (C) 2018 Adobe Systems Incorporated. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -22,9 +23,7 @@ > #pragma once > > #include "Path.h" >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedNumber.h" >-#include "SVGExternalResourcesRequired.h" > #include "SVGGraphicsElement.h" > #include "SVGNames.h" > >@@ -43,16 +42,25 @@ public: > bool isPointInFill(DOMPointInit&&); > bool isPointInStroke(DOMPointInit&&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGeometryElement, SVGGraphicsElement>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ auto pathLengthAnimated() { return m_pathLength.animatedProperty(attributeOwnerProxy()); } >+ > protected: > SVGGeometryElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGeometryElement) >- DECLARE_ANIMATED_NUMBER(PathLength, pathLength) >- END_DECLARE_ANIMATED_PROPERTIES >+private: >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ >+ static void registerAttributes(); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedNumberAttribute m_pathLength; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGGlyphRefElement.cpp b/Source/WebCore/svg/SVGGlyphRefElement.cpp >index 8cb593b70aa..24cdd40e829 100644 >--- a/Source/WebCore/svg/SVGGlyphRefElement.cpp >+++ b/Source/WebCore/svg/SVGGlyphRefElement.cpp >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2011 Leo Yang <leoyang@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -33,19 +34,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGlyphRefElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGGlyphRefElement, XLinkNames::hrefAttr, Href, href) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGlyphRefElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGGlyphRefElement::SVGGlyphRefElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >+ , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::glyphRefTag)); >- registerAnimatedPropertiesForSVGGlyphRefElement(); > } > > Ref<SVGGlyphRefElement> SVGGlyphRefElement::create(const QualifiedName& tagName, Document& document) >diff --git a/Source/WebCore/svg/SVGGlyphRefElement.h b/Source/WebCore/svg/SVGGlyphRefElement.h >index 0f92d21d8d9..8810d5b0926 100644 >--- a/Source/WebCore/svg/SVGGlyphRefElement.h >+++ b/Source/WebCore/svg/SVGGlyphRefElement.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2011 Leo Yang <leoyang@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -45,17 +46,17 @@ public: > private: > SVGGlyphRefElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGlyphRefElement, SVGElement, SVGURIReference>; >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; >- bool rendererIsNeeded(const RenderStyle&) final { return false; } > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGlyphRefElement) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- END_DECLARE_ANIMATED_PROPERTIES >+ bool rendererIsNeeded(const RenderStyle&) final { return false; } > > float m_x { 0 }; > float m_y { 0 }; > float m_dx { 0 }; > float m_dy { 0 }; >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > }; > > } >diff --git a/Source/WebCore/svg/SVGGradientElement.cpp b/Source/WebCore/svg/SVGGradientElement.cpp >index bb2b0b69309..d65e0f87d43 100644 >--- a/Source/WebCore/svg/SVGGradientElement.cpp >+++ b/Source/WebCore/svg/SVGGradientElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -39,40 +40,22 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGradientElement); > >-// Animated property definitions >-DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::spreadMethodAttr, SpreadMethod, spreadMethod, SVGSpreadMethodType) >-DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::gradientUnitsAttr, GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType) >-DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAttr, GradientTransform, gradientTransform) >-DEFINE_ANIMATED_STRING(SVGGradientElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGGradientElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGradientElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(spreadMethod) >- REGISTER_LOCAL_ANIMATED_PROPERTY(gradientUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(gradientTransform) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_spreadMethod(SVGSpreadMethodPad) >- , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) >+ , SVGExternalResourcesRequired(this) >+ , SVGURIReference(this) > { >- registerAnimatedPropertiesForSVGGradientElement(); >+ registerAttributes(); > } > >-bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGGradientElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGURIReference::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ SVGNames::gradientUnitsAttr.get(), SVGNames::gradientTransformAttr.get(), SVGNames::spreadMethodAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::spreadMethodAttr, SVGSpreadMethodType, &SVGGradientElement::m_spreadMethod>(); >+ registry.registerAttribute<SVGNames::gradientUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGGradientElement::m_gradientUnits>(); >+ registry.registerAttribute<SVGNames::gradientTransformAttr, &SVGGradientElement::m_gradientTransform>(); > } > > void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -80,22 +63,22 @@ void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS > if (name == SVGNames::gradientUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setGradientUnitsBaseValue(propertyValue); >+ m_gradientUnits.setValue(propertyValue); > return; > } > > if (name == SVGNames::gradientTransformAttr) { > SVGTransformListValues newList; > newList.parse(value); >- detachAnimatedGradientTransformListWrappers(newList.size()); >- setGradientTransformBaseValue(newList); >+ m_gradientTransform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_gradientTransform.setValue(WTFMove(newList)); > return; > } > > if (name == SVGNames::spreadMethodAttr) { > auto propertyValue = SVGPropertyTraits<SVGSpreadMethodType>::fromString(value); > if (propertyValue > 0) >- setSpreadMethodBaseValue(propertyValue); >+ m_spreadMethod.setValue(propertyValue); > return; > } > >@@ -106,15 +89,14 @@ void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGElement::svgAttributeChanged(attrName); > } > > void SVGGradientElement::childrenChanged(const ChildChange& change) >diff --git a/Source/WebCore/svg/SVGGradientElement.h b/Source/WebCore/svg/SVGGradientElement.h >index a5dced65023..b4c392b3549 100644 >--- a/Source/WebCore/svg/SVGGradientElement.h >+++ b/Source/WebCore/svg/SVGGradientElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -72,7 +73,7 @@ struct SVGPropertyTraits<SVGSpreadMethodType> { > } > }; > >-class SVGGradientElement : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired { >+class SVGGradientElement : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference { > WTF_MAKE_ISO_ALLOCATED(SVGGradientElement); > public: > enum { >@@ -83,26 +84,36 @@ public: > }; > > Vector<Gradient::ColorStop> buildStops(); >- >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGradientElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ SVGSpreadMethodType spreadMethod() const { return m_spreadMethod.currentValue(attributeOwnerProxy()); } >+ SVGUnitTypes::SVGUnitType gradientUnits() const { return m_gradientUnits.currentValue(attributeOwnerProxy()); } >+ const SVGTransformListValues& gradientTransform() const { return m_gradientTransform.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedEnumeration> spreadMethodAnimated() { return m_spreadMethod.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> gradientUnitsAnimated() { return m_gradientUnits.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedTransformList> gradientTransformAnimated() { return m_gradientTransform.animatedProperty(attributeOwnerProxy()); } >+ > protected: > SVGGradientElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > > private: > bool needsPendingResourceHandling() const override { return false; } >- > void childrenChanged(const ChildChange&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGradientElement) >- DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod, SVGSpreadMethodType) >- DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType) >- DECLARE_ANIMATED_TRANSFORM_LIST(GradientTransform, gradientTransform) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ static void registerAttributes(); >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedEnumerationAttribute<SVGSpreadMethodType> m_spreadMethod { SVGSpreadMethodPad }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_gradientUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >+ SVGAnimatedTransformListAttribute m_gradientTransform; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGGraphicsElement.cpp b/Source/WebCore/svg/SVGGraphicsElement.cpp >index 57d5cce184a..c59636cf792 100644 >--- a/Source/WebCore/svg/SVGGraphicsElement.cpp >+++ b/Source/WebCore/svg/SVGGraphicsElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -36,20 +37,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGraphicsElement); > >-// Animated property definitions >-DEFINE_ANIMATED_TRANSFORM_LIST(SVGGraphicsElement, SVGNames::transformAttr, Transform, transform) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGraphicsElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(transform) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGGraphicsElement::SVGGraphicsElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >+ , SVGTests(this) > , m_shouldIsolateBlending(false) > { >- registerAnimatedPropertiesForSVGGraphicsElement(); >+ registerAttributes(); > } > > SVGGraphicsElement::~SVGGraphicsElement() = default; >@@ -127,15 +120,12 @@ AffineTransform* SVGGraphicsElement::supplementalTransform() > return m_supplementalTransform.get(); > } > >-bool SVGGraphicsElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGGraphicsElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGTests::addSupportedAttributes(set); >- set.add(SVGNames::transformAttr); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::transformAttr, &SVGGraphicsElement::m_transform>(); > } > > void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -143,8 +133,8 @@ void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicS > if (name == SVGNames::transformAttr) { > SVGTransformListValues newList; > newList.parse(value); >- detachAnimatedTransformListWrappers(newList.size()); >- setTransformBaseValue(newList); >+ m_transform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_transform.setValue(newList); > return; > } > >@@ -154,27 +144,22 @@ void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >- return; >- } >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > >- InstanceInvalidationGuard guard(*this); >+ auto renderer = this->renderer(); >+ if (!renderer) >+ return; > >- if (SVGTests::handleAttributeChange(this, attrName)) >- return; >- >- auto renderer = this->renderer(); >- if (!renderer) >- return; >- >- if (attrName == SVGNames::transformAttr) { >- renderer->setNeedsTransformUpdate(); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- return; >+ if (attrName == SVGNames::transformAttr) { >+ renderer->setNeedsTransformUpdate(); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ return; >+ } > } > >- ASSERT_NOT_REACHED(); >+ SVGElement::svgAttributeChanged(attrName); >+ SVGTests::svgAttributeChanged(attrName); > } > > SVGElement* SVGGraphicsElement::nearestViewportElement() const >@@ -210,19 +195,4 @@ Path SVGGraphicsElement::toClipPath() > return path; > } > >-Ref<SVGStringList> SVGGraphicsElement::requiredFeatures() >-{ >- return SVGTests::requiredFeatures(*this); >-} >- >-Ref<SVGStringList> SVGGraphicsElement::requiredExtensions() >-{ >- return SVGTests::requiredExtensions(*this); >-} >- >-Ref<SVGStringList> SVGGraphicsElement::systemLanguage() >-{ >- return SVGTests::systemLanguage(*this); >-} >- > } >diff --git a/Source/WebCore/svg/SVGGraphicsElement.h b/Source/WebCore/svg/SVGGraphicsElement.h >index 8e0fe0a6779..06ee4b30792 100644 >--- a/Source/WebCore/svg/SVGGraphicsElement.h >+++ b/Source/WebCore/svg/SVGGraphicsElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -62,10 +63,11 @@ public: > > size_t approximateMemoryCost() const override { return sizeof(*this); } > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGraphicsElement, SVGElement, SVGTests>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ const auto& transform() const { return m_transform.currentValue(attributeOwnerProxy()); } >+ auto transformAnimated() { return m_transform.animatedProperty(attributeOwnerProxy()); } > > protected: > SVGGraphicsElement(const QualifiedName&, Document&); >@@ -75,25 +77,22 @@ protected: > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGraphicsElement) >- DECLARE_ANIMATED_TRANSFORM_LIST(Transform, transform) >- END_DECLARE_ANIMATED_PROPERTIES >- > private: > bool isSVGGraphicsElement() const override { return true; } > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } > >- // SVGTests >- void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } >- void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } >- void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } >+ static void registerAttributes(); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } > > // Used by <animateMotion> > std::unique_ptr<AffineTransform> m_supplementalTransform; > > // Used to isolate blend operations caused by masking. > bool m_shouldIsolateBlending; >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedTransformListAttribute m_transform; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGImageElement.cpp b/Source/WebCore/svg/SVGImageElement.cpp >index d15748c7a57..f93937736ed 100644 >--- a/Source/WebCore/svg/SVGImageElement.cpp >+++ b/Source/WebCore/svg/SVGImageElement.cpp >@@ -3,6 +3,7 @@ > * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org> > * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -36,35 +37,13 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGImageElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGImageElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) >-DEFINE_ANIMATED_STRING(SVGImageElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGImageElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGImageElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >- , m_x(LengthModeWidth) >- , m_y(LengthModeHeight) >- , m_width(LengthModeWidth) >- , m_height(LengthModeHeight) >+ , SVGExternalResourcesRequired(this) >+ , SVGURIReference(this) > , m_imageLoader(*this) > { >- registerAnimatedPropertiesForSVGImageElement(); >+ registerAttributes(); > } > > Ref<SVGImageElement> SVGImageElement::create(const QualifiedName& tagName, Document& document) >@@ -81,17 +60,16 @@ bool SVGImageElement::hasSingleSecurityOrigin() const > return !image || image->hasSingleSecurityOrigin(); > } > >-bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGImageElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- SVGURIReference::addSupportedAttributes(set); >- set.add({ SVGNames::xAttr.get(), SVGNames::yAttr.get(), SVGNames::widthAttr.get(), SVGNames::heightAttr.get(), SVGNames::preserveAspectRatioAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGImageElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGImageElement::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGImageElement::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGImageElement::m_height>(); >+ registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGImageElement::m_preserveAspectRatio>(); > } > > void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -99,20 +77,20 @@ void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri > if (name == SVGNames::preserveAspectRatioAttr) { > SVGPreserveAspectRatioValue preserveAspectRatio; > preserveAspectRatio.parse(value); >- setPreserveAspectRatioBaseValue(preserveAspectRatio); >+ m_preserveAspectRatio.setValue(preserveAspectRatio); > return; > } > > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); >+ m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::heightAttr) >- setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); >+ m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >@@ -123,50 +101,37 @@ void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri > > void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >- return; >- } >- >- InstanceInvalidationGuard guard(*this); >- >- if (attrName == SVGNames::widthAttr >- || attrName == SVGNames::heightAttr) { >- invalidateSVGPresentationAttributeStyle(); >- return; >- } >- >- bool isLengthAttribute = attrName == SVGNames::xAttr >- || attrName == SVGNames::yAttr >- || attrName == SVGNames::widthAttr >- || attrName == SVGNames::heightAttr; >- >- if (isLengthAttribute) >+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) { >+ InstanceInvalidationGuard guard(*this); > updateRelativeLengthsInformation(); > >- if (SVGURIReference::isKnownAttribute(attrName)) { >- m_imageLoader.updateFromElementIgnoringPreviousError(); >+ if (auto* renderer = this->renderer()) { >+ if (downcast<RenderSVGImage>(*renderer).updateImageViewport()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > return; > } > >- auto* renderer = this->renderer(); >- if (!renderer) >+ if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { >+ InstanceInvalidationGuard guard(*this); >+ invalidateSVGPresentationAttributeStyle(); > return; >+ } > >- if (isLengthAttribute) { >- if (downcast<RenderSVGImage>(*renderer).updateImageViewport()) >+ if (attrName == SVGNames::preserveAspectRatioAttr) { >+ InstanceInvalidationGuard guard(*this); >+ if (auto* renderer = this->renderer()) > RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > return; > } > >- if (attrName == SVGNames::preserveAspectRatioAttr >- || SVGLangSpace::isKnownAttribute(attrName) >- || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ if (SVGURIReference::isKnownAttribute(attrName)) { >+ m_imageLoader.updateFromElementIgnoringPreviousError(); > return; > } > >- ASSERT_NOT_REACHED(); >+ SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGImageElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >@@ -176,7 +141,7 @@ RenderPtr<RenderElement> SVGImageElement::createElementRenderer(RenderStyle&& st > > bool SVGImageElement::haveLoadedRequiredResources() > { >- return !externalResourcesRequiredBaseValue() || !m_imageLoader.hasPendingActivity(); >+ return !externalResourcesRequired() || !m_imageLoader.hasPendingActivity(); > } > > void SVGImageElement::didAttachRenderers() >diff --git a/Source/WebCore/svg/SVGImageElement.h b/Source/WebCore/svg/SVGImageElement.h >index 0e85e4cccd2..523be601217 100644 >--- a/Source/WebCore/svg/SVGImageElement.h >+++ b/Source/WebCore/svg/SVGImageElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -20,7 +21,6 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedLength.h" > #include "SVGAnimatedPreserveAspectRatio.h" > #include "SVGExternalResourcesRequired.h" >@@ -38,37 +38,47 @@ public: > bool hasSingleSecurityOrigin() const; > const AtomicString& imageSourceURL() const final; > >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >+ const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGImageElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGImageElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > > void didAttachRenderers() final; > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; >- > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > > void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; >- > bool haveLoadedRequiredResources() final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool selfHasRelativeLengths() const final { return true; } > void didMoveToNewDocument(Document& oldDocument, Document& newDocument) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >- >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { LengthModeHeight }; >+ SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio; > SVGImageLoader m_imageLoader; > }; > >diff --git a/Source/WebCore/svg/SVGImageLoader.cpp b/Source/WebCore/svg/SVGImageLoader.cpp >index 87e8cb7ea64..32768827c6a 100644 >--- a/Source/WebCore/svg/SVGImageLoader.cpp >+++ b/Source/WebCore/svg/SVGImageLoader.cpp >@@ -41,7 +41,7 @@ void SVGImageLoader::dispatchLoadEvent() > if (image()->errorOccurred()) > element().dispatchEvent(Event::create(eventNames().errorEvent, false, false)); > else { >- if (downcast<SVGImageElement>(element()).externalResourcesRequiredBaseValue()) >+ if (downcast<SVGImageElement>(element()).externalResourcesRequired()) > downcast<SVGImageElement>(ImageLoader::element()).sendSVGLoadEventIfPossible(true); > } > } >diff --git a/Source/WebCore/svg/SVGLangSpace.cpp b/Source/WebCore/svg/SVGLangSpace.cpp >index 1f4ce6b0e84..258a1af6e88 100644 >--- a/Source/WebCore/svg/SVGLangSpace.cpp >+++ b/Source/WebCore/svg/SVGLangSpace.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,29 +22,36 @@ > #include "config.h" > #include "SVGLangSpace.h" > >+#include "RenderSVGResource.h" >+#include "RenderSVGShape.h" >+#include "SVGElement.h" > #include "XMLNames.h" > #include <wtf/NeverDestroyed.h> > > namespace WebCore { > >-void SVGLangSpace::setXmllang(const AtomicString& xmlLang) >+SVGLangSpace::SVGLangSpace(SVGElement* contextElement) >+ : m_contextElement(*contextElement) > { >- m_lang = xmlLang; >+ registerAttributes(); > } > >-const AtomicString& SVGLangSpace::xmlspace() const >+void SVGLangSpace::registerAttributes() > { >- if (!m_space) { >- static NeverDestroyed<const AtomicString> defaultString("default", AtomicString::ConstructFromLiteral); >- return defaultString; >- } >- >- return m_space; >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::langAttr, &SVGLangSpace::m_lang>()); >+ registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::spaceAttr, &SVGLangSpace::m_space>()); > } > >-void SVGLangSpace::setXmlspace(const AtomicString& xmlSpace) >+const String& SVGLangSpace::xmlspace() const > { >- m_space = xmlSpace; >+ if (!m_space.value()) { >+ static NeverDestroyed<String> defaultString("default"); >+ return defaultString; >+ } >+ return m_space.value(); > } > > void SVGLangSpace::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -54,22 +62,15 @@ void SVGLangSpace::parseAttribute(const QualifiedName& name, const AtomicString& > setXmlspace(value); > } > >-bool SVGLangSpace::isKnownAttribute(const QualifiedName& attrName) >+void SVGLangSpace::svgAttributeChanged(const QualifiedName& attrName) > { >- return attrName.matches(XMLNames::langAttr) || attrName.matches(XMLNames::spaceAttr); >-} >+ if (!isKnownAttribute(attrName)) >+ return; > >-static void addWithAndWithoutXMLPrefix(HashSet<QualifiedName>& set, const QualifiedName& attributeName) >-{ >- ASSERT(attributeName.prefix().isNull()); >- set.add(attributeName); >- set.add({ xmlAtom(), attributeName.localName(), attributeName.namespaceURI() }); >-} >- >-void SVGLangSpace::addSupportedAttributes(HashSet<QualifiedName>& set) >-{ >- addWithAndWithoutXMLPrefix(set, XMLNames::langAttr); >- addWithAndWithoutXMLPrefix(set, XMLNames::spaceAttr); >+ if (auto* renderer = downcast<RenderSVGShape>(m_contextElement.renderer())) { >+ SVGElement::InstanceInvalidationGuard guard(m_contextElement); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > } > > } >diff --git a/Source/WebCore/svg/SVGLangSpace.h b/Source/WebCore/svg/SVGLangSpace.h >index 22c4118a80c..8775822221e 100644 >--- a/Source/WebCore/svg/SVGLangSpace.h >+++ b/Source/WebCore/svg/SVGLangSpace.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,26 +22,41 @@ > #pragma once > > #include "QualifiedName.h" >+#include "SVGAttributeOwnerProxyImpl.h" > #include <wtf/HashSet.h> > > namespace WebCore { > >+class SVGElement; >+ > class SVGLangSpace { > public: >- const AtomicString& xmllang() const { return m_lang; } >- void setXmllang(const AtomicString& xmlLang); >+ const String& xmllang() const { return m_lang.value(); } >+ void setXmllang(const AtomicString& xmlLang) { m_lang.setValue(xmlLang); } > >- const AtomicString& xmlspace() const; >- void setXmlspace(const AtomicString& xmlSpace); >+ const String& xmlspace() const; >+ void setXmlspace(const AtomicString& xmlSpace) { m_space.setValue(xmlSpace); } > > void parseAttribute(const QualifiedName&, const AtomicString&); > >- static bool isKnownAttribute(const QualifiedName&); >- static void addSupportedAttributes(HashSet<QualifiedName>&); >+ void svgAttributeChanged(const QualifiedName&); >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLangSpace>; >+ using AttributeRegistry = SVGAttributeRegistry<SVGLangSpace>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return attributeRegistry().isKnownAttribute(attributeName); } >+ >+protected: >+ SVGLangSpace(SVGElement* contextElement); > > private: >- AtomicString m_lang; >- AtomicString m_space; >+ using SVGStringAttribute = SVGPropertyAttribute<String>; >+ using SVGStringAttributeAccessor = SVGPropertyAttributeAccessor<SVGLangSpace, SVGStringAttribute>; >+ static void registerAttributes(); >+ >+ SVGElement& m_contextElement; >+ SVGStringAttribute m_lang; >+ SVGStringAttribute m_space; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGLineElement.cpp b/Source/WebCore/svg/SVGLineElement.cpp >index 34815df1632..da54067b405 100644 >--- a/Source/WebCore/svg/SVGLineElement.cpp >+++ b/Source/WebCore/svg/SVGLineElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,43 +22,20 @@ > #include "config.h" > #include "SVGLineElement.h" > >-#include "FloatPoint.h" >-#include "RenderSVGPath.h" > #include "RenderSVGResource.h" > #include "SVGLengthValue.h" >-#include "SVGNames.h" > #include <wtf/IsoMallocInlines.h> >-#include <wtf/NeverDestroyed.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGLineElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x1Attr, X1, x1) >-DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y1Attr, Y1, y1) >-DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x2Attr, X2, x2) >-DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y2Attr, Y2, y2) >-DEFINE_ANIMATED_BOOLEAN(SVGLineElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLineElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x2) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y2) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document& document) > : SVGGeometryElement(tagName, document) >- , m_x1(LengthModeWidth) >- , m_y1(LengthModeHeight) >- , m_x2(LengthModeWidth) >- , m_y2(LengthModeHeight) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::lineTag)); >- registerAnimatedPropertiesForSVGLineElement(); >+ registerAttributes(); > } > > Ref<SVGLineElement> SVGLineElement::create(const QualifiedName& tagName, Document& document) >@@ -65,16 +43,15 @@ Ref<SVGLineElement> SVGLineElement::create(const QualifiedName& tagName, Documen > return adoptRef(*new SVGLineElement(tagName, document)); > } > >-bool SVGLineElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGLineElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ SVGNames::x1Attr.get(), SVGNames::x2Attr.get(), SVGNames::y1Attr.get(), SVGNames::y2Attr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::x1Attr, &SVGLineElement::m_x1>(); >+ registry.registerAttribute<SVGNames::y1Attr, &SVGLineElement::m_y1>(); >+ registry.registerAttribute<SVGNames::x2Attr, &SVGLineElement::m_x2>(); >+ registry.registerAttribute<SVGNames::y2Attr, &SVGLineElement::m_y2>(); > } > > void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -82,53 +59,35 @@ void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin > SVGParsingError parseError = NoError; > > if (name == SVGNames::x1Attr) >- setX1BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::y1Attr) >- setY1BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::x2Attr) >- setX2BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::y2Attr) >- setY2BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > >- SVGGraphicsElement::parseAttribute(name, value); >+ SVGGeometryElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); > } > > void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >- return; >- } >- >- InstanceInvalidationGuard guard(*this); >- >- bool isLengthAttribute = attrName == SVGNames::x1Attr >- || attrName == SVGNames::y1Attr >- || attrName == SVGNames::x2Attr >- || attrName == SVGNames::y2Attr; >- >- if (isLengthAttribute) >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > updateRelativeLengthsInformation(); > >- auto* renderer = downcast<RenderSVGShape>(this->renderer()); >- if (!renderer) >- return; >- >- if (isLengthAttribute) { >- renderer->setNeedsShapeUpdate(); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- return; >- } >- >- if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) { >+ renderer->setNeedsShapeUpdate(); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > return; > } > >- ASSERT_NOT_REACHED(); >+ SVGGeometryElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > bool SVGLineElement::selfHasRelativeLengths() const >diff --git a/Source/WebCore/svg/SVGLineElement.h b/Source/WebCore/svg/SVGLineElement.h >index 609b6d93d04..f1ebc4ecbf7 100644 >--- a/Source/WebCore/svg/SVGLineElement.h >+++ b/Source/WebCore/svg/SVGLineElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -20,10 +21,10 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedLength.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGeometryElement.h" >+#include "SVGNames.h" > > namespace WebCore { > >@@ -32,26 +33,37 @@ class SVGLineElement final : public SVGGeometryElement, public SVGExternalResour > public: > static Ref<SVGLineElement> create(const QualifiedName&, Document&); > >+ const SVGLengthValue& x1() const { return m_x1.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y1() const { return m_y1.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& x2() const { return m_x2.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y2() const { return m_y2.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGLineElement(const QualifiedName&, Document&); >- >- bool isValid() const final { return SVGTests::isValid(); } > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLineElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool supportsMarkers() const final { return true; } >- > bool selfHasRelativeLengths() const final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGLineElement) >- DECLARE_ANIMATED_LENGTH(X1, x1) >- DECLARE_ANIMATED_LENGTH(Y1, y1) >- DECLARE_ANIMATED_LENGTH(X2, x2) >- DECLARE_ANIMATED_LENGTH(Y2, y2) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x1 { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y1 { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_x2 { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y2 { LengthModeHeight }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGLinearGradientElement.cpp b/Source/WebCore/svg/SVGLinearGradientElement.cpp >index 58dfe639ed7..951012c2b8c 100644 >--- a/Source/WebCore/svg/SVGLinearGradientElement.cpp >+++ b/Source/WebCore/svg/SVGLinearGradientElement.cpp >@@ -4,6 +4,7 @@ > * Copyright (C) 2008 Eric Seidel <eric@webkit.org> > * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -38,30 +39,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGLinearGradientElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x1Attr, X1, x1) >-DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y1Attr, Y1, y1) >-DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x2Attr, X2, x2) >-DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y2Attr, Y2, y2) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLinearGradientElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y1) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x2) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y2) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGradientElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document& document) > : SVGGradientElement(tagName, document) >- , m_x1(LengthModeWidth) >- , m_y1(LengthModeHeight) >- , m_x2(LengthModeWidth, "100%") >- , m_y2(LengthModeHeight) > { > // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified. > ASSERT(hasTagName(SVGNames::linearGradientTag)); >- registerAnimatedPropertiesForSVGLinearGradientElement(); >+ registerAttributes(); > } > > Ref<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedName& tagName, Document& document) >@@ -69,12 +52,15 @@ Ref<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedNa > return adoptRef(*new SVGLinearGradientElement(tagName, document)); > } > >-bool SVGLinearGradientElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGLinearGradientElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> { >- SVGNames::x1Attr, SVGNames::x2Attr, SVGNames::y1Attr, SVGNames::y2Attr >- }); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::x1Attr, &SVGLinearGradientElement::m_x1>(); >+ registry.registerAttribute<SVGNames::y1Attr, &SVGLinearGradientElement::m_y1>(); >+ registry.registerAttribute<SVGNames::x2Attr, &SVGLinearGradientElement::m_x2>(); >+ registry.registerAttribute<SVGNames::y2Attr, &SVGLinearGradientElement::m_y2>(); > } > > void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -82,13 +68,13 @@ void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const A > SVGParsingError parseError = NoError; > > if (name == SVGNames::x1Attr) >- setX1BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::y1Attr) >- setY1BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::x2Attr) >- setX2BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::y2Attr) >- setY2BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > >@@ -97,17 +83,15 @@ void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const A > > void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGradientElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ updateRelativeLengthsInformation(); >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- updateRelativeLengthsInformation(); >- >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGGradientElement::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGLinearGradientElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGLinearGradientElement.h b/Source/WebCore/svg/SVGLinearGradientElement.h >index cb1bb8c0137..9f670c9daa4 100644 >--- a/Source/WebCore/svg/SVGLinearGradientElement.h >+++ b/Source/WebCore/svg/SVGLinearGradientElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -35,10 +36,25 @@ public: > > bool collectGradientAttributes(LinearGradientAttributes&); > >+ const SVGLengthValue& x1() const { return m_x1.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y1() const { return m_y1.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& x2() const { return m_x2.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y2() const { return m_y2.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGLinearGradientElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLinearGradientElement, SVGGradientElement>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -46,12 +62,11 @@ private: > > bool selfHasRelativeLengths() const override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGLinearGradientElement) >- DECLARE_ANIMATED_LENGTH(X1, x1) >- DECLARE_ANIMATED_LENGTH(Y1, y1) >- DECLARE_ANIMATED_LENGTH(X2, x2) >- DECLARE_ANIMATED_LENGTH(Y2, y2) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x1 { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y1 { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_x2 { LengthModeWidth, "100%" }; >+ SVGAnimatedLengthAttribute m_y2 { LengthModeHeight }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGMPathElement.cpp b/Source/WebCore/svg/SVGMPathElement.cpp >index 96f9c8c3b6d..93c8d4357b0 100644 >--- a/Source/WebCore/svg/SVGMPathElement.cpp >+++ b/Source/WebCore/svg/SVGMPathElement.cpp >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2007 Eric Seidel <eric@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -31,20 +32,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGMPathElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGMPathElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGMPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGMPathElement::SVGMPathElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >+ , SVGExternalResourcesRequired(this) >+ , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::mpathTag)); >- registerAnimatedPropertiesForSVGMPathElement(); > } > > Ref<SVGMPathElement> SVGMPathElement::create(const QualifiedName& tagName, Document& document) >@@ -125,6 +118,7 @@ void SVGMPathElement::svgAttributeChanged(const QualifiedName& attrName) > } > > SVGElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > RefPtr<SVGPathElement> SVGMPathElement::pathElement() >diff --git a/Source/WebCore/svg/SVGMPathElement.h b/Source/WebCore/svg/SVGMPathElement.h >index 798b080c2ec..39c9ea04518 100644 >--- a/Source/WebCore/svg/SVGMPathElement.h >+++ b/Source/WebCore/svg/SVGMPathElement.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2007 Eric Seidel <eric@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,7 +31,7 @@ namespace WebCore { > > class SVGPathElement; > >-class SVGMPathElement final : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired { >+class SVGMPathElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference { > WTF_MAKE_ISO_ALLOCATED(SVGMPathElement); > public: > static Ref<SVGMPathElement> create(const QualifiedName&, Document&); >@@ -44,23 +45,23 @@ public: > private: > SVGMPathElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMPathElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } >+ void parseAttribute(const QualifiedName&, const AtomicString&) final; >+ void svgAttributeChanged(const QualifiedName&) final; >+ > void buildPendingResource() final; > void clearResourceReferences(); > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; > void removedFromAncestor(RemovalType, ContainerNode&) final; > >- void parseAttribute(const QualifiedName&, const AtomicString&) final; >- void svgAttributeChanged(const QualifiedName&) final; >- > bool rendererIsNeeded(const RenderStyle&) final { return false; } > void didFinishInsertingNode() final; > > void notifyParentOfPathChange(ContainerNode*); > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMPathElement) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGMarkerElement.cpp b/Source/WebCore/svg/SVGMarkerElement.cpp >index 4c31e95ed7b..6ab2b7ff22c 100644 >--- a/Source/WebCore/svg/SVGMarkerElement.cpp >+++ b/Source/WebCore/svg/SVGMarkerElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> > * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -32,58 +33,14 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGMarkerElement); > >-// Define custom animated property 'orientType'. >-const SVGPropertyInfo* SVGMarkerElement::orientTypePropertyInfo() >-{ >- static const SVGPropertyInfo* s_propertyInfo = 0; >- if (!s_propertyInfo) { >- s_propertyInfo = new SVGPropertyInfo(AnimatedEnumeration, >- PropertyIsReadWrite, >- SVGNames::orientAttr, >- orientTypeIdentifier(), >- &SVGMarkerElement::synchronizeOrientType, >- &SVGMarkerElement::lookupOrCreateOrientTypeWrapper); >- } >- return s_propertyInfo; >-} >- >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::refXAttr, RefX, refX) >-DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::refYAttr, RefY, refY) >-DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerWidthAttr, MarkerWidth, markerWidth) >-DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerHeightAttr, MarkerHeight, markerHeight) >-DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerUnits, markerUnits, SVGMarkerUnitsType) >-DEFINE_ANIMATED_ANGLE_AND_ENUMERATION(SVGMarkerElement, SVGNames::orientAttr, orientAngleIdentifier(), OrientAngle, orientAngle) >-DEFINE_ANIMATED_BOOLEAN(SVGMarkerElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >-DEFINE_ANIMATED_RECT(SVGMarkerElement, SVGNames::viewBoxAttr, ViewBox, viewBox) >-DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGMarkerElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMarkerElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(refX) >- REGISTER_LOCAL_ANIMATED_PROPERTY(refY) >- REGISTER_LOCAL_ANIMATED_PROPERTY(markerWidth) >- REGISTER_LOCAL_ANIMATED_PROPERTY(markerHeight) >- REGISTER_LOCAL_ANIMATED_PROPERTY(markerUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(orientAngle) >- REGISTER_LOCAL_ANIMATED_PROPERTY(orientType) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) >- REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_refX(LengthModeWidth) >- , m_refY(LengthModeHeight) >- , m_markerWidth(LengthModeWidth, "3") >- , m_markerHeight(LengthModeHeight, "3") >- , m_markerUnits(SVGMarkerUnitsStrokeWidth) >- , m_orientType(SVGMarkerOrientAngle) >+ , SVGExternalResourcesRequired(this) >+ , SVGFitToViewBox(this) > { > // Spec: If the markerWidth/markerHeight attribute is not specified, the effect is as if a value of "3" were specified. > ASSERT(hasTagName(SVGNames::markerTag)); >- registerAnimatedPropertiesForSVGMarkerElement(); >+ registerAttributes(); > } > > Ref<SVGMarkerElement> SVGMarkerElement::create(const QualifiedName& tagName, Document& document) >@@ -108,24 +65,19 @@ AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float > return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight); > } > >-bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGMarkerElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- SVGFitToViewBox::addSupportedAttributes(set); >- set.add({ >- SVGNames::markerUnitsAttr.get(), >- SVGNames::refXAttr.get(), >- SVGNames::refYAttr.get(), >- SVGNames::markerWidthAttr.get(), >- SVGNames::markerHeightAttr.get(), >- SVGNames::orientAttr.get(), >- }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::refXAttr, &SVGMarkerElement::m_refX>(); >+ registry.registerAttribute<SVGNames::refYAttr, &SVGMarkerElement::m_refY>(); >+ registry.registerAttribute<SVGNames::markerWidthAttr, &SVGMarkerElement::m_markerWidth>(); >+ registry.registerAttribute<SVGNames::markerHeightAttr, &SVGMarkerElement::m_markerHeight>(); >+ registry.registerAttribute<SVGNames::markerUnitsAttr, SVGMarkerUnitsType, &SVGMarkerElement::m_markerUnits>(); >+ registry.registerAttribute(SVGAnimatedCustomAngleAttributeAccessor::singleton<SVGNames::orientAttr, >+ &SVGMarkerElement::orientAngleIdentifier, &SVGMarkerElement::m_orientAngle, >+ &SVGMarkerElement::orientTypeIdentifier, &SVGMarkerElement::m_orientType>()); > } > > void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -133,7 +85,7 @@ void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicStr > if (name == SVGNames::markerUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGMarkerUnitsType>::fromString(value); > if (propertyValue > 0) >- setMarkerUnitsBaseValue(propertyValue); >+ m_markerUnits.setValue(propertyValue); > return; > } > >@@ -141,47 +93,49 @@ void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicStr > SVGAngleValue angle; > auto orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(value, angle); > if (orientType > 0) >- setOrientTypeBaseValue(orientType); >+ m_orientType.setValue(orientType); > if (orientType == SVGMarkerOrientAngle) >- setOrientAngleBaseValue(angle); >+ m_orientAngle.setValue(angle); > return; > } > > SVGParsingError parseError = NoError; > > if (name == SVGNames::refXAttr) >- setRefXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_refX.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::refYAttr) >- setRefYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_refY.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::markerWidthAttr) >- setMarkerWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_markerWidth.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::markerHeightAttr) >- setMarkerHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_markerHeight.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > > SVGElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); >- SVGFitToViewBox::parseAttribute(this, name, value); >+ SVGFitToViewBox::parseAttribute(name, value); > } > > void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ if (isAnimatedLengthAttribute(attrName)) >+ updateRelativeLengthsInformation(); >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); > return; > } >- >- InstanceInvalidationGuard guard(*this); > >- if (attrName == SVGNames::refXAttr >- || attrName == SVGNames::refYAttr >- || attrName == SVGNames::markerWidthAttr >- || attrName == SVGNames::markerHeightAttr) >- updateRelativeLengthsInformation(); >+ if (SVGFitToViewBox::isKnownAttribute(attrName)) { >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); >+ return; >+ } > >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > void SVGMarkerElement::childrenChanged(const ChildChange& change) >@@ -197,14 +151,14 @@ void SVGMarkerElement::childrenChanged(const ChildChange& change) > > void SVGMarkerElement::setOrient(SVGMarkerOrientType orientType, const SVGAngleValue& angle) > { >- setOrientTypeBaseValue(orientType); >- setOrientAngleBaseValue(angle); >+ m_orientType.setValue(orientType); >+ m_orientAngle.setValue(angle); > > // Mark orientAttr dirty - the next XML DOM access of that attribute kicks in synchronization. >- m_orientAngle.shouldSynchronize = true; >- m_orientType.shouldSynchronize = true; >+ m_orientAngle.setShouldSynchronize(true); >+ m_orientType.setShouldSynchronize(true); > invalidateSVGAttributes(); >- svgAttributeChanged(orientAnglePropertyInfo()->attributeName); >+ svgAttributeChanged(SVGNames::orientAttr); > } > > void SVGMarkerElement::setOrientToAuto() >@@ -230,49 +184,4 @@ bool SVGMarkerElement::selfHasRelativeLengths() const > || markerHeight().isRelative(); > } > >-void SVGMarkerElement::synchronizeOrientType(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- SVGMarkerElement& ownerType = downcast<SVGMarkerElement>(*contextElement); >- if (!ownerType.m_orientType.shouldSynchronize) >- return; >- >- static NeverDestroyed<AtomicString> autoString("auto", AtomicString::ConstructFromLiteral); >- static NeverDestroyed<AtomicString> autoStartReverseString("auto-start-reverse", AtomicString::ConstructFromLiteral); >- >- // If orient is not auto or auto-start-reverse, the previous call to synchronizeOrientAngle already set the orientAttr to the right angle. >- if (ownerType.m_orientType.value == SVGMarkerOrientAuto) { >- ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoString); >- return; >- } >- >- if (ownerType.m_orientType.value == SVGMarkerOrientAutoStartReverse) >- ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoStartReverseString); >-} >- >-Ref<SVGAnimatedProperty> SVGMarkerElement::lookupOrCreateOrientTypeWrapper(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- SVGMarkerElement& ownerType = downcast<SVGMarkerElement>(*contextElement); >- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGMarkerElement, SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>, SVGMarkerOrientType> >- (&ownerType, orientTypePropertyInfo(), ownerType.m_orientType.value); >-} >- >-SVGMarkerOrientType& SVGMarkerElement::orientType() const >-{ >- if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, SVGAnimatedEnumeration>(this, orientTypePropertyInfo())) { >- if (wrapper->isAnimating()) { >- ASSERT(wrapper->currentAnimatedValue() < SVGMarkerOrientMax); >- return reinterpret_cast<SVGMarkerOrientType&>(wrapper->currentAnimatedValue()); >- } >- } >- return m_orientType.value; >-} >- >-Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated() >-{ >- m_orientType.shouldSynchronize = true; >- return static_reference_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>>(lookupOrCreateOrientTypeWrapper(this)); >-} >- > } >diff --git a/Source/WebCore/svg/SVGMarkerElement.h b/Source/WebCore/svg/SVGMarkerElement.h >index 67f4051f553..37c180a01fa 100644 >--- a/Source/WebCore/svg/SVGMarkerElement.h >+++ b/Source/WebCore/svg/SVGMarkerElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -57,14 +58,32 @@ public: > void setOrientToAuto(); > void setOrientToAngle(SVGAngle&); > >- static const SVGPropertyInfo* orientTypePropertyInfo(); >+ const SVGLengthValue& refX() const { return m_refX.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& refY() const { return m_refY.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& markerWidth() const { return m_markerWidth.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& markerHeight() const { return m_markerHeight.currentValue(attributeOwnerProxy()); } >+ SVGMarkerUnitsType markerUnits() const { return m_markerUnits.currentValue(attributeOwnerProxy()); } >+ const SVGAngleValue& orientAngle() const { return m_orientAngle.currentValue(attributeOwnerProxy()); } >+ SVGMarkerOrientType orientType() const { return m_orientType.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> refXAnimated() { return m_refX.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> refYAnimated() { return m_refY.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> markerWidthAnimated() { return m_markerWidth.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> markerHeightAnimated() { return m_markerHeight.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> markerUnitsAnimated() { return m_markerUnits.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedAngle> orientAngleAnimated() { return m_orientAngle.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> orientTypeAnimated() { return m_orientType.animatedProperty(attributeOwnerProxy()); } > > private: > SVGMarkerElement(const QualifiedName&, Document&); > >- bool needsPendingResourceHandling() const override { return false; } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > void childrenChanged(const ChildChange&) override; >@@ -72,38 +91,48 @@ private: > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; > bool rendererIsNeeded(const RenderStyle&) override { return true; } > >+ bool needsPendingResourceHandling() const override { return false; } >+ > bool selfHasRelativeLengths() const override; > > void setOrient(SVGMarkerOrientType, const SVGAngleValue&); > >- void synchronizeOrientType(); >- > static const AtomicString& orientTypeIdentifier(); > static const AtomicString& orientAngleIdentifier(); >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMarkerElement) >- DECLARE_ANIMATED_LENGTH(RefX, refX) >- DECLARE_ANIMATED_LENGTH(RefY, refY) >- DECLARE_ANIMATED_LENGTH(MarkerWidth, markerWidth) >- DECLARE_ANIMATED_LENGTH(MarkerHeight, markerHeight) >- DECLARE_ANIMATED_ENUMERATION(MarkerUnits, markerUnits, SVGMarkerUnitsType) >- DECLARE_ANIMATED_ANGLE(OrientAngle, orientAngle) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- DECLARE_ANIMATED_RECT(ViewBox, viewBox) >- DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) >- END_DECLARE_ANIMATED_PROPERTIES >- >-public: >- // Custom 'orientType' property. >- static void synchronizeOrientType(SVGElement* contextElement); >- static Ref<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement); >- SVGMarkerOrientType& orientType() const; >- SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; } >- void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; } >- Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated(); > >-private: >- mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType; >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ >+ class SVGAnimatedCustomOrientTypeAttribute : public SVGAnimatedEnumerationAttribute<SVGMarkerOrientType> { >+ public: >+ using Base = SVGAnimatedEnumerationAttribute<SVGMarkerOrientType>; >+ >+ SVGAnimatedCustomOrientTypeAttribute(SVGMarkerOrientType baseValue) >+ : Base(baseValue) >+ { >+ } >+ void synchronize(Element& element, const QualifiedName& attributeName) >+ { >+ static const NeverDestroyed<String> autoString = MAKE_STATIC_STRING_IMPL("auto"); >+ static const NeverDestroyed<String> autoStartReverseString = MAKE_STATIC_STRING_IMPL("auto-start-reverse"); >+ >+ if (!shouldSynchronize()) >+ return; >+ if (value() == SVGMarkerOrientAuto) >+ element.setSynchronizedLazyAttribute(attributeName, autoString.get()); >+ else if (value() == SVGMarkerOrientAutoStartReverse) >+ element.setSynchronizedLazyAttribute(attributeName, autoStartReverseString.get()); >+ } >+ }; >+ >+ using SVGAnimatedCustomAngleAttributeAccessor = SVGAnimatedPairAttributeAccessor<SVGMarkerElement, SVGAnimatedAngleAttribute, AnimatedAngle, SVGAnimatedCustomOrientTypeAttribute, AnimatedEnumeration>; >+ >+ SVGAnimatedLengthAttribute m_refX { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_refY { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_markerWidth { LengthModeWidth, "3" }; >+ SVGAnimatedLengthAttribute m_markerHeight { LengthModeHeight, "3" }; >+ SVGAnimatedEnumerationAttribute<SVGMarkerUnitsType> m_markerUnits { SVGMarkerUnitsStrokeWidth }; >+ SVGAnimatedAngleAttribute m_orientAngle; >+ SVGAnimatedCustomOrientTypeAttribute m_orientType { SVGMarkerOrientAngle }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGMaskElement.cpp b/Source/WebCore/svg/SVGMaskElement.cpp >index b60d941f0a9..cd43fa630e2 100644 >--- a/Source/WebCore/svg/SVGMaskElement.cpp >+++ b/Source/WebCore/svg/SVGMaskElement.cpp >@@ -5,6 +5,7 @@ > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> > * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -38,40 +39,15 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGMaskElement); > >-// Animated property definitions >-DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskUnitsAttr, MaskUnits, maskUnits, SVGUnitTypes::SVGUnitType) >-DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskContentUnitsAttr, MaskContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType) >-DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_BOOLEAN(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMaskElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(maskUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(maskContentUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) >- , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) >- , m_x(LengthModeWidth, "-10%") >- , m_y(LengthModeHeight, "-10%") >- , m_width(LengthModeWidth, "120%") >- , m_height(LengthModeHeight, "120%") >+ , SVGExternalResourcesRequired(this) >+ , SVGTests(this) > { > // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified. > // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified. > ASSERT(hasTagName(SVGNames::maskTag)); >- registerAnimatedPropertiesForSVGMaskElement(); >+ registerAttributes(); > } > > Ref<SVGMaskElement> SVGMaskElement::create(const QualifiedName& tagName, Document& document) >@@ -79,25 +55,17 @@ Ref<SVGMaskElement> SVGMaskElement::create(const QualifiedName& tagName, Documen > return adoptRef(*new SVGMaskElement(tagName, document)); > } > >-bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGMaskElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGTests::addSupportedAttributes(set); >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ >- SVGNames::maskUnitsAttr.get(), >- SVGNames::maskContentUnitsAttr.get(), >- SVGNames::refYAttr.get(), >- SVGNames::xAttr.get(), >- SVGNames::yAttr.get(), >- SVGNames::widthAttr.get(), >- SVGNames::heightAttr.get(), >- }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGMaskElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGMaskElement::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGMaskElement::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGMaskElement::m_height>(); >+ registry.registerAttribute<SVGNames::maskUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskUnits>(); >+ registry.registerAttribute<SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskContentUnits>(); > } > > void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -105,26 +73,26 @@ void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin > if (name == SVGNames::maskUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setMaskUnitsBaseValue(propertyValue); >+ m_maskUnits.setValue(propertyValue); > return; > } > if (name == SVGNames::maskContentUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setMaskContentUnitsBaseValue(propertyValue); >+ m_maskContentUnits.setValue(propertyValue); > return; > } > > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::heightAttr) >- setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > > reportAttributeParsingError(parseError, name, value); > >@@ -135,23 +103,20 @@ void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin > > void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isAnimatedLengthAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ invalidateSVGPresentationAttributeStyle(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- if (attrName == SVGNames::xAttr >- || attrName == SVGNames::yAttr >- || attrName == SVGNames::widthAttr >- || attrName == SVGNames::heightAttr) { >- invalidateSVGPresentationAttributeStyle(); >+ if (isKnownAttribute(attrName)) { >+ if (auto* renderer = this->renderer()) >+ renderer->setNeedsLayout(); > return; > } > >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > void SVGMaskElement::childrenChanged(const ChildChange& change) >@@ -170,19 +135,4 @@ RenderPtr<RenderElement> SVGMaskElement::createElementRenderer(RenderStyle&& sty > return createRenderer<RenderSVGResourceMasker>(*this, WTFMove(style)); > } > >-Ref<SVGStringList> SVGMaskElement::requiredFeatures() >-{ >- return SVGTests::requiredFeatures(*this); >-} >- >-Ref<SVGStringList> SVGMaskElement::requiredExtensions() >-{ >- return SVGTests::requiredExtensions(*this); >-} >- >-Ref<SVGStringList> SVGMaskElement::systemLanguage() >-{ >- return SVGTests::systemLanguage(*this); >-} >- > } >diff --git a/Source/WebCore/svg/SVGMaskElement.h b/Source/WebCore/svg/SVGMaskElement.h >index 3bbd89b1547..30be77e80ae 100644 >--- a/Source/WebCore/svg/SVGMaskElement.h >+++ b/Source/WebCore/svg/SVGMaskElement.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,45 +31,52 @@ > > namespace WebCore { > >-class SVGMaskElement final : public SVGElement, public SVGTests, public SVGExternalResourcesRequired { >+class SVGMaskElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGTests { > WTF_MAKE_ISO_ALLOCATED(SVGMaskElement); > public: > static Ref<SVGMaskElement> create(const QualifiedName&, Document&); > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >+ SVGUnitTypes::SVGUnitType maskUnits() const { return m_maskUnits.currentValue(attributeOwnerProxy()); } >+ SVGUnitTypes::SVGUnitType maskContentUnits() const { return m_maskContentUnits.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> maskUnitsAnimated() { return m_maskUnits.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> maskContentUnitsAnimated() { return m_maskContentUnits.animatedProperty(attributeOwnerProxy()); } > > private: > SVGMaskElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- bool needsPendingResourceHandling() const final { return false; } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMaskElement, SVGElement, SVGExternalResourcesRequired, SVGTests>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > void childrenChanged(const ChildChange&) final; > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } >+ bool needsPendingResourceHandling() const final { return false; } > bool selfHasRelativeLengths() const final { return true; } > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMaskElement) >- DECLARE_ANIMATED_ENUMERATION(MaskUnits, maskUnits, SVGUnitTypes::SVGUnitType) >- DECLARE_ANIMATED_ENUMERATION(MaskContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >- >- // SVGTests >- void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } >- void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } >- void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth, "-10%" }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight, "-10%" }; >+ SVGAnimatedLengthAttribute m_width { LengthModeWidth, "120%" }; >+ SVGAnimatedLengthAttribute m_height { LengthModeHeight, "120%" }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskContentUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGPathElement.cpp b/Source/WebCore/svg/SVGPathElement.cpp >index 1dac18c5cc1..f9391b7d388 100644 >--- a/Source/WebCore/svg/SVGPathElement.cpp >+++ b/Source/WebCore/svg/SVGPathElement.cpp >@@ -56,39 +56,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPathElement); > >-// Define custom animated property 'd'. >-const SVGPropertyInfo* SVGPathElement::dPropertyInfo() >-{ >- static const SVGPropertyInfo* s_propertyInfo = nullptr; >- if (!s_propertyInfo) { >- s_propertyInfo = new SVGPropertyInfo(AnimatedPath, >- PropertyIsReadWrite, >- SVGNames::dAttr, >- SVGNames::dAttr->localName(), >- &SVGPathElement::synchronizeD, >- &SVGPathElement::lookupOrCreateDWrapper); >- } >- return s_propertyInfo; >-} >- >-// Animated property definitions >-DEFINE_ANIMATED_NUMBER(SVGPathElement, SVGNames::pathLengthAttr, PathLength, pathLength) >-DEFINE_ANIMATED_BOOLEAN(SVGPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPathElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(d) >- REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& document) > : SVGGeometryElement(tagName, document) >- , m_pathSegList(PathSegUnalteredRole) >- , m_isAnimValObserved(false) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::pathTag)); >- registerAnimatedPropertiesForSVGPathElement(); >+ registerAttributes(); > } > > Ref<SVGPathElement> SVGPathElement::create(const QualifiedName& tagName, Document& document) >@@ -212,16 +185,12 @@ Ref<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::createSVGPathSegCurveto > return SVGPathSegCurvetoQuadraticSmoothRel::create(*this, role, x, y); > } > >-bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGPathElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ SVGNames::dAttr.get(), SVGNames::pathLengthAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute(SVGAnimatedCustomPathSegListAttributeAccessor::singleton<SVGNames::dAttr, &SVGPathElement::m_pathSegList>()); > } > > void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -233,43 +202,35 @@ void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin > return; > } > >- if (name == SVGNames::pathLengthAttr) { >- setPathLengthBaseValue(value.toFloat()); >- if (pathLengthBaseValue() < 0) >- document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed"); >- return; >- } >- > SVGGeometryElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); > } > > void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGeometryElement::svgAttributeChanged(attrName); >- return; >- } >- >- InstanceInvalidationGuard guard(*this); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > >- RenderSVGPath* renderer = downcast<RenderSVGPath>(this->renderer()); >+ RenderSVGPath* renderer = downcast<RenderSVGPath>(this->renderer()); >+ if (attrName == SVGNames::dAttr) { >+ if (m_pathSegList.shouldSynchronize() && !lookupAnimatedProperty(m_pathSegList)->isAnimating()) { >+ SVGPathSegListValues newList(PathSegUnalteredRole); >+ buildSVGPathSegListValuesFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing); >+ m_pathSegList.setValue(WTFMove(newList)); >+ } > >- if (attrName == SVGNames::dAttr) { >- if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo())->isAnimating()) { >- SVGPathSegListValues newList(PathSegUnalteredRole); >- buildSVGPathSegListValuesFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing); >- m_pathSegList.value = WTFMove(newList); >+ if (renderer) >+ renderer->setNeedsShapeUpdate(); >+ invalidateMPathDependencies(); > } > > if (renderer) >- renderer->setNeedsShapeUpdate(); >- >- invalidateMPathDependencies(); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ return; > } > >- if (renderer) >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ SVGGeometryElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > void SVGPathElement::invalidateMPathDependencies() >@@ -299,15 +260,14 @@ void SVGPathElement::removedFromAncestor(RemovalType removalType, ContainerNode& > > const SVGPathByteStream& SVGPathElement::pathByteStream() const > { >- auto property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo()); >+ auto property = lookupAnimatedProperty(m_pathSegList); > if (!property || !property->isAnimating()) > return m_pathByteStream; > >- SVGPathByteStream* animatedPathByteStream = static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property.get())->animatedPathByteStream(); >- if (!animatedPathByteStream) >- return m_pathByteStream; >+ if (auto* animatedPathByteStream = static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property.get())->animatedPathByteStream()) >+ return *animatedPathByteStream; > >- return *animatedPathByteStream; >+ return m_pathByteStream; > } > > Path SVGPathElement::pathForByteStream() const >@@ -323,42 +283,23 @@ Path SVGPathElement::pathForByteStream() const > return buildPathFromByteStream(pathByteStreamToUse); > } > >-Ref<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement); >- >- if (auto property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(&ownerType, dPropertyInfo())) >- return *property; >- >- if (ownerType.m_pathSegList.value.isEmpty()) >- buildSVGPathSegListValuesFromByteStream(ownerType.m_pathByteStream, ownerType, ownerType.m_pathSegList.value, UnalteredParsing); >- >- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegListValues>(&ownerType, dPropertyInfo(), ownerType.m_pathSegList.value); >-} >- >-void SVGPathElement::synchronizeD(SVGElement* contextElement) >+RefPtr<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper() > { >- ASSERT(contextElement); >- SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement); >- if (!ownerType.m_pathSegList.shouldSynchronize) >- return; >- ownerType.m_pathSegList.synchronize(&ownerType, dPropertyInfo()->attributeName, ownerType.m_pathSegList.value.valueAsString()); >+ return m_pathSegList.animatedProperty(attributeOwnerProxy()); > } > > void SVGPathElement::animatedPropertyWillBeDeleted() > { > // m_pathSegList.shouldSynchronize is set to true when the 'd' wrapper for m_pathSegList > // is created and cached. We need to reset it back to false when this wrapper is deleted >- // so we can be sure if shouldSynchronize is true, SVGAnimatedProperty::lookupWrapper() >+ // so we can be sure if shouldSynchronize is true, SVGAttributeAccessor::lookupAnimatedProperty() > // will return a valid cached 'd' wrapper for the m_pathSegList. >- m_pathSegList.shouldSynchronize = false; >+ m_pathSegList.setShouldSynchronize(false); > } > > Ref<SVGPathSegList> SVGPathElement::pathSegList() > { >- m_pathSegList.shouldSynchronize = true; >- return static_reference_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->baseVal(); >+ return static_pointer_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper())->baseVal(); > } > > RefPtr<SVGPathSegList> SVGPathElement::normalizedPathSegList() >@@ -369,9 +310,8 @@ RefPtr<SVGPathSegList> SVGPathElement::normalizedPathSegList() > > Ref<SVGPathSegList> SVGPathElement::animatedPathSegList() > { >- m_pathSegList.shouldSynchronize = true; > m_isAnimValObserved = true; >- return static_reference_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->animVal(); >+ return static_pointer_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper())->animVal(); > } > > RefPtr<SVGPathSegList> SVGPathElement::animatedNormalizedPathSegList() >@@ -394,14 +334,16 @@ void SVGPathElement::pathSegListChanged(SVGPathSegRole role, ListModification li > case PathSegNormalizedRole: > // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! > break; >- case PathSegUnalteredRole: >+ case PathSegUnalteredRole: { >+ auto& pathSegList = m_pathSegList.value(false); > if (listModification == ListModificationAppend) { >- ASSERT(!m_pathSegList.value.isEmpty()); >- appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last().copyRef(), m_pathByteStream, UnalteredParsing); >+ ASSERT(!pathSegList.isEmpty()); >+ appendSVGPathByteStreamFromSVGPathSeg(pathSegList.last().copyRef(), m_pathByteStream, UnalteredParsing); > } else >- buildSVGPathByteStreamFromSVGPathSegListValues(m_pathSegList.value, m_pathByteStream, UnalteredParsing); >+ buildSVGPathByteStreamFromSVGPathSegListValues(pathSegList, m_pathByteStream, UnalteredParsing); > m_cachedPath = std::nullopt; > break; >+ } > case PathSegUndefinedRole: > return; > } >diff --git a/Source/WebCore/svg/SVGPathElement.h b/Source/WebCore/svg/SVGPathElement.h >index 1e4ec8f6385..6c45a1bd0e4 100644 >--- a/Source/WebCore/svg/SVGPathElement.h >+++ b/Source/WebCore/svg/SVGPathElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -23,6 +24,7 @@ > #include "Path.h" > #include "SVGAnimatedBoolean.h" > #include "SVGAnimatedNumber.h" >+#include "SVGAnimatedPath.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGeometryElement.h" > #include "SVGNames.h" >@@ -95,32 +97,30 @@ public: > > FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) final; > >- static const SVGPropertyInfo* dPropertyInfo(); >- > bool isAnimValObserved() const { return m_isAnimValObserved; } > > void animatedPropertyWillBeDeleted(); > > size_t approximateMemoryCost() const final; > >+ const SVGPathSegListValues& pathSegList() const { return m_pathSegList.currentValue(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedPathSegList> pathSegListAnimated() { return m_pathSegList.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGPathElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPathElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; >- bool supportsMarkers() const final { return true; } > >- // Custom 'd' property >- static void synchronizeD(SVGElement* contextElement); >- static Ref<SVGAnimatedProperty> lookupOrCreateDWrapper(SVGElement* contextElement); >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPathElement) >- DECLARE_ANIMATED_NUMBER(PathLength, pathLength) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ bool isValid() const final { return SVGTests::isValid(); } >+ bool supportsMarkers() const final { return true; } >+ RefPtr<SVGAnimatedProperty> lookupOrCreateDWrapper(); > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >@@ -132,8 +132,31 @@ private: > private: > SVGPathByteStream m_pathByteStream; > mutable std::optional<Path> m_cachedPath; >- mutable SVGSynchronizableAnimatedProperty<SVGPathSegListValues> m_pathSegList; >- bool m_isAnimValObserved; >+ bool m_isAnimValObserved { false }; >+ >+ class SVGAnimatedCustomPathSegListAttribute : public SVGAnimatedPathSegListAttribute { >+ public: >+ SVGAnimatedCustomPathSegListAttribute(SVGPathElement& element) >+ : SVGAnimatedPathSegListAttribute(PathSegUnalteredRole) >+ , m_element(element) >+ { >+ } >+ >+ SVGPathSegListValues& value(bool shouldBuildSegListValues = true) >+ { >+ if (shouldBuildSegListValues && m_property.isEmpty()) >+ buildSVGPathSegListValuesFromByteStream(m_element.m_pathByteStream, m_element, m_property, UnalteredParsing); >+ return m_property; >+ } >+ >+ private: >+ SVGPathElement& m_element; >+ }; >+ >+ using SVGAnimatedCustomPathSegListAttributeAccessor = SVGAnimatedAttributeAccessor<SVGPathElement, SVGAnimatedCustomPathSegListAttribute, AnimatedPath>; >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedCustomPathSegListAttribute m_pathSegList { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGPathSegListValues.h b/Source/WebCore/svg/SVGPathSegListValues.h >index 5c150f555d7..8681e31ff94 100644 >--- a/Source/WebCore/svg/SVGPathSegListValues.h >+++ b/Source/WebCore/svg/SVGPathSegListValues.h >@@ -77,6 +77,7 @@ private: > > template<> struct SVGPropertyTraits<SVGPathSegListValues> { > static SVGPathSegListValues initialValue() { return SVGPathSegListValues(PathSegUndefinedRole); } >+ static String toString(const SVGPathSegListValues& list) { return list.valueAsString(); } > > using ListItemType = RefPtr<SVGPathSeg>; > using ListItemTearOff = SVGPropertyTearOff<RefPtr<SVGPathSeg>>; >diff --git a/Source/WebCore/svg/SVGPathSegWithContext.h b/Source/WebCore/svg/SVGPathSegWithContext.h >index 4e395b9e2fa..0a7a0e825bb 100644 >--- a/Source/WebCore/svg/SVGPathSegWithContext.h >+++ b/Source/WebCore/svg/SVGPathSegWithContext.h >@@ -19,7 +19,7 @@ > > #pragma once > >-#include "SVGAnimatedPathSegListPropertyTearOff.h" >+#include "SVGPathElement.h" > > namespace WebCore { > >@@ -40,7 +40,7 @@ public: > case PathSegUndefinedRole: > return nullptr; > case PathSegUnalteredRole: >- return SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(m_element.get(), SVGPathElement::dPropertyInfo()); >+ return m_element->pathSegListAnimated(); > case PathSegNormalizedRole: > // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! > return nullptr; >diff --git a/Source/WebCore/svg/SVGPatternElement.cpp b/Source/WebCore/svg/SVGPatternElement.cpp >index 09037d75af4..172d6c6ebdd 100644 >--- a/Source/WebCore/svg/SVGPatternElement.cpp >+++ b/Source/WebCore/svg/SVGPatternElement.cpp >@@ -3,6 +3,7 @@ > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> > * Copyright (C) Research In Motion Limited 2010. All rights reserved. > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -45,46 +46,15 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPatternElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternUnitsAttr, PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType) >-DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternContentUnitsAttr, PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType) >-DEFINE_ANIMATED_TRANSFORM_LIST(SVGPatternElement, SVGNames::patternTransformAttr, PatternTransform, patternTransform) >-DEFINE_ANIMATED_STRING(SVGPatternElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGPatternElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >-DEFINE_ANIMATED_RECT(SVGPatternElement, SVGNames::viewBoxAttr, ViewBox, viewBox) >-DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGPatternElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(patternUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(patternContentUnits) >- REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) >- REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_x(LengthModeWidth) >- , m_y(LengthModeHeight) >- , m_width(LengthModeWidth) >- , m_height(LengthModeHeight) >- , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) >- , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) >+ , SVGExternalResourcesRequired(this) >+ , SVGFitToViewBox(this) >+ , SVGTests(this) >+ , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::patternTag)); >- registerAnimatedPropertiesForSVGPatternElement(); >+ registerAttributes(); > } > > Ref<SVGPatternElement> SVGPatternElement::create(const QualifiedName& tagName, Document& document) >@@ -92,22 +62,18 @@ Ref<SVGPatternElement> SVGPatternElement::create(const QualifiedName& tagName, D > return adoptRef(*new SVGPatternElement(tagName, document)); > } > >-bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGPatternElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGURIReference::addSupportedAttributes(set); >- SVGTests::addSupportedAttributes(set); >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- SVGFitToViewBox::addSupportedAttributes(set); >- set.add({ >- SVGNames::patternUnitsAttr.get(), SVGNames::patternContentUnitsAttr.get(), SVGNames::patternTransformAttr.get(), >- SVGNames::xAttr.get(), SVGNames::yAttr.get(), SVGNames::widthAttr.get(), SVGNames::heightAttr.get(), >- }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGPatternElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGPatternElement::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGPatternElement::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGPatternElement::m_height>(); >+ registry.registerAttribute<SVGNames::patternUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternUnits>(); >+ registry.registerAttribute<SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternContentUnits>(); >+ registry.registerAttribute<SVGNames::patternTransformAttr, &SVGPatternElement::m_patternTransform>(); > } > > void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -115,33 +81,33 @@ void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt > if (name == SVGNames::patternUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setPatternUnitsBaseValue(propertyValue); >+ m_patternUnits.setValue(propertyValue); > return; > } > if (name == SVGNames::patternContentUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setPatternContentUnitsBaseValue(propertyValue); >+ m_patternContentUnits.setValue(propertyValue); > return; > } > if (name == SVGNames::patternTransformAttr) { > SVGTransformListValues newList; > newList.parse(value); >- detachAnimatedPatternTransformListWrappers(newList.size()); >- setPatternTransformBaseValue(newList); >+ m_patternTransform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_patternTransform.setValue(WTFMove(newList)); > return; > } > > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); >+ m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::heightAttr) >- setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); >+ m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >@@ -149,28 +115,25 @@ void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt > SVGURIReference::parseAttribute(name, value); > SVGTests::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); >- SVGFitToViewBox::parseAttribute(this, name, value); >+ SVGFitToViewBox::parseAttribute(name, value); > } > > void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >+ if (isAnimatedLengthAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ invalidateSVGPresentationAttributeStyle(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- if (attrName == SVGNames::xAttr >- || attrName == SVGNames::yAttr >- || attrName == SVGNames::widthAttr >- || attrName == SVGNames::heightAttr) { >- invalidateSVGPresentationAttributeStyle(); >+ if (isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) { >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); > return; > } > >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > void SVGPatternElement::childrenChanged(const ChildChange& change) >@@ -203,7 +166,7 @@ void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) > if (!attributes.hasHeight() && hasAttribute(SVGNames::heightAttr)) > attributes.setHeight(height()); > >- if (!attributes.hasViewBox() && hasAttribute(SVGNames::viewBoxAttr) && viewBoxIsValid()) >+ if (!attributes.hasViewBox() && hasAttribute(SVGNames::viewBoxAttr) && hasValidViewBox()) > attributes.setViewBox(viewBox()); > > if (!attributes.hasPreserveAspectRatio() && hasAttribute(SVGNames::preserveAspectRatioAttr)) >@@ -232,19 +195,4 @@ AffineTransform SVGPatternElement::localCoordinateSpaceTransform(SVGLocatable::C > return matrix; > } > >-Ref<SVGStringList> SVGPatternElement::requiredFeatures() >-{ >- return SVGTests::requiredFeatures(*this); >-} >- >-Ref<SVGStringList> SVGPatternElement::requiredExtensions() >-{ >- return SVGTests::requiredExtensions(*this); >-} >- >-Ref<SVGStringList> SVGPatternElement::systemLanguage() >-{ >- return SVGTests::systemLanguage(*this); >-} >- > } >diff --git a/Source/WebCore/svg/SVGPatternElement.h b/Source/WebCore/svg/SVGPatternElement.h >index 6cf1aad5f8d..03a606f0a05 100644 >--- a/Source/WebCore/svg/SVGPatternElement.h >+++ b/Source/WebCore/svg/SVGPatternElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -38,7 +39,7 @@ namespace WebCore { > > struct PatternAttributes; > >-class SVGPatternElement final : public SVGElement, public SVGURIReference, public SVGTests, public SVGExternalResourcesRequired, public SVGFitToViewBox { >+class SVGPatternElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGFitToViewBox, public SVGTests, public SVGURIReference { > WTF_MAKE_ISO_ALLOCATED(SVGPatternElement); > public: > static Ref<SVGPatternElement> create(const QualifiedName&, Document&); >@@ -47,44 +48,50 @@ public: > > AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const final; > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >+ SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits.currentValue(attributeOwnerProxy()); } >+ SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternContentUnits.currentValue(attributeOwnerProxy()); } >+ const SVGTransformListValues& patternTransform() const { return m_patternTransform.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> patternUnitsAnimated() { return m_patternUnits.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> patternContentUnitsAnimated() { return m_patternContentUnits.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedTransformList> patternTransformAnimated() { return m_patternTransform.animatedProperty(attributeOwnerProxy()); } > > private: > SVGPatternElement(const QualifiedName&, Document&); >- >- bool isValid() const final { return SVGTests::isValid(); } >- bool needsPendingResourceHandling() const final { return false; } > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPatternElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGTests, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > void childrenChanged(const ChildChange&) final; > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } >+ bool needsPendingResourceHandling() const final { return false; } > bool selfHasRelativeLengths() const final { return true; } > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPatternElement) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_ENUMERATION(PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType) >- DECLARE_ANIMATED_ENUMERATION(PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType) >- DECLARE_ANIMATED_TRANSFORM_LIST(PatternTransform, patternTransform) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- DECLARE_ANIMATED_RECT(ViewBox, viewBox) >- DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) >- END_DECLARE_ANIMATED_PROPERTIES >- >- // SVGTests >- void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } >- void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } >- void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { LengthModeHeight }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternContentUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; >+ SVGAnimatedTransformListAttribute m_patternTransform; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGPointListValues.h b/Source/WebCore/svg/SVGPointListValues.h >index e53515e27d3..362fdcc5d7d 100644 >--- a/Source/WebCore/svg/SVGPointListValues.h >+++ b/Source/WebCore/svg/SVGPointListValues.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -44,7 +45,7 @@ struct SVGPropertyTraits<SVGPointListValues> { > return list; > } > static std::optional<SVGPointListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return { }; } >- static String toString(const SVGPointListValues&) { ASSERT_NOT_REACHED(); return emptyString(); } >+ static String toString(const SVGPointListValues& list) { return list.valueAsString(); } > > using ListItemType = FloatPoint; > using ListItemTearOff = SVGPoint; >diff --git a/Source/WebCore/svg/SVGPolyElement.cpp b/Source/WebCore/svg/SVGPolyElement.cpp >index 628d3cd2160..af6db56bcb0 100644 >--- a/Source/WebCore/svg/SVGPolyElement.cpp >+++ b/Source/WebCore/svg/SVGPolyElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -24,46 +25,27 @@ > #include "Document.h" > #include "RenderSVGPath.h" > #include "RenderSVGResource.h" >-#include "SVGAnimatedPointList.h" > #include "SVGDocumentExtensions.h" >-#include "SVGNames.h" > #include "SVGParserUtilities.h" >-#include "SVGPoint.h" >-#include "SVGPointList.h" > #include <wtf/IsoMallocInlines.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPolyElement); > >-// Define custom animated property 'points'. >-const SVGPropertyInfo* SVGPolyElement::pointsPropertyInfo() >+SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) >+ : SVGGeometryElement(tagName, document) >+ , SVGExternalResourcesRequired(this) > { >- static const SVGPropertyInfo* s_propertyInfo = nullptr; >- if (!s_propertyInfo) { >- s_propertyInfo = new SVGPropertyInfo(AnimatedPoints, >- PropertyIsReadWrite, >- SVGNames::pointsAttr, >- SVGNames::pointsAttr->localName(), >- &SVGPolyElement::synchronizePoints, >- &SVGPolyElement::lookupOrCreatePointsWrapper); >- } >- return s_propertyInfo; >+ registerAttributes(); > } > >-// Animated property definitions >-DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(points) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement) >-END_REGISTER_ANIMATED_PROPERTIES >- >-SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) >- : SVGGeometryElement(tagName, document) >+void SVGPolyElement::registerAttributes() > { >- registerAnimatedPropertiesForSVGPolyElement(); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::pointsAttr, &SVGPolyElement::m_points>(); > } > > void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -73,14 +55,14 @@ void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin > if (!pointsListFromSVGData(newList, value)) > document().accessSVGExtensions().reportError("Problem parsing points=\"" + value + "\""); > >- if (auto wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) >- static_pointer_cast<SVGAnimatedPointList>(wrapper)->detachListWrappers(newList.size()); >+ if (auto wrapper = static_pointer_cast<SVGAnimatedPointList>(lookupAnimatedProperty(m_points))) >+ wrapper->detachListWrappers(newList.size()); > >- m_points.value = WTFMove(newList); >+ m_points.setValue(WTFMove(newList)); > return; > } > >- SVGGraphicsElement::parseAttribute(name, value); >+ SVGGeometryElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); > } > >@@ -95,43 +77,20 @@ void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) > return; > } > >- if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >- if (auto* renderer = downcast<RenderSVGPath>(this->renderer())) { >- InstanceInvalidationGuard guard(*this); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- } >- return; >- } >- >- SVGGraphicsElement::svgAttributeChanged(attrName); >-} >- >-void SVGPolyElement::synchronizePoints(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement); >- if (!ownerType.m_points.shouldSynchronize) >- return; >- ownerType.m_points.synchronize(&ownerType, pointsPropertyInfo()->attributeName, ownerType.m_points.value.valueAsString()); >-} >- >-Ref<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement); >- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPolyElement, SVGAnimatedPointList, SVGPointListValues>(&ownerType, pointsPropertyInfo(), ownerType.m_points.value); >+ SVGGeometryElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > Ref<SVGPointList> SVGPolyElement::points() > { >- m_points.shouldSynchronize = true; >- return static_reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal(); >+ m_points.setShouldSynchronize(true); >+ return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->baseVal(); > } > > Ref<SVGPointList> SVGPolyElement::animatedPoints() > { >- m_points.shouldSynchronize = true; >- return static_reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal(); >+ m_points.setShouldSynchronize(true); >+ return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->animVal(); > } > > size_t SVGPolyElement::approximateMemoryCost() const >diff --git a/Source/WebCore/svg/SVGPolyElement.h b/Source/WebCore/svg/SVGPolyElement.h >index df760e0b080..0320c047808 100644 >--- a/Source/WebCore/svg/SVGPolyElement.h >+++ b/Source/WebCore/svg/SVGPolyElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -20,11 +21,10 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" >+#include "SVGAnimatedPointList.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGeometryElement.h" > #include "SVGNames.h" >-#include "SVGPointListValues.h" > > namespace WebCore { > >@@ -34,9 +34,7 @@ public: > Ref<SVGPointList> points(); > Ref<SVGPointList> animatedPoints(); > >- SVGPointListValues& pointList() const { return m_points.value; } >- >- static const SVGPropertyInfo* pointsPropertyInfo(); >+ const SVGPointListValues& pointList() const { return m_points.value(); } > > size_t approximateMemoryCost() const override; > >@@ -44,23 +42,20 @@ protected: > SVGPolyElement(const QualifiedName&, Document&); > > private: >- bool isValid() const override { return SVGTests::isValid(); } >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPolyElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >+ bool isValid() const override { return SVGTests::isValid(); } > bool supportsMarkers() const override { return true; } > >- // Custom 'points' property >- static void synchronizePoints(SVGElement* contextElement); >- static Ref<SVGAnimatedProperty> lookupOrCreatePointsWrapper(SVGElement* contextElement); >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPolyElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >- >-protected: >- mutable SVGSynchronizableAnimatedProperty<SVGPointListValues> m_points; >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedPointListAttribute m_points; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp b/Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp >index 54641af6d9e..d0bc716620f 100644 >--- a/Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp >+++ b/Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp >@@ -180,7 +180,7 @@ bool SVGPreserveAspectRatioValue::parseInternal(const UChar*& currParam, const U > return true; > } > >-void SVGPreserveAspectRatioValue::transformRect(FloatRect& destRect, FloatRect& srcRect) >+void SVGPreserveAspectRatioValue::transformRect(FloatRect& destRect, FloatRect& srcRect) const > { > if (m_align == SVG_PRESERVEASPECTRATIO_NONE) > return; >diff --git a/Source/WebCore/svg/SVGPreserveAspectRatioValue.h b/Source/WebCore/svg/SVGPreserveAspectRatioValue.h >index 5d956087b7e..6a7fca24a4d 100644 >--- a/Source/WebCore/svg/SVGPreserveAspectRatioValue.h >+++ b/Source/WebCore/svg/SVGPreserveAspectRatioValue.h >@@ -60,7 +60,7 @@ public: > ExceptionOr<void> setMeetOrSlice(unsigned short); > unsigned short meetOrSlice() const { return m_meetOrSlice; } > >- void transformRect(FloatRect& destRect, FloatRect& srcRect); >+ void transformRect(FloatRect& destRect, FloatRect& srcRect) const; > > AffineTransform getCTM(float logicalX, float logicalY, float logicalWidth, float logicalHeight, float physicalWidth, float physicalHeight) const; > >diff --git a/Source/WebCore/svg/SVGRadialGradientElement.cpp b/Source/WebCore/svg/SVGRadialGradientElement.cpp >index 9a293956fe7..87520f19d74 100644 >--- a/Source/WebCore/svg/SVGRadialGradientElement.cpp >+++ b/Source/WebCore/svg/SVGRadialGradientElement.cpp >@@ -4,6 +4,7 @@ > * Copyright (C) 2008 Eric Seidel <eric@webkit.org> > * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> > * Copyright (C) Research In Motion Limited 2010. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -38,36 +39,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGRadialGradientElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::cxAttr, Cx, cx) >-DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::cyAttr, Cy, cy) >-DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::rAttr, R, r) >-DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::fxAttr, Fx, fx) >-DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::fyAttr, Fy, fy) >-DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::frAttr, Fr, fr) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRadialGradientElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(cx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(cy) >- REGISTER_LOCAL_ANIMATED_PROPERTY(r) >- REGISTER_LOCAL_ANIMATED_PROPERTY(fx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(fy) >- REGISTER_LOCAL_ANIMATED_PROPERTY(fr) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGradientElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document& document) > : SVGGradientElement(tagName, document) >- , m_cx(LengthModeWidth, "50%") >- , m_cy(LengthModeHeight, "50%") >- , m_r(LengthModeOther, "50%") >- , m_fx(LengthModeWidth) >- , m_fy(LengthModeHeight) >- , m_fr(LengthModeOther, "0%") > { > // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified. > ASSERT(hasTagName(SVGNames::radialGradientTag)); >- registerAnimatedPropertiesForSVGRadialGradientElement(); >+ registerAttributes(); > } > > Ref<SVGRadialGradientElement> SVGRadialGradientElement::create(const QualifiedName& tagName, Document& document) >@@ -75,12 +52,17 @@ Ref<SVGRadialGradientElement> SVGRadialGradientElement::create(const QualifiedNa > return adoptRef(*new SVGRadialGradientElement(tagName, document)); > } > >-bool SVGRadialGradientElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGRadialGradientElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> { >- SVGNames::cxAttr.get(), SVGNames::cyAttr.get(), SVGNames::fxAttr.get(), SVGNames::fyAttr.get(), SVGNames::rAttr.get(), SVGNames::frAttr.get(), >- }); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::cxAttr, &SVGRadialGradientElement::m_cx>(); >+ registry.registerAttribute<SVGNames::cyAttr, &SVGRadialGradientElement::m_cy>(); >+ registry.registerAttribute<SVGNames::rAttr, &SVGRadialGradientElement::m_r>(); >+ registry.registerAttribute<SVGNames::fxAttr, &SVGRadialGradientElement::m_fx>(); >+ registry.registerAttribute<SVGNames::fyAttr, &SVGRadialGradientElement::m_fy>(); >+ registry.registerAttribute<SVGNames::frAttr, &SVGRadialGradientElement::m_fr>(); > } > > void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -88,17 +70,17 @@ void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const A > SVGParsingError parseError = NoError; > > if (name == SVGNames::cxAttr) >- setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::cyAttr) >- setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::rAttr) >- setRBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); >+ m_r.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::fxAttr) >- setFxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_fx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::fyAttr) >- setFyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_fy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::frAttr) >- setFrBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); >+ m_fr.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >@@ -107,17 +89,15 @@ void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const A > > void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGradientElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ updateRelativeLengthsInformation(); >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- updateRelativeLengthsInformation(); >- >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGGradientElement::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGRadialGradientElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGRadialGradientElement.h b/Source/WebCore/svg/SVGRadialGradientElement.h >index 8e58f70e656..f991f3d02d9 100644 >--- a/Source/WebCore/svg/SVGRadialGradientElement.h >+++ b/Source/WebCore/svg/SVGRadialGradientElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -35,10 +36,28 @@ public: > > bool collectGradientAttributes(RadialGradientAttributes&); > >+ const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& r() const { return m_r.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& fx() const { return m_fx.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& fy() const { return m_fy.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& fr() const { return m_fr.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> rAnimated() { return m_r.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> fxAnimated() { return m_fx.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> fyAnimated() { return m_fy.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> frAnimated() { return m_fr.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGRadialGradientElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRadialGradientElement, SVGGradientElement>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -46,14 +65,13 @@ private: > > bool selfHasRelativeLengths() const override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGRadialGradientElement) >- DECLARE_ANIMATED_LENGTH(Cx, cx) >- DECLARE_ANIMATED_LENGTH(Cy, cy) >- DECLARE_ANIMATED_LENGTH(R, r) >- DECLARE_ANIMATED_LENGTH(Fx, fx) >- DECLARE_ANIMATED_LENGTH(Fy, fy) >- DECLARE_ANIMATED_LENGTH(Fr, fr) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_cx { LengthModeWidth, "50%" }; >+ SVGAnimatedLengthAttribute m_cy { LengthModeHeight, "50%" }; >+ SVGAnimatedLengthAttribute m_r { LengthModeOther, "50%" }; >+ SVGAnimatedLengthAttribute m_fx { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_fy { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_fr { LengthModeOther, "0%" }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGRectElement.cpp b/Source/WebCore/svg/SVGRectElement.cpp >index a05f2abb5c7..cfdf196d035 100644 >--- a/Source/WebCore/svg/SVGRectElement.cpp >+++ b/Source/WebCore/svg/SVGRectElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -22,48 +23,20 @@ > #include "config.h" > #include "SVGRectElement.h" > >-#include "RenderSVGPath.h" > #include "RenderSVGRect.h" > #include "RenderSVGResource.h" >-#include "SVGLengthValue.h" >-#include "SVGNames.h" > #include <wtf/IsoMallocInlines.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGRectElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::rxAttr, Rx, rx) >-DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::ryAttr, Ry, ry) >-DEFINE_ANIMATED_BOOLEAN(SVGRectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRectElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(rx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(ry) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document& document) > : SVGGeometryElement(tagName, document) >- , m_x(LengthModeWidth) >- , m_y(LengthModeHeight) >- , m_width(LengthModeWidth) >- , m_height(LengthModeHeight) >- , m_rx(LengthModeWidth) >- , m_ry(LengthModeHeight) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::rectTag)); >- registerAnimatedPropertiesForSVGRectElement(); >+ registerAttributes(); > } > > Ref<SVGRectElement> SVGRectElement::create(const QualifiedName& tagName, Document& document) >@@ -71,46 +44,52 @@ Ref<SVGRectElement> SVGRectElement::create(const QualifiedName& tagName, Documen > return adoptRef(*new SVGRectElement(tagName, document)); > } > >+void SVGRectElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGRectElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGRectElement::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGRectElement::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGRectElement::m_height>(); >+ registry.registerAttribute<SVGNames::rxAttr, &SVGRectElement::m_rx>(); >+ registry.registerAttribute<SVGNames::ryAttr, &SVGRectElement::m_ry>(); >+} >+ > void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::rxAttr) >- setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); >+ m_rx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::ryAttr) >- setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); >+ m_ry.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::widthAttr) >- setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); >+ m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::heightAttr) >- setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); >+ m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >- SVGGraphicsElement::parseAttribute(name, value); >+ SVGGeometryElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); > } > > void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidateSVGPresentationAttributeStyle(); > return; > } > >- if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >- if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) { >- InstanceInvalidationGuard guard(*this); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- } >- return; >- } >- >- SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGGeometryElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGRectElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGRectElement.h b/Source/WebCore/svg/SVGRectElement.h >index d2408643f04..e4cdab1affa 100644 >--- a/Source/WebCore/svg/SVGRectElement.h >+++ b/Source/WebCore/svg/SVGRectElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -33,27 +34,44 @@ class SVGRectElement final : public SVGGeometryElement, public SVGExternalResour > public: > static Ref<SVGRectElement> create(const QualifiedName&, Document&); > >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& rx() const { return m_rx.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& ry() const { return m_ry.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> rxAnimated() { return m_rx.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> ryAnimated() { return m_ry.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGRectElement(const QualifiedName&, Document&); >- >- bool isValid() const final { return SVGTests::isValid(); } > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRectElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool selfHasRelativeLengths() const final { return true; } > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGRectElement) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_LENGTH(Rx, rx) >- DECLARE_ANIMATED_LENGTH(Ry, ry) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_rx { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_ry { LengthModeHeight}; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGSVGElement.cpp b/Source/WebCore/svg/SVGSVGElement.cpp >index c5f0af57487..16171a305ed 100644 >--- a/Source/WebCore/svg/SVGSVGElement.cpp >+++ b/Source/WebCore/svg/SVGSVGElement.cpp >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> >- * Copyright (C) 2007-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2007-2018 Apple Inc. All rights reserved. > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. > * > * This library is free software; you can redistribute it and/or >@@ -52,36 +52,14 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGSVGElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_BOOLEAN(SVGSVGElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >-DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSVGElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) >-DEFINE_ANIMATED_RECT(SVGSVGElement, SVGNames::viewBoxAttr, ViewBox, viewBox) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSVGElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) >- REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >- , m_x(LengthModeWidth) >- , m_y(LengthModeHeight) >- , m_width(LengthModeWidth, "100%"_s) >- , m_height(LengthModeHeight, "100%"_s) >+ , SVGExternalResourcesRequired(this) >+ , SVGFitToViewBox(this) > , m_timeContainer(SMILTimeContainer::create(*this)) > { > ASSERT(hasTagName(SVGNames::svgTag)); >- registerAnimatedPropertiesForSVGSVGElement(); >+ registerAttributes(); > document.registerForDocumentSuspensionCallbacks(this); > } > >@@ -214,6 +192,17 @@ void SVGSVGElement::updateCurrentTranslate() > document().renderView()->repaint(); > } > >+void SVGSVGElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGSVGElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGSVGElement::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGSVGElement::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGSVGElement::m_height>(); >+} >+ > void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (!nearestViewportElement()) { >@@ -252,9 +241,9 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) { > auto length = SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths); > if (parseError != NoError || value.isEmpty()) { >@@ -262,7 +251,7 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString > // Not sure it's correct for the empty string or for something that can't be parsed. > length = SVGLengthValue(LengthModeWidth, "100%"_s); > } >- setWidthBaseValue(length); >+ m_width.setValue(length); > } else if (name == SVGNames::heightAttr) { > auto length = SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths); > if (parseError != NoError || value.isEmpty()) { >@@ -270,43 +259,38 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString > // Not sure it's correct for the empty string or for something that can't be parsed. > length = SVGLengthValue(LengthModeHeight, "100%"_s); > } >- setHeightBaseValue(length); >+ m_height.setValue(length); > } > > reportAttributeParsingError(parseError, name, value); > >- SVGExternalResourcesRequired::parseAttribute(name, value); >- SVGFitToViewBox::parseAttribute(this, name, value); >- SVGZoomAndPan::parseAttribute(*this, name, value); > SVGGraphicsElement::parseAttribute(name, value); >+ SVGExternalResourcesRequired::parseAttribute(name, value); >+ SVGFitToViewBox::parseAttribute(name, value); >+ SVGZoomAndPan::parseAttribute(name, value); > } > > void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) > { >- bool updateRelativeLengthsOrViewBox = false; >- if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) { >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > invalidateSVGPresentationAttributeStyle(); >- updateRelativeLengthsOrViewBox = true; >- } > >+ if (auto renderer = this->renderer()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ return; >+ } >+ > if (SVGFitToViewBox::isKnownAttribute(attrName)) { >- updateRelativeLengthsOrViewBox = true; >- if (auto* renderer = this->renderer()) >+ if (auto* renderer = this->renderer()) { > renderer->setNeedsTransformUpdate(); >- } >- >- InstanceInvalidationGuard guard(*this); >- >- if (updateRelativeLengthsOrViewBox >- || SVGLangSpace::isKnownAttribute(attrName) >- || SVGExternalResourcesRequired::isKnownAttribute(attrName) >- || SVGZoomAndPan::isKnownAttribute(attrName)) { >- if (auto renderer = this->renderer()) > RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > return; > } > > SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > unsigned SVGSVGElement::suspendRedraw(unsigned) >@@ -634,7 +618,7 @@ AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie > return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), preserveAspectRatio(), viewWidth, viewHeight); > > AffineTransform transform = SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_viewSpec->preserveAspectRatio(), viewWidth, viewHeight); >- m_viewSpec->transformBaseValue().concatenate(transform); >+ m_viewSpec->transformValue().concatenate(transform); > return transform; > } > >@@ -716,9 +700,9 @@ void SVGSVGElement::resetScrollAnchor() > if (!m_currentViewFragmentIdentifier.isEmpty()) { > if (auto* rootElement = findRootAnchor(m_currentViewFragmentIdentifier)) { > SVGViewSpec& view = rootElement->currentView(); >- view.setViewBoxBaseValue(viewBox()); >- view.setPreserveAspectRatioBaseValue(preserveAspectRatioBaseValue()); >- view.setZoomAndPanBaseValue(zoomAndPan()); >+ view.setViewBox(viewBox()); >+ view.setPreserveAspectRatio(preserveAspectRatio()); >+ view.setZoomAndPan(zoomAndPan()); > m_currentViewFragmentIdentifier = { }; > } > } >@@ -734,19 +718,19 @@ void SVGSVGElement::inheritViewAttributes(const SVGViewElement& viewElement) > m_useCurrentView = true; > > if (viewElement.hasAttribute(SVGNames::viewBoxAttr)) >- view.setViewBoxBaseValue(viewElement.viewBox()); >+ view.setViewBox(viewElement.viewBox()); > else >- view.setViewBoxBaseValue(viewBox()); >+ view.setViewBox(viewBox()); > > if (viewElement.hasAttribute(SVGNames::preserveAspectRatioAttr)) >- view.setPreserveAspectRatioBaseValue(viewElement.preserveAspectRatioBaseValue()); >+ view.setPreserveAspectRatio(viewElement.preserveAspectRatio()); > else >- view.setPreserveAspectRatioBaseValue(preserveAspectRatioBaseValue()); >+ view.setPreserveAspectRatio(preserveAspectRatio()); > > if (viewElement.hasAttribute(SVGNames::zoomAndPanAttr)) >- view.setZoomAndPanBaseValue(viewElement.zoomAndPan()); >+ view.setZoomAndPan(viewElement.zoomAndPan()); > else >- view.setZoomAndPanBaseValue(zoomAndPan()); >+ view.setZoomAndPan(zoomAndPan()); > } > > void SVGSVGElement::prepareForDocumentSuspension() >diff --git a/Source/WebCore/svg/SVGSVGElement.h b/Source/WebCore/svg/SVGSVGElement.h >index 2c8f1d80bc0..9bcf2868564 100644 >--- a/Source/WebCore/svg/SVGSVGElement.h >+++ b/Source/WebCore/svg/SVGSVGElement.h >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> >- * Copyright (C) 2015 Apple Inc. All rights reserved. >+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -44,17 +44,6 @@ class SVGViewSpec; > > class SVGSVGElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGFitToViewBox, public SVGZoomAndPan { > WTF_MAKE_ISO_ALLOCATED(SVGSVGElement); >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- DECLARE_ANIMATED_RECT(ViewBox, viewBox) >- DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) >- END_DECLARE_ANIMATED_PROPERTIES >- > public: // DOM > const AtomicString& contentScriptType() const; > void setContentScriptType(const AtomicString&); >@@ -69,14 +58,14 @@ public: // DOM > float screenPixelToMillimeterX() const; > float screenPixelToMillimeterY() const; > >- bool useCurrentView() const; >+ bool useCurrentView() const { return m_useCurrentView; } > SVGViewSpec& currentView(); > > float currentScale() const; > void setCurrentScale(float); > > Ref<SVGPoint> currentTranslate(); >- FloatPoint currentTranslateValue(); >+ FloatPoint currentTranslateValue() { return m_currentTranslate; } > > unsigned suspendRedraw(unsigned maxWaitMilliseconds); > void unsuspendRedraw(unsigned suspendHandleId); >@@ -108,9 +97,6 @@ public: // DOM > > Element* getElementById(const AtomicString&); > >- SVGZoomAndPanType zoomAndPan() const; >- void setZoomAndPan(unsigned short); >- > public: > static Ref<SVGSVGElement> create(const QualifiedName&, Document&); > static Ref<SVGSVGElement> create(Document&); >@@ -120,7 +106,7 @@ public: > using SVGGraphicsElement::ref; > using SVGGraphicsElement::deref; > >- SMILTimeContainer& timeContainer(); >+ SMILTimeContainer& timeContainer() { return m_timeContainer.get(); } > > void setCurrentTranslate(const FloatPoint&); // Used to pan. > void updateCurrentTranslate(); // Used from DOM bindings to create an SVGStaticPropertyTearOff for currentTranslate. >@@ -133,26 +119,42 @@ public: > FloatSize currentViewportSize() const; > FloatRect currentViewBoxRect() const; > >- bool hasEmptyViewBox() const; > AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; > >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGSVGElement(const QualifiedName&, Document&); > virtual ~SVGSVGElement(); > >- bool isValid() const override; >- void didMoveToNewDocument(Document& oldDocument, Document& newDocument) override; >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSVGElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >+ void svgAttributeChanged(const QualifiedName&) override; >+ bool selfHasRelativeLengths() const override; >+ bool isValid() const override; >+ > bool rendererIsNeeded(const RenderStyle&) override; > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; > void removedFromAncestor(RemovalType, ContainerNode&) override; >- void svgAttributeChanged(const QualifiedName&) override; >- bool selfHasRelativeLengths() const override; > void prepareForDocumentSuspension() override; > void resumeFromDocumentSuspension() override; >- AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override; >+ void didMoveToNewDocument(Document& oldDocument, Document& newDocument) override; > >+ AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override; > RefPtr<Frame> frameForCurrentScale() const; > void inheritViewAttributes(const SVGViewElement&); > Ref<NodeList> collectIntersectionOrEnclosureList(SVGRect&, SVGElement*, bool (*checkFunction)(SVGElement&, SVGRect&)); >@@ -162,41 +164,16 @@ private: > SVGSVGElement* findRootAnchor(const String&) const; > > bool m_useCurrentView { false }; >- SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify }; > Ref<SMILTimeContainer> m_timeContainer; > FloatPoint m_currentTranslate; > RefPtr<SVGViewSpec> m_viewSpec; > String m_currentViewFragmentIdentifier; >-}; > >-inline bool SVGSVGElement::useCurrentView() const >-{ >- return m_useCurrentView; >-} >- >-inline FloatPoint SVGSVGElement::currentTranslateValue() >-{ >- return m_currentTranslate; >-} >- >-inline SVGZoomAndPanType SVGSVGElement::zoomAndPan() const >-{ >- return m_zoomAndPan; >-} >- >-inline void SVGSVGElement::setZoomAndPan(unsigned short zoomAndPan) >-{ >- m_zoomAndPan = parseFromNumber(zoomAndPan); >-} >- >-inline SMILTimeContainer& SVGSVGElement::timeContainer() >-{ >- return m_timeContainer.get(); >-} >- >-inline bool SVGSVGElement::hasEmptyViewBox() const >-{ >- return viewBoxIsValid() && viewBox().isEmpty(); >-} >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight}; >+ SVGAnimatedLengthAttribute m_width { LengthModeWidth, "100%"_s }; >+ SVGAnimatedLengthAttribute m_height { LengthModeHeight, "100%"_s }; >+}; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGScriptElement.cpp b/Source/WebCore/svg/SVGScriptElement.cpp >index a0ef60a92e4..9c333ed1906 100644 >--- a/Source/WebCore/svg/SVGScriptElement.cpp >+++ b/Source/WebCore/svg/SVGScriptElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -24,29 +25,20 @@ > #include "Document.h" > #include "Event.h" > #include "SVGAnimatedStaticPropertyTearOff.h" >-#include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > > namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGScriptElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGScriptElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document& document, bool wasInsertedByParser, bool alreadyStarted) > : SVGElement(tagName, document) >+ , SVGExternalResourcesRequired(this) >+ , SVGURIReference(this) > , ScriptElement(*this, wasInsertedByParser, alreadyStarted) > , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired) > { > ASSERT(hasTagName(SVGNames::scriptTag)); >- registerAnimatedPropertiesForSVGScriptElement(); > } > > Ref<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagName, Document& document, bool insertedByParser) >@@ -70,15 +62,15 @@ void SVGScriptElement::svgAttributeChanged(const QualifiedName& attrName) > return; > } > >- SVGExternalResourcesRequired::handleAttributeChange(this, attrName); > SVGElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > Node::InsertedIntoAncestorResult SVGScriptElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree) > { > SVGElement::insertedIntoAncestor(insertionType, parentOfInsertedTree); > if (insertionType.connectedToDocument) >- SVGExternalResourcesRequired::insertedIntoDocument(this); >+ SVGExternalResourcesRequired::insertedIntoDocument(); > return ScriptElement::insertedIntoAncestor(insertionType, parentOfInsertedTree); > } > >@@ -93,11 +85,6 @@ void SVGScriptElement::childrenChanged(const ChildChange& change) > ScriptElement::childrenChanged(change); > } > >-bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const >-{ >- return attribute.name() == sourceAttributeValue(); >-} >- > void SVGScriptElement::finishParsingChildren() > { > SVGElement::finishParsingChildren(); >@@ -110,67 +97,9 @@ void SVGScriptElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const > > addSubresourceURL(urls, document().completeURL(href())); > } >- >-String SVGScriptElement::sourceAttributeValue() const >-{ >- return href(); >-} >- >-String SVGScriptElement::charsetAttributeValue() const >-{ >- return String(); >-} >- >-String SVGScriptElement::typeAttributeValue() const >-{ >- return getAttribute(SVGNames::typeAttr).string(); >-} >- >-String SVGScriptElement::languageAttributeValue() const >-{ >- return String(); >-} >- >-String SVGScriptElement::forAttributeValue() const >-{ >- return String(); >-} >- >-String SVGScriptElement::eventAttributeValue() const >-{ >- return String(); >-} >- >-bool SVGScriptElement::hasAsyncAttribute() const >-{ >- return false; >-} >- >-bool SVGScriptElement::hasDeferAttribute() const >-{ >- return false; >-} >- >-bool SVGScriptElement::hasNoModuleAttribute() const >-{ >- return false; >-} >- >-bool SVGScriptElement::hasSourceAttribute() const >-{ >- return hasAttribute(XLinkNames::hrefAttr); >-} >- > Ref<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren(Document& targetDocument) > { > return adoptRef(*new SVGScriptElement(tagQName(), targetDocument, false, alreadyStarted())); > } > >-#ifndef NDEBUG >-bool SVGScriptElement::filterOutAnimatableAttribute(const QualifiedName& name) const >-{ >- return name == SVGNames::typeAttr; >-} >-#endif >- > } >diff --git a/Source/WebCore/svg/SVGScriptElement.h b/Source/WebCore/svg/SVGScriptElement.h >index 1703b00a63e..5264571facd 100644 >--- a/Source/WebCore/svg/SVGScriptElement.h >+++ b/Source/WebCore/svg/SVGScriptElement.h >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> >- * Copyright (C) 2008-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2008-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -27,10 +27,11 @@ > #include "SVGExternalResourcesRequired.h" > #include "SVGURIReference.h" > #include "ScriptElement.h" >+#include "XLinkNames.h" > > namespace WebCore { > >-class SVGScriptElement final : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired, public ScriptElement { >+class SVGScriptElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference, public ScriptElement { > WTF_MAKE_ISO_ALLOCATED(SVGScriptElement); > public: > static Ref<SVGScriptElement> create(const QualifiedName&, Document&, bool wasInsertedByParser); >@@ -41,31 +42,34 @@ public: > private: > SVGScriptElement(const QualifiedName&, Document&, bool wasInsertedByParser, bool alreadyStarted); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGScriptElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; >+ void svgAttributeChanged(const QualifiedName&) final; >+ > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; > void didFinishInsertingNode() final; > void childrenChanged(const ChildChange&) final; > >- void svgAttributeChanged(const QualifiedName&) final; >- bool isURLAttribute(const Attribute&) const final; >+ bool isURLAttribute(const Attribute& attribute) const final { return attribute.name() == sourceAttributeValue(); } > void finishParsingChildren() final; >- > void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; > > bool haveLoadedRequiredResources() final { return SVGExternalResourcesRequired::haveLoadedRequiredResources(); } > >- String sourceAttributeValue() const final; >- String charsetAttributeValue() const final; >- String typeAttributeValue() const final; >- String languageAttributeValue() const final; >- String forAttributeValue() const final; >- String eventAttributeValue() const final; >- bool hasAsyncAttribute() const final; >- bool hasDeferAttribute() const final; >- bool hasNoModuleAttribute() const final; >- bool hasSourceAttribute() const final; >+ String sourceAttributeValue() const final { return href(); } >+ String charsetAttributeValue() const final { return String(); } >+ String typeAttributeValue() const final { return getAttribute(SVGNames::typeAttr).string(); } >+ String languageAttributeValue() const final { return String(); } >+ String forAttributeValue() const final { return String(); } >+ String eventAttributeValue() const final { return String(); } >+ bool hasAsyncAttribute() const final { return false; } >+ bool hasDeferAttribute() const final { return false; } >+ bool hasNoModuleAttribute() const final { return false; } >+ bool hasSourceAttribute() const final { return hasAttribute(XLinkNames::hrefAttr); } > >- void dispatchLoadEvent() final { SVGExternalResourcesRequired::dispatchLoadEvent(this); } >+ void dispatchLoadEvent() final { SVGExternalResourcesRequired::dispatchLoadEvent(); } > > Ref<Element> cloneElementWithoutAttributesAndChildren(Document&) final; > bool rendererIsNeeded(const RenderStyle&) final { return false; } >@@ -77,14 +81,10 @@ private: > Timer* svgLoadEventTimer() final { return &m_svgLoadEventTimer; } > > #ifndef NDEBUG >- bool filterOutAnimatableAttribute(const QualifiedName&) const final; >+ bool filterOutAnimatableAttribute(const QualifiedName& name) const final { return name == SVGNames::typeAttr; } > #endif > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >- >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > Timer m_svgLoadEventTimer; > }; > >diff --git a/Source/WebCore/svg/SVGStopElement.cpp b/Source/WebCore/svg/SVGStopElement.cpp >index 7cda107491b..2ab2afb5f1b 100644 >--- a/Source/WebCore/svg/SVGStopElement.cpp >+++ b/Source/WebCore/svg/SVGStopElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -32,20 +33,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGStopElement); > >-// Animated property definitions >-DEFINE_ANIMATED_NUMBER(SVGStopElement, SVGNames::offsetAttr, Offset, offset) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGStopElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(offset) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_offset(0) > { > ASSERT(hasTagName(SVGNames::stopTag)); >- registerAnimatedPropertiesForSVGStopElement(); >+ registerAttributes(); > } > > Ref<SVGStopElement> SVGStopElement::create(const QualifiedName& tagName, Document& document) >@@ -53,13 +45,21 @@ Ref<SVGStopElement> SVGStopElement::create(const QualifiedName& tagName, Documen > return adoptRef(*new SVGStopElement(tagName, document)); > } > >+void SVGStopElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::offsetAttr, &SVGStopElement::m_offset>(); >+} >+ > void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::offsetAttr) { > if (value.endsWith('%')) >- setOffsetBaseValue(value.string().left(value.length() - 1).toFloat() / 100.0f); >+ m_offset.setValue(value.string().left(value.length() - 1).toFloat() / 100.0f); > else >- setOffsetBaseValue(value.toFloat()); >+ m_offset.setValue(value.toFloat()); > return; > } > >diff --git a/Source/WebCore/svg/SVGStopElement.h b/Source/WebCore/svg/SVGStopElement.h >index 4e0c2825002..d843b76afed 100644 >--- a/Source/WebCore/svg/SVGStopElement.h >+++ b/Source/WebCore/svg/SVGStopElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -32,9 +33,18 @@ public: > > Color stopColorIncludingOpacity() const; > >+ float offset() { return m_offset.currentValue(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumber> offsetAnimated() { return m_offset.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGStopElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGStopElement, SVGElement>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >@@ -43,9 +53,8 @@ private: > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > bool rendererIsNeeded(const RenderStyle&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGStopElement) >- DECLARE_ANIMATED_NUMBER(Offset, offset) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedNumberAttribute m_offset { 0 }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGStringListValues.h b/Source/WebCore/svg/SVGStringListValues.h >index 89651c7af04..ff9a2742219 100644 >--- a/Source/WebCore/svg/SVGStringListValues.h >+++ b/Source/WebCore/svg/SVGStringListValues.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,17 +22,25 @@ > #pragma once > > #include "QualifiedName.h" >+#include "SVGAttributeAccessor.h" > #include "SVGPropertyTraits.h" >+ > #include <wtf/Vector.h> > > namespace WebCore { > > class SVGElement; > class SVGStringList; >+class SVGStringListValues; > > template<typename T> > class SVGPropertyTearOff; > >+using SVGStringListValuesAttribute = SVGPropertyAttribute<SVGStringListValues>; >+ >+template<typename OwnerType> >+using SVGStringListValuesAttributeAccessor = SVGPropertyAttributeAccessor<OwnerType, SVGStringListValuesAttribute>; >+ > class SVGStringListValues final : public Vector<String> { > public: > SVGStringListValues(const QualifiedName& attributeName) >@@ -52,6 +61,8 @@ private: > }; > > template<> struct SVGPropertyTraits<SVGStringListValues> { >+ static String toString(const SVGStringListValues& list) { return list.valueAsString(); } >+ > using ListItemType = String; > using ListItemTearOff = SVGPropertyTearOff<String>; > using ListPropertyTearOff = SVGStringList; >diff --git a/Source/WebCore/svg/SVGSwitchElement.cpp b/Source/WebCore/svg/SVGSwitchElement.cpp >index e1fda9aa152..989d435ba3f 100644 >--- a/Source/WebCore/svg/SVGSwitchElement.cpp >+++ b/Source/WebCore/svg/SVGSwitchElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,19 +31,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGSwitchElement); > >-// Animated property definitions >-DEFINE_ANIMATED_BOOLEAN(SVGSwitchElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSwitchElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::switchTag)); >- registerAnimatedPropertiesForSVGSwitchElement(); > } > > Ref<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagName, Document& document) >diff --git a/Source/WebCore/svg/SVGSwitchElement.h b/Source/WebCore/svg/SVGSwitchElement.h >index ffaf2a65232..1e44667db4e 100644 >--- a/Source/WebCore/svg/SVGSwitchElement.h >+++ b/Source/WebCore/svg/SVGSwitchElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -33,15 +34,16 @@ public: > > private: > SVGSwitchElement(const QualifiedName&, Document&); >- >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSwitchElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } >+ > bool isValid() const final { return SVGTests::isValid(); } > > bool childShouldCreateRenderer(const Node&) const final; > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSwitchElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGSymbolElement.cpp b/Source/WebCore/svg/SVGSymbolElement.cpp >index b17ecc16b89..2e339a36b14 100644 >--- a/Source/WebCore/svg/SVGSymbolElement.cpp >+++ b/Source/WebCore/svg/SVGSymbolElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,23 +31,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGSymbolElement); > >-// Animated property definitions >-DEFINE_ANIMATED_BOOLEAN(SVGSymbolElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >-DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSymbolElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) >-DEFINE_ANIMATED_RECT(SVGSymbolElement, SVGNames::viewBoxAttr, ViewBox, viewBox) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) >- REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >+ , SVGExternalResourcesRequired(this) >+ , SVGFitToViewBox(this) > { > ASSERT(hasTagName(SVGNames::symbolTag)); >- registerAnimatedPropertiesForSVGSymbolElement(); > } > > Ref<SVGSymbolElement> SVGSymbolElement::create(const QualifiedName& tagName, Document& document) >@@ -58,18 +48,13 @@ void SVGSymbolElement::parseAttribute(const QualifiedName& name, const AtomicStr > { > SVGElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); >- SVGFitToViewBox::parseAttribute(this, name, value); >+ SVGFitToViewBox::parseAttribute(name, value); > } > > void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::viewBoxAttr) { >- InstanceInvalidationGuard guard(*this); >- updateRelativeLengthsInformation(); >- return; >- } >- > SVGElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > bool SVGSymbolElement::selfHasRelativeLengths() const >diff --git a/Source/WebCore/svg/SVGSymbolElement.h b/Source/WebCore/svg/SVGSymbolElement.h >index 1ebdcf7bdd1..d7683e19238 100644 >--- a/Source/WebCore/svg/SVGSymbolElement.h >+++ b/Source/WebCore/svg/SVGSymbolElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -37,17 +38,16 @@ public: > private: > SVGSymbolElement(const QualifiedName&, Document&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSymbolElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>; >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } >+ > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; > > bool selfHasRelativeLengths() const override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSymbolElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- DECLARE_ANIMATED_RECT(ViewBox, viewBox) >- DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGTRefElement.cpp b/Source/WebCore/svg/SVGTRefElement.cpp >index c160b07c361..26becb225c7 100644 >--- a/Source/WebCore/svg/SVGTRefElement.cpp >+++ b/Source/WebCore/svg/SVGTRefElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> > * Copyright (C) Research In Motion Limited 2011. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -42,14 +43,6 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTRefElement); > >-// Animated property definitions >-DEFINE_ANIMATED_STRING(SVGTRefElement, XLinkNames::hrefAttr, Href, href) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTRefElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextPositioningElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > Ref<SVGTRefElement> SVGTRefElement::create(const QualifiedName& tagName, Document& document) > { > Ref<SVGTRefElement> element = adoptRef(*new SVGTRefElement(tagName, document)); >@@ -131,10 +124,10 @@ void SVGTRefTargetEventListener::handleEvent(ScriptExecutionContext&, Event& eve > > inline SVGTRefElement::SVGTRefElement(const QualifiedName& tagName, Document& document) > : SVGTextPositioningElement(tagName, document) >+ , SVGURIReference(this) > , m_targetListener(SVGTRefTargetEventListener::create(*this)) > { > ASSERT(hasTagName(SVGNames::trefTag)); >- registerAnimatedPropertiesForSVGTRefElement(); > } > > SVGTRefElement::~SVGTRefElement() >diff --git a/Source/WebCore/svg/SVGTRefElement.h b/Source/WebCore/svg/SVGTRefElement.h >index a56f478eb6b..ba17ccaae7e 100644 >--- a/Source/WebCore/svg/SVGTRefElement.h >+++ b/Source/WebCore/svg/SVGTRefElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -38,6 +39,9 @@ private: > SVGTRefElement(const QualifiedName&, Document&); > virtual ~SVGTRefElement(); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTRefElement, SVGTextPositioningElement, SVGURIReference>; >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -50,17 +54,11 @@ private: > void didFinishInsertingNode() override; > > void clearTarget() override; >- > void updateReferencedText(Element*); >- > void detachTarget(); >- > void buildPendingResource() override; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTRefElement) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- END_DECLARE_ANIMATED_PROPERTIES >- >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > Ref<SVGTRefTargetEventListener> m_targetListener; > }; > >diff --git a/Source/WebCore/svg/SVGTests.cpp b/Source/WebCore/svg/SVGTests.cpp >index 597cedd7c0a..7134ce7b8e6 100644 >--- a/Source/WebCore/svg/SVGTests.cpp >+++ b/Source/WebCore/svg/SVGTests.cpp >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >- * Copyright (C) 2015-2016 Apple Inc. All right reserved. >+ * Copyright (C) 2015-2018 Apple Inc. All right reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -24,6 +24,7 @@ > > #include "DOMImplementation.h" > #include "HTMLNames.h" >+#include "SVGAttributeOwnerProxy.h" > #include "SVGElement.h" > #include "SVGNames.h" > #include "SVGStringList.h" >@@ -106,40 +107,30 @@ static const HashSet<String, ASCIICaseInsensitiveHash>& supportedSVGFeatures() > return features; > } > >-SVGTests::SVGTests() >- : m_requiredFeatures(requiredFeaturesAttr) >- , m_requiredExtensions(requiredExtensionsAttr) >- , m_systemLanguage(systemLanguageAttr) >+SVGTests::SVGTests(SVGElement* contextElement) >+ : m_contextElement(*contextElement) > { >+ registerAttributes(); > } > >-static SVGPropertyInfo createSVGTestPropertyInfo(const QualifiedName& attributeName, SVGPropertyInfo::SynchronizeProperty synchronizeFunction) >+void SVGTests::registerAttributes() > { >- return { AnimatedUnknown, PropertyIsReadWrite, attributeName, attributeName.localName(), synchronizeFunction, nullptr }; >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::requiredFeaturesAttr, &SVGTests::m_requiredFeatures>(); >+ registry.registerAttribute<SVGNames::requiredExtensionsAttr, &SVGTests::m_requiredExtensions>(); >+ registry.registerAttribute<SVGNames::systemLanguageAttr, &SVGTests::m_systemLanguage>(); > } > >-static SVGAttributeToPropertyMap createSVGTextAttributeToPropertyMap() >+SVGTests::AttributeRegistry& SVGTests::attributeRegistry() > { >- typedef NeverDestroyed<const SVGPropertyInfo> Info; >- >- SVGAttributeToPropertyMap map; >- >- static Info requiredFeatures = createSVGTestPropertyInfo(requiredFeaturesAttr, SVGElement::synchronizeRequiredFeatures); >- map.addProperty(requiredFeatures.get()); >- >- static Info requiredExtensions = createSVGTestPropertyInfo(requiredExtensionsAttr, SVGElement::synchronizeRequiredExtensions); >- map.addProperty(requiredExtensions.get()); >- >- static Info systemLanguage = createSVGTestPropertyInfo(systemLanguageAttr, SVGElement::synchronizeSystemLanguage); >- map.addProperty(systemLanguage.get()); >- >- return map; >+ return AttributeOwnerProxy::attributeRegistry(); > } > >-const SVGAttributeToPropertyMap& SVGTests::attributeToPropertyMap() >+bool SVGTests::isKnownAttribute(const QualifiedName& attributeName) > { >- static NeverDestroyed<SVGAttributeToPropertyMap> map = createSVGTextAttributeToPropertyMap(); >- return map; >+ return AttributeOwnerProxy::isKnownAttribute(attributeName); > } > > bool SVGTests::hasExtension(const String& extension) >@@ -154,15 +145,15 @@ bool SVGTests::hasExtension(const String& extension) > > bool SVGTests::isValid() const > { >- for (auto& feature : m_requiredFeatures.value) { >+ for (auto& feature : m_requiredFeatures.value()) { > if (feature.isEmpty() || !supportedSVGFeatures().contains(feature)) > return false; > } >- for (auto& language : m_systemLanguage.value) { >+ for (auto& language : m_systemLanguage.value()) { > if (language != defaultLanguage().substring(0, 2)) > return false; > } >- for (auto& extension : m_requiredExtensions.value) { >+ for (auto& extension : m_requiredExtensions.value()) { > if (!hasExtension(extension)) > return false; > } >@@ -172,29 +163,21 @@ bool SVGTests::isValid() const > void SVGTests::parseAttribute(const QualifiedName& attributeName, const AtomicString& value) > { > if (attributeName == requiredFeaturesAttr) >- m_requiredFeatures.value.reset(value); >+ m_requiredFeatures.value().reset(value); > if (attributeName == requiredExtensionsAttr) >- m_requiredExtensions.value.reset(value); >+ m_requiredExtensions.value().reset(value); > if (attributeName == systemLanguageAttr) >- m_systemLanguage.value.reset(value); >+ m_systemLanguage.value().reset(value); > } > >-bool SVGTests::isKnownAttribute(const QualifiedName& attributeName) >+void SVGTests::svgAttributeChanged(const QualifiedName& attrName) > { >- return attributeName == requiredFeaturesAttr >- || attributeName == requiredExtensionsAttr >- || attributeName == systemLanguageAttr; >-} >+ if (!isKnownAttribute(attrName)) >+ return; > >-bool SVGTests::handleAttributeChange(SVGElement* targetElement, const QualifiedName& attributeName) >-{ >- ASSERT(targetElement); >- if (!isKnownAttribute(attributeName)) >- return false; >- if (!targetElement->isConnected()) >- return true; >- targetElement->invalidateStyleAndRenderersForSubtree(); >- return true; >+ if (!m_contextElement.isConnected()) >+ return; >+ m_contextElement.invalidateStyleAndRenderersForSubtree(); > } > > void SVGTests::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes) >@@ -204,44 +187,22 @@ void SVGTests::addSupportedAttributes(HashSet<QualifiedName>& supportedAttribute > supportedAttributes.add(systemLanguageAttr); > } > >-void SVGTests::synchronizeAttribute(SVGElement& contextElement, SVGSynchronizableAnimatedProperty<SVGStringListValues>& property, const QualifiedName& attributeName) >-{ >- if (!property.shouldSynchronize) >- return; >- m_requiredFeatures.synchronize(&contextElement, attributeName, property.value.valueAsString()); >-} >- >-void SVGTests::synchronizeRequiredFeatures(SVGElement& contextElement) >-{ >- synchronizeAttribute(contextElement, m_requiredFeatures, requiredFeaturesAttr); >-} >- >-void SVGTests::synchronizeRequiredExtensions(SVGElement& contextElement) >-{ >- synchronizeAttribute(contextElement, m_requiredExtensions, requiredExtensionsAttr); >-} >- >-void SVGTests::synchronizeSystemLanguage(SVGElement& contextElement) >-{ >- synchronizeAttribute(contextElement, m_systemLanguage, systemLanguageAttr); >-} >- >-Ref<SVGStringList> SVGTests::requiredFeatures(SVGElement& contextElement) >+Ref<SVGStringList> SVGTests::requiredFeatures() > { >- m_requiredFeatures.shouldSynchronize = true; >- return SVGStringList::create(contextElement, m_requiredFeatures.value); >+ m_requiredFeatures.setShouldSynchronize(true); >+ return SVGStringList::create(m_contextElement, m_requiredFeatures.value()); > } > >-Ref<SVGStringList> SVGTests::requiredExtensions(SVGElement& contextElement) >+Ref<SVGStringList> SVGTests::requiredExtensions() > { >- m_requiredExtensions.shouldSynchronize = true; >- return SVGStringList::create(contextElement, m_requiredExtensions.value); >+ m_requiredExtensions.setShouldSynchronize(true); >+ return SVGStringList::create(m_contextElement, m_requiredExtensions.value()); > } > >-Ref<SVGStringList> SVGTests::systemLanguage(SVGElement& contextElement) >+Ref<SVGStringList> SVGTests::systemLanguage() > { >- m_systemLanguage.shouldSynchronize = true; >- return SVGStringList::create(contextElement, m_systemLanguage.value); >+ m_systemLanguage.setShouldSynchronize(true); >+ return SVGStringList::create(m_contextElement, m_systemLanguage.value()); > } > > bool SVGTests::hasFeatureForLegacyBindings(const String& feature, const String& version) >diff --git a/Source/WebCore/svg/SVGTests.h b/Source/WebCore/svg/SVGTests.h >index d99ac22401a..79dde9b60a4 100644 >--- a/Source/WebCore/svg/SVGTests.h >+++ b/Source/WebCore/svg/SVGTests.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2010 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -20,7 +21,7 @@ > > #pragma once > >-#include "SVGAnimatedPropertyMacros.h" >+#include "SVGAttribute.h" > #include "SVGStringListValues.h" > > namespace WebCore { >@@ -28,39 +29,45 @@ namespace WebCore { > class SVGElement; > class SVGStringList; > >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeRegistry; >+ >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeOwnerProxyImpl; >+ > class SVGTests { >+ WTF_MAKE_NONCOPYABLE(SVGTests); > public: > static bool hasExtension(const String&); > bool isValid() const; > >+ using AttributeRegistry = SVGAttributeRegistry<SVGTests>; >+ static AttributeRegistry& attributeRegistry(); >+ static bool isKnownAttribute(const QualifiedName& attributeName); >+ > void parseAttribute(const QualifiedName&, const AtomicString&); >+ void svgAttributeChanged(const QualifiedName&); > >- static bool isKnownAttribute(const QualifiedName&); > static void addSupportedAttributes(HashSet<QualifiedName>&); > >- static bool handleAttributeChange(SVGElement*, const QualifiedName&); >- >- static const SVGAttributeToPropertyMap& attributeToPropertyMap(); >- > WEBCORE_EXPORT static bool hasFeatureForLegacyBindings(const String& feature, const String& version); > >-protected: >- SVGTests(); >- >- Ref<SVGStringList> requiredFeatures(SVGElement&); >- Ref<SVGStringList> requiredExtensions(SVGElement&); >- Ref<SVGStringList> systemLanguage(SVGElement&); >+ // These methods are called from DOM through the super classes. >+ Ref<SVGStringList> requiredFeatures(); >+ Ref<SVGStringList> requiredExtensions(); >+ Ref<SVGStringList> systemLanguage(); > >- void synchronizeRequiredFeatures(SVGElement&); >- void synchronizeRequiredExtensions(SVGElement&); >- void synchronizeSystemLanguage(SVGElement&); >+protected: >+ SVGTests(SVGElement* contextElement); > > private: >- void synchronizeAttribute(SVGElement& contextElement, SVGSynchronizableAnimatedProperty<SVGStringListValues>&, const QualifiedName& attributeName); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTests>; >+ static void registerAttributes(); > >- SVGSynchronizableAnimatedProperty<SVGStringListValues> m_requiredFeatures; >- SVGSynchronizableAnimatedProperty<SVGStringListValues> m_requiredExtensions; >- SVGSynchronizableAnimatedProperty<SVGStringListValues> m_systemLanguage; >+ SVGElement& m_contextElement; >+ SVGStringListValuesAttribute m_requiredFeatures { SVGNames::requiredFeaturesAttr }; >+ SVGStringListValuesAttribute m_requiredExtensions { SVGNames::requiredExtensionsAttr }; >+ SVGStringListValuesAttribute m_systemLanguage { SVGNames::systemLanguageAttr }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGTextContentElement.cpp b/Source/WebCore/svg/SVGTextContentElement.cpp >index 703b60141d1..8be560528de 100644 >--- a/Source/WebCore/svg/SVGTextContentElement.cpp >+++ b/Source/WebCore/svg/SVGTextContentElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -42,67 +43,11 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextContentElement); > >-// Define custom animated property 'textLength'. >-const SVGPropertyInfo* SVGTextContentElement::textLengthPropertyInfo() >-{ >- static const SVGPropertyInfo* s_propertyInfo = nullptr; >- if (!s_propertyInfo) { >- s_propertyInfo = new SVGPropertyInfo(AnimatedLength, >- PropertyIsReadWrite, >- SVGNames::textLengthAttr, >- SVGNames::textLengthAttr->localName(), >- &SVGTextContentElement::synchronizeTextLength, >- &SVGTextContentElement::lookupOrCreateTextLengthWrapper); >- } >- return s_propertyInfo; >-} >- >-// Animated property definitions >-DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, LengthAdjust, lengthAdjust, SVGLengthAdjustType) >-DEFINE_ANIMATED_BOOLEAN(SVGTextContentElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextContentElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(textLength) >- REGISTER_LOCAL_ANIMATED_PROPERTY(lengthAdjust) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >- , m_textLength(LengthModeOther) >- , m_specifiedTextLength(LengthModeOther) >- , m_lengthAdjust(SVGLengthAdjustSpacing) >-{ >- registerAnimatedPropertiesForSVGTextContentElement(); >-} >- >-void SVGTextContentElement::synchronizeTextLength(SVGElement* contextElement) >+ , SVGExternalResourcesRequired(this) > { >- ASSERT(contextElement); >- SVGTextContentElement& ownerType = downcast<SVGTextContentElement>(*contextElement); >- if (!ownerType.m_textLength.shouldSynchronize) >- return; >- AtomicString value(SVGPropertyTraits<SVGLengthValue>::toString(ownerType.m_specifiedTextLength)); >- ownerType.m_textLength.synchronize(&ownerType, textLengthPropertyInfo()->attributeName, value); >-} >- >-Ref<SVGAnimatedProperty> SVGTextContentElement::lookupOrCreateTextLengthWrapper(SVGElement* contextElement) >-{ >- ASSERT(contextElement); >- SVGTextContentElement& ownerType = downcast<SVGTextContentElement>(*contextElement); >- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGTextContentElement, SVGAnimatedLength, SVGLengthValue> >- (&ownerType, textLengthPropertyInfo(), ownerType.m_textLength.value); >-} >- >-Ref<SVGAnimatedLength> SVGTextContentElement::textLengthAnimated() >-{ >- static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther); >- if (m_specifiedTextLength == defaultTextLength) >- m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength()); >- >- m_textLength.shouldSynchronize = true; >- return static_reference_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this)); >+ registerAttributes(); > } > > unsigned SVGTextContentElement::getNumberOfChars() >@@ -193,18 +138,6 @@ ExceptionOr<void> SVGTextContentElement::selectSubString(unsigned charnum, unsig > return { }; > } > >-bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName) >-{ >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGLangSpace::addSupportedAttributes(set); >- SVGExternalResourcesRequired::addSupportedAttributes(set); >- set.add({ SVGNames::lengthAdjustAttr.get(), SVGNames::textLengthAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >-} >- > bool SVGTextContentElement::isPresentationAttribute(const QualifiedName& name) const > { > if (name.matches(XMLNames::spaceAttr)) >@@ -225,6 +158,15 @@ void SVGTextContentElement::collectStyleForPresentationAttribute(const Qualified > SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style); > } > >+void SVGTextContentElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute(SVGAnimatedCustomLengthAttributeAccessor::singleton<SVGNames::textLengthAttr, &SVGTextContentElement::m_textLength>()); >+ registry.registerAttribute<SVGNames::lengthAdjustAttr, SVGLengthAdjustType, &SVGTextContentElement::m_lengthAdjust>(); >+} >+ > void SVGTextContentElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; >@@ -232,9 +174,9 @@ void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom > if (name == SVGNames::lengthAdjustAttr) { > auto propertyValue = SVGPropertyTraits<SVGLengthAdjustType>::fromString(value); > if (propertyValue > 0) >- setLengthAdjustBaseValue(propertyValue); >+ m_lengthAdjust.setValue(propertyValue); > } else if (name == SVGNames::textLengthAttr) >- m_textLength.value = SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths); >+ m_textLength.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >@@ -244,18 +186,19 @@ void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom > > void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ if (attrName == SVGNames::textLengthAttr) >+ m_specifiedTextLength = m_textLength.value(); >+ >+ if (auto renderer = this->renderer()) { >+ InstanceInvalidationGuard guard(*this); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > return; > } > >- if (attrName == SVGNames::textLengthAttr) >- m_specifiedTextLength = m_textLength.value; >- >- if (auto renderer = this->renderer()) { >- InstanceInvalidationGuard guard(*this); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- } >+ SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > bool SVGTextContentElement::selfHasRelativeLengths() const >diff --git a/Source/WebCore/svg/SVGTextContentElement.h b/Source/WebCore/svg/SVGTextContentElement.h >index d2f3fb6c0e5..157c3d7a786 100644 >--- a/Source/WebCore/svg/SVGTextContentElement.h >+++ b/Source/WebCore/svg/SVGTextContentElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -84,12 +85,16 @@ public: > ExceptionOr<void> selectSubString(unsigned charnum, unsigned nchars); > > static SVGTextContentElement* elementFromRenderer(RenderObject*); >+ const SVGLengthValue& specifiedTextLength() { return m_specifiedTextLength; } > >- // textLength is not declared using the standard DECLARE_ANIMATED_LENGTH macro >- // as its getter needs special handling (return getComputedTextLength(), instead of m_textLength). >- SVGLengthValue& specifiedTextLength() { return m_specifiedTextLength; } >- Ref<SVGAnimatedLength> textLengthAnimated(); >- static const SVGPropertyInfo* textLengthPropertyInfo(); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ const SVGLengthValue& textLength() const { return m_textLength.currentValue(attributeOwnerProxy()); } >+ SVGLengthAdjustType lengthAdjust() const { return m_lengthAdjust.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> textLengthAnimated() { return m_textLength.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> lengthAdjustAnimated() { return m_lengthAdjust.animatedProperty(attributeOwnerProxy()); } > > protected: > SVGTextContentElement(const QualifiedName&, Document&); >@@ -105,19 +110,49 @@ protected: > > private: > bool isTextContent() const final { return true; } >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ >+ static void registerAttributes(); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ >+ class SVGAnimatedCustomLengthAttribute : public SVGAnimatedLengthAttribute { >+ public: >+ using SVGAnimatedLengthAttribute::operator=; >+ >+ SVGAnimatedCustomLengthAttribute(SVGTextContentElement& element, SVGLengthMode lengthMode) >+ : SVGAnimatedLengthAttribute(lengthMode) >+ , m_element(element) >+ { >+ } >+ >+ void synchronize(Element&, const QualifiedName& attributeName) >+ { >+ if (!shouldSynchronize()) >+ return; >+ String string(SVGPropertyTraits<SVGLengthValue>::toString(m_element.m_specifiedTextLength)); >+ static_cast<Element&>(m_element).setSynchronizedLazyAttribute(attributeName, string); >+ } >+ >+ RefPtr<SVGAnimatedLength> animatedProperty(const SVGAttributeOwnerProxy& attributeOwnerProxy) >+ { >+ static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther); >+ if (m_element.m_specifiedTextLength == defaultTextLength) >+ m_element.m_textLength.value().newValueSpecifiedUnits(LengthTypeNumber, m_element.getComputedTextLength()); >+ >+ setShouldSynchronize(true); >+ return static_reference_cast<SVGAnimatedLength>(attributeOwnerProxy.lookupOrCreateAnimatedProperty(*this).releaseNonNull()); >+ } >+ >+ private: >+ SVGTextContentElement& m_element; >+ }; >+ >+ using SVGAnimatedCustomLengthAttributeAccessor = SVGAnimatedAttributeAccessor<SVGTextContentElement, SVGAnimatedCustomLengthAttribute, AnimatedLength>; > >- static bool isSupportedAttribute(const QualifiedName&); >- >- // Custom 'textLength' property >- static void synchronizeTextLength(SVGElement* contextElement); >- static Ref<SVGAnimatedProperty> lookupOrCreateTextLengthWrapper(SVGElement* contextElement); >- mutable SVGSynchronizableAnimatedProperty<SVGLengthValue> m_textLength; >- SVGLengthValue m_specifiedTextLength; >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement) >- DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjustType) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedCustomLengthAttribute m_textLength { *this, LengthModeOther }; >+ SVGAnimatedEnumerationAttribute<SVGLengthAdjustType> m_lengthAdjust { SVGLengthAdjustSpacing }; >+ SVGLengthValue m_specifiedTextLength { LengthModeOther }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGTextPathElement.cpp b/Source/WebCore/svg/SVGTextPathElement.cpp >index ae96a32caeb..f922dabcbee 100644 >--- a/Source/WebCore/svg/SVGTextPathElement.cpp >+++ b/Source/WebCore/svg/SVGTextPathElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -33,28 +34,12 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextPathElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH(SVGTextPathElement, SVGNames::startOffsetAttr, StartOffset, startOffset) >-DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::methodAttr, Method, method, SVGTextPathMethodType) >-DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::spacingAttr, Spacing, spacing, SVGTextPathSpacingType) >-DEFINE_ANIMATED_STRING(SVGTextPathElement, XLinkNames::hrefAttr, Href, href) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPathElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(startOffset) >- REGISTER_LOCAL_ANIMATED_PROPERTY(method) >- REGISTER_LOCAL_ANIMATED_PROPERTY(spacing) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document& document) > : SVGTextContentElement(tagName, document) >- , m_startOffset(LengthModeOther) >- , m_method(SVGTextPathMethodAlign) >- , m_spacing(SVGTextPathSpacingExact) >+ , SVGURIReference(this) > { > ASSERT(hasTagName(SVGNames::textPathTag)); >- registerAnimatedPropertiesForSVGTextPathElement(); >+ registerAttributes(); > } > > Ref<SVGTextPathElement> SVGTextPathElement::create(const QualifiedName& tagName, Document& document) >@@ -72,15 +57,14 @@ void SVGTextPathElement::clearResourceReferences() > document().accessSVGExtensions().removeAllTargetReferencesForElement(this); > } > >-bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName) >+void SVGTextPathElement::registerAttributes() > { >- static const auto supportedAttributes = makeNeverDestroyed([] { >- HashSet<QualifiedName> set; >- SVGURIReference::addSupportedAttributes(set); >- set.add({ SVGNames::startOffsetAttr.get(), SVGNames::methodAttr.get(), SVGNames::spacingAttr.get() }); >- return set; >- }()); >- return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::startOffsetAttr, &SVGTextPathElement::m_startOffset>(); >+ registry.registerAttribute<SVGNames::methodAttr, SVGTextPathMethodType, &SVGTextPathElement::m_method>(); >+ registry.registerAttribute<SVGNames::spacingAttr, SVGTextPathSpacingType, &SVGTextPathElement::m_spacing>(); > } > > void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -88,15 +72,15 @@ void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS > SVGParsingError parseError = NoError; > > if (name == SVGNames::startOffsetAttr) >- setStartOffsetBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError)); >+ m_startOffset.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError)); > else if (name == SVGNames::methodAttr) { > SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value); > if (propertyValue > 0) >- setMethodBaseValue(propertyValue); >+ m_method.setValue(propertyValue); > } else if (name == SVGNames::spacingAttr) { > SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpacingType>::fromString(value); > if (propertyValue > 0) >- setSpacingBaseValue(propertyValue); >+ m_spacing.setValue(propertyValue); > } > > reportAttributeParsingError(parseError, name, value); >@@ -107,23 +91,23 @@ void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS > > void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGTextContentElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ >+ if (attrName == SVGNames::startOffsetAttr) >+ updateRelativeLengthsInformation(); >+ >+ if (auto renderer = this->renderer()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > return; > } > >- InstanceInvalidationGuard guard(*this); >- > if (SVGURIReference::isKnownAttribute(attrName)) { > buildPendingResource(); > return; > } > >- if (attrName == SVGNames::startOffsetAttr) >- updateRelativeLengthsInformation(); >- >- if (auto renderer = this->renderer()) >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ SVGTextContentElement::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGTextPathElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >diff --git a/Source/WebCore/svg/SVGTextPathElement.h b/Source/WebCore/svg/SVGTextPathElement.h >index a35519fd9c1..69b3855d633 100644 >--- a/Source/WebCore/svg/SVGTextPathElement.h >+++ b/Source/WebCore/svg/SVGTextPathElement.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -110,21 +111,27 @@ public: > > static Ref<SVGTextPathElement> create(const QualifiedName&, Document&); > >+ const SVGLengthValue& startOffset() const { return m_startOffset.currentValue(attributeOwnerProxy()); } >+ SVGTextPathMethodType method() const { return m_method.currentValue(attributeOwnerProxy()); } >+ SVGTextPathSpacingType spacing() const { return m_spacing.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> startOffsetAnimated() { return m_startOffset.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> methodAnimated() { return m_method.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedEnumeration> spacingAnimated() { return m_spacing.animatedProperty(attributeOwnerProxy()); } >+ > protected: > void didFinishInsertingNode() override; > > private: > SVGTextPathElement(const QualifiedName&, Document&); >- > virtual ~SVGTextPathElement(); > >- void clearResourceReferences(); >- >- void buildPendingResource() override; >- InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; >- void removedFromAncestor(RemovalType, ContainerNode&) override; >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPathElement, SVGTextContentElement, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -132,14 +139,17 @@ private: > bool childShouldCreateRenderer(const Node&) const override; > bool rendererIsNeeded(const RenderStyle&) override; > >+ void clearResourceReferences(); >+ void buildPendingResource() override; >+ InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; >+ void removedFromAncestor(RemovalType, ContainerNode&) override; >+ > bool selfHasRelativeLengths() const override; >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPathElement) >- DECLARE_ANIMATED_LENGTH(StartOffset, startOffset) >- DECLARE_ANIMATED_ENUMERATION(Method, method, SVGTextPathMethodType) >- DECLARE_ANIMATED_ENUMERATION(Spacing, spacing, SVGTextPathSpacingType) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- END_DECLARE_ANIMATED_PROPERTIES >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_startOffset { LengthModeOther }; >+ SVGAnimatedEnumerationAttribute<SVGTextPathMethodType> m_method { SVGTextPathMethodAlign }; >+ SVGAnimatedEnumerationAttribute<SVGTextPathSpacingType> m_spacing { SVGTextPathSpacingExact }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGTextPositioningElement.cpp b/Source/WebCore/svg/SVGTextPositioningElement.cpp >index 48d2f65ca2c..75c4bfe343c 100644 >--- a/Source/WebCore/svg/SVGTextPositioningElement.cpp >+++ b/Source/WebCore/svg/SVGTextPositioningElement.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> > * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -38,26 +39,22 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextPositioningElement); > >-// Animated property definitions >-DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::dxAttr, Dx, dx) >-DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::dyAttr, Dy, dy) >-DEFINE_ANIMATED_NUMBER_LIST(SVGTextPositioningElement, SVGNames::rotateAttr, Rotate, rotate) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPositioningElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(dx) >- REGISTER_LOCAL_ANIMATED_PROPERTY(dy) >- REGISTER_LOCAL_ANIMATED_PROPERTY(rotate) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document& document) > : SVGTextContentElement(tagName, document) > { >- registerAnimatedPropertiesForSVGTextPositioningElement(); >+ registerAttributes(); >+} >+ >+void SVGTextPositioningElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGTextPositioningElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGTextPositioningElement::m_y>(); >+ registry.registerAttribute<SVGNames::dxAttr, &SVGTextPositioningElement::m_dx>(); >+ registry.registerAttribute<SVGNames::dyAttr, &SVGTextPositioningElement::m_dy>(); >+ registry.registerAttribute<SVGNames::rotateAttr, &SVGTextPositioningElement::m_rotate>(); > } > > void SVGTextPositioningElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -65,40 +62,40 @@ void SVGTextPositioningElement::parseAttribute(const QualifiedName& name, const > if (name == SVGNames::xAttr) { > SVGLengthListValues newList; > newList.parse(value, LengthModeWidth); >- detachAnimatedXListWrappers(newList.size()); >- setXBaseValue(newList); >+ m_x.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_x.setValue(WTFMove(newList)); > return; > } > > if (name == SVGNames::yAttr) { > SVGLengthListValues newList; > newList.parse(value, LengthModeHeight); >- detachAnimatedYListWrappers(newList.size()); >- setYBaseValue(newList); >+ m_y.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_y.setValue(WTFMove(newList)); > return; > } > > if (name == SVGNames::dxAttr) { > SVGLengthListValues newList; > newList.parse(value, LengthModeWidth); >- detachAnimatedDxListWrappers(newList.size()); >- setDxBaseValue(newList); >+ m_dx.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_dx.setValue(WTFMove(newList)); > return; > } > > if (name == SVGNames::dyAttr) { > SVGLengthListValues newList; > newList.parse(value, LengthModeHeight); >- detachAnimatedDyListWrappers(newList.size()); >- setDyBaseValue(newList); >+ m_dy.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_dy.setValue(WTFMove(newList)); > return; > } > > if (name == SVGNames::rotateAttr) { > SVGNumberListValues newList; > newList.parse(value); >- detachAnimatedRotateListWrappers(newList.size()); >- setRotateBaseValue(newList); >+ m_rotate.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); >+ m_rotate.setValue(WTFMove(newList)); > return; > } > >@@ -121,7 +118,7 @@ bool SVGTextPositioningElement::isPresentationAttribute(const QualifiedName& nam > > void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr || attrName == SVGNames::rotateAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > > if (attrName != SVGNames::rotateAttr) >diff --git a/Source/WebCore/svg/SVGTextPositioningElement.h b/Source/WebCore/svg/SVGTextPositioningElement.h >index 65a4a6dcaca..1b1b81bb289 100644 >--- a/Source/WebCore/svg/SVGTextPositioningElement.h >+++ b/Source/WebCore/svg/SVGTextPositioningElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -31,6 +32,21 @@ class SVGTextPositioningElement : public SVGTextContentElement { > public: > static SVGTextPositioningElement* elementFromRenderer(RenderBoxModelObject&); > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPositioningElement, SVGTextContentElement>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ >+ const SVGLengthListValues& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthListValues& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthListValues& dx() const { return m_dx.currentValue(attributeOwnerProxy()); } >+ const SVGLengthListValues& dy() const { return m_dy.currentValue(attributeOwnerProxy()); } >+ const SVGNumberListValues& rotate() const { return m_rotate.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLengthList> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLengthList> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLengthList> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLengthList> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedNumberList> rotateAnimated() { return m_rotate.animatedProperty(attributeOwnerProxy()); } >+ > protected: > SVGTextPositioningElement(const QualifiedName&, Document&); > >@@ -41,13 +57,17 @@ private: > bool isPresentationAttribute(const QualifiedName&) const final; > void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPositioningElement) >- DECLARE_ANIMATED_LENGTH_LIST(X, x) >- DECLARE_ANIMATED_LENGTH_LIST(Y, y) >- DECLARE_ANIMATED_LENGTH_LIST(Dx, dx) >- DECLARE_ANIMATED_LENGTH_LIST(Dy, dy) >- DECLARE_ANIMATED_NUMBER_LIST(Rotate, rotate) >- END_DECLARE_ANIMATED_PROPERTIES >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } >+ >+ static void registerAttributes(); >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthListAttribute m_x; >+ SVGAnimatedLengthListAttribute m_y; >+ SVGAnimatedLengthListAttribute m_dx; >+ SVGAnimatedLengthListAttribute m_dy; >+ SVGAnimatedNumberListAttribute m_rotate; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGURIReference.cpp b/Source/WebCore/svg/SVGURIReference.cpp >index 0e28196ba06..9cb4da0ec59 100644 >--- a/Source/WebCore/svg/SVGURIReference.cpp >+++ b/Source/WebCore/svg/SVGURIReference.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -23,20 +24,50 @@ > > #include "Document.h" > #include "Element.h" >+#include "SVGAttributeOwnerProxy.h" > #include "URL.h" > #include "XLinkNames.h" > > namespace WebCore { > >+SVGURIReference::SVGURIReference(SVGElement* contextElement) >+ : m_attributeOwnerProxy(std::make_unique<AttributeOwnerProxy>(*this, *contextElement)) >+{ >+ registerAttributes(); >+} >+ >+void SVGURIReference::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<XLinkNames::hrefAttr, &SVGURIReference::m_href>(); >+} >+ >+SVGURIReference::AttributeRegistry& SVGURIReference::attributeRegistry() >+{ >+ return AttributeOwnerProxy::attributeRegistry(); >+} >+ >+bool SVGURIReference::isKnownAttribute(const QualifiedName& attributeName) >+{ >+ return AttributeOwnerProxy::isKnownAttribute(attributeName); >+} >+ > void SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name.matches(XLinkNames::hrefAttr)) >- setHrefBaseValue(value); >+ m_href.setValue(value); > } > >-bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName) >+const String& SVGURIReference::href() const > { >- return attrName.matches(XLinkNames::hrefAttr); >+ return m_href.currentValue(*m_attributeOwnerProxy); >+} >+ >+RefPtr<SVGAnimatedString> SVGURIReference::hrefAnimated() >+{ >+ return m_href.animatedProperty(*m_attributeOwnerProxy); > } > > String SVGURIReference::fragmentIdentifierFromIRIString(const String& url, const Document& document) >@@ -98,9 +129,4 @@ Element* SVGURIReference::targetElementFromIRIString(const String& iri, const Do > return document.getElementById(id); > } > >-void SVGURIReference::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes) >-{ >- supportedAttributes.add(XLinkNames::hrefAttr); >-} >- > } >diff --git a/Source/WebCore/svg/SVGURIReference.h b/Source/WebCore/svg/SVGURIReference.h >index 770f628c991..6848c203fd6 100644 >--- a/Source/WebCore/svg/SVGURIReference.h >+++ b/Source/WebCore/svg/SVGURIReference.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -22,16 +23,22 @@ > > #include "Document.h" > #include "QualifiedName.h" >+#include "SVGAnimatedString.h" > > namespace WebCore { > >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeRegistry; >+ >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeOwnerProxyImpl; >+ > class SVGURIReference { >+ WTF_MAKE_NONCOPYABLE(SVGURIReference); > public: > virtual ~SVGURIReference() = default; > > void parseAttribute(const QualifiedName&, const AtomicString&); >- static bool isKnownAttribute(const QualifiedName&); >- static void addSupportedAttributes(HashSet<QualifiedName>&); > > static String fragmentIdentifierFromIRIString(const String&, const Document&); > static Element* targetElementFromIRIString(const String&, const Document&, String* fragmentIdentifier = nullptr, const Document* externalDocument = nullptr); >@@ -48,9 +55,23 @@ public: > return !equalIgnoringFragmentIdentifier(url, document.url()); > } > >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGURIReference>; >+ using AttributeRegistry = SVGAttributeRegistry<SVGURIReference>; >+ static AttributeRegistry& attributeRegistry(); >+ >+ const String& href() const; >+ RefPtr<SVGAnimatedString> hrefAnimated(); >+ > protected: >- virtual String& hrefBaseValue() const = 0; >- virtual void setHrefBaseValue(const String&, const bool validValue = true) = 0; >+ SVGURIReference(SVGElement* contextElement); >+ >+ static bool isKnownAttribute(const QualifiedName& attributeName); >+ >+private: >+ static void registerAttributes(); >+ >+ std::unique_ptr<AttributeOwnerProxy> m_attributeOwnerProxy; >+ SVGAnimatedStringAttribute m_href; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp >index 072c5908ee5..f12c7d0a88e 100644 >--- a/Source/WebCore/svg/SVGUseElement.cpp >+++ b/Source/WebCore/svg/SVGUseElement.cpp >@@ -5,7 +5,7 @@ > * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. > * Copyright (C) 2012 University of Szeged > * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> >- * Copyright (C) 2015-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -46,34 +46,15 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGUseElement); > >-DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::xAttr, X, x) >-DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::yAttr, Y, y) >-DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::widthAttr, Width, width) >-DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::heightAttr, Height, height) >-DEFINE_ANIMATED_STRING(SVGUseElement, XLinkNames::hrefAttr, Href, href) >-DEFINE_ANIMATED_BOOLEAN(SVGUseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGUseElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(x) >- REGISTER_LOCAL_ANIMATED_PROPERTY(y) >- REGISTER_LOCAL_ANIMATED_PROPERTY(width) >- REGISTER_LOCAL_ANIMATED_PROPERTY(height) >- REGISTER_LOCAL_ANIMATED_PROPERTY(href) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& document) > : SVGGraphicsElement(tagName, document) >- , m_x(LengthModeWidth) >- , m_y(LengthModeHeight) >- , m_width(LengthModeWidth) >- , m_height(LengthModeHeight) >+ , SVGExternalResourcesRequired(this) >+ , SVGURIReference(this) > , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired) > { > ASSERT(hasCustomStyleResolveCallbacks()); > ASSERT(hasTagName(SVGNames::useTag)); >- registerAnimatedPropertiesForSVGUseElement(); >+ registerAttributes(); > } > > Ref<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Document& document) >@@ -87,18 +68,29 @@ SVGUseElement::~SVGUseElement() > m_externalDocument->removeClient(*this); > } > >+void SVGUseElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::xAttr, &SVGUseElement::m_x>(); >+ registry.registerAttribute<SVGNames::yAttr, &SVGUseElement::m_y>(); >+ registry.registerAttribute<SVGNames::widthAttr, &SVGUseElement::m_width>(); >+ registry.registerAttribute<SVGNames::heightAttr, &SVGUseElement::m_height>(); >+} >+ > void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > SVGParsingError parseError = NoError; > > if (name == SVGNames::xAttr) >- setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); >+ m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); > else if (name == SVGNames::yAttr) >- setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); >+ m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); > else if (name == SVGNames::widthAttr) >- setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); >+ m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); > else if (name == SVGNames::heightAttr) >- setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); >+ m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); > > reportAttributeParsingError(parseError, name, value); > >@@ -113,7 +105,7 @@ Node::InsertedIntoAncestorResult SVGUseElement::insertedIntoAncestor(InsertionTy > if (insertionType.connectedToDocument) { > if (m_shadowTreeNeedsUpdate) > document().addSVGUseElement(*this); >- SVGExternalResourcesRequired::insertedIntoDocument(this); >+ SVGExternalResourcesRequired::insertedIntoDocument(); > invalidateShadowTree(); > // FIXME: Move back the call to updateExternalDocument() here once notifyFinished is made always async. > return InsertedIntoAncestorResult::NeedsPostInsertionCallback; >@@ -156,14 +148,14 @@ void SVGUseElement::transferSizeAttributesToTargetClone(SVGElement& shadowElemen > // If attributes width and/or height are provided on the 'use' element, then these attributes > // will be transferred to the generated 'svg'. If attributes width and/or height are not specified, > // the generated 'svg' element will use values of 100% for these attributes. >- shadowElement.setAttribute(SVGNames::widthAttr, (widthIsValid() && width().valueInSpecifiedUnits()) ? AtomicString(width().valueAsString()) : "100%"); >- shadowElement.setAttribute(SVGNames::heightAttr, (heightIsValid() && height().valueInSpecifiedUnits()) ? AtomicString(height().valueAsString()) : "100%"); >+ shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? AtomicString(width().valueAsString()) : "100%"); >+ shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? AtomicString(height().valueAsString()) : "100%"); > } else if (is<SVGSVGElement>(shadowElement)) { > // Spec (<use> on <svg>): If attributes width and/or height are provided on the 'use' element, then these > // values will override the corresponding attributes on the 'svg' in the generated tree. > auto correspondingElement = makeRefPtr(shadowElement.correspondingElement()); >- shadowElement.setAttribute(SVGNames::widthAttr, (widthIsValid() && width().valueInSpecifiedUnits()) ? AtomicString(width().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom())); >- shadowElement.setAttribute(SVGNames::heightAttr, (heightIsValid() && height().valueInSpecifiedUnits()) ? AtomicString(height().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom())); >+ shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? AtomicString(width().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom())); >+ shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? AtomicString(height().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom())); > } > } > >@@ -171,7 +163,7 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) > { > InstanceInvalidationGuard guard(*this); > >- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { >+ if (isKnownAttribute(attrName)) { > updateRelativeLengthsInformation(); > if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { > // FIXME: It's unnecessarily inefficient to update both width and height each time either is changed. >@@ -183,21 +175,17 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) > return; > } > >- if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName)) >- return; >- > if (SVGURIReference::isKnownAttribute(attrName)) { > updateExternalDocument(); > invalidateShadowTree(); > return; > } > >- if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >+ if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) > invalidateShadowTree(); >- return; >- } > > SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > static HashSet<AtomicString> createAllowedElementSet() >@@ -572,7 +560,7 @@ void SVGUseElement::notifyFinished(CachedResource& resource) > if (resource.errorOccurred()) > dispatchEvent(Event::create(eventNames().errorEvent, false, false)); > else if (!resource.wasCanceled()) >- SVGExternalResourcesRequired::dispatchLoadEvent(this); >+ SVGExternalResourcesRequired::dispatchLoadEvent(); > } > > void SVGUseElement::finishParsingChildren() >diff --git a/Source/WebCore/svg/SVGUseElement.h b/Source/WebCore/svg/SVGUseElement.h >index 65060bb2874..31e0c09fb8c 100644 >--- a/Source/WebCore/svg/SVGUseElement.h >+++ b/Source/WebCore/svg/SVGUseElement.h >@@ -1,7 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >- * Copyright (C) 2015 Apple Inc. All rights reserved. >+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -36,16 +36,6 @@ class SVGGElement; > > class SVGUseElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGURIReference, private CachedSVGDocumentClient { > WTF_MAKE_ISO_ALLOCATED(SVGUseElement); >- >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGUseElement) >- DECLARE_ANIMATED_LENGTH(X, x) >- DECLARE_ANIMATED_LENGTH(Y, y) >- DECLARE_ANIMATED_LENGTH(Width, width) >- DECLARE_ANIMATED_LENGTH(Height, height) >- DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >- > public: > static Ref<SVGUseElement> create(const QualifiedName&, Document&); > virtual ~SVGUseElement(); >@@ -56,6 +46,16 @@ public: > > RenderElement* rendererClipChild() const; > >+ const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } >+ const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } >+ >+ RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } >+ RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } >+ > private: > SVGUseElement(const QualifiedName&, Document&); > >@@ -64,8 +64,16 @@ private: > void didFinishInsertingNode() final; > void removedFromAncestor(RemovalType, ContainerNode&) override; > void buildPendingResource() override; >+ >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGUseElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; >+ > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; > Path toClipPath() override; > bool haveLoadedRequiredResources() override; >@@ -92,6 +100,12 @@ private: > void clearShadowTree(); > void invalidateDependentShadowTrees(); > >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; >+ SVGAnimatedLengthAttribute m_x { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { LengthModeHeight }; >+ > bool m_haveFiredLoadEvent { false }; > bool m_shadowTreeNeedsUpdate { true }; > CachedResourceHandle<CachedSVGDocument> m_externalDocument; >diff --git a/Source/WebCore/svg/SVGValue.h b/Source/WebCore/svg/SVGValue.h >index 499623d3df4..bf906179853 100644 >--- a/Source/WebCore/svg/SVGValue.h >+++ b/Source/WebCore/svg/SVGValue.h >@@ -35,7 +35,6 @@ > #include "SVGPathByteStream.h" > #include "SVGPointListValues.h" > #include "SVGPreserveAspectRatioValue.h" >-#include "SVGPropertyInfo.h" > #include "SVGPropertyTraits.h" > #include "SVGTransformListValues.h" > >diff --git a/Source/WebCore/svg/SVGViewElement.cpp b/Source/WebCore/svg/SVGViewElement.cpp >index a93f51a23c7..53bf4a34ff1 100644 >--- a/Source/WebCore/svg/SVGViewElement.cpp >+++ b/Source/WebCore/svg/SVGViewElement.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -29,25 +30,13 @@ namespace WebCore { > > WTF_MAKE_ISO_ALLOCATED_IMPL(SVGViewElement); > >-// Animated property definitions >-DEFINE_ANIMATED_BOOLEAN(SVGViewElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) >-DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox) >-DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio) >- >-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) >- REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) >- REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) >- REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) >- REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) >-END_REGISTER_ANIMATED_PROPERTIES >- > inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document& document) > : SVGElement(tagName, document) >- , m_zoomAndPan(SVGZoomAndPanMagnify) >+ , SVGExternalResourcesRequired(this) >+ , SVGFitToViewBox(this) > , m_viewTarget(SVGNames::viewTargetAttr) > { > ASSERT(hasTagName(SVGNames::viewTag)); >- registerAnimatedPropertiesForSVGViewElement(); > } > > Ref<SVGViewElement> SVGViewElement::create(const QualifiedName& tagName, Document& document) >@@ -65,10 +54,10 @@ void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicStrin > if (name == SVGNames::viewTargetAttr) > m_viewTarget.reset(value); > >- SVGExternalResourcesRequired::parseAttribute(name, value); >- SVGFitToViewBox::parseAttribute(this, name, value); >- SVGZoomAndPan::parseAttribute(*this, name, value); > SVGElement::parseAttribute(name, value); >+ SVGExternalResourcesRequired::parseAttribute(name, value); >+ SVGFitToViewBox::parseAttribute(name, value); >+ SVGZoomAndPan::parseAttribute(name, value); > } > > } >diff --git a/Source/WebCore/svg/SVGViewElement.h b/Source/WebCore/svg/SVGViewElement.h >index 0e6090f6e86..a5773104dca 100644 >--- a/Source/WebCore/svg/SVGViewElement.h >+++ b/Source/WebCore/svg/SVGViewElement.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -20,13 +21,9 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" >-#include "SVGAnimatedPreserveAspectRatio.h" >-#include "SVGAnimatedRect.h" > #include "SVGElement.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGFitToViewBox.h" >-#include "SVGStringListValues.h" > #include "SVGZoomAndPan.h" > > namespace WebCore { >@@ -42,24 +39,18 @@ public: > using SVGElement::deref; > > Ref<SVGStringList> viewTarget(); >- SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } >- void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); } > > private: > SVGViewElement(const QualifiedName&, Document&); > > // FIXME: svgAttributeChanged missing. >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGViewElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan>; >+ const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > > bool rendererIsNeeded(const RenderStyle&) final { return false; } > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGViewElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- DECLARE_ANIMATED_RECT(ViewBox, viewBox) >- DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) >- END_DECLARE_ANIMATED_PROPERTIES >- >- SVGZoomAndPanType m_zoomAndPan; >+ AttributeOwnerProxy m_attributeOwnerProxy { *this }; > SVGStringListValues m_viewTarget; > }; > >diff --git a/Source/WebCore/svg/SVGViewSpec.cpp b/Source/WebCore/svg/SVGViewSpec.cpp >index 098a173dd1f..caea7cace28 100644 >--- a/Source/WebCore/svg/SVGViewSpec.cpp >+++ b/Source/WebCore/svg/SVGViewSpec.cpp >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2007, 2010 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -31,94 +32,20 @@ > > namespace WebCore { > >-// Define custom animated property 'viewBox'. >-const SVGPropertyInfo* SVGViewSpec::viewBoxPropertyInfo() >-{ >- static const SVGPropertyInfo* s_propertyInfo = nullptr; >- if (!s_propertyInfo) { >- s_propertyInfo = new SVGPropertyInfo(AnimatedRect, >- PropertyIsReadOnly, >- SVGNames::viewBoxAttr, >- viewBoxIdentifier(), >- 0, >- 0); >- } >- return s_propertyInfo; >-} >- >-// Define custom animated property 'preserveAspectRatio'. >-const SVGPropertyInfo* SVGViewSpec::preserveAspectRatioPropertyInfo() >-{ >- static const SVGPropertyInfo* s_propertyInfo = nullptr; >- if (!s_propertyInfo) { >- s_propertyInfo = new SVGPropertyInfo(AnimatedPreserveAspectRatio, >- PropertyIsReadOnly, >- SVGNames::preserveAspectRatioAttr, >- preserveAspectRatioIdentifier(), >- 0, >- 0); >- } >- return s_propertyInfo; >-} >- >- >-// Define custom non-animated property 'transform'. >-const SVGPropertyInfo* SVGViewSpec::transformPropertyInfo() >-{ >- static const SVGPropertyInfo* s_propertyInfo = nullptr; >- if (!s_propertyInfo) { >- s_propertyInfo = new SVGPropertyInfo(AnimatedTransformList, >- PropertyIsReadOnly, >- SVGNames::transformAttr, >- transformIdentifier(), >- 0, >- 0); >- } >- return s_propertyInfo; >-} >- > SVGViewSpec::SVGViewSpec(SVGElement& contextElement) >- : m_contextElement(&contextElement) >-{ >-} >- >-const AtomicString& SVGViewSpec::viewBoxIdentifier() >-{ >- static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecViewBoxAttribute", AtomicString::ConstructFromLiteral); >- return s_identifier; >-} >- >-const AtomicString& SVGViewSpec::preserveAspectRatioIdentifier() >-{ >- static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecPreserveAspectRatioAttribute", AtomicString::ConstructFromLiteral); >- return s_identifier; >-} >- >-const AtomicString& SVGViewSpec::transformIdentifier() >-{ >- static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecTransformAttribute", AtomicString::ConstructFromLiteral); >- return s_identifier; >-} >- >-ExceptionOr<void> SVGViewSpec::setZoomAndPan(unsigned short) >+ : SVGFitToViewBox(&contextElement, PropertyIsReadOnly) >+ , m_contextElement(&contextElement) >+ , m_attributeOwnerProxy(*this, contextElement) > { >- // SVGViewSpec and all of its content is read-only. >- return Exception { NoModificationAllowedError }; >+ registerAttributes(); > } > >-String SVGViewSpec::transformString() const >+void SVGViewSpec::registerAttributes() > { >- return SVGPropertyTraits<SVGTransformListValues>::toString(m_transform); >-} >- >-String SVGViewSpec::viewBoxString() const >-{ >- return SVGPropertyTraits<FloatRect>::toString(m_viewBox); >-} >- >-String SVGViewSpec::preserveAspectRatioString() const >-{ >- return SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString(m_preserveAspectRatio); >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::transformAttr, &SVGViewSpec::m_transform>(); > } > > SVGElement* SVGViewSpec::viewTarget() const >@@ -136,51 +63,15 @@ RefPtr<SVGTransformList> SVGViewSpec::transform() > if (!m_contextElement) > return nullptr; > // Return the animVal here, as its readonly by default - which is exactly what we want here. >- return static_reference_cast<SVGAnimatedTransformList>(lookupOrCreateTransformWrapper(this))->animVal(); >-} >- >-RefPtr<SVGAnimatedRect> SVGViewSpec::viewBoxAnimated() >-{ >- if (!m_contextElement) >- return nullptr; >- return static_reference_cast<SVGAnimatedRect>(lookupOrCreateViewBoxWrapper(this)); >-} >- >-RefPtr<SVGAnimatedPreserveAspectRatio> SVGViewSpec::preserveAspectRatioAnimated() >-{ >- if (!m_contextElement) >- return nullptr; >- return static_reference_cast<SVGAnimatedPreserveAspectRatio>(lookupOrCreatePreserveAspectRatioWrapper(this)); >-} >- >-Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateViewBoxWrapper(SVGViewSpec* ownerType) >-{ >- ASSERT(ownerType); >- ASSERT(ownerType->m_contextElement); >- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, FloatRect>(ownerType->m_contextElement, viewBoxPropertyInfo(), ownerType->m_viewBox); >-} >- >-Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* ownerType) >-{ >- ASSERT(ownerType); >- ASSERT(ownerType->m_contextElement); >- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatioValue>(ownerType->m_contextElement, preserveAspectRatioPropertyInfo(), ownerType->m_preserveAspectRatio); >-} >- >-Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateTransformWrapper(SVGViewSpec* ownerType) >-{ >- ASSERT(ownerType); >- ASSERT(ownerType->m_contextElement); >- return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedTransformList, SVGTransformListValues>(ownerType->m_contextElement, transformPropertyInfo(), ownerType->m_transform); >+ return m_transform.animatedProperty(m_attributeOwnerProxy)->animVal(); > } > > void SVGViewSpec::reset() > { >- m_zoomAndPan = SVGZoomAndPanMagnify; >- m_transform.clear(); >- m_viewBox = { }; >- m_preserveAspectRatio = { }; > m_viewTargetString = emptyString(); >+ m_transform.resetValue(); >+ SVGFitToViewBox::reset(); >+ SVGZoomAndPan::reset(); > } > > static const UChar svgViewSpec[] = {'s', 'v', 'g', 'V', 'i', 'e', 'w'}; >@@ -213,9 +104,9 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) > return false; > currViewSpec++; > FloatRect viewBox; >- if (!SVGFitToViewBox::parseViewBox(&m_contextElement->document(), currViewSpec, end, viewBox, false)) >+ if (!SVGFitToViewBox::parseViewBox(currViewSpec, end, viewBox, false)) > return false; >- setViewBoxBaseValue(viewBox); >+ setViewBox(viewBox); > if (currViewSpec >= end || *currViewSpec != ')') > return false; > currViewSpec++; >@@ -237,7 +128,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) > if (currViewSpec >= end || *currViewSpec != '(') > return false; > currViewSpec++; >- if (!parse(currViewSpec, end, m_zoomAndPan)) >+ if (!SVGZoomAndPan::parseZoomAndPan(currViewSpec, end)) > return false; > if (currViewSpec >= end || *currViewSpec != ')') > return false; >@@ -251,7 +142,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) > SVGPreserveAspectRatioValue preserveAspectRatio; > if (!preserveAspectRatio.parse(currViewSpec, end, false)) > return false; >- setPreserveAspectRatioBaseValue(preserveAspectRatio); >+ setPreserveAspectRatio(preserveAspectRatio); > if (currViewSpec >= end || *currViewSpec != ')') > return false; > currViewSpec++; >@@ -261,7 +152,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) > if (currViewSpec >= end || *currViewSpec != '(') > return false; > currViewSpec++; >- SVGTransformable::parseTransformAttribute(m_transform, currViewSpec, end, SVGTransformable::DoNotClearList); >+ SVGTransformable::parseTransformAttribute(m_transform.value(), currViewSpec, end, SVGTransformable::DoNotClearList); > if (currViewSpec >= end || *currViewSpec != ')') > return false; > currViewSpec++; >diff --git a/Source/WebCore/svg/SVGViewSpec.h b/Source/WebCore/svg/SVGViewSpec.h >index 9fb5d42beee..b8849961893 100644 >--- a/Source/WebCore/svg/SVGViewSpec.h >+++ b/Source/WebCore/svg/SVGViewSpec.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,7 +31,7 @@ namespace WebCore { > class SVGElement; > class SVGTransformList; > >-class SVGViewSpec final : public RefCounted<SVGViewSpec>, public SVGZoomAndPan, public SVGFitToViewBox { >+class SVGViewSpec final : public RefCounted<SVGViewSpec>, public SVGFitToViewBox, public SVGZoomAndPan { > public: > static Ref<SVGViewSpec> create(SVGElement& contextElement) > { >@@ -39,55 +40,28 @@ public: > > bool parseViewSpec(const String&); > void reset(); >+ void resetContextElement() { m_contextElement = nullptr; } > > SVGElement* viewTarget() const; >- >- String transformString() const; >- String viewBoxString() const; >- String preserveAspectRatioString() const; > const String& viewTargetString() const { return m_viewTargetString; } > >- SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } >- ExceptionOr<void> setZoomAndPan(unsigned short); >- void setZoomAndPanBaseValue(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); } >- >- void resetContextElement() { m_contextElement = nullptr; } >- >- // Custom non-animated 'transform' property. >+ String transformString() const { return m_transform.toString(); } > RefPtr<SVGTransformList> transform(); >- SVGTransformListValues transformBaseValue() const { return m_transform; } >- >- // Custom animated 'viewBox' property. >- RefPtr<SVGAnimatedRect> viewBoxAnimated(); >- FloatRect& viewBox() { return m_viewBox; } >- void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; } >- >- // Custom animated 'preserveAspectRatio' property. >- RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated(); >- SVGPreserveAspectRatioValue& preserveAspectRatio() { return m_preserveAspectRatio; } >- void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; } >+ SVGTransformListValues transformValue() const { return m_transform.value(); } > > private: > explicit SVGViewSpec(SVGElement&); > >- static const SVGPropertyInfo* transformPropertyInfo(); >- static const SVGPropertyInfo* viewBoxPropertyInfo(); >- static const SVGPropertyInfo* preserveAspectRatioPropertyInfo(); >- >- static const AtomicString& transformIdentifier(); >- static const AtomicString& viewBoxIdentifier(); >- static const AtomicString& preserveAspectRatioIdentifier(); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGViewSpec, SVGFitToViewBox, SVGZoomAndPan>; >+ static void registerAttributes(); > >- static Ref<SVGAnimatedProperty> lookupOrCreateTransformWrapper(SVGViewSpec* contextElement); >- static Ref<SVGAnimatedProperty> lookupOrCreateViewBoxWrapper(SVGViewSpec* contextElement); >- static Ref<SVGAnimatedProperty> lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* contextElement); >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } > > SVGElement* m_contextElement; >- SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify }; >- SVGTransformListValues m_transform; >- FloatRect m_viewBox; >- SVGPreserveAspectRatioValue m_preserveAspectRatio; > String m_viewTargetString; >+ AttributeOwnerProxy m_attributeOwnerProxy; >+ SVGAnimatedTransformListAttribute m_transform; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGViewSpec.idl b/Source/WebCore/svg/SVGViewSpec.idl >index 5708c03ccb1..4411d576aa5 100644 >--- a/Source/WebCore/svg/SVGViewSpec.idl >+++ b/Source/WebCore/svg/SVGViewSpec.idl >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2007 Eric Seidel <eric@webkit.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -35,9 +36,7 @@ > readonly attribute DOMString preserveAspectRatioString; > readonly attribute DOMString transformString; > readonly attribute DOMString viewTargetString; >- >- // SVGZoomAndPan >- attribute unsigned short zoomAndPan; > }; > > SVGViewSpec implements SVGFitToViewBox; >+SVGViewSpec implements SVGZoomAndPan; >diff --git a/Source/WebCore/svg/SVGZoomAndPan.cpp b/Source/WebCore/svg/SVGZoomAndPan.cpp >index f15c8370b06..efadd4b2251 100644 >--- a/Source/WebCore/svg/SVGZoomAndPan.cpp >+++ b/Source/WebCore/svg/SVGZoomAndPan.cpp >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,32 +22,43 @@ > #include "config.h" > #include "SVGZoomAndPan.h" > >-#include "SVGParserUtilities.h" >- > namespace WebCore { > >-bool SVGZoomAndPan::parse(const UChar*& start, const UChar* end, SVGZoomAndPanType& zoomAndPan) >+SVGZoomAndPan::SVGZoomAndPan() >+{ >+ registerAttributes(); >+} >+ >+void SVGZoomAndPan::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::zoomAndPanAttr, &SVGZoomAndPan::m_zoomAndPan>(); >+} >+ >+bool SVGZoomAndPan::parseZoomAndPan(const UChar*& start, const UChar* end) > { > static const UChar disable[] = { 'd', 'i', 's', 'a', 'b', 'l', 'e' }; > if (skipString(start, end, disable, WTF_ARRAY_LENGTH(disable))) { >- zoomAndPan = SVGZoomAndPanDisable; >+ m_zoomAndPan.setValue(SVGZoomAndPanDisable); > return true; > } >+ > static const UChar magnify[] = { 'm', 'a', 'g', 'n', 'i', 'f', 'y' }; > if (skipString(start, end, magnify, WTF_ARRAY_LENGTH(magnify))) { >- zoomAndPan = SVGZoomAndPanMagnify; >+ m_zoomAndPan.setValue(SVGZoomAndPanMagnify); > return true; > } >+ > return false; > } > >-SVGZoomAndPanType SVGZoomAndPan::parseAttributeValue(const AtomicString& value) >+void SVGZoomAndPan::parseAttribute(const QualifiedName& attributeName, const AtomicString& value) > { >- if (value == "disable") >- return SVGZoomAndPanDisable; >- if (value == "magnify") >- return SVGZoomAndPanMagnify; >- return SVGZoomAndPanUnknown; >+ if (attributeName != SVGNames::zoomAndPanAttr) >+ return; >+ m_zoomAndPan.setValue(SVGPropertyTraits<SVGZoomAndPanType>::fromString(value)); > } > > } >diff --git a/Source/WebCore/svg/SVGZoomAndPan.h b/Source/WebCore/svg/SVGZoomAndPan.h >index 2a3702b9284..35d8828ec57 100644 >--- a/Source/WebCore/svg/SVGZoomAndPan.h >+++ b/Source/WebCore/svg/SVGZoomAndPan.h >@@ -1,6 +1,7 @@ > /* > * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> > * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -22,12 +23,12 @@ > > #include "QualifiedName.h" > #include "SVGNames.h" >+#include "SVGZoomAndPanType.h" > > namespace WebCore { > >-enum SVGZoomAndPanType { SVGZoomAndPanUnknown, SVGZoomAndPanDisable, SVGZoomAndPanMagnify }; >- > class SVGZoomAndPan { >+ WTF_MAKE_NONCOPYABLE(SVGZoomAndPan); > public: > // Forward declare enumerations in the W3C naming scheme, for IDL generation. > enum { >@@ -36,33 +37,26 @@ public: > SVG_ZOOMANDPAN_MAGNIFY = SVGZoomAndPanMagnify > }; > >- static bool isKnownAttribute(const QualifiedName&); >+ SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan.value(); } >+ void setZoomAndPan(SVGZoomAndPanType zoomAndPan) { m_zoomAndPan.setValue(zoomAndPan); } >+ ExceptionOr<void> setZoomAndPan(unsigned) { return Exception { NoModificationAllowedError }; } >+ void reset() { m_zoomAndPan.setValue(SVGZoomAndPanMagnify); } > >- static SVGZoomAndPanType parseFromNumber(unsigned short); >+ using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGZoomAndPan>; >+ static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } > >- static bool parse(const UChar*& start, const UChar* end, SVGZoomAndPanType&); >- template<class DerivedClass> static void parseAttribute(DerivedClass&, const QualifiedName&, const AtomicString& value); >+ void parseAttribute(const QualifiedName&, const AtomicString&); > >-private: >- static SVGZoomAndPanType parseAttributeValue(const AtomicString&); >-}; >+protected: >+ SVGZoomAndPan(); > >-inline bool SVGZoomAndPan::isKnownAttribute(const QualifiedName& name) >-{ >- return name == SVGNames::zoomAndPanAttr; >-} >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } >+ bool parseZoomAndPan(const UChar*&, const UChar*); > >-inline SVGZoomAndPanType SVGZoomAndPan::parseFromNumber(unsigned short number) >-{ >- if (number > SVGZoomAndPanMagnify) >- return SVGZoomAndPanUnknown; >- return static_cast<SVGZoomAndPanType>(number); >-} >+private: >+ static void registerAttributes(); > >-template<class DerivedClass> void SVGZoomAndPan::parseAttribute(DerivedClass& element, const QualifiedName& name, const AtomicString& value) >-{ >- if (name == SVGNames::zoomAndPanAttr) >- element.setZoomAndPan(parseAttributeValue(value)); >-} >+ SVGPropertyAttribute<SVGZoomAndPanType> m_zoomAndPan; >+}; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/SVGZoomAndPanType.h b/Source/WebCore/svg/SVGZoomAndPanType.h >new file mode 100644 >index 00000000000..481e4f5d4d6 >--- /dev/null >+++ b/Source/WebCore/svg/SVGZoomAndPanType.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "SVGAttributeAccessor.h" >+#include "SVGPropertyTraits.h" >+ >+namespace WebCore { >+ >+enum SVGZoomAndPanType { >+ SVGZoomAndPanUnknown, >+ SVGZoomAndPanDisable, >+ SVGZoomAndPanMagnify >+}; >+ >+using SVGZoomAndPanTypeAttribute = SVGPropertyAttribute<SVGZoomAndPanType>; >+ >+template<typename OwnerType> >+using SVGZoomAndPanTypeAttributeAccessor = SVGPropertyAttributeAccessor<OwnerType, SVGZoomAndPanTypeAttribute>; >+ >+template<> >+struct SVGPropertyTraits<SVGZoomAndPanType> { >+ static SVGZoomAndPanType initialValue() { return SVGZoomAndPanMagnify; } >+ static String toString(SVGZoomAndPanType) { return emptyString(); } >+ static SVGZoomAndPanType fromString(const String& value) >+ { >+ if (value == "disable") >+ return SVGZoomAndPanDisable; >+ if (value == "magnify") >+ return SVGZoomAndPanMagnify; >+ return SVGZoomAndPanUnknown; >+ } >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h b/Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h >index 413c2d36d44..5683af899b7 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h >@@ -27,6 +27,8 @@ namespace WebCore { > template<typename EnumType> > class SVGAnimatedEnumerationPropertyTearOff final : public SVGAnimatedStaticPropertyTearOff<unsigned> { > public: >+ using ContentType = EnumType; >+ > const unsigned& baseVal() final > { > const unsigned& baseVal = SVGAnimatedStaticPropertyTearOff::baseVal(); >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp b/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp >new file mode 100644 >index 00000000000..fd6e1f203a5 >--- /dev/null >+++ b/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp >@@ -0,0 +1,61 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "SVGAnimatedPathSegListPropertyTearOff.h" >+ >+#include "SVGPathElement.h" >+ >+namespace WebCore { >+ >+SVGAnimatedPathSegListPropertyTearOff::SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegListValues& values) >+ : Base(contextElement, attributeName, animatedPropertyType, values) >+{ >+ ASSERT(contextElement); >+ ASSERT(is<SVGPathElement>(contextElement)); >+} >+ >+SVGAnimatedPathSegListPropertyTearOff::~SVGAnimatedPathSegListPropertyTearOff() >+{ >+ downcast<SVGPathElement>(contextElement())->animatedPropertyWillBeDeleted(); >+} >+ >+void SVGAnimatedPathSegListPropertyTearOff::animValDidChange() >+{ >+ ASSERT(m_animatedPathByteStream); >+ auto pathElement = makeRefPtr(downcast<SVGPathElement>(contextElement())); >+ >+ // If the animVal is observed from JS, we have to update it on each animation step. >+ // This is an expensive operation and only done if someone actually observes the animatedPathSegList() while an animation is running. >+ if (pathElement->isAnimValObserved()) { >+ auto& animatedList = currentAnimatedValue(); >+ animatedList.clear(); >+ buildSVGPathSegListValuesFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing); >+ } >+ >+ Base::animValDidChange(); >+} >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h >index 6732f9af24c..ba859937436 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,7 +22,6 @@ > > #include "SVGAnimatedListPropertyTearOff.h" > #include "SVGPathByteStream.h" >-#include "SVGPathElement.h" > #include "SVGPathSegList.h" > #include "SVGPathUtilities.h" > >@@ -87,39 +87,15 @@ public: > Base::animationEnded(); > } > >- void animValDidChange() >- { >- ASSERT(m_animatedPathByteStream); >- auto pathElement = makeRefPtr(downcast<SVGPathElement>(contextElement())); >- >- // If the animVal is observed from JS, we have to update it on each animation step. >- // This is an expensive operation and only done, if someone actually observes the animatedPathSegList() while an animation is running. >- if (pathElement->isAnimValObserved()) { >- auto& animatedList = currentAnimatedValue(); >- animatedList.clear(); >- buildSVGPathSegListValuesFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing); >- } >- >- Base::animValDidChange(); >- } >+ void animValDidChange(); > > SVGPathByteStream* animatedPathByteStream() const { return m_animatedPathByteStream; } > > private: >- SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegListValues& values) >- : Base(contextElement, attributeName, animatedPropertyType, values) >- , m_animatedPathByteStream(nullptr) >- { >- ASSERT(contextElement); >- ASSERT(is<SVGPathElement>(contextElement)); >- } >- >- virtual ~SVGAnimatedPathSegListPropertyTearOff() >- { >- downcast<SVGPathElement>(contextElement())->animatedPropertyWillBeDeleted(); >- } >+ SVGAnimatedPathSegListPropertyTearOff(SVGElement*, const QualifiedName&, AnimatedPropertyType, SVGPathSegListValues&); >+ virtual ~SVGAnimatedPathSegListPropertyTearOff(); > >- SVGPathByteStream* m_animatedPathByteStream; >+ SVGPathByteStream* m_animatedPathByteStream { nullptr }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp b/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp >index f24a8d871e7..e4eec385bfe 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp >+++ b/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp >@@ -1,7 +1,7 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. > * Copyright (C) 2013 Samsung Electronics. All rights reserved. >- * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,22 +30,23 @@ SVGAnimatedProperty::SVGAnimatedProperty(SVGElement* contextElement, const Quali > : m_contextElement(contextElement) > , m_attributeName(attributeName) > , m_animatedPropertyType(animatedPropertyType) >- , m_isReadOnly(false) > { > } > > SVGAnimatedProperty::~SVGAnimatedProperty() > { >+ // Assure that animationEnded() was called, if animationStarted() was called before. >+ ASSERT(!isAnimating()); >+ > // Remove wrapper from cache. >- for (auto& cache : *animatedPropertyCache()) { >+ for (auto& cache : animatedPropertyCache()) { > if (cache.value == this) { >- animatedPropertyCache()->remove(cache.key); >- break; >+ animatedPropertyCache().remove(cache.key); >+ return; > } > } > >- // Assure that animationEnded() was called, if animationStarted() was called before. >- ASSERT(!isAnimating()); >+ RELEASE_ASSERT_NOT_REACHED(); > } > > void SVGAnimatedProperty::commitChange() >@@ -58,10 +59,4 @@ void SVGAnimatedProperty::commitChange() > m_contextElement->synchronizeAnimatedSVGAttribute(m_attributeName); > } > >-SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache() >-{ >- static Cache* s_cache = new Cache; >- return s_cache; >-} >- > } // namespace WebCore >diff --git a/Source/WebCore/svg/properties/SVGAnimatedProperty.h b/Source/WebCore/svg/properties/SVGAnimatedProperty.h >index 6629413830f..8dc52dd11ed 100644 >--- a/Source/WebCore/svg/properties/SVGAnimatedProperty.h >+++ b/Source/WebCore/svg/properties/SVGAnimatedProperty.h >@@ -1,7 +1,7 @@ > /* > * Copyright (C) Research In Motion Limited 2010. All rights reserved. > * Copyright (C) 2013 Samsung Electronics. All rights reserved. >- * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,8 +21,9 @@ > > #pragma once > >+#include "QualifiedName.h" > #include "SVGAnimatedPropertyDescription.h" >-#include "SVGPropertyInfo.h" >+#include "SVGAnimatedPropertyType.h" > #include <wtf/RefCounted.h> > > namespace WebCore { >@@ -32,6 +33,10 @@ class SVGProperty; > > class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty> { > public: >+ virtual ~SVGAnimatedProperty(); >+ virtual bool isAnimating() const { return false; } >+ virtual bool isAnimatedListTearOff() const { return false; } >+ > SVGElement* contextElement() const { return m_contextElement.get(); } > const QualifiedName& attributeName() const { return m_attributeName; } > AnimatedPropertyType animatedPropertyType() const { return m_animatedPropertyType; } >@@ -40,60 +45,49 @@ public: > > void commitChange(); > >- virtual bool isAnimating() const { return false; } >- virtual bool isAnimatedListTearOff() const { return false; } >- >- // Caching facilities. >- typedef HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> Cache; >- >- virtual ~SVGAnimatedProperty(); >- >- template<typename OwnerType, typename TearOffType, typename PropertyType> >- static Ref<TearOffType> lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType& property) >+ template<typename TearOffType, typename PropertyType, AnimatedPropertyType animatedType> >+ static RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(SVGElement& element, const QualifiedName& attributeName, const AtomicString& identifier, PropertyType& property, AnimatedPropertyState animatedState) > { >- ASSERT(info); >- SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); >+ SVGAnimatedPropertyDescription key(&element, identifier); > >- auto result = animatedPropertyCache()->add(key, nullptr); >+ auto result = animatedPropertyCache().add(key, nullptr); > if (!result.isNewEntry) >- return static_cast<TearOffType&>(*result.iterator->value); >+ return result.iterator->value; > >- Ref<SVGAnimatedProperty> wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property); >- if (info->animatedPropertyState == PropertyIsReadOnly) >+ auto wrapper = TearOffType::create(&element, attributeName, animatedType, property); >+ if (animatedState == PropertyIsReadOnly) > wrapper->setIsReadOnly(); > >- // Cache the raw pointer but return a Ref<>. This will break the cyclic reference >+ // Cache the raw pointer but return a RefPtr<>. This will break the cyclic reference > // between SVGAnimatedProperty and SVGElement once the property pointer is not needed. > result.iterator->value = wrapper.ptr(); >- return static_reference_cast<TearOffType>(wrapper); >- } >- >- template<typename OwnerType, typename TearOffType> >- static RefPtr<TearOffType> lookupWrapper(OwnerType* element, const SVGPropertyInfo* info) >- { >- ASSERT(info); >- SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); >- return static_cast<TearOffType*>(animatedPropertyCache()->get(key)); >+ return static_reference_cast<SVGAnimatedProperty>(wrapper); > } > >- template<typename OwnerType, typename TearOffType> >- static RefPtr<TearOffType> lookupWrapper(const OwnerType* element, const SVGPropertyInfo* info) >+ static RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGElement& element, const AtomicString& identifier) > { >- return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(element), info); >+ SVGAnimatedPropertyDescription key(const_cast<SVGElement*>(&element), identifier); >+ return animatedPropertyCache().get(key); > } > > protected: > SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType); > > private: >- static Cache* animatedPropertyCache(); >+ // Caching facilities. >+ using Cache = HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits>; >+ static Cache& animatedPropertyCache() >+ { >+ static NeverDestroyed<Cache> cache; >+ return cache; >+ } > > RefPtr<SVGElement> m_contextElement; > const QualifiedName& m_attributeName; > AnimatedPropertyType m_animatedPropertyType; > > protected: >- bool m_isReadOnly; >+ bool m_isReadOnly { false }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h >deleted file mode 100644 >index 30f85567940..00000000000 >--- a/Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h >+++ /dev/null >@@ -1,190 +0,0 @@ >-/* >- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> >- * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> >- * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#include "Element.h" >-#include "SVGAnimatedProperty.h" >-#include "SVGAttributeToPropertyMap.h" >-#include "SVGPropertyTraits.h" >-#include <wtf/NeverDestroyed.h> >-#include <wtf/StdLibExtras.h> >- >-namespace WebCore { >- >-// SVGSynchronizableAnimatedProperty implementation >-template<typename PropertyType> >-struct SVGSynchronizableAnimatedProperty { >- SVGSynchronizableAnimatedProperty() >- : value(SVGPropertyTraits<PropertyType>::initialValue()) >- , shouldSynchronize(false) >- , isValid(false) >- { >- } >- >- template<typename ConstructorParameter1> >- SVGSynchronizableAnimatedProperty(const ConstructorParameter1& value1) >- : value(value1) >- , shouldSynchronize(false) >- , isValid(false) >- { >- } >- >- template<typename ConstructorParameter1, typename ConstructorParameter2> >- SVGSynchronizableAnimatedProperty(const ConstructorParameter1& value1, const ConstructorParameter2& value2) >- : value(value1, value2) >- , shouldSynchronize(false) >- , isValid(false) >- { >- } >- >- void synchronize(Element* ownerElement, const QualifiedName& attrName, const AtomicString& value) >- { >- ownerElement->setSynchronizedLazyAttribute(attrName, value); >- } >- >- PropertyType value; >- bool shouldSynchronize : 1; >- bool isValid : 1; >-}; >- >-// Property registration helpers >-#define BEGIN_REGISTER_ANIMATED_PROPERTIES(OwnerType) \ >-SVGAttributeToPropertyMap& OwnerType::attributeToPropertyMap() \ >-{ \ >- static NeverDestroyed<SVGAttributeToPropertyMap> map; \ >- return map; \ >-} \ >-\ >-static void registerAnimatedPropertiesFor##OwnerType() \ >-{ \ >- auto& map = OwnerType::attributeToPropertyMap(); \ >- if (!map.isEmpty()) \ >- return; \ >- typedef OwnerType UseOwnerType; >- >-#define REGISTER_LOCAL_ANIMATED_PROPERTY(LowerProperty) map.addProperty(*UseOwnerType::LowerProperty##PropertyInfo()); >-#define REGISTER_PARENT_ANIMATED_PROPERTIES(ClassName) map.addProperties(ClassName::attributeToPropertyMap()); >-#define END_REGISTER_ANIMATED_PROPERTIES } >- >-// Property definition helpers (used in SVG*.cpp files) >-#define DEFINE_ANIMATED_PROPERTY(AnimatedPropertyTypeEnum, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ >-const SVGPropertyInfo* OwnerType::LowerProperty##PropertyInfo() { \ >- static NeverDestroyed<const SVGPropertyInfo> s_propertyInfo = SVGPropertyInfo \ >- (AnimatedPropertyTypeEnum, \ >- PropertyIsReadWrite, \ >- DOMAttribute, \ >- SVGDOMAttributeIdentifier, \ >- &OwnerType::synchronize##UpperProperty, \ >- &OwnerType::lookupOrCreate##UpperProperty##Wrapper); \ >- return &s_propertyInfo.get(); \ >-} >- >-// Property declaration helpers (used in SVG*.h files) >-#define BEGIN_DECLARE_ANIMATED_PROPERTIES_BASE(OwnerType) \ >-public: \ >- static SVGAttributeToPropertyMap& attributeToPropertyMap(); \ >- virtual SVGAttributeToPropertyMap& localAttributeToPropertyMap() \ >- { \ >- return attributeToPropertyMap(); \ >- } \ >- typedef OwnerType UseOwnerType; >- >-#define BEGIN_DECLARE_ANIMATED_PROPERTIES(OwnerType) \ >-public: \ >- static SVGAttributeToPropertyMap& attributeToPropertyMap(); \ >- SVGAttributeToPropertyMap& localAttributeToPropertyMap() override \ >- { \ >- return attributeToPropertyMap(); \ >- } \ >- typedef OwnerType UseOwnerType; >- >-#define DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty, OverrideSpecifier) \ >-public: \ >- static const SVGPropertyInfo* LowerProperty##PropertyInfo(); \ >- PropertyType& LowerProperty() const \ >- { \ >- if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) { \ >- if (wrapper->isAnimating()) \ >- return wrapper->currentAnimatedValue(); \ >- } \ >- return m_##LowerProperty.value; \ >- } \ >-\ >- PropertyType& LowerProperty##BaseValue() const OverrideSpecifier \ >- { \ >- return m_##LowerProperty.value; \ >- } \ >-\ >- void set##UpperProperty##BaseValue(const PropertyType& type, const bool validValue = true) OverrideSpecifier \ >- { \ >- m_##LowerProperty.value = type; \ >- m_##LowerProperty.isValid = validValue; \ >- } \ >-\ >- Ref<TearOffType> LowerProperty##Animated() \ >- { \ >- m_##LowerProperty.shouldSynchronize = true; \ >- return static_reference_cast<TearOffType>(lookupOrCreate##UpperProperty##Wrapper(this)); \ >- } \ >-\ >- bool LowerProperty##IsValid() const \ >- { \ >- return m_##LowerProperty.isValid; \ >- } \ >-\ >-private: \ >- void synchronize##UpperProperty() \ >- { \ >- if (!m_##LowerProperty.shouldSynchronize) \ >- return; \ >- AtomicString value(SVGPropertyTraits<PropertyType>::toString(m_##LowerProperty.value)); \ >- m_##LowerProperty.synchronize(this, LowerProperty##PropertyInfo()->attributeName, value); \ >- } \ >-\ >- static Ref<SVGAnimatedProperty> lookupOrCreate##UpperProperty##Wrapper(SVGElement* maskedOwnerType) \ >- { \ >- ASSERT(maskedOwnerType); \ >- UseOwnerType* ownerType = static_cast<UseOwnerType*>(maskedOwnerType); \ >- return SVGAnimatedProperty::lookupOrCreateWrapper<UseOwnerType, TearOffType, PropertyType>(ownerType, LowerProperty##PropertyInfo(), ownerType->m_##LowerProperty.value); \ >- } \ >-\ >- static void synchronize##UpperProperty(SVGElement* maskedOwnerType) \ >- { \ >- ASSERT(maskedOwnerType); \ >- UseOwnerType* ownerType = static_cast<UseOwnerType*>(maskedOwnerType); \ >- ownerType->synchronize##UpperProperty(); \ >- } \ >-\ >- mutable SVGSynchronizableAnimatedProperty<PropertyType> m_##LowerProperty; >- >-#define END_DECLARE_ANIMATED_PROPERTIES >- >-// List specific definition/declaration helpers >-#define DECLARE_ANIMATED_LIST_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty, ) \ >-void detachAnimated##UpperProperty##ListWrappers(unsigned newListSize) \ >-{ \ >- if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) \ >- wrapper->detachListWrappers(newListSize); \ >-} >- >-} // namespace WebCore >diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertyType.h b/Source/WebCore/svg/properties/SVGAnimatedPropertyType.h >new file mode 100644 >index 00000000000..f8bad439e32 >--- /dev/null >+++ b/Source/WebCore/svg/properties/SVGAnimatedPropertyType.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+enum AnimatedPropertyState { >+ PropertyIsReadWrite, >+ PropertyIsReadOnly >+}; >+ >+enum AnimatedPropertyType { >+ AnimatedPropertyTypeMin = 0, >+ AnimatedAngle = AnimatedPropertyTypeMin, >+ AnimatedBoolean, >+ AnimatedColor, >+ AnimatedEnumeration, >+ AnimatedInteger, >+ AnimatedIntegerOptionalInteger, >+ AnimatedLength, >+ AnimatedLengthList, >+ AnimatedNumber, >+ AnimatedNumberList, >+ AnimatedNumberOptionalNumber, >+ AnimatedPath, >+ AnimatedPoints, >+ AnimatedPreserveAspectRatio, >+ AnimatedRect, >+ AnimatedString, >+ AnimatedTransformList, >+ AnimatedPropertyTypeMax, >+ AnimatedUnknown = AnimatedPropertyTypeMax >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAttribute.h b/Source/WebCore/svg/properties/SVGAttribute.h >new file mode 100644 >index 00000000000..8711ac8cc16 >--- /dev/null >+++ b/Source/WebCore/svg/properties/SVGAttribute.h >@@ -0,0 +1,131 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "Element.h" >+#include "SVGAttributeOwnerProxy.h" >+#include "SVGPropertyTraits.h" >+ >+namespace WebCore { >+ >+class SVGAttribute { }; >+ >+template<typename PropertyType> >+class SVGPropertyAttribute : public SVGAttribute { >+public: >+ SVGPropertyAttribute() >+ : m_property(SVGPropertyTraits<PropertyType>::initialValue()) >+ { >+ } >+ >+ template<typename... Arguments> >+ SVGPropertyAttribute(Arguments&&... arguments) >+ : m_property(std::forward<Arguments>(arguments)...) >+ { >+ } >+ >+ PropertyType& value() { return m_property; } >+ const PropertyType& value() const { return m_property; } >+ >+ void setValue(const PropertyType& property) { m_property = property; } >+ void setValue(PropertyType&& property) { m_property = WTFMove(property); } >+ void resetValue() { m_property = SVGPropertyTraits<PropertyType>::initialValue(); } >+ >+ String toString() const { return SVGPropertyTraits<PropertyType>::toString(m_property); } >+ >+ void setShouldSynchronize(bool shouldSynchronize) { m_shouldSynchronize = shouldSynchronize; } >+ bool shouldSynchronize() const { return m_shouldSynchronize; } >+ void synchronize(Element& element, const QualifiedName& attributeName) >+ { >+ if (!m_shouldSynchronize) >+ return; >+ element.setSynchronizedLazyAttribute(attributeName, toString()); >+ } >+ >+protected: >+ PropertyType m_property; >+ bool m_shouldSynchronize { false }; >+}; >+ >+template<typename TearOffType> >+class SVGAnimatedAttribute : public SVGPropertyAttribute<typename TearOffType::ContentType> { >+public: >+ using PropertyTearOffType = TearOffType; >+ using PropertyType = typename PropertyTearOffType::ContentType; >+ using Base = SVGPropertyAttribute<PropertyType>; >+ using Base::m_property; >+ using Base::m_shouldSynchronize; >+ >+ SVGAnimatedAttribute() = default; >+ >+ template<typename... Arguments> >+ SVGAnimatedAttribute(Arguments&&... arguments) >+ : Base(std::forward<Arguments>(arguments)...) >+ { >+ } >+ >+ const PropertyType& currentValue(const SVGAttributeOwnerProxy& attributeOwnerProxy) const >+ { >+ if (auto wrapper = attributeOwnerProxy.lookupAnimatedProperty(*this)) { >+ if (wrapper->isAnimating()) >+ return static_pointer_cast<PropertyTearOffType>(wrapper)->currentAnimatedValue(); >+ } >+ return m_property; >+ } >+ >+ RefPtr<PropertyTearOffType> animatedProperty(const SVGAttributeOwnerProxy& attributeOwnerProxy) >+ { >+ m_shouldSynchronize = true; >+ if (auto wrapper = attributeOwnerProxy.lookupOrCreateAnimatedProperty(*this)) >+ return static_pointer_cast<PropertyTearOffType>(wrapper); >+ RELEASE_ASSERT_NOT_REACHED(); >+ return nullptr; >+ } >+}; >+ >+template<typename TearOffType> >+class SVGAnimatedAttributeList : public SVGAnimatedAttribute<TearOffType> { >+public: >+ using PropertyTearOffType = TearOffType; >+ using PropertyType = typename PropertyTearOffType::ContentType; >+ using Base = SVGAnimatedAttribute<PropertyTearOffType>; >+ >+ SVGAnimatedAttributeList() = default; >+ >+ template<typename... Arguments> >+ SVGAnimatedAttributeList(Arguments&&... arguments) >+ : Base(std::forward<Arguments>(arguments)...) >+ { >+ } >+ >+ void detachAnimatedListWrappers(const SVGAttributeOwnerProxy& attributeOwnerProxy, unsigned newListSize) >+ { >+ if (auto wrapper = attributeOwnerProxy.lookupAnimatedProperty(*this)) >+ static_pointer_cast<PropertyTearOffType>(wrapper)->detachListWrappers(newListSize); >+ } >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAttributeAccessor.h b/Source/WebCore/svg/properties/SVGAttributeAccessor.h >new file mode 100644 >index 00000000000..c5c0f8f6648 >--- /dev/null >+++ b/Source/WebCore/svg/properties/SVGAttributeAccessor.h >@@ -0,0 +1,248 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "Element.h" >+#include "QualifiedName.h" >+#include "SVGAnimatedProperty.h" >+#include "SVGAnimatedPropertyType.h" >+#include "SVGAttribute.h" >+#include "SVGLengthValue.h" >+#include "SVGNames.h" >+#include "SVGPropertyTraits.h" >+ >+namespace WebCore { >+ >+class SVGAttribute; >+class SVGElement; >+ >+template<typename OwnerType> >+class SVGAttributeAccessor { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ SVGAttributeAccessor(const QualifiedName& attributeName) >+ : m_attributeName(attributeName) >+ { >+ } >+ virtual ~SVGAttributeAccessor() = default; >+ >+ const QualifiedName& attributeName() const { return m_attributeName; } >+ >+ virtual bool isMatched(const OwnerType&, const SVGAttribute&) const = 0; >+ virtual void synchronizeProperty(OwnerType&, Element&) const = 0; >+ >+ virtual bool isAnimatedLengthAttribute() const { return false; } >+ virtual AnimatedPropertyType animatedType() const { return AnimatedUnknown; } >+ virtual Vector<AnimatedPropertyType> animatedTypes() const { return { animatedType() }; } >+ >+ virtual RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(OwnerType&, SVGElement&, const SVGAttribute&, AnimatedPropertyState) const { return nullptr; }; >+ virtual RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const OwnerType&, const SVGElement&, const SVGAttribute&) const { return nullptr; }; >+ virtual Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(OwnerType&, SVGElement&, AnimatedPropertyState) const { return { }; } >+ >+protected: >+ const QualifiedName m_attributeName; >+}; >+ >+template<typename OwnerType, typename AttributeType> >+class SVGPropertyAttributeAccessor : public SVGAttributeAccessor<OwnerType> { >+public: >+ using Base = SVGAttributeAccessor<OwnerType>; >+ using Base::m_attributeName; >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, AttributeType OwnerType::*attribute> >+ static SVGAttributeAccessor<OwnerType>& singleton() >+ { >+ static NeverDestroyed<SVGPropertyAttributeAccessor> attributeAccessor { attributeName, attributeName->localName(), attribute }; >+ return attributeAccessor; >+ } >+ >+ SVGPropertyAttributeAccessor(const QualifiedName& attributeName, const AtomicString& identifier, AttributeType OwnerType::*attribute) >+ : Base(attributeName) >+ , m_identifier(identifier) >+ , m_attribute(attribute) >+ { >+ } >+ >+protected: >+ auto& attribute(OwnerType& owner) const { return owner.*m_attribute; } >+ const auto& attribute(const OwnerType& owner) const { return owner.*m_attribute; } >+ >+ bool isMatched(const OwnerType& owner, const SVGAttribute& attribute) const override >+ { >+ return &this->attribute(owner) == &attribute; >+ } >+ >+ void synchronizeProperty(OwnerType& owner, Element& element) const override >+ { >+ attribute(owner).synchronize(element, m_attributeName); >+ } >+ >+ const AtomicString& m_identifier; >+ AttributeType OwnerType::*m_attribute; >+}; >+ >+template<typename OwnerType, typename AnimatedAttributeType, AnimatedPropertyType type> >+class SVGAnimatedAttributeAccessor : public SVGPropertyAttributeAccessor<OwnerType, AnimatedAttributeType> { >+public: >+ using PropertyTearOffType = typename AnimatedAttributeType::PropertyTearOffType; >+ using PropertyType = typename AnimatedAttributeType::PropertyType; >+ using Base = SVGPropertyAttributeAccessor<OwnerType, AnimatedAttributeType>; >+ using Base::attribute; >+ using Base::isMatched; >+ using Base::m_attributeName; >+ using Base::m_identifier; >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, AnimatedAttributeType OwnerType::*attribute> >+ static SVGAttributeAccessor<OwnerType>& singleton() >+ { >+ static NeverDestroyed<SVGAnimatedAttributeAccessor> attributeAccessor { attributeName, attributeName->localName(), attribute }; >+ return attributeAccessor; >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, const AtomicString& (*identifier)(), AnimatedAttributeType OwnerType::*attribute> >+ static SVGAttributeAccessor<OwnerType>& singleton() >+ { >+ static NeverDestroyed<SVGAnimatedAttributeAccessor> attributeAccessor { attributeName, identifier(), attribute }; >+ return attributeAccessor; >+ } >+ >+ SVGAnimatedAttributeAccessor(const QualifiedName& attributeName, const AtomicString& identifier, AnimatedAttributeType OwnerType::*attribute) >+ : Base(attributeName, identifier, attribute) >+ { >+ } >+ >+protected: >+ template<typename PropertyTearOff = PropertyTearOffType, typename Property = PropertyType, AnimatedPropertyType animatedType = type> >+ static RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(SVGElement& element, const QualifiedName& attributeName, const AtomicString& identifier, Property& property, AnimatedPropertyState animatedState) >+ { >+ return SVGAnimatedProperty::lookupOrCreateAnimatedProperty<PropertyTearOff, Property, animatedType>(element, attributeName, identifier, property, animatedState); >+ } >+ >+ static RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGElement& element, const AtomicString& identifier) >+ { >+ return SVGAnimatedProperty::lookupAnimatedProperty(element, identifier); >+ } >+ >+ bool isAnimatedLengthAttribute() const override { return std::is_same<PropertyType, SVGLengthValue>::value; } >+ AnimatedPropertyType animatedType() const override { return type; } >+ >+ RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(OwnerType& owner, SVGElement& element, const SVGAttribute& attribute, AnimatedPropertyState animatedState) const override >+ { >+ ASSERT_UNUSED(attribute, isMatched(owner, attribute)); >+ return lookupOrCreateAnimatedProperty(element, m_attributeName, m_identifier, this->attribute(owner).value(), animatedState); >+ } >+ >+ RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const OwnerType&, const SVGElement& element, const SVGAttribute&) const override >+ { >+ return lookupAnimatedProperty(element, m_identifier); >+ } >+ >+ Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(OwnerType& owner, SVGElement& element, AnimatedPropertyState animatedState) const override >+ { >+ return { lookupOrCreateAnimatedProperty(element, m_attributeName, m_identifier, attribute(owner).value(), animatedState) }; >+ } >+}; >+ >+template<typename OwnerType, typename AnimatedAttributeType, AnimatedPropertyType type, typename SecondAnimatedAttributeType, AnimatedPropertyType secondType> >+class SVGAnimatedPairAttributeAccessor : public SVGAnimatedAttributeAccessor<OwnerType, AnimatedAttributeType, type> { >+public: >+ using PropertyTearOffType = typename AnimatedAttributeType::PropertyTearOffType; >+ using SecondPropertyTearOffType = typename SecondAnimatedAttributeType::PropertyTearOffType; >+ using SecondPropertyType = typename SecondAnimatedAttributeType::PropertyType; >+ using Base = SVGAnimatedAttributeAccessor<OwnerType, AnimatedAttributeType, type>; >+ using Base::attribute; >+ using Base::lookupOrCreateAnimatedProperty; >+ using Base::lookupAnimatedProperty; >+ using Base::m_attributeName; >+ using Base::m_identifier; >+ >+ template< >+ const LazyNeverDestroyed<const QualifiedName>& attributeName, >+ const AtomicString& (*identifier)(), AnimatedAttributeType OwnerType::*attribute, >+ const AtomicString& (*secondIdentifier)(), SecondAnimatedAttributeType OwnerType::*secondAttribute >+ > >+ static SVGAttributeAccessor<OwnerType>& singleton() >+ { >+ static NeverDestroyed<SVGAnimatedPairAttributeAccessor> attributeAccessor { attributeName, identifier(), attribute, secondIdentifier(), secondAttribute }; >+ return attributeAccessor; >+ } >+ >+ SVGAnimatedPairAttributeAccessor(const QualifiedName& attributeName, const AtomicString& identifier, AnimatedAttributeType OwnerType::*attribute, const AtomicString& secondIdentifier, SecondAnimatedAttributeType OwnerType::*secondAttribute) >+ : Base(attributeName, identifier, attribute) >+ , m_secondIdentifier(secondIdentifier) >+ , m_secondAttribute(secondAttribute) >+ { >+ } >+ >+private: >+ auto& secondAttribute(OwnerType& owner) const { return owner.*m_secondAttribute; } >+ const auto& secondAttribute(const OwnerType& owner) const { return owner.*m_secondAttribute; } >+ >+ bool isMatched(const OwnerType& owner, const SVGAttribute& attribute) const override >+ { >+ return Base::isMatched(owner, attribute) || &secondAttribute(owner) == &attribute; >+ } >+ >+ void synchronizeProperty(OwnerType& owner, Element& element) const override >+ { >+ attribute(owner).synchronize(element, m_attributeName); >+ secondAttribute(owner).synchronize(element, m_attributeName); >+ } >+ >+ Vector<AnimatedPropertyType> animatedTypes() const override { return { type, secondType }; } >+ >+ RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(OwnerType& owner, SVGElement& element, const SVGAttribute& attribute, AnimatedPropertyState animatedState) const override >+ { >+ if (Base::isMatched(owner, attribute)) >+ return lookupOrCreateAnimatedProperty(element, m_attributeName, m_identifier, this->attribute(owner).value(), animatedState); >+ ASSERT(&secondAttribute(owner) == &attribute); >+ return Base::template lookupOrCreateAnimatedProperty<SecondPropertyTearOffType, SecondPropertyType, secondType>(element, m_attributeName, m_secondIdentifier, secondAttribute(owner).value(), animatedState); >+ } >+ >+ RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const OwnerType& owner, const SVGElement& element, const SVGAttribute& attribute) const override >+ { >+ if (Base::isMatched(owner, attribute)) >+ return lookupAnimatedProperty(element, m_identifier); >+ ASSERT(&secondAttribute(owner) == &attribute); >+ return lookupAnimatedProperty(element, m_secondIdentifier); >+ } >+ >+ Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(OwnerType& owner, SVGElement& element, AnimatedPropertyState animatedState) const override >+ { >+ return { >+ lookupOrCreateAnimatedProperty(element, m_attributeName, m_identifier, attribute(owner).value(), animatedState), >+ Base::template lookupOrCreateAnimatedProperty<SecondPropertyTearOffType, SecondPropertyType, secondType>(element, m_attributeName, m_secondIdentifier, secondAttribute(owner).value(), animatedState) >+ }; >+ } >+ >+ const AtomicString& m_secondIdentifier; >+ SecondAnimatedAttributeType OwnerType::*m_secondAttribute; >+}; >+ >+template<typename OwnerType, typename AnimatedAttributeType, AnimatedPropertyType type> >+using SVGAnimatedOptionalAttributeAccessor = SVGAnimatedPairAttributeAccessor<OwnerType, AnimatedAttributeType, type, AnimatedAttributeType, type>; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h b/Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h >new file mode 100644 >index 00000000000..ee9c301b794 >--- /dev/null >+++ b/Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "SVGAnimatedPropertyType.h" >+ >+namespace WebCore { >+ >+class SVGAnimatedProperty; >+class SVGAttribute; >+class SVGElement; >+ >+class SVGAttributeOwnerProxy { >+public: >+ SVGAttributeOwnerProxy(SVGElement& element) >+ : m_element(element) >+ { >+ } >+ >+ virtual ~SVGAttributeOwnerProxy() = default; >+ >+ SVGElement& element() const { return m_element; } >+ >+ virtual void synchronizeAttributes() const = 0; >+ virtual void synchronizeAttribute(const QualifiedName&) const = 0; >+ >+ virtual Vector<AnimatedPropertyType> animatedTypes(const QualifiedName&) const = 0; >+ >+ virtual RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(const SVGAttribute&) const = 0; >+ virtual RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGAttribute&) const = 0; >+ virtual Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(const QualifiedName&) const = 0; >+ >+protected: >+ SVGElement& m_element; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAttributeOwnerProxyImpl.h b/Source/WebCore/svg/properties/SVGAttributeOwnerProxyImpl.h >new file mode 100644 >index 00000000000..da0d16746d5 >--- /dev/null >+++ b/Source/WebCore/svg/properties/SVGAttributeOwnerProxyImpl.h >@@ -0,0 +1,103 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "SVGAttributeOwnerProxy.h" >+#include "SVGAttributeRegistry.h" >+ >+namespace WebCore { >+ >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeOwnerProxyImpl : public SVGAttributeOwnerProxy { >+public: >+ using AttributeRegistry = SVGAttributeRegistry<OwnerType, BaseTypes...>; >+ >+ SVGAttributeOwnerProxyImpl(OwnerType& owner, SVGElement& element, AnimatedPropertyState animatedState = PropertyIsReadWrite) >+ : SVGAttributeOwnerProxy(element) >+ , m_owner(owner) >+ , m_animatedState(animatedState) >+ { >+ // This is the OwnerProxy constructor for the non SVGElement based owners, e.g. SVGTests. >+ } >+ >+ SVGAttributeOwnerProxyImpl(OwnerType& owner) >+ : SVGAttributeOwnerProxy(owner) >+ , m_owner(owner) >+ { >+ static_assert(std::is_base_of<SVGElement, OwnerType>::value, "The owner of SVGAttributeOwnerProxy should be derived from SVGElement."); >+ } >+ >+ static AttributeRegistry& attributeRegistry() >+ { >+ return AttributeRegistry::singleton(); >+ } >+ >+ static bool isKnownAttribute(const QualifiedName& attributeName) >+ { >+ return attributeRegistry().isKnownAttribute(attributeName); >+ } >+ >+ static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) >+ { >+ return attributeRegistry().isAnimatedLengthAttribute(attributeName); >+ } >+ >+private: >+ void synchronizeAttributes() const override >+ { >+ attributeRegistry().synchronizeAttributes(m_owner, m_element); >+ } >+ >+ void synchronizeAttribute(const QualifiedName& attributeName) const override >+ { >+ attributeRegistry().synchronizeAttribute(m_owner, m_element, attributeName); >+ } >+ >+ Vector<AnimatedPropertyType> animatedTypes(const QualifiedName& attributeName) const override >+ { >+ return attributeRegistry().animatedTypes(attributeName); >+ } >+ >+ RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(const SVGAttribute& attribute) const override >+ { >+ return attributeRegistry().lookupOrCreateAnimatedProperty(m_owner, m_element, attribute, m_animatedState); >+ } >+ >+ RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGAttribute& attribute) const override >+ { >+ return attributeRegistry().lookupAnimatedProperty(m_owner, m_element, attribute); >+ } >+ >+ Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(const QualifiedName& attributeName) const override >+ { >+ return attributeRegistry().lookupOrCreateAnimatedProperties(m_owner, m_element, attributeName, m_animatedState); >+ } >+ >+ OwnerType& m_owner; >+ AnimatedPropertyState m_animatedState { PropertyIsReadWrite }; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAttributeRegistry.h b/Source/WebCore/svg/properties/SVGAttributeRegistry.h >new file mode 100644 >index 00000000000..3022280063b >--- /dev/null >+++ b/Source/WebCore/svg/properties/SVGAttributeRegistry.h >@@ -0,0 +1,330 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "SVGAnimatedBoolean.h" >+#include "SVGAnimatedEnumeration.h" >+#include "SVGAnimatedInteger.h" >+#include "SVGAnimatedLength.h" >+#include "SVGAnimatedLengthList.h" >+#include "SVGAnimatedNumber.h" >+#include "SVGAnimatedNumberList.h" >+#include "SVGAnimatedPointList.h" >+#include "SVGAnimatedPreserveAspectRatio.h" >+#include "SVGAnimatedProperty.h" >+#include "SVGAnimatedRect.h" >+#include "SVGAnimatedString.h" >+#include "SVGAnimatedTransformList.h" >+#include "SVGAttributeAccessor.h" >+#include "SVGStringListValues.h" >+#include "SVGZoomAndPanType.h" >+#include <wtf/HashMap.h> >+ >+namespace WebCore { >+ >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeRegistry { >+public: >+ static SVGAttributeRegistry<OwnerType, BaseTypes...>& singleton() >+ { >+ static NeverDestroyed<SVGAttributeRegistry<OwnerType, BaseTypes...>> map; >+ return map; >+ } >+ >+ // Non animatable attributes >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGStringListValuesAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGStringListValuesAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGZoomAndPanTypeAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGZoomAndPanTypeAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ // Animatable attributes >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedBooleanAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedBooleanAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, typename EnumType, SVGAnimatedEnumerationAttribute<EnumType> OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedEnumerationAttributeAccessor<OwnerType, EnumType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedIntegerAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedIntegerAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, >+ const AtomicString& (*identifier)(), SVGAnimatedIntegerAttribute OwnerType::*attribute, >+ const AtomicString& (*optionalIdentifier)(), SVGAnimatedIntegerAttribute OwnerType::*optionalAttribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedOptionalIntegerAttributeAccessor<OwnerType>::template singleton<attributeName, identifier, attribute, optionalIdentifier, optionalAttribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedLengthAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedLengthAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedLengthListAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedLengthListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedNumberAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedNumberAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedNumberListAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedNumberListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, >+ const AtomicString& (*identifier)(), SVGAnimatedNumberAttribute OwnerType::*attribute, >+ const AtomicString& (*optionalIdentifier)(), SVGAnimatedNumberAttribute OwnerType::*optionalAttribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedOptionalNumberAttributeAccessor<OwnerType>::template singleton<attributeName, identifier, attribute, optionalIdentifier, optionalAttribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedPointListAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedPointListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedPreserveAspectRatioAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedPreserveAspectRatioAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedRectAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedRectAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedStringAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedStringAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedTransformListAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedTransformListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ bool isEmpty() const { return m_map.isEmpty(); } >+ >+ bool isKnownAttribute(const QualifiedName& attributeName) const >+ { >+ // Here we need to loop through the entries in the map and use matches() to compare them with attributeName. >+ // m_map.contains() uses QualifiedName::operator==() which compares the impl pointers only while matches() >+ // compares the contents if the impl pointers differ. >+ auto it = std::find_if(m_map.begin(), m_map.end(), [&attributeName](const auto& entry) -> bool { >+ return entry.key.matches(attributeName); >+ }); >+ return it != m_map.end(); >+ } >+ >+ bool isAnimatedLengthAttribute(const QualifiedName& attributeName) const >+ { >+ if (const auto* attributeAccessor = findAttributeAccessor(attributeName)) >+ return attributeAccessor->isAnimatedLengthAttribute(); >+ return false; >+ } >+ >+ Vector<AnimatedPropertyType> animatedTypes(const QualifiedName& attributeName) const >+ { >+ // If this registry has an accessor for attributeName, return animatedTypes() of this accessor. >+ if (const auto* attributeAccessor = findAttributeAccessor(attributeName)) >+ return attributeAccessor->animatedTypes(); >+ // Otherwise loop through BaeTypes and see if any of them knows attributeName. >+ return animatedTypesBaseTypes(attributeName); >+ } >+ >+ void synchronizeAttributes(OwnerType& owner, SVGElement& element) const >+ { >+ for (auto* attributeAccessor : m_map.values()) >+ attributeAccessor->synchronizeProperty(owner, element); >+ synchronizeAttributesBaseTypes(owner, element); >+ } >+ >+ bool synchronizeAttribute(OwnerType& owner, SVGElement& element, const QualifiedName& attributeName) const >+ { >+ if (const auto* attributeAccessor = findAttributeAccessor(attributeName)) { >+ attributeAccessor->synchronizeProperty(owner, element); >+ return true; >+ } >+ return synchronizeAttributeBaseTypes(owner, element, attributeName); >+ } >+ >+ RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(OwnerType& owner, SVGElement& element, const SVGAttribute& attribute, AnimatedPropertyState animatedState) const >+ { >+ if (const auto* attributeAccessor = findAttributeAccessor(owner, attribute)) >+ return attributeAccessor->lookupOrCreateAnimatedProperty(owner, element, attribute, animatedState); >+ return lookupOrCreateAnimatedPropertyBaseTypes(owner, element, attribute, animatedState); >+ } >+ >+ RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const OwnerType& owner, const SVGElement& element, const SVGAttribute& attribute) const >+ { >+ if (const auto* attributeAccessor = findAttributeAccessor(owner, attribute)) >+ return attributeAccessor->lookupAnimatedProperty(owner, element, attribute); >+ return lookupAnimatedPropertyBaseTypes(owner, element, attribute); >+ } >+ >+ Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(OwnerType& owner, SVGElement& element, const QualifiedName& attributeName, AnimatedPropertyState animatedState) const >+ { >+ if (const auto* attributeAccessor = findAttributeAccessor(attributeName)) >+ return attributeAccessor->lookupOrCreateAnimatedProperties(owner, element, animatedState); >+ return lookupOrCreateAnimatedPropertiesBaseTypes(owner, element, attributeName, animatedState); >+ } >+ >+ void registerAttribute(const SVGAttributeAccessor<OwnerType>& attributeAccessor) >+ { >+ m_map.add(attributeAccessor.attributeName(), &attributeAccessor); >+ } >+ >+private: >+ // This is a template function with parameter 'I' whose default value = 0. So you can call it without any parameter from animatedTypes(). >+ // It returns Vector<AnimatedPropertyType> and is enable_if<I == sizeof...(BaseTypes)>. So it is mainly for breaking the recursion. If >+ // it is called, this means no attribute was found in this registry for this QualifiedName. So return an empty Vector<AnimatedPropertyType>. >+ template<size_t I = 0> >+ static typename std::enable_if<I == sizeof...(BaseTypes), Vector<AnimatedPropertyType>>::type animatedTypesBaseTypes(const QualifiedName&) { return { }; } >+ >+ // This version of animatedTypesBaseTypes() is enable_if<I < sizeof...(BaseTypes)>. >+ template<size_t I = 0> >+ static typename std::enable_if<I < sizeof...(BaseTypes), Vector<AnimatedPropertyType>>::type animatedTypesBaseTypes(const QualifiedName& attributeName) >+ { >+ // Get the base type at index 'I' using std::tuple and std::tuple_element. >+ using BaseType = typename std::tuple_element<I, typename std::tuple<BaseTypes...>>::type; >+ >+ // Get the SVGAttributeRegistry of BaseType. If it knows attributeName break the recursion. >+ auto animatedTypes = BaseType::attributeRegistry().animatedTypes(attributeName); >+ if (!animatedTypes.isEmpty()) >+ return animatedTypes; >+ >+ // SVGAttributeRegistry of BaseType does not know attributeName. Recurse to the next BaseType. >+ return animatedTypesBaseTypes<I + 1>(attributeName); >+ } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I == sizeof...(BaseTypes), void>::type synchronizeAttributesBaseTypes(OwnerType&, Element&) { } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I < sizeof...(BaseTypes), void>::type synchronizeAttributesBaseTypes(OwnerType& owner, SVGElement& element) >+ { >+ using BaseType = typename std::tuple_element<I, typename std::tuple<BaseTypes...>>::type; >+ BaseType::attributeRegistry().synchronizeAttributes(owner, element); >+ synchronizeAttributesBaseTypes<I + 1>(owner, element); >+ } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I == sizeof...(BaseTypes), bool>::type synchronizeAttributeBaseTypes(OwnerType&, Element&, const QualifiedName&) { return false; } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I < sizeof...(BaseTypes), bool>::type synchronizeAttributeBaseTypes(OwnerType& owner, SVGElement& element, const QualifiedName& attributeName) >+ { >+ using BaseType = typename std::tuple_element<I, typename std::tuple<BaseTypes...>>::type; >+ if (BaseType::attributeRegistry().synchronizeAttribute(owner, element, attributeName)) >+ return true; >+ return synchronizeAttributeBaseTypes<I + 1>(owner, element, attributeName); >+ } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I == sizeof...(BaseTypes), RefPtr<SVGAnimatedProperty>>::type lookupOrCreateAnimatedPropertyBaseTypes(OwnerType&, SVGElement&, const SVGAttribute&, AnimatedPropertyState) { return nullptr; } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I < sizeof...(BaseTypes), RefPtr<SVGAnimatedProperty>>::type lookupOrCreateAnimatedPropertyBaseTypes(OwnerType& owner, SVGElement& element, const SVGAttribute& attribute, AnimatedPropertyState animatedState) >+ { >+ using BaseType = typename std::tuple_element<I, typename std::tuple<BaseTypes...>>::type; >+ if (auto animatedProperty = BaseType::attributeRegistry().lookupOrCreateAnimatedProperty(owner, element, attribute, animatedState)) >+ return animatedProperty; >+ return lookupOrCreateAnimatedPropertyBaseTypes<I + 1>(owner, element, attribute, animatedState); >+ } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I == sizeof...(BaseTypes), RefPtr<SVGAnimatedProperty>>::type lookupAnimatedPropertyBaseTypes(const OwnerType&, const SVGElement&, const SVGAttribute&) { return nullptr; } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I < sizeof...(BaseTypes), RefPtr<SVGAnimatedProperty>>::type lookupAnimatedPropertyBaseTypes(const OwnerType& owner, const SVGElement& element, const SVGAttribute& attribute) >+ { >+ using BaseType = typename std::tuple_element<I, typename std::tuple<BaseTypes...>>::type; >+ if (auto animatedProperty = BaseType::attributeRegistry().lookupAnimatedProperty(owner, element, attribute)) >+ return animatedProperty; >+ return lookupAnimatedPropertyBaseTypes<I + 1>(owner, element, attribute); >+ } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I == sizeof...(BaseTypes), Vector<RefPtr<SVGAnimatedProperty>>>::type lookupOrCreateAnimatedPropertiesBaseTypes(OwnerType&, SVGElement&, const QualifiedName&, AnimatedPropertyState) { return { }; } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I < sizeof...(BaseTypes), Vector<RefPtr<SVGAnimatedProperty>>>::type lookupOrCreateAnimatedPropertiesBaseTypes(OwnerType& owner, SVGElement& element, const QualifiedName& attributeName, AnimatedPropertyState animatedState) >+ { >+ using BaseType = typename std::tuple_element<I, typename std::tuple<BaseTypes...>>::type; >+ auto animatedProperties = BaseType::attributeRegistry().lookupOrCreateAnimatedProperties(owner, element, attributeName, animatedState); >+ if (!animatedProperties.isEmpty()) >+ return animatedProperties; >+ return lookupOrCreateAnimatedPropertiesBaseTypes<I + 1>(owner, element, attributeName, animatedState); >+ } >+ >+ const SVGAttributeAccessor<OwnerType>* findAttributeAccessor(const OwnerType& owner, const SVGAttribute& attribute) const >+ { >+ for (auto* attributeAccessor : m_map.values()) { >+ if (attributeAccessor->isMatched(owner, attribute)) >+ return attributeAccessor; >+ } >+ return nullptr; >+ } >+ >+ const SVGAttributeAccessor<OwnerType>* findAttributeAccessor(const QualifiedName& attributeName) const >+ { >+ return m_map.get(attributeName); >+ } >+ >+ HashMap<QualifiedName, const SVGAttributeAccessor<OwnerType>*> m_map; >+}; >+ >+} >diff --git a/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp b/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp >deleted file mode 100644 >index 9629e58ca27..00000000000 >--- a/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp >+++ /dev/null >@@ -1,86 +0,0 @@ >-/* >- * Copyright (C) Research In Motion Limited 2011. All rights reserved. >- * Copyright (C) 2015 Apple Inc. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "SVGAttributeToPropertyMap.h" >- >-#include "SVGAnimatedProperty.h" >- >-namespace WebCore { >- >-void SVGAttributeToPropertyMap::addProperties(const SVGAttributeToPropertyMap& map) >-{ >- for (auto& vector : map.m_map.values()) { >- ASSERT(!vector.isEmpty()); >- auto& properties = m_map.add(vector[0]->attributeName, PropertyInfoVector()).iterator->value; >- properties.reserveCapacity(properties.size() + vector.size()); >- for (auto* property : vector) >- properties.uncheckedAppend(property); >- } >-} >- >-void SVGAttributeToPropertyMap::addProperty(const SVGPropertyInfo& info) >-{ >- m_map.add(info.attributeName, PropertyInfoVector()).iterator->value.append(&info); >-} >- >-Vector<RefPtr<SVGAnimatedProperty>> SVGAttributeToPropertyMap::properties(SVGElement& contextElement, const QualifiedName& attributeName) const >-{ >- Vector<RefPtr<SVGAnimatedProperty>> properties; >- auto it = m_map.find(attributeName); >- if (it == m_map.end()) >- return properties; >- properties.reserveInitialCapacity(it->value.size()); >- for (auto* property : it->value) >- properties.uncheckedAppend(property->lookupOrCreateWrapperForAnimatedProperty(&contextElement)); >- return properties; >-} >- >-Vector<AnimatedPropertyType> SVGAttributeToPropertyMap::types(const QualifiedName& attributeName) const >-{ >- Vector<AnimatedPropertyType> types; >- auto it = m_map.find(attributeName); >- if (it == m_map.end()) >- return types; >- types.reserveInitialCapacity(it->value.size()); >- for (auto* property : it->value) >- types.uncheckedAppend(property->animatedPropertyType); >- return types; >-} >- >-void SVGAttributeToPropertyMap::synchronizeProperties(SVGElement& contextElement) const >-{ >- for (auto& vector : m_map.values()) { >- for (auto* property : vector) >- property->synchronizeProperty(&contextElement); >- } >-} >- >-bool SVGAttributeToPropertyMap::synchronizeProperty(SVGElement& contextElement, const QualifiedName& attributeName) const >-{ >- auto it = m_map.find(attributeName); >- if (it == m_map.end()) >- return false; >- for (auto* property : it->value) >- property->synchronizeProperty(&contextElement); >- return true; >-} >- >-} >diff --git a/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h b/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h >deleted file mode 100644 >index 94768056a35..00000000000 >--- a/Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h >+++ /dev/null >@@ -1,49 +0,0 @@ >-/* >- * Copyright (C) Research In Motion Limited 2011. All rights reserved. >- * Copyright (C) 2015 Apple Inc. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#include "SVGPropertyInfo.h" >-#include <wtf/HashMap.h> >- >-namespace WebCore { >- >-class SVGAnimatedProperty; >-class SVGElement; >- >-class SVGAttributeToPropertyMap { >-public: >- bool isEmpty() const { return m_map.isEmpty(); } >- >- void addProperty(const SVGPropertyInfo&); >- void addProperties(const SVGAttributeToPropertyMap&); >- >- Vector<RefPtr<SVGAnimatedProperty>> properties(SVGElement&, const QualifiedName& attributeName) const; >- Vector<AnimatedPropertyType> types(const QualifiedName& attributeName) const; >- >- void synchronizeProperties(SVGElement&) const; >- bool synchronizeProperty(SVGElement&, const QualifiedName& attributeName) const; >- >-private: >- typedef Vector<const SVGPropertyInfo*> PropertyInfoVector; >- HashMap<QualifiedName, PropertyInfoVector> m_map; >-}; >- >-} // namespace WebCore >diff --git a/Source/WebCore/svg/properties/SVGPropertyInfo.cpp b/Source/WebCore/svg/properties/SVGPropertyInfo.cpp >deleted file mode 100644 >index 45c862cd525..00000000000 >--- a/Source/WebCore/svg/properties/SVGPropertyInfo.cpp >+++ /dev/null >@@ -1,35 +0,0 @@ >-/* >- * Copyright (C) Research In Motion Limited 2011. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "SVGPropertyInfo.h" >- >-namespace WebCore { >- >-SVGPropertyInfo::SVGPropertyInfo(AnimatedPropertyType newType, AnimatedPropertyState newState, const QualifiedName& newAttributeName, const AtomicString& newPropertyIdentifier, SynchronizeProperty newSynchronizeProperty, LookupOrCreateWrapperForAnimatedProperty newLookupOrCreateWrapperForAnimatedProperty) >- : animatedPropertyType(newType) >- , animatedPropertyState(newState) >- , attributeName(newAttributeName) >- , propertyIdentifier(newPropertyIdentifier) >- , synchronizeProperty(newSynchronizeProperty) >- , lookupOrCreateWrapperForAnimatedProperty(newLookupOrCreateWrapperForAnimatedProperty) >-{ >-} >- >-} // namespace >diff --git a/Source/WebCore/svg/properties/SVGPropertyInfo.h b/Source/WebCore/svg/properties/SVGPropertyInfo.h >deleted file mode 100644 >index e1d5292dbc4..00000000000 >--- a/Source/WebCore/svg/properties/SVGPropertyInfo.h >+++ /dev/null >@@ -1,75 +0,0 @@ >-/* >- * Copyright (C) Research In Motion Limited 2011. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- */ >- >-#pragma once >- >-#include "QualifiedName.h" >- >-namespace WebCore { >- >-class SVGAnimatedProperty; >-class SVGElement; >- >-enum AnimatedPropertyState { >- PropertyIsReadWrite, >- PropertyIsReadOnly >-}; >- >-enum AnimatedPropertyType { >- AnimatedPropertyTypeMin = 0, >- AnimatedAngle = AnimatedPropertyTypeMin, >- AnimatedBoolean, >- AnimatedColor, >- AnimatedEnumeration, >- AnimatedInteger, >- AnimatedIntegerOptionalInteger, >- AnimatedLength, >- AnimatedLengthList, >- AnimatedNumber, >- AnimatedNumberList, >- AnimatedNumberOptionalNumber, >- AnimatedPath, >- AnimatedPoints, >- AnimatedPreserveAspectRatio, >- AnimatedRect, >- AnimatedString, >- AnimatedTransformList, >- AnimatedPropertyTypeMax, >- AnimatedUnknown = AnimatedPropertyTypeMax >-}; >- >-struct SVGPropertyInfo { >- WTF_MAKE_FAST_ALLOCATED; >-public: >- typedef void (*SynchronizeProperty)(SVGElement*); >- typedef Ref<SVGAnimatedProperty> (*LookupOrCreateWrapperForAnimatedProperty)(SVGElement*); >- >- SVGPropertyInfo(AnimatedPropertyType newType, AnimatedPropertyState newState, const QualifiedName& newAttributeName, >- const AtomicString& newPropertyIdentifier, SynchronizeProperty newSynchronizeProperty, >- LookupOrCreateWrapperForAnimatedProperty newLookupOrCreateWrapperForAnimatedProperty); >- >- AnimatedPropertyType animatedPropertyType; >- AnimatedPropertyState animatedPropertyState; >- const QualifiedName& attributeName; >- const AtomicString& propertyIdentifier; >- SynchronizeProperty synchronizeProperty; >- LookupOrCreateWrapperForAnimatedProperty lookupOrCreateWrapperForAnimatedProperty; >-}; >- >-} // namespace WebCore
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186751
:
342916
|
342917
|
342985
|
343001
|
343114
|
343123
|
343124
|
343127
|
343129
|
343162
|
343167
|
343169
|
343171
|
343174
|
343213
|
343217
|
343327
|
343335
|
343338
|
343339
|
343343
|
343415
|
343979
|
343989
|
344002
|
344513
|
344516
|
344523
|
344534
|
344536
|
344988
|
344990
|
346097
|
346103
|
346124
|
346129
|
346177
|
346179
|
346180
|
346182
|
346185
|
346188
|
346190
|
346192
|
346193
|
346197
|
346199
|
346201
|
346202
|
346203
|
346204
|
346205
|
346206
|
346207
|
346211
|
346212
|
346217
|
346224
|
346230
|
346233
|
346241
|
346244
|
346245
|
346315
|
346316
|
346317
|
346318
|
346319
|
346320
|
346322
|
346323
|
346324
|
346325
|
346326
|
346327
|
346328
|
346329
|
346330
|
346331
|
346332
|
346333
|
346334
|
346335
|
346336
|
346337
|
346338
|
346339
|
346340
|
346341
|
346342
|
346343
|
346344
|
346345
|
346346
|
346347
|
346348
|
346349
|
346350
|
346518
|
346519
|
346520
|
346521
|
346522
|
346524
|
346525
|
346526
|
346527
|
346528
|
346529
|
346530
|
346531
|
346532
|
346533
|
346534
|
346535
|
346536
|
346537
|
346538
|
346539
|
346540
|
346541
|
346545
|
346546
|
346549
|
346551
|
346552
|
346601
|
346602
|
346611
|
346636
|
346642