WebKit Bugzilla
Attachment 343327 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
bug-186751-20180622083655.patch (text/plain), 755.62 KB, created by
Said Abou-Hallawa
on 2018-06-22 08:36:56 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-06-22 08:36:56 PDT
Size:
755.62 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 233079) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,847 @@ >+2018-06-22 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!). >+ >+ This patch is for EWS. I may need to break it into smaller patches once >+ it passes the EWS. >+ >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * accessibility/AccessibilitySVGElement.cpp: >+ (WebCore::AccessibilitySVGElement::targetForUseElement const): >+ * bindings/scripts/CodeGenerator.pm: >+ (AttributeNameForGetterAndSetter): >+ * css/CSSCursorImageValue.cpp: >+ (WebCore::CSSCursorImageValue::cursorElementChanged): >+ (WebCore::CSSCursorImageValue::loadImage): >+ * rendering/FilterEffectRenderer.cpp: >+ (WebCore::FilterEffectRenderer::buildReferenceFilter): >+ * rendering/svg/RenderSVGForeignObject.cpp: >+ (WebCore::RenderSVGForeignObject::layout): >+ * rendering/svg/RenderSVGImage.cpp: >+ (WebCore::RenderSVGImage::updateImageViewport): >+ (WebCore::RenderSVGImage::paintForeground): >+ * rendering/svg/RenderSVGRect.cpp: >+ (WebCore::RenderSVGRect::updateShapeFromElement): >+ * rendering/svg/RenderSVGResourceClipper.cpp: >+ (WebCore::RenderSVGResourceClipper::pathOnlyClipping): >+ (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage): >+ (WebCore::RenderSVGResourceClipper::hitTestClipContent): >+ (WebCore::RenderSVGResourceClipper::resourceBoundingBox): >+ * rendering/svg/RenderSVGResourceClipper.h: >+ * rendering/svg/RenderSVGResourceFilter.cpp: >+ (WebCore::RenderSVGResourceFilter::buildPrimitives const): >+ (WebCore::RenderSVGResourceFilter::applyResource): >+ (WebCore::RenderSVGResourceFilter::resourceBoundingBox): >+ * rendering/svg/RenderSVGResourceFilter.h: >+ * rendering/svg/RenderSVGResourceMarker.cpp: >+ (WebCore::RenderSVGResourceMarker::referencePoint const): >+ (WebCore::RenderSVGResourceMarker::angle const): >+ (WebCore::RenderSVGResourceMarker::markerTransformation const): >+ (WebCore::RenderSVGResourceMarker::draw): >+ (WebCore::RenderSVGResourceMarker::calcViewport): >+ * rendering/svg/RenderSVGResourceMarker.h: >+ * rendering/svg/RenderSVGResourceMasker.cpp: >+ (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage): >+ (WebCore::RenderSVGResourceMasker::resourceBoundingBox): >+ * rendering/svg/RenderSVGResourceMasker.h: >+ * rendering/svg/RenderSVGRoot.cpp: >+ (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation const): >+ * rendering/svg/RenderSVGTextPath.cpp: >+ (WebCore::RenderSVGTextPath::layoutPath const): >+ (WebCore::RenderSVGTextPath::startOffset const): >+ (WebCore::RenderSVGTextPath::exactAlignment const): >+ (WebCore::RenderSVGTextPath::stretchMethod const): >+ * rendering/svg/RenderSVGTransformableContainer.cpp: >+ (WebCore::RenderSVGTransformableContainer::calculateLocalTransform): >+ * rendering/svg/RenderSVGViewportContainer.cpp: >+ (WebCore::RenderSVGViewportContainer::calcViewport): >+ * rendering/svg/SVGPathData.cpp: >+ (WebCore::pathFromLineElement): >+ * rendering/svg/SVGRenderTreeAsText.cpp: >+ (WebCore::operator<<): >+ (WebCore::writeSVGGradientStop): >+ * rendering/svg/SVGResources.cpp: >+ (WebCore::targetReferenceFromResource): >+ (WebCore::SVGResources::markerReverseStart const): >+ * rendering/svg/SVGTextChunk.cpp: >+ (WebCore::SVGTextChunk::SVGTextChunk): >+ * rendering/svg/SVGTextLayoutAttributesBuilder.cpp: >+ (WebCore::SVGTextLayoutAttributesBuilder::fillCharacterDataMap): >+ * rendering/svg/SVGTextLayoutEngine.cpp: >+ (WebCore::SVGTextLayoutEngine::parentDefinesTextLength const): >+ (WebCore::SVGTextLayoutEngine::beginTextPathLayout): >+ * svg/SVGAElement.cpp: >+ (WebCore::SVGAElement::SVGAElement): >+ (WebCore::SVGAElement::registerAttributes): >+ (WebCore::SVGAElement::parseAttribute): >+ (WebCore::SVGAElement::svgAttributeChanged): >+ (WebCore::SVGAElement::defaultEventHandler): >+ * svg/SVGAElement.h: >+ * 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.cpp: >+ * 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::attributeRegistry): >+ (WebCore::SVGComponentTransferFunctionElement::isKnownAttribute): >+ * svg/SVGCursorElement.cpp: >+ (WebCore::SVGCursorElement::SVGCursorElement): >+ (WebCore::SVGCursorElement::registerAttributes): >+ (WebCore::SVGCursorElement::parseAttribute): >+ (WebCore::SVGCursorElement::svgAttributeChanged): >+ (WebCore::SVGCursorElement::addSubresourceAttributeURLs const): >+ (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::attributeRegistryBridge const): >+ (WebCore::SVGElement::animatedPropertyWillBeDeleted): >+ (WebCore::SVGElement::synchronizeAttribute): >+ (WebCore::SVGElement::synchronizeAttributes): >+ (WebCore::SVGElement::animatedTypes const): >+ (WebCore::SVGElement::lookupAnimatedProperty const): >+ (WebCore::SVGElement::lookupOrCreateAnimatedProperty): >+ (WebCore::SVGElement::lookupOrCreateAnimatedProperties): >+ (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::externalResourcesRequired const): >+ (WebCore::SVGExternalResourcesRequired::setExternalResourcesRequired): >+ (WebCore::SVGExternalResourcesRequired::attributeRegistry): >+ (WebCore::SVGExternalResourcesRequired::isKnownAttribute): >+ * svg/SVGFEBlendElement.cpp: >+ (WebCore::SVGFEBlendElement::SVGFEBlendElement): >+ (WebCore::SVGFEBlendElement::registerAttributes): >+ (WebCore::SVGFEBlendElement::parseAttribute): >+ (WebCore::SVGFEBlendElement::setFilterEffectAttribute): >+ (WebCore::SVGFEBlendElement::svgAttributeChanged): >+ (WebCore::SVGFEBlendElement::build): >+ * svg/SVGFEBlendElement.h: >+ * svg/SVGFEColorMatrixElement.cpp: >+ (WebCore::SVGFEColorMatrixElement::SVGFEColorMatrixElement): >+ (WebCore::SVGFEColorMatrixElement::registerAttributes): >+ (WebCore::SVGFEColorMatrixElement::parseAttribute): >+ (WebCore::SVGFEColorMatrixElement::setFilterEffectAttribute): >+ (WebCore::SVGFEColorMatrixElement::svgAttributeChanged): >+ (WebCore::SVGFEColorMatrixElement::build): >+ * svg/SVGFEColorMatrixElement.h: >+ * svg/SVGFEComponentTransferElement.cpp: >+ (WebCore::SVGFEComponentTransferElement::SVGFEComponentTransferElement): >+ (WebCore::SVGFEComponentTransferElement::registerAttributes): >+ (WebCore::SVGFEComponentTransferElement::parseAttribute): >+ (WebCore::SVGFEComponentTransferElement::build): >+ * svg/SVGFEComponentTransferElement.h: >+ * svg/SVGFECompositeElement.cpp: >+ (WebCore::SVGFECompositeElement::SVGFECompositeElement): >+ (WebCore::SVGFECompositeElement::registerAttributes): >+ (WebCore::SVGFECompositeElement::parseAttribute): >+ (WebCore::SVGFECompositeElement::setFilterEffectAttribute): >+ (WebCore::SVGFECompositeElement::svgAttributeChanged): >+ (WebCore::SVGFECompositeElement::build): >+ * svg/SVGFECompositeElement.h: >+ * svg/SVGFEConvolveMatrixElement.cpp: >+ (WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement): >+ (WebCore::SVGFEConvolveMatrixElement::registerAttributes): >+ (WebCore::SVGFEConvolveMatrixElement::parseAttribute): >+ (WebCore::SVGFEConvolveMatrixElement::setFilterEffectAttribute): >+ (WebCore::SVGFEConvolveMatrixElement::setOrder): >+ (WebCore::SVGFEConvolveMatrixElement::setKernelUnitLength): >+ (WebCore::SVGFEConvolveMatrixElement::svgAttributeChanged): >+ (WebCore::SVGFEConvolveMatrixElement::build): >+ * svg/SVGFEConvolveMatrixElement.h: >+ (WebCore::SVGPropertyTraits<EdgeModeType>::initialValue): >+ * svg/SVGFEDiffuseLightingElement.cpp: >+ (WebCore::SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement): >+ (WebCore::SVGFEDiffuseLightingElement::registerAttributes): >+ (WebCore::SVGFEDiffuseLightingElement::parseAttribute): >+ (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute): >+ (WebCore::SVGFEDiffuseLightingElement::svgAttributeChanged): >+ (WebCore::SVGFEDiffuseLightingElement::build): >+ * svg/SVGFEDiffuseLightingElement.h: >+ * svg/SVGFEDisplacementMapElement.cpp: >+ (WebCore::SVGFEDisplacementMapElement::SVGFEDisplacementMapElement): >+ (WebCore::SVGFEDisplacementMapElement::registerAttributes): >+ (WebCore::SVGFEDisplacementMapElement::parseAttribute): >+ (WebCore::SVGFEDisplacementMapElement::setFilterEffectAttribute): >+ (WebCore::SVGFEDisplacementMapElement::svgAttributeChanged): >+ (WebCore::SVGFEDisplacementMapElement::build): >+ * svg/SVGFEDisplacementMapElement.h: >+ * svg/SVGFEDistantLightElement.cpp: >+ (WebCore::SVGFEDistantLightElement::lightSource const): >+ * svg/SVGFEDropShadowElement.cpp: >+ (WebCore::SVGFEDropShadowElement::SVGFEDropShadowElement): >+ (WebCore::SVGFEDropShadowElement::setStdDeviation): >+ (WebCore::SVGFEDropShadowElement::registerAttributes): >+ (WebCore::SVGFEDropShadowElement::parseAttribute): >+ (WebCore::SVGFEDropShadowElement::svgAttributeChanged): >+ (WebCore::SVGFEDropShadowElement::build): >+ * svg/SVGFEDropShadowElement.h: >+ * svg/SVGFEGaussianBlurElement.cpp: >+ (WebCore::SVGFEGaussianBlurElement::SVGFEGaussianBlurElement): >+ (WebCore::SVGFEGaussianBlurElement::setStdDeviation): >+ (WebCore::SVGFEGaussianBlurElement::registerAttributes): >+ (WebCore::SVGFEGaussianBlurElement::parseAttribute): >+ (WebCore::SVGFEGaussianBlurElement::svgAttributeChanged): >+ (WebCore::SVGFEGaussianBlurElement::build): >+ * svg/SVGFEGaussianBlurElement.h: >+ * svg/SVGFEImageElement.cpp: >+ (WebCore::SVGFEImageElement::SVGFEImageElement): >+ (WebCore::SVGFEImageElement::requestImageResource): >+ (WebCore::SVGFEImageElement::buildPendingResource): >+ (WebCore::SVGFEImageElement::registerAttributes): >+ (WebCore::SVGFEImageElement::parseAttribute): >+ (WebCore::SVGFEImageElement::svgAttributeChanged): >+ (WebCore::SVGFEImageElement::build): >+ (WebCore::SVGFEImageElement::addSubresourceAttributeURLs const): >+ * svg/SVGFEImageElement.h: >+ * svg/SVGFELightElement.cpp: >+ (WebCore::SVGFELightElement::SVGFELightElement): >+ (WebCore::SVGFELightElement::registerAttributes): >+ (WebCore::SVGFELightElement::parseAttribute): >+ (WebCore::SVGFELightElement::svgAttributeChanged): >+ * svg/SVGFELightElement.h: >+ (WebCore::SVGFELightElement::attributeRegistry): >+ (WebCore::SVGFELightElement::isKnownAttribute): >+ * svg/SVGFEMergeElement.cpp: >+ (WebCore::SVGFEMergeElement::build): >+ * svg/SVGFEMergeNodeElement.cpp: >+ (WebCore::SVGFEMergeNodeElement::SVGFEMergeNodeElement): >+ (WebCore::SVGFEMergeNodeElement::registerAttributes): >+ (WebCore::SVGFEMergeNodeElement::parseAttribute): >+ (WebCore::SVGFEMergeNodeElement::svgAttributeChanged): >+ * svg/SVGFEMergeNodeElement.h: >+ * svg/SVGFEMorphologyElement.cpp: >+ (WebCore::SVGFEMorphologyElement::SVGFEMorphologyElement): >+ (WebCore::SVGFEMorphologyElement::registerAttributes): >+ (WebCore::SVGFEMorphologyElement::setRadius): >+ (WebCore::SVGFEMorphologyElement::parseAttribute): >+ (WebCore::SVGFEMorphologyElement::setFilterEffectAttribute): >+ (WebCore::SVGFEMorphologyElement::svgAttributeChanged): >+ (WebCore::SVGFEMorphologyElement::build): >+ * svg/SVGFEMorphologyElement.h: >+ * svg/SVGFEOffsetElement.cpp: >+ (WebCore::SVGFEOffsetElement::SVGFEOffsetElement): >+ (WebCore::SVGFEOffsetElement::registerAttributes): >+ (WebCore::SVGFEOffsetElement::parseAttribute): >+ (WebCore::SVGFEOffsetElement::svgAttributeChanged): >+ (WebCore::SVGFEOffsetElement::build): >+ * svg/SVGFEOffsetElement.h: >+ * svg/SVGFEPointLightElement.cpp: >+ (WebCore::SVGFEPointLightElement::lightSource const): >+ * svg/SVGFESpecularLightingElement.cpp: >+ (WebCore::SVGFESpecularLightingElement::SVGFESpecularLightingElement): >+ (WebCore::SVGFESpecularLightingElement::registerAttributes): >+ (WebCore::SVGFESpecularLightingElement::parseAttribute): >+ (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute): >+ (WebCore::SVGFESpecularLightingElement::svgAttributeChanged): >+ (WebCore::SVGFESpecularLightingElement::build): >+ * svg/SVGFESpecularLightingElement.h: >+ * svg/SVGFESpotLightElement.cpp: >+ (WebCore::SVGFESpotLightElement::lightSource const): >+ * svg/SVGFETileElement.cpp: >+ (WebCore::SVGFETileElement::SVGFETileElement): >+ (WebCore::SVGFETileElement::registerAttributes): >+ (WebCore::SVGFETileElement::parseAttribute): >+ (WebCore::SVGFETileElement::svgAttributeChanged): >+ (WebCore::SVGFETileElement::build): >+ * svg/SVGFETileElement.h: >+ * svg/SVGFETurbulenceElement.cpp: >+ (WebCore::SVGFETurbulenceElement::SVGFETurbulenceElement): >+ (WebCore::SVGFETurbulenceElement::registerAttributes): >+ (WebCore::SVGFETurbulenceElement::parseAttribute): >+ (WebCore::SVGFETurbulenceElement::setFilterEffectAttribute): >+ (WebCore::SVGFETurbulenceElement::svgAttributeChanged): >+ (WebCore::SVGFETurbulenceElement::build): >+ * 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::isKnownAttribute): >+ * svg/SVGFitToViewBox.cpp: >+ (WebCore::SVGFitToViewBox::SVGFitToViewBox): >+ (WebCore::SVGFitToViewBox::registerAttributes): >+ (WebCore::SVGFitToViewBox::reset): >+ (WebCore::SVGFitToViewBox::parseAttribute): >+ (WebCore::SVGFitToViewBox::parseViewBox): >+ (WebCore::SVGFitToViewBox::isKnownAttribute): Deleted. >+ (WebCore::SVGFitToViewBox::addSupportedAttributes): Deleted. >+ * svg/SVGFitToViewBox.h: >+ (WebCore::SVGFitToViewBox::viewBox const): >+ (WebCore::SVGFitToViewBox::setViewBox): >+ (WebCore::SVGFitToViewBox::resetViewBox): >+ (WebCore::SVGFitToViewBox::preserveAspectRatio const): >+ (WebCore::SVGFitToViewBox::setPreserveAspectRatio): >+ (WebCore::SVGFitToViewBox::resetPreserveAspectRatio): >+ (WebCore::SVGFitToViewBox::viewBoxString const): >+ (WebCore::SVGFitToViewBox::preserveAspectRatioString const): >+ (WebCore::SVGFitToViewBox::hasValidViewBox const): >+ (WebCore::SVGFitToViewBox::hasEmptyViewBox const): >+ (WebCore::SVGFitToViewBox::attributeRegistry): >+ (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::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::buildStops): >+ (WebCore::SVGGradientElement::isSupportedAttribute): Deleted. >+ * svg/SVGGradientElement.h: >+ (WebCore::SVGGradientElement::attributeRegistry): >+ (WebCore::SVGGradientElement::isKnownAttribute): >+ * svg/SVGGraphicsElement.cpp: >+ (WebCore::SVGGraphicsElement::SVGGraphicsElement): >+ (WebCore::SVGGraphicsElement::animatedLocalTransform const): >+ (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::isKnownAttribute): >+ * svg/SVGImageElement.cpp: >+ (WebCore::SVGImageElement::SVGImageElement): >+ (WebCore::SVGImageElement::registerAttributes): >+ (WebCore::SVGImageElement::parseAttribute): >+ (WebCore::SVGImageElement::svgAttributeChanged): >+ (WebCore::SVGImageElement::haveLoadedRequiredResources): >+ (WebCore::SVGImageElement::addSubresourceAttributeURLs const): >+ (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/SVGLengthContext.h: >+ (WebCore::SVGLengthContext::resolveRectangle): >+ * svg/SVGLineElement.cpp: >+ (WebCore::SVGLineElement::SVGLineElement): >+ (WebCore::SVGLineElement::registerAttributes): >+ (WebCore::SVGLineElement::parseAttribute): >+ (WebCore::SVGLineElement::svgAttributeChanged): >+ (WebCore::SVGLineElement::selfHasRelativeLengths const): >+ (WebCore::SVGLineElement::isSupportedAttribute): Deleted. >+ * svg/SVGLineElement.h: >+ * svg/SVGLinearGradientElement.cpp: >+ (WebCore::SVGLinearGradientElement::SVGLinearGradientElement): >+ (WebCore::SVGLinearGradientElement::registerAttributes): >+ (WebCore::SVGLinearGradientElement::parseAttribute): >+ (WebCore::SVGLinearGradientElement::svgAttributeChanged): >+ (WebCore::setGradientAttributes): >+ (WebCore::SVGLinearGradientElement::collectGradientAttributes): >+ (WebCore::SVGLinearGradientElement::selfHasRelativeLengths const): >+ (WebCore::SVGLinearGradientElement::isSupportedAttribute): Deleted. >+ * svg/SVGLinearGradientElement.h: >+ * svg/SVGMPathElement.cpp: >+ (WebCore::SVGMPathElement::SVGMPathElement): >+ (WebCore::SVGMPathElement::buildPendingResource): >+ (WebCore::SVGMPathElement::svgAttributeChanged): >+ (WebCore::SVGMPathElement::pathElement): >+ * svg/SVGMPathElement.h: >+ * svg/SVGMarkerElement.cpp: >+ (WebCore::SVGMarkerElement::SVGMarkerElement): >+ (WebCore::SVGMarkerElement::viewBoxToViewTransform const): >+ (WebCore::SVGMarkerElement::registerAttributes): >+ (WebCore::SVGMarkerElement::parseAttribute): >+ (WebCore::SVGMarkerElement::svgAttributeChanged): >+ (WebCore::SVGMarkerElement::setOrient): >+ (WebCore::SVGMarkerElement::selfHasRelativeLengths const): >+ (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/SVGMarkerTypes.h: >+ (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::toString): >+ * 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/SVGPathSegList.cpp: >+ * 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::localCoordinateSpaceTransform 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::setGradientAttributes): >+ (WebCore::SVGRadialGradientElement::collectGradientAttributes): >+ (WebCore::SVGRadialGradientElement::selfHasRelativeLengths const): >+ (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::localCoordinateSpaceTransform const): >+ (WebCore::SVGSVGElement::selfHasRelativeLengths const): >+ (WebCore::SVGSVGElement::currentViewBoxRect const): >+ (WebCore::SVGSVGElement::hasIntrinsicWidth const): >+ (WebCore::SVGSVGElement::hasIntrinsicHeight const): >+ (WebCore::SVGSVGElement::intrinsicWidth const): >+ (WebCore::SVGSVGElement::intrinsicHeight const): >+ (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): >+ (WebCore::SVGStopElement::svgAttributeChanged): >+ * 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): >+ (WebCore::SVGTRefElement::detachTarget): >+ (WebCore::SVGTRefElement::svgAttributeChanged): >+ (WebCore::SVGTRefElement::buildPendingResource): >+ * 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::handleAttributeChange): >+ (WebCore::SVGTests::requiredFeatures): >+ (WebCore::SVGTests::requiredExtensions): >+ (WebCore::SVGTests::systemLanguage): >+ (WebCore::createSVGTestPropertyInfo): Deleted. >+ (WebCore::createSVGTextAttributeToPropertyMap): Deleted. >+ (WebCore::SVGTests::attributeToPropertyMap): 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::isKnownAttribute): >+ (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::SVGAnimatedCustomLengthAttribute): >+ (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::synchronize): >+ (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::animatedProperty): >+ * svg/SVGTextElement.cpp: >+ (WebCore::SVGTextElement::animatedLocalTransform const): >+ * svg/SVGTextPathElement.cpp: >+ (WebCore::SVGTextPathElement::SVGTextPathElement): >+ (WebCore::SVGTextPathElement::registerAttributes): >+ (WebCore::SVGTextPathElement::parseAttribute): >+ (WebCore::SVGTextPathElement::svgAttributeChanged): >+ (WebCore::SVGTextPathElement::buildPendingResource): >+ (WebCore::SVGTextPathElement::selfHasRelativeLengths const): >+ (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::isKnownAttribute): >+ * svg/SVGTransformListValues.h: >+ * svg/SVGURIReference.cpp: >+ (WebCore::SVGURIReference::SVGURIReference): >+ (WebCore::SVGURIReference::registerAttributes): >+ (WebCore::SVGURIReference::attributeRegistry): >+ (WebCore::SVGURIReference::isKnownAttribute): >+ (WebCore::SVGURIReference::parseAttribute): >+ (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::toClipPath): >+ (WebCore::SVGUseElement::findTarget const): >+ (WebCore::SVGUseElement::selfHasRelativeLengths const): >+ (WebCore::SVGUseElement::notifyFinished): >+ (WebCore::SVGUseElement::updateExternalDocument): >+ * 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::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: Added. >+ (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::initialValue): >+ (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::toString): >+ (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::fromString): >+ * svg/graphics/SVGImage.cpp: >+ (WebCore::SVGImage::computeIntrinsicDimensions): >+ * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h: >+ * svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp: Added. >+ (WebCore::SVGAnimatedPathSegListPropertyTearOff::SVGAnimatedPathSegListPropertyTearOff): >+ (WebCore::SVGAnimatedPathSegListPropertyTearOff::animValDidChange): >+ * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h: >+ * svg/properties/SVGAnimatedProperty.cpp: >+ (WebCore::SVGAnimatedProperty::~SVGAnimatedProperty): >+ (WebCore::SVGAnimatedProperty::animatedPropertyCache): Deleted. >+ * svg/properties/SVGAnimatedProperty.h: >+ (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper): Deleted. >+ (WebCore::SVGAnimatedProperty::lookupWrapper): Deleted. >+ * svg/properties/SVGAnimatedPropertyMacros.h: Removed. >+ * svg/properties/SVGAnimatedPropertyType.h: Added. >+ * svg/properties/SVGAnimatedStaticPropertyTearOff.h: >+ * 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::animatedValue 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::SVGAttributeAccessor::animatedPropertyWillBeDeleted const): >+ (WebCore::SVGPropertyAttributeAccessor::singleton): >+ (WebCore::SVGPropertyAttributeAccessor::SVGPropertyAttributeAccessor): >+ (WebCore::SVGPropertyAttributeAccessor::attribute const): >+ (WebCore::SVGAnimatedAttributeAccessor::singleton): >+ (WebCore::SVGAnimatedAttributeAccessor::SVGAnimatedAttributeAccessor): >+ (WebCore::SVGAnimatedAttributeAccessor::lookupOrCreateAnimatedProperty const): >+ (WebCore::SVGAnimatedAttributeAccessor::lookupAnimatedProperty const): >+ (WebCore::SVGAnimatedAttributeAccessor::animatedPropertyCache): >+ (WebCore::SVGAnimatedPairAttributeAccessor::SVGAnimatedPairAttributeAccessor): >+ (WebCore::SVGAnimatedPairAttributeAccessor::secondAttribute const): >+ * 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::animatedPropertyWillBeDeleted const): >+ (WebCore::SVGAttributeRegistry::animatedTypesBaseTypes): >+ (WebCore::SVGAttributeRegistry::synchronizeAttributesBaseTypes): >+ (WebCore::SVGAttributeRegistry::synchronizeAttributeBaseTypes): >+ (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedPropertyBaseTypes): >+ (WebCore::SVGAttributeRegistry::lookupAnimatedPropertyBaseTypes): >+ (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedPropertiesBaseTypes): >+ (WebCore::SVGAttributeRegistry::animatedPropertyWillBeDeletedBaseTypes): >+ (WebCore::SVGAttributeRegistry::findAttributeAccessor const): >+ * svg/properties/SVGAttributeRegistryBridge.h: Added. >+ (WebCore::SVGAttributeRegistryBridgeImpl::SVGAttributeRegistryBridgeImpl): >+ (WebCore::SVGAttributeRegistryBridgeImpl::attributeRegistry): >+ (WebCore::SVGAttributeRegistryBridgeImpl::isKnownAttribute): >+ (WebCore::SVGAttributeRegistryBridgeImpl::isAnimatedLengthAttribute): >+ * svg/properties/SVGAttributeToPropertyMap.cpp: Removed. >+ * svg/properties/SVGAttributeToPropertyMap.h: Removed. >+ * svg/properties/SVGPropertyInfo.cpp: Removed. >+ * svg/properties/SVGPropertyInfo.h: Removed. >+ > 2018-06-20 Darin Adler <darin@apple.com> > > [Cocoa] Use the isDirectory: variants of NSURL methods more to eliminate unnecessary file system activity >Index: Source/WebCore/Sources.txt >=================================================================== >--- Source/WebCore/Sources.txt (revision 233069) >+++ Source/WebCore/Sources.txt (working copy) >@@ -2267,9 +2267,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 >Index: Source/WebCore/WebCore.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebCore/WebCore.xcodeproj/project.pbxproj (revision 233069) >+++ Source/WebCore/WebCore.xcodeproj/project.pbxproj (working copy) >@@ -233,7 +233,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 */; }; >@@ -267,7 +266,6 @@ > 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, ); }; }; >@@ -279,7 +277,6 @@ > 089582560E857A7E00F82C83 /* ImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 089582540E857A7E00F82C83 /* ImageLoader.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 089A8E07128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */; }; > 08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08A484760E5272C500C3FE76 /* ScriptElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- 08B35B13127B6A7C005314DD /* SVGAnimatedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 08B35B12127B6A7C005314DD /* SVGAnimatedNumber.h */; }; > 08B35B17127B6A88005314DD /* SVGAnimatedNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = 08B35B16127B6A88005314DD /* SVGAnimatedNumberList.h */; }; > 08C7A2C710DC7462002D368B /* SVGNames.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 656581E909D1508D000E61D7 /* SVGNames.h */; }; > 08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 08C859BF1274575300A5728D /* SVGAnimatedRect.h */; }; >@@ -293,7 +290,7 @@ > 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, ); }; }; >+ 08FB3F8413BC754C0099FC18 /* SVGAttributeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FB3F8313BC754C0099FC18 /* SVGAttributeRegistry.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 = (); }; }; >@@ -1711,11 +1708,16 @@ > 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, ); }; }; >+ 551A5E75208D9C3E001D2E11 /* SVGAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 551A5E73208D9B93001D2E11 /* SVGAttribute.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5546757B1FD212A9003B10B0 /* ImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 554675781FD1FC1A003B10B0 /* ImageSource.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 554D14A020C288CF005477A2 /* SVGAnimatedPropertyType.h in Headers */ = {isa = PBXBuildFile; fileRef = 554D149E20C27429005477A2 /* SVGAnimatedPropertyType.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, ); }; }; > 555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */; }; >+ 555C9B8120B75B8A00B7EB9D /* SVGAnimatedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 08B35B12127B6A7C005314DD /* SVGAnimatedNumber.h */; }; >+ 555C9B8320BBED9400B7EB9D /* SVGAttributeAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 555C9B8220BBEC3200B7EB9D /* SVGAttributeAccessor.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5576A5651D88A70800CCC04C /* ImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 5576A5631D88A70800CCC04C /* ImageFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 5584994E20CF035A001E9F50 /* SVGZoomAndPanType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5584994C20CEFECE001E9F50 /* SVGZoomAndPanType.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 55A336F71D8209F40022C4C7 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; }; > 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, ); }; }; >@@ -5443,7 +5445,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>"; }; >@@ -5492,7 +5493,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>"; }; >@@ -5526,8 +5526,7 @@ > 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>"; }; >+ 08FB3F8313BC754C0099FC18 /* SVGAttributeRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeRegistry.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>"; }; >@@ -8369,14 +8368,20 @@ > 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>"; }; >+ 551A5E73208D9B93001D2E11 /* SVGAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttribute.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>"; }; >+ 554D149E20C27429005477A2 /* SVGAnimatedPropertyType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyType.h; sourceTree = "<group>"; }; >+ 554D14A120C32725005477A2 /* SVGAnimatedPathSegListPropertyTearOff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPathSegListPropertyTearOff.cpp; sourceTree = "<group>"; }; > 5550CB411E955E3C00111AA0 /* ImageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageTypes.h; sourceTree = "<group>"; }; > 555130001E7CCCCA00A69E38 /* DecodingOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecodingOptions.h; sourceTree = "<group>"; }; > 555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDecoderCG.cpp; sourceTree = "<group>"; }; > 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDecoderCG.h; sourceTree = "<group>"; }; >+ 555C9B8220BBEC3200B7EB9D /* SVGAttributeAccessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeAccessor.h; sourceTree = "<group>"; }; >+ 555C9B8520C08D8900B7EB9D /* SVGAttributeRegistryBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeRegistryBridge.h; sourceTree = "<group>"; }; > 5576A5621D88A70800CCC04C /* ImageFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrame.cpp; sourceTree = "<group>"; }; > 5576A5631D88A70800CCC04C /* ImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFrame.h; sourceTree = "<group>"; }; >+ 5584994C20CEFECE001E9F50 /* SVGZoomAndPanType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGZoomAndPanType.h; sourceTree = "<group>"; }; > 5597FCCB2076C06800D35BB0 /* GlyphDisplayListCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlyphDisplayListCache.h; sourceTree = "<group>"; }; > 55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; }; > 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBackingStore.h; sourceTree = "<group>"; }; >@@ -12510,7 +12515,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>"; }; >@@ -15423,22 +15427,23 @@ > children = ( > 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */, > 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */, >+ 554D14A120C32725005477A2 /* SVGAnimatedPathSegListPropertyTearOff.cpp */, > 089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */, > 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */, > 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */, > 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */, >- 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */, > 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */, >+ 554D149E20C27429005477A2 /* SVGAnimatedPropertyType.h */, > 08525E621278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h */, > 085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */, >- 08FB17C013BC7E9100040086 /* SVGAttributeToPropertyMap.cpp */, >- 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */, >+ 551A5E73208D9B93001D2E11 /* SVGAttribute.h */, >+ 555C9B8220BBEC3200B7EB9D /* SVGAttributeAccessor.h */, >+ 08FB3F8313BC754C0099FC18 /* SVGAttributeRegistry.h */, >+ 555C9B8520C08D8900B7EB9D /* SVGAttributeRegistryBridge.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 */, >@@ -23368,6 +23373,7 @@ > B222795F0D00BF210071B782 /* SVGZoomAndPan.cpp */, > B22279600D00BF210071B782 /* SVGZoomAndPan.h */, > B22279610D00BF210071B782 /* SVGZoomAndPan.idl */, >+ 5584994C20CEFECE001E9F50 /* SVGZoomAndPanType.h */, > B2E4EC940D00C22B00432643 /* SVGZoomEvent.cpp */, > B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */, > B2E4EC960D00C22B00432643 /* SVGZoomEvent.idl */, >@@ -30329,7 +30335,7 @@ > 089021A9126EF5DE0092D5EA /* SVGAnimatedLength.h in Headers */, > 089021AD126EF5E90092D5EA /* SVGAnimatedLengthList.h in Headers */, > 088A0E04126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h in Headers */, >- 08B35B13127B6A7C005314DD /* SVGAnimatedNumber.h in Headers */, >+ 555C9B8120B75B8A00B7EB9D /* SVGAnimatedNumber.h in Headers */, > 08B35B17127B6A88005314DD /* SVGAnimatedNumberList.h in Headers */, > 431A2F9C13B6F2B0007791E4 /* SVGAnimatedNumberOptionalNumber.h in Headers */, > 0863951613B5FE5700BB344D /* SVGAnimatedPath.h in Headers */, >@@ -30338,8 +30344,8 @@ > 08FE0BC5127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h in Headers */, > 088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */, > 088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */, >- 088A0E07126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h in Headers */, > 088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */, >+ 554D14A020C288CF005477A2 /* SVGAnimatedPropertyType.h in Headers */, > 08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */, > 08525E631278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h in Headers */, > 084DB59B128008CC002A6D64 /* SVGAnimatedString.h in Headers */, >@@ -30353,7 +30359,9 @@ > B22279950D00BF220071B782 /* SVGAnimateTransformElement.h in Headers */, > B22279980D00BF220071B782 /* SVGAnimationElement.h in Headers */, > 439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */, >- 08FB3F8413BC754C0099FC18 /* SVGAttributeToPropertyMap.h in Headers */, >+ 551A5E75208D9C3E001D2E11 /* SVGAttribute.h in Headers */, >+ 555C9B8320BBED9400B7EB9D /* SVGAttributeAccessor.h in Headers */, >+ 08FB3F8413BC754C0099FC18 /* SVGAttributeRegistry.h in Headers */, > B222799C0D00BF220071B782 /* SVGCircleElement.h in Headers */, > B222799F0D00BF220071B782 /* SVGClipPathElement.h in Headers */, > B22279A50D00BF220071B782 /* SVGComponentTransferFunctionElement.h in Headers */, >@@ -30496,7 +30504,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 */, >@@ -30557,6 +30564,7 @@ > B2227AF30D00BF220071B782 /* SVGViewSpec.h in Headers */, > 8485228B1190173C006EDC7F /* SVGVKernElement.h in Headers */, > B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */, >+ 5584994E20CF035A001E9F50 /* SVGZoomAndPanType.h in Headers */, > B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */, > 46ECB6381FD0A3C80088E5AD /* SWClientConnection.h in Headers */, > 46658DC91FA24B8700F7DD54 /* SWContextManager.h in Headers */, >Index: Source/WebCore/accessibility/AccessibilitySVGElement.cpp >=================================================================== >--- Source/WebCore/accessibility/AccessibilitySVGElement.cpp (revision 233069) >+++ Source/WebCore/accessibility/AccessibilitySVGElement.cpp (working copy) >@@ -61,7 +61,7 @@ AccessibilityObject* AccessibilitySVGEle > return nullptr; > > SVGUseElement& use = downcast<SVGUseElement>(*element()); >- String href = use.href(); >+ String href = use.m_href.animatedValue(); > if (href.isEmpty()) > href = getAttribute(HTMLNames::hrefAttr); > >Index: Source/WebCore/bindings/scripts/CodeGenerator.pm >=================================================================== >--- Source/WebCore/bindings/scripts/CodeGenerator.pm (revision 233069) >+++ Source/WebCore/bindings/scripts/CodeGenerator.pm (working copy) >@@ -785,7 +785,9 @@ sub AttributeNameForGetterAndSetter > > # SVG animated types need to use a special attribute name. > # The rest of the special casing for SVG animated types is handled in the language-specific code generators. >- $attributeName .= "Animated" if $generator->IsSVGAnimatedType($attributeType); >+ if ($generator->IsSVGAnimatedType($attributeType)) { >+ $attributeName = "m_${attributeName}.animatedProperty"; >+ } > > return $attributeName; > } >Index: Source/WebCore/css/CSSCursorImageValue.cpp >=================================================================== >--- Source/WebCore/css/CSSCursorImageValue.cpp (revision 233069) >+++ Source/WebCore/css/CSSCursorImageValue.cpp (working copy) >@@ -91,10 +91,10 @@ void CSSCursorImageValue::cursorElementC > // FIXME: This will override hot spot specified in CSS, which is probably incorrect. > SVGLengthContext lengthContext(nullptr); > m_hasHotSpot = true; >- float x = std::round(cursorElement.x().value(lengthContext)); >+ float x = std::round(cursorElement.m_x.animatedValue().value(lengthContext)); > m_hotSpot.setX(static_cast<int>(x)); > >- float y = std::round(cursorElement.y().value(lengthContext)); >+ float y = std::round(cursorElement.m_y.animatedValue().value(lengthContext)); > m_hotSpot.setY(static_cast<int>(y)); > } > >@@ -104,8 +104,8 @@ std::pair<CachedImage*, float> CSSCursor > return downcast<CSSImageSetValue>(m_imageValue.get()).loadBestFitImage(loader, options); > > if (auto* cursorElement = updateCursorElement(*loader.document())) { >- if (cursorElement->href() != downcast<CSSImageValue>(m_imageValue.get()).url()) >- m_imageValue = CSSImageValue::create(loader.document()->completeURL(cursorElement->href())); >+ if (cursorElement->m_href.animatedValue() != downcast<CSSImageValue>(m_imageValue.get()).url()) >+ m_imageValue = CSSImageValue::create(loader.document()->completeURL(cursorElement->m_href.animatedValue())); > } > > return { downcast<CSSImageValue>(m_imageValue.get()).loadImage(loader, options), 1 }; >Index: Source/WebCore/rendering/FilterEffectRenderer.cpp >=================================================================== >--- Source/WebCore/rendering/FilterEffectRenderer.cpp (revision 233069) >+++ Source/WebCore/rendering/FilterEffectRenderer.cpp (working copy) >@@ -120,7 +120,7 @@ RefPtr<FilterEffect> FilterEffectRendere > if (effectElement.renderer()) > effect->setOperatingColorSpace(effectElement.renderer()->style().svgStyle().colorInterpolationFilters() == ColorInterpolation::LinearRGB ? ColorSpaceLinearRGB : ColorSpaceSRGB); > >- builder->add(effectElement.result(), effect); >+ builder->add(effectElement.m_result.animatedValue(), effect); > m_effects.append(*effect); > } > return effect; >Index: Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp (working copy) >@@ -149,8 +149,8 @@ void RenderSVGForeignObject::layout() > > // Cache viewport boundaries > SVGLengthContext lengthContext(&foreignObjectElement()); >- FloatPoint viewportLocation(foreignObjectElement().x().value(lengthContext), foreignObjectElement().y().value(lengthContext)); >- m_viewport = FloatRect(viewportLocation, FloatSize(foreignObjectElement().width().value(lengthContext), foreignObjectElement().height().value(lengthContext))); >+ FloatPoint viewportLocation(foreignObjectElement().m_x.animatedValue().value(lengthContext), foreignObjectElement().m_y.animatedValue().value(lengthContext)); >+ m_viewport = FloatRect(viewportLocation, FloatSize(foreignObjectElement().m_width.animatedValue().value(lengthContext), foreignObjectElement().m_height.animatedValue().value(lengthContext))); > if (!updateCachedBoundariesInParents) > updateCachedBoundariesInParents = oldViewport != m_viewport; > >Index: Source/WebCore/rendering/svg/RenderSVGImage.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGImage.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGImage.cpp (working copy) >@@ -74,14 +74,14 @@ bool RenderSVGImage::updateImageViewport > bool updatedViewport = false; > > SVGLengthContext lengthContext(&imageElement()); >- m_objectBoundingBox = FloatRect(imageElement().x().value(lengthContext), imageElement().y().value(lengthContext), imageElement().width().value(lengthContext), imageElement().height().value(lengthContext)); >+ m_objectBoundingBox = FloatRect(imageElement().m_x.animatedValue().value(lengthContext), imageElement().m_y.animatedValue().value(lengthContext), imageElement().m_width.animatedValue().value(lengthContext), imageElement().m_height.animatedValue().value(lengthContext)); > > URL imageSourceURL = document().completeURL(imageElement().imageSourceURL()); > > // Images with preserveAspectRatio=none should force non-uniform scaling. This can be achieved > // by setting the image's container size to its intrinsic size. > // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRatio’ attribute. >- if (imageElement().preserveAspectRatio().align() == SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_NONE) { >+ if (imageElement().m_preserveAspectRatio.animatedValue().align() == SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_NONE) { > if (CachedImage* cachedImage = imageResource().cachedImage()) { > LayoutSize intrinsicSize = cachedImage->imageSizeForRenderer(nullptr, style().effectiveZoom()); > if (intrinsicSize != imageResource().imageSize(style().effectiveZoom())) { >@@ -175,7 +175,7 @@ void RenderSVGImage::paintForeground(Pai > FloatRect destRect = m_objectBoundingBox; > FloatRect srcRect(0, 0, image->width(), image->height()); > >- imageElement().preserveAspectRatio().transformRect(destRect, srcRect); >+ imageElement().m_preserveAspectRatio.animatedValue().transformRect(destRect, srcRect); > > paintInfo.context().drawImage(*image, destRect, srcRect); > } >Index: Source/WebCore/rendering/svg/RenderSVGRect.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGRect.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGRect.cpp (working copy) >@@ -65,7 +65,7 @@ void RenderSVGRect::updateShapeFromEleme > > // Rendering enabled? Spec: "A value of zero disables rendering of the element." > if (!boundingBoxSize.isEmpty()) { >- if (rectElement().rx().value(lengthContext) > 0 || rectElement().ry().value(lengthContext) > 0 || hasNonScalingStroke()) { >+ if (rectElement().m_rx.animatedValue().value(lengthContext) > 0 || rectElement().m_ry.animatedValue().value(lengthContext) > 0 || hasNonScalingStroke()) { > // Fall back to RenderSVGShape > RenderSVGShape::updateShapeFromElement(); > m_usePathFallback = true; >Index: Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp (working copy) >@@ -111,7 +111,7 @@ bool RenderSVGResourceClipper::pathOnlyC > return false; > } > // Only one visible shape/path was found. Directly continue clipping and transform the content to userspace if necessary. >- if (clipPathElement().clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { >+ if (clipPathElement().m_clipPathUnits.animatedValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { > AffineTransform transform; > transform.translate(objectBoundingBox.location()); > transform.scale(objectBoundingBox.size()); >@@ -182,7 +182,7 @@ bool RenderSVGResourceClipper::drawConte > GraphicsContext& maskContext = clipperMaskImage->context(); > > AffineTransform maskContentTransformation; >- if (clipPathElement().clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { >+ if (clipPathElement().m_clipPathUnits.animatedValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { > maskContentTransformation.translate(objectBoundingBox.location()); > maskContentTransformation.scale(objectBoundingBox.size()); > maskContext.concatCTM(maskContentTransformation); >@@ -264,7 +264,7 @@ bool RenderSVGResourceClipper::hitTestCl > if (!SVGRenderSupport::pointInClippingArea(*this, point)) > return false; > >- if (clipPathElement().clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { >+ if (clipPathElement().m_clipPathUnits.animatedValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { > AffineTransform transform; > transform.translate(objectBoundingBox.location()); > transform.scale(objectBoundingBox.size()); >@@ -299,7 +299,7 @@ FloatRect RenderSVGResourceClipper::reso > if (m_clipBoundaries.isEmpty()) > calculateClipContentRepaintRect(); > >- if (clipPathElement().clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { >+ if (clipPathElement().m_clipPathUnits.animatedValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { > FloatRect objectBoundingBox = object.objectBoundingBox(); > AffineTransform transform; > transform.translate(objectBoundingBox.location()); >Index: Source/WebCore/rendering/svg/RenderSVGResourceClipper.h >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGResourceClipper.h (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGResourceClipper.h (working copy) >@@ -54,7 +54,7 @@ public: > > bool hitTestClipContent(const FloatRect&, const FloatPoint&); > >- SVGUnitTypes::SVGUnitType clipPathUnits() const { return clipPathElement().clipPathUnits(); } >+ SVGUnitTypes::SVGUnitType clipPathUnits() const { return clipPathElement().m_clipPathUnits.animatedValue(); } > > protected: > bool selfNeedsClientInvalidation() const override { return (everHadLayout() || m_clipper.size()) && selfNeedsLayout(); } >Index: Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (working copy) >@@ -89,7 +89,7 @@ std::unique_ptr<SVGFilterBuilder> Render > > // Add effects to the builder > auto builder = std::make_unique<SVGFilterBuilder>(SourceGraphic::create(filter)); >- builder->setPrimitiveUnits(filterElement().primitiveUnits()); >+ builder->setPrimitiveUnits(filterElement().m_primitiveUnits.animatedValue()); > builder->setTargetBoundingBox(targetBoundingBox); > > for (auto& element : childrenOfType<SVGFilterPrimitiveStandardAttributes>(filterElement())) { >@@ -100,10 +100,10 @@ std::unique_ptr<SVGFilterBuilder> Render > } > builder->appendEffectToEffectReferences(effect.copyRef(), element.renderer()); > element.setStandardAttributes(effect.get()); >- effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(&element, filterElement().primitiveUnits(), targetBoundingBox)); >+ effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilterPrimitiveStandardAttributes>(&element, filterElement().m_primitiveUnits.animatedValue(), targetBoundingBox)); > if (element.renderer()) > effect->setOperatingColorSpace(element.renderer()->style().svgStyle().colorInterpolationFilters() == ColorInterpolation::LinearRGB ? ColorSpaceLinearRGB : ColorSpaceSRGB); >- builder->add(element.result(), WTFMove(effect)); >+ builder->add(element.m_result.animatedValue(), WTFMove(effect)); > } > return builder; > } >@@ -125,7 +125,7 @@ bool RenderSVGResourceFilter::applyResou > auto filterData = std::make_unique<FilterData>(); > FloatRect targetBoundingBox = renderer.objectBoundingBox(); > >- filterData->boundaries = SVGLengthContext::resolveRectangle<SVGFilterElement>(&filterElement(), filterElement().filterUnits(), targetBoundingBox); >+ filterData->boundaries = SVGLengthContext::resolveRectangle<SVGFilterElement>(&filterElement(), filterElement().m_filterUnits.animatedValue(), targetBoundingBox); > if (filterData->boundaries.isEmpty()) > return false; > >@@ -144,7 +144,7 @@ bool RenderSVGResourceFilter::applyResou > FloatRect absoluteDrawingRegion = filterData->shearFreeAbsoluteTransform.mapRect(filterData->drawingRegion); > > // Create the SVGFilter object. >- bool primitiveBoundingBoxMode = filterElement().primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; >+ bool primitiveBoundingBoxMode = filterElement().m_primitiveUnits.animatedValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; > filterData->filter = SVGFilter::create(filterData->shearFreeAbsoluteTransform, absoluteDrawingRegion, targetBoundingBox, filterData->boundaries, primitiveBoundingBoxMode); > > // Create all relevant filter primitives. >@@ -156,8 +156,8 @@ bool RenderSVGResourceFilter::applyResou > // Also see http://www.w3.org/TR/SVG/filters.html#FilterEffectsRegion > FloatSize scale(1, 1); > if (filterElement().hasAttribute(SVGNames::filterResAttr)) { >- scale.setWidth(filterElement().filterResX() / absoluteFilterBoundaries.width()); >- scale.setHeight(filterElement().filterResY() / absoluteFilterBoundaries.height()); >+ scale.setWidth(filterElement().m_filterResX.animatedValue() / absoluteFilterBoundaries.width()); >+ scale.setHeight(filterElement().m_filterResY.animatedValue() / absoluteFilterBoundaries.height()); > } > > if (scale.isEmpty()) >@@ -301,7 +301,7 @@ void RenderSVGResourceFilter::postApplyR > > FloatRect RenderSVGResourceFilter::resourceBoundingBox(const RenderObject& object) > { >- return SVGLengthContext::resolveRectangle<SVGFilterElement>(&filterElement(), filterElement().filterUnits(), object.objectBoundingBox()); >+ return SVGLengthContext::resolveRectangle<SVGFilterElement>(&filterElement(), filterElement().m_filterUnits.animatedValue(), object.objectBoundingBox()); > } > > void RenderSVGResourceFilter::primitiveAttributeChanged(RenderObject* object, const QualifiedName& attribute) >Index: Source/WebCore/rendering/svg/RenderSVGResourceFilter.h >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGResourceFilter.h (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGResourceFilter.h (working copy) >@@ -72,8 +72,8 @@ public: > > std::unique_ptr<SVGFilterBuilder> buildPrimitives(SVGFilter&) const; > >- SVGUnitTypes::SVGUnitType filterUnits() const { return filterElement().filterUnits(); } >- SVGUnitTypes::SVGUnitType primitiveUnits() const { return filterElement().primitiveUnits(); } >+ SVGUnitTypes::SVGUnitType filterUnits() const { return filterElement().m_filterUnits.animatedValue(); } >+ SVGUnitTypes::SVGUnitType primitiveUnits() const { return filterElement().m_primitiveUnits.animatedValue(); } > > void primitiveAttributeChanged(RenderObject*, const QualifiedName&); > >Index: Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp (working copy) >@@ -88,14 +88,14 @@ const AffineTransform& RenderSVGResource > FloatPoint RenderSVGResourceMarker::referencePoint() const > { > SVGLengthContext lengthContext(&markerElement()); >- return FloatPoint(markerElement().refX().value(lengthContext), markerElement().refY().value(lengthContext)); >+ return FloatPoint(markerElement().m_refX.animatedValue().value(lengthContext), markerElement().m_refY.animatedValue().value(lengthContext)); > } > > float RenderSVGResourceMarker::angle() const > { > float angle = -1; >- if (markerElement().orientType() == SVGMarkerOrientAngle) >- angle = markerElement().orientAngle().value(); >+ if (markerElement().m_orientType.animatedValue() == SVGMarkerOrientAngle) >+ angle = markerElement().m_orientAngle.animatedValue().value(); > > return angle; > } >@@ -103,7 +103,7 @@ float RenderSVGResourceMarker::angle() c > AffineTransform RenderSVGResourceMarker::markerTransformation(const FloatPoint& origin, float autoAngle, float strokeWidth) const > { > float markerAngle = angle(); >- bool useStrokeWidth = markerElement().markerUnits() == SVGMarkerUnitsStrokeWidth; >+ bool useStrokeWidth = markerElement().m_markerUnits.animatedValue() == SVGMarkerUnitsStrokeWidth; > > AffineTransform transform; > transform.translate(origin); >@@ -115,7 +115,7 @@ AffineTransform RenderSVGResourceMarker: > 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); >@@ -148,8 +148,8 @@ void RenderSVGResourceMarker::calcViewpo > return; > > SVGLengthContext lengthContext(&markerElement()); >- float w = markerElement().markerWidth().value(lengthContext); >- float h = markerElement().markerHeight().value(lengthContext); >+ float w = markerElement().m_markerWidth.animatedValue().value(lengthContext); >+ float h = markerElement().m_markerHeight.animatedValue().value(lengthContext); > m_viewport = FloatRect(0, 0, w, h); > } > >Index: Source/WebCore/rendering/svg/RenderSVGResourceMarker.h >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGResourceMarker.h (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGResourceMarker.h (working copy) >@@ -55,7 +55,7 @@ public: > > FloatPoint referencePoint() const; > float angle() const; >- SVGMarkerUnitsType markerUnits() const { return markerElement().markerUnits(); } >+ SVGMarkerUnitsType markerUnits() const { return markerElement().m_markerUnits.animatedValue(); } > > RenderSVGResourceType resourceType() const override { return MarkerResourceType; } > >Index: Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp (working copy) >@@ -92,7 +92,7 @@ bool RenderSVGResourceMasker::drawConten > > // Eventually adjust the mask image context according to the target objectBoundingBox. > AffineTransform maskContentTransformation; >- if (maskElement().maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { >+ if (maskElement().m_maskContentUnits.animatedValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { > FloatRect objectBoundingBox = object->objectBoundingBox(); > maskContentTransformation.translate(objectBoundingBox.location()); > maskContentTransformation.scale(objectBoundingBox.size()); >@@ -141,7 +141,7 @@ void RenderSVGResourceMasker::calculateM > FloatRect RenderSVGResourceMasker::resourceBoundingBox(const RenderObject& object) > { > FloatRect objectBoundingBox = object.objectBoundingBox(); >- FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement>(&maskElement(), maskElement().maskUnits(), objectBoundingBox); >+ FloatRect maskBoundaries = SVGLengthContext::resolveRectangle<SVGMaskElement>(&maskElement(), maskElement().m_maskUnits.animatedValue(), objectBoundingBox); > > // Resource was not layouted yet. Give back clipping rect of the mask. > if (selfNeedsLayout()) >@@ -151,7 +151,7 @@ FloatRect RenderSVGResourceMasker::resou > calculateMaskContentRepaintRect(); > > FloatRect maskRect = m_maskContentBoundaries; >- if (maskElement().maskContentUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { >+ if (maskElement().m_maskContentUnits.animatedValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { > AffineTransform transform; > transform.translate(objectBoundingBox.location()); > transform.scale(objectBoundingBox.size()); >Index: Source/WebCore/rendering/svg/RenderSVGResourceMasker.h >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGResourceMasker.h (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGResourceMasker.h (working copy) >@@ -47,8 +47,8 @@ public: > bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override; > FloatRect resourceBoundingBox(const RenderObject&) override; > >- SVGUnitTypes::SVGUnitType maskUnits() const { return maskElement().maskUnits(); } >- SVGUnitTypes::SVGUnitType maskContentUnits() const { return maskElement().maskContentUnits(); } >+ SVGUnitTypes::SVGUnitType maskUnits() const { return maskElement().m_maskUnits.animatedValue(); } >+ SVGUnitTypes::SVGUnitType maskContentUnits() const { return maskElement().m_maskContentUnits.animatedValue(); } > > RenderSVGResourceType resourceType() const override { return MaskerResourceType; } > >Index: Source/WebCore/rendering/svg/RenderSVGRoot.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGRoot.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGRoot.cpp (working copy) >@@ -91,7 +91,7 @@ void RenderSVGRoot::computeIntrinsicRati > // aspect ratio is calculated from the width and height values of the ‘viewBox’ specified for the current SVG document > // fragment. If the ‘viewBox’ is not correctly specified, or set to 'none', the intrinsic aspect ratio cannot be > // calculated and is considered unspecified. >- FloatSize viewBoxSize = svgSVGElement().viewBox().size(); >+ FloatSize viewBoxSize = svgSVGElement().m_viewBox.animatedValue().size(); > if (!viewBoxSize.isEmpty()) { > // The viewBox can only yield an intrinsic ratio, not an intrinsic size. > intrinsicRatio = viewBoxSize.width() / static_cast<double>(viewBoxSize.height()); >Index: Source/WebCore/rendering/svg/RenderSVGTextPath.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGTextPath.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGTextPath.cpp (working copy) >@@ -46,7 +46,7 @@ SVGTextPathElement& RenderSVGTextPath::t > > Path RenderSVGTextPath::layoutPath() const > { >- Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement().href(), document()); >+ Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement().m_href.animatedValue(), document()); > if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag)) > return Path(); > >@@ -65,17 +65,17 @@ Path RenderSVGTextPath::layoutPath() con > > float RenderSVGTextPath::startOffset() const > { >- return textPathElement().startOffset().valueAsPercentage(); >+ return textPathElement().m_startOffset.animatedValue().valueAsPercentage(); > } > > bool RenderSVGTextPath::exactAlignment() const > { >- return textPathElement().spacing() == SVGTextPathSpacingExact; >+ return textPathElement().m_spacing.animatedValue() == SVGTextPathSpacingExact; > } > > bool RenderSVGTextPath::stretchMethod() const > { >- return textPathElement().method() == SVGTextPathMethodStretch; >+ return textPathElement().m_method.animatedValue() == SVGTextPathMethodStretch; > } > > } >Index: Source/WebCore/rendering/svg/RenderSVGTransformableContainer.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGTransformableContainer.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGTransformableContainer.cpp (working copy) >@@ -55,7 +55,7 @@ bool RenderSVGTransformableContainer::ca > > if (useElement) { > SVGLengthContext lengthContext(useElement); >- FloatSize translation(useElement->x().value(lengthContext), useElement->y().value(lengthContext)); >+ FloatSize translation(useElement->m_x.animatedValue().value(lengthContext), useElement->m_y.animatedValue().value(lengthContext)); > if (translation != m_lastTranslation) > m_needsTransformUpdate = true; > m_lastTranslation = translation; >Index: Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp >=================================================================== >--- Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp (working copy) >@@ -60,7 +60,7 @@ void RenderSVGViewportContainer::calcVie > { > SVGSVGElement& element = svgSVGElement(); > SVGLengthContext lengthContext(&element); >- FloatRect newViewport(element.x().value(lengthContext), element.y().value(lengthContext), element.width().value(lengthContext), element.height().value(lengthContext)); >+ FloatRect newViewport(element.m_x.animatedValue().value(lengthContext), element.m_y.animatedValue().value(lengthContext), element.m_width.animatedValue().value(lengthContext), element.m_height.animatedValue().value(lengthContext)); > > if (m_viewport == newViewport) > return; >Index: Source/WebCore/rendering/svg/SVGPathData.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGPathData.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/SVGPathData.cpp (working copy) >@@ -88,8 +88,8 @@ static Path pathFromLineElement(SVGEleme > const auto& line = downcast<SVGLineElement>(element); > > SVGLengthContext lengthContext(&element); >- path.moveTo(FloatPoint(line.x1().value(lengthContext), line.y1().value(lengthContext))); >- path.addLineTo(FloatPoint(line.x2().value(lengthContext), line.y2().value(lengthContext))); >+ path.moveTo(FloatPoint(line.m_x1.animatedValue().value(lengthContext), line.m_y1.animatedValue().value(lengthContext))); >+ path.addLineTo(FloatPoint(line.m_x2.animatedValue().value(lengthContext), line.m_y2.animatedValue().value(lengthContext))); > return path; > } > >Index: Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (working copy) >@@ -248,27 +248,27 @@ static TextStream& operator<<(TextStream > > if (is<SVGRectElement>(svgElement)) { > const SVGRectElement& element = downcast<SVGRectElement>(svgElement); >- writeNameValuePair(ts, "x", element.x().value(lengthContext)); >- writeNameValuePair(ts, "y", element.y().value(lengthContext)); >- writeNameValuePair(ts, "width", element.width().value(lengthContext)); >- writeNameValuePair(ts, "height", element.height().value(lengthContext)); >+ writeNameValuePair(ts, "x", element.m_x.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "y", element.m_y.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "width", element.m_width.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "height", element.m_height.animatedValue().value(lengthContext)); > } else if (is<SVGLineElement>(svgElement)) { > const SVGLineElement& element = downcast<SVGLineElement>(svgElement); >- writeNameValuePair(ts, "x1", element.x1().value(lengthContext)); >- writeNameValuePair(ts, "y1", element.y1().value(lengthContext)); >- writeNameValuePair(ts, "x2", element.x2().value(lengthContext)); >- writeNameValuePair(ts, "y2", element.y2().value(lengthContext)); >+ writeNameValuePair(ts, "x1", element.m_x1.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "y1", element.m_y1.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "x2", element.m_x2.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "y2", element.m_y2.animatedValue().value(lengthContext)); > } else if (is<SVGEllipseElement>(svgElement)) { > const SVGEllipseElement& element = downcast<SVGEllipseElement>(svgElement); >- writeNameValuePair(ts, "cx", element.cx().value(lengthContext)); >- writeNameValuePair(ts, "cy", element.cy().value(lengthContext)); >- writeNameValuePair(ts, "rx", element.rx().value(lengthContext)); >- writeNameValuePair(ts, "ry", element.ry().value(lengthContext)); >+ writeNameValuePair(ts, "cx", element.m_cx.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "cy", element.m_cy.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "rx", element.m_rx.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "ry", element.m_ry.animatedValue().value(lengthContext)); > } else if (is<SVGCircleElement>(svgElement)) { > const SVGCircleElement& element = downcast<SVGCircleElement>(svgElement); >- writeNameValuePair(ts, "cx", element.cx().value(lengthContext)); >- writeNameValuePair(ts, "cy", element.cy().value(lengthContext)); >- writeNameValuePair(ts, "r", element.r().value(lengthContext)); >+ writeNameValuePair(ts, "cx", element.m_cx.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "cy", element.m_cy.animatedValue().value(lengthContext)); >+ writeNameValuePair(ts, "r", element.m_r.animatedValue().value(lengthContext)); > } else if (is<SVGPolyElement>(svgElement)) { > const SVGPolyElement& element = downcast<SVGPolyElement>(svgElement); > writeNameAndQuotedValue(ts, "points", element.pointList().valueAsString()); >@@ -544,7 +544,7 @@ void writeSVGGradientStop(TextStream& ts > { > writeStandardPrefix(ts, stop, behavior); > >- ts << " [offset=" << stop.element().offset() << "] [color=" << stop.element().stopColorIncludingOpacity() << "]\n"; >+ ts << " [offset=" << stop.element().m_offset.animatedValue() << "] [color=" << stop.element().stopColorIncludingOpacity() << "]\n"; > } > > void writeResources(TextStream& ts, const RenderObject& renderer, RenderAsTextBehavior behavior) >Index: Source/WebCore/rendering/svg/SVGResources.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGResources.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/SVGResources.cpp (working copy) >@@ -142,11 +142,11 @@ static inline String targetReferenceFrom > { > String target; > if (is<SVGPatternElement>(element)) >- target = downcast<SVGPatternElement>(element).href(); >+ target = downcast<SVGPatternElement>(element).m_href.animatedValue(); > else if (is<SVGGradientElement>(element)) >- target = downcast<SVGGradientElement>(element).href(); >+ target = downcast<SVGGradientElement>(element).m_href.animatedValue(); > else if (is<SVGFilterElement>(element)) >- target = downcast<SVGFilterElement>(element).href(); >+ target = downcast<SVGFilterElement>(element).m_href.animatedValue(); > else > ASSERT_NOT_REACHED(); > >@@ -325,7 +325,7 @@ bool SVGResources::markerReverseStart() > { > return m_markerData > && m_markerData->markerStart >- && m_markerData->markerStart->markerElement().orientType() == SVGMarkerOrientAutoStartReverse; >+ && m_markerData->markerStart->markerElement().m_orientType.animatedValue() == SVGMarkerOrientAutoStartReverse; > } > > void SVGResources::removeClientFromCache(RenderElement& renderer, bool markForInvalidation) const >Index: Source/WebCore/rendering/svg/SVGTextChunk.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGTextChunk.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/SVGTextChunk.cpp (working copy) >@@ -57,7 +57,7 @@ SVGTextChunk::SVGTextChunk(const Vector< > SVGLengthContext lengthContext(textContentElement); > m_desiredTextLength = textContentElement->specifiedTextLength().value(lengthContext); > >- switch (textContentElement->lengthAdjust()) { >+ switch (textContentElement->m_lengthAdjust.animatedValue()) { > case SVGLengthAdjustUnknown: > break; > case SVGLengthAdjustSpacing: >Index: Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp (working copy) >@@ -178,11 +178,11 @@ static inline void updateCharacterData(u > > void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& position) > { >- const auto& xList = position.element->x(); >- const auto& yList = position.element->y(); >- const auto& dxList = position.element->dx(); >- const auto& dyList = position.element->dy(); >- const auto& rotateList = position.element->rotate(); >+ const auto& xList = position.element->m_x.animatedValue(); >+ const auto& yList = position.element->m_y.animatedValue(); >+ const auto& dxList = position.element->m_dx.animatedValue(); >+ const auto& dyList = position.element->m_dy.animatedValue(); >+ const auto& rotateList = position.element->m_rotate.animatedValue(); > > unsigned xListSize = xList.size(); > unsigned yListSize = yList.size(); >Index: Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp (revision 233069) >+++ Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp (working copy) >@@ -148,7 +148,7 @@ bool SVGTextLayoutEngine::parentDefinesT > while (currentParent) { > if (SVGTextContentElement* textContentElement = SVGTextContentElement::elementFromRenderer(currentParent)) { > SVGLengthContext lengthContext(textContentElement); >- if (textContentElement->lengthAdjust() == SVGLengthAdjustSpacing && textContentElement->specifiedTextLength().value(lengthContext) > 0) >+ if (textContentElement->m_lengthAdjust.animatedValue() == SVGLengthAdjustSpacing && textContentElement->specifiedTextLength().value(lengthContext) > 0) > return true; > } > >@@ -194,7 +194,7 @@ void SVGTextLayoutEngine::beginTextPathL > float totalLength = lineLayout.m_chunkLayoutBuilder.totalLength(); > unsigned totalCharacters = lineLayout.m_chunkLayoutBuilder.totalCharacters(); > >- if (textContentElement->lengthAdjust() == SVGLengthAdjustSpacing) >+ if (textContentElement->m_lengthAdjust.animatedValue() == SVGLengthAdjustSpacing) > m_textPathSpacing = (desiredTextLength - totalLength) / totalCharacters; > else > m_textPathScaling = desiredTextLength / totalLength; >Index: Source/WebCore/svg/SVGAElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGAElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGAElement.cpp (working copy) >@@ -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,29 +46,27 @@ 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) >+ , SVGURIReference(this) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::aTag)); >- registerAnimatedPropertiesForSVGAElement(); >+ registerAttributes(); > } > > Ref<SVGAElement> SVGAElement::create(const QualifiedName& tagName, Document& document) > { > return adoptRef(*new SVGAElement(tagName, document)); > } >+ >+void SVGAElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::targetAttr, &SVGAElement::m_svgTarget>(); >+} > > String SVGAElement::title() const > { >@@ -84,7 +82,7 @@ String SVGAElement::title() const > void SVGAElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { > if (name == SVGNames::targetAttr) { >- setSVGTargetBaseValue(value); >+ m_svgTarget.setValue(value); > return; > } > >@@ -97,11 +95,12 @@ void SVGAElement::svgAttributeChanged(co > { > if (SVGURIReference::isKnownAttribute(attrName)) { > bool wasLink = isLink(); >- setIsLink(!href().isNull() && !shouldProhibitLinks(this)); >+ setIsLink(!m_href.animatedValue().isNull() && !shouldProhibitLinks(this)); > if (wasLink != isLink()) { > InstanceInvalidationGuard guard(*this); > invalidateStyleForSubtree(); > } >+ return; > } > > SVGGraphicsElement::svgAttributeChanged(attrName); >@@ -125,7 +124,7 @@ void SVGAElement::defaultEventHandler(Ev > } > > if (MouseEvent::canTriggerActivationBehavior(event)) { >- String url = stripLeadingAndTrailingHTMLSpaces(href()); >+ String url = stripLeadingAndTrailingHTMLSpaces(m_href.animatedValue()); > > if (url[0] == '#') { > auto targetElement = makeRefPtr(treeScope().getElementById(url.substringSharingImpl(1))); >Index: Source/WebCore/svg/SVGAElement.h >=================================================================== >--- Source/WebCore/svg/SVGAElement.h (revision 233069) >+++ Source/WebCore/svg/SVGAElement.h (working copy) >@@ -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 >@@ -36,11 +37,11 @@ public: > private: > SVGAElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- >- String title() const final; >- String target() const final { return svgTarget(); } >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGAElement, SVGGraphicsElement, SVGURIReference, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static void registerAttributes(); > >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >@@ -48,6 +49,11 @@ private: > bool childShouldCreateRenderer(const Node&) const final; > > void defaultEventHandler(Event&) final; >+ >+ bool isValid() const final { return SVGTests::isValid(); } >+ >+ String title() const final; >+ String target() const final { return m_svgTarget.animatedValue(); } > > bool supportsFocus() const final; > bool isMouseFocusable() const final; >@@ -58,13 +64,10 @@ 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_svgTarget { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGAltGlyphElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGAltGlyphElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGAltGlyphElement.cpp (working copy) >@@ -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) >Index: Source/WebCore/svg/SVGAltGlyphElement.h >=================================================================== >--- Source/WebCore/svg/SVGAltGlyphElement.h (revision 233069) >+++ Source/WebCore/svg/SVGAltGlyphElement.h (working copy) >@@ -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 AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGAltGlyphElement, SVGTextPositioningElement, SVGURIReference>; >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } >+ > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGAnimatedAngle.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedAngle.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedAngle.h (working copy) >@@ -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 >@@ -20,23 +21,19 @@ > #pragma once > > #include "SVGAngle.h" >+#include "SVGAnimatedEnumeration.h" > #include "SVGAnimatedPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" >+#include "SVGMarkerTypes.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*); >Index: Source/WebCore/svg/SVGAnimatedBoolean.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedBoolean.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedBoolean.h (working copy) >@@ -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,21 @@ > > #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, ) >+class SVGAnimationElement; > >-#define DECLARE_ANIMATED_BOOLEAN_OVERRIDE(UpperProperty, LowerProperty) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedBoolean, bool, UpperProperty, LowerProperty, override) >+using SVGBooleanAttribute = SVGPropertyAttribute<bool>; >+using SVGAnimatedBoolean = SVGAnimatedStaticPropertyTearOff<bool>; >+using SVGAnimatedBooleanAttribute = SVGAnimatedAttribute<SVGAnimatedBoolean>; > >-#define DEFINE_ANIMATED_BOOLEAN(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedBoolean, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+template<typename OwnerType> >+using SVGBooleanAttributeAccessor = SVGPropertyAttributeAccessor<OwnerType, SVGBooleanAttribute>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedBooleanAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedBooleanAttribute, AnimatedBoolean>; > > class SVGAnimatedBooleanAnimator final : public SVGAnimatedTypeAnimator { > public: >Index: Source/WebCore/svg/SVGAnimatedEnumeration.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedEnumeration.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedEnumeration.h (working copy) >@@ -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,18 @@ > #pragma once > > #include "SVGAnimatedEnumerationPropertyTearOff.h" >-#include "SVGAnimatedPropertyMacros.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > > namespace WebCore { > >-typedef SVGAnimatedStaticPropertyTearOff<unsigned> SVGAnimatedEnumeration; >+using SVGAnimatedEnumeration = SVGAnimatedStaticPropertyTearOff<unsigned>; > >-// Helper macros to declare/define a SVGAnimatedEnumeration object >-#define DECLARE_ANIMATED_ENUMERATION(UpperProperty, LowerProperty, EnumType) \ >-DECLARE_ANIMATED_PROPERTY(SVGAnimatedEnumerationPropertyTearOff<EnumType>, EnumType, UpperProperty, LowerProperty, ) >+template<typename EnumType> >+using SVGAnimatedEnumerationAttribute = SVGAnimatedAttribute<SVGAnimatedEnumerationPropertyTearOff<EnumType>>; > >-#define DEFINE_ANIMATED_ENUMERATION(OwnerType, DOMAttribute, UpperProperty, LowerProperty, EnumType) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedEnumeration, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+template<typename OwnerType, typename EnumType> >+using SVGAnimatedEnumerationAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedEnumerationAttribute<EnumType>, AnimatedEnumeration>; > > class SVGAnimatedEnumerationAnimator final : public SVGAnimatedTypeAnimator { > public: >Index: Source/WebCore/svg/SVGAnimatedInteger.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedInteger.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedInteger.h (working copy) >@@ -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,26 +20,23 @@ > > #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, ) >- >-#define DEFINE_ANIMATED_INTEGER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedInteger, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) >+class SVGAnimationElement; > >-#define DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ >-DEFINE_ANIMATED_PROPERTY(AnimatedIntegerOptionalInteger, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) >+using SVGAnimatedInteger = SVGAnimatedStaticPropertyTearOff<int>; >+using SVGAnimatedIntegerAttribute = SVGAnimatedAttribute<SVGAnimatedInteger>; > >-class SVGAnimationElement; >+template<typename OwnerType> >+using SVGAnimatedIntegerAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedIntegerAttribute, AnimatedInteger>; > >+template<typename OwnerType> >+using SVGAnimatedOptionalIntegerAttributeAccessor = SVGAnimatedOptionalAttributeAccessor<OwnerType, SVGAnimatedIntegerAttribute, AnimatedIntegerOptionalInteger>; >+ > class SVGAnimatedIntegerAnimator final : public SVGAnimatedTypeAnimator { > public: > SVGAnimatedIntegerAnimator(SVGAnimationElement*, SVGElement*); >Index: Source/WebCore/svg/SVGAnimatedLength.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedLength.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedLength.h (working copy) >@@ -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: >Index: Source/WebCore/svg/SVGAnimatedLengthList.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedLengthList.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedLengthList.h (working copy) >@@ -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: >Index: Source/WebCore/svg/SVGAnimatedNumber.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedNumber.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedNumber.h (working copy) >@@ -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: >Index: Source/WebCore/svg/SVGAnimatedNumberList.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedNumberList.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedNumberList.h (working copy) >@@ -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: >Index: Source/WebCore/svg/SVGAnimatedPath.cpp >=================================================================== >--- Source/WebCore/svg/SVGAnimatedPath.cpp (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedPath.cpp (working copy) >@@ -21,7 +21,6 @@ > #include "SVGAnimatedPath.h" > > #include "SVGAnimateElementBase.h" >-#include "SVGAnimatedPathSegListPropertyTearOff.h" > > namespace WebCore { > >Index: Source/WebCore/svg/SVGAnimatedPath.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedPath.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedPath.h (working copy) >@@ -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,20 @@ > > #pragma once > >+#include "SVGAnimatedPathSegListPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > > namespace WebCore { > > class SVGAnimationElement; > >+using SVGAnimatedPathSegList = SVGAnimatedPathSegListPropertyTearOff; >+using SVGAnimatedPathSegListAttribute = SVGAnimatedAttributeList<SVGAnimatedPathSegList>; >+ >+template<typename OwnerType> >+using SVGAnimatedPathSegListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedPathSegListAttribute, AnimatedPath>; >+ > class SVGAnimatedPathAnimator final : public SVGAnimatedTypeAnimator { > public: > SVGAnimatedPathAnimator(SVGAnimationElement*, SVGElement*); >Index: Source/WebCore/svg/SVGAnimatedPointList.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedPointList.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedPointList.h (working copy) >@@ -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 >@@ -21,13 +22,18 @@ > > #include "SVGAnimatedListPropertyTearOff.h" > #include "SVGAnimatedTypeAnimator.h" >+#include "SVGAttributeAccessor.h" > #include "SVGPointList.h" > > 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: >Index: Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h (working copy) >@@ -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: >Index: Source/WebCore/svg/SVGAnimatedRect.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedRect.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedRect.h (working copy) >@@ -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: >Index: Source/WebCore/svg/SVGAnimatedString.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedString.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedString.h (working copy) >@@ -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: >Index: Source/WebCore/svg/SVGAnimatedTransformList.h >=================================================================== >--- Source/WebCore/svg/SVGAnimatedTransformList.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedTransformList.h (working copy) >@@ -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: >Index: Source/WebCore/svg/SVGAnimatedTypeAnimator.cpp >=================================================================== >--- Source/WebCore/svg/SVGAnimatedTypeAnimator.cpp (revision 233069) >+++ Source/WebCore/svg/SVGAnimatedTypeAnimator.cpp (working copy) >@@ -22,7 +22,6 @@ > #include "config.h" > #include "SVGAnimatedTypeAnimator.h" > >-#include "SVGAttributeToPropertyMap.h" > #include "SVGElement.h" > > namespace WebCore { >@@ -56,16 +55,14 @@ SVGElementAnimatedPropertyList SVGAnimat > 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) { >Index: Source/WebCore/svg/SVGAnimationElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGAnimationElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGAnimationElement.cpp (working copy) >@@ -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) >+ , SVGTests(this) >+ , SVGExternalResourcesRequired(this) > { >- registerAnimatedPropertiesForSVGAnimationElement(); > } > > static void parseKeyTimes(const String& parse, Vector<float>& result, bool verifyOrder) >@@ -691,19 +684,4 @@ void SVGAnimationElement::checkInvalidCS > 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); >-} >- > } >Index: Source/WebCore/svg/SVGAnimationElement.h >=================================================================== >--- Source/WebCore/svg/SVGAnimationElement.h (revision 233069) >+++ Source/WebCore/svg/SVGAnimationElement.h (working copy) >@@ -146,14 +146,13 @@ public: > animatedNumber = number; > } > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >- > protected: > SVGAnimationElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGAnimationElement, SVGElement, SVGTests, SVGExternalResourcesRequired>; >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const override { return m_attributeRegistryBridge; } >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ > 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,8 @@ private: > bool m_hasInvalidCSSAttributeType { false }; > CalcMode m_calcMode { CalcMode::Linear }; > AnimationMode m_animationMode { NoAnimation }; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGCircleElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGCircleElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGCircleElement.cpp (working copy) >@@ -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:: > 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&) >Index: Source/WebCore/svg/SVGCircleElement.h >=================================================================== >--- Source/WebCore/svg/SVGCircleElement.h (revision 233069) >+++ Source/WebCore/svg/SVGCircleElement.h (working copy) >@@ -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 { > >@@ -35,21 +36,26 @@ public: > private: > SVGCircleElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGCircleElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; >+ >+ RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > >+ bool isValid() const final { return SVGTests::isValid(); } > bool selfHasRelativeLengths() const final { return true; } > >- RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > >- 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 >+public: >+ SVGAnimatedLengthAttribute m_cx { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_cy { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_r { m_attributeRegistryBridge, LengthModeOther }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGClipPathElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGClipPathElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGClipPathElement.cpp (working copy) >@@ -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> SVGClipPathEleme > 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( > if (name == SVGNames::clipPathUnitsAttr) { > auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); > if (propertyValue > 0) >- setClipPathUnitsBaseValue(propertyValue); >+ m_clipPathUnits.setValue(propertyValue); > return; > } > >@@ -83,15 +70,14 @@ void SVGClipPathElement::parseAttribute( > > 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); > } > > void SVGClipPathElement::childrenChanged(const ChildChange& change) >Index: Source/WebCore/svg/SVGClipPathElement.h >=================================================================== >--- Source/WebCore/svg/SVGClipPathElement.h (revision 233069) >+++ Source/WebCore/svg/SVGClipPathElement.h (working copy) >@@ -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 >@@ -38,21 +39,26 @@ public: > private: > SVGClipPathElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- bool supportsFocus() const final { return false; } >- bool needsPendingResourceHandling() const final { return false; } >- >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGClipPathElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > void childrenChanged(const ChildChange&) final; > > 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 >+ bool isValid() const final { return SVGTests::isValid(); } >+ bool supportsFocus() const final { return false; } >+ bool needsPendingResourceHandling() const final { return false; } >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_clipPathUnits { m_attributeRegistryBridge, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp (working copy) >@@ -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 > 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(newList.size()); >+ m_tableValues.setValue(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 > > 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 { >+ m_type.animatedValue(), >+ m_slope.animatedValue(), >+ m_intercept.animatedValue(), >+ m_amplitude.animatedValue(), >+ m_exponent.animatedValue(), >+ m_offset.animatedValue(), >+ m_tableValues.animatedValue() >+ }; > } > > } >Index: Source/WebCore/svg/SVGComponentTransferFunctionElement.h >=================================================================== >--- Source/WebCore/svg/SVGComponentTransferFunctionElement.h (revision 233069) >+++ Source/WebCore/svg/SVGComponentTransferFunctionElement.h (working copy) >@@ -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 >@@ -77,23 +78,28 @@ public: > protected: > SVGComponentTransferFunctionElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGComponentTransferFunctionElement, SVGElement>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const override { return m_attributeRegistryBridge; } > 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&); >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > >- 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 >+public: >+ SVGAnimatedEnumerationAttribute<ComponentTransferType> m_type { m_attributeRegistryBridge, FECOMPONENTTRANSFER_TYPE_IDENTITY }; >+ SVGAnimatedNumberListAttribute m_tableValues { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_slope { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_intercept { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_amplitude { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_exponent { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_offset { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGCursorElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGCursorElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGCursorElement.cpp (working copy) >@@ -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) >+ , SVGTests(this) >+ , SVGExternalResourcesRequired(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(co > 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,36 +93,21 @@ void SVGCursorElement::removeClient(CSSC > > 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 > { > SVGElement::addSubresourceAttributeURLs(urls); > >- 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); >+ addSubresourceURL(urls, document().completeURL(m_href.animatedValue())); > } > > } >Index: Source/WebCore/svg/SVGCursorElement.h >=================================================================== >--- Source/WebCore/svg/SVGCursorElement.h (revision 233069) >+++ Source/WebCore/svg/SVGCursorElement.h (working copy) >@@ -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 >@@ -42,37 +43,30 @@ public: > void addClient(CSSCursorImageValue&); > void removeClient(CSSCursorImageValue&); > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >- > private: > SVGCursorElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGCursorElement, SVGElement, SVGTests, SVGExternalResourcesRequired, SVGURIReference>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > > bool rendererIsNeeded(const RenderStyle&) final { return false; } >+ bool isValid() const final { return SVGTests::isValid(); } > > void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; >+ >+ HashSet<CSSCursorImageValue*> m_clients; > >- 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); } >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > >- HashSet<CSSCursorImageValue*> m_clients; >+public: >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGDefsElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGDefsElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGDefsElement.cpp (working copy) >@@ -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) >Index: Source/WebCore/svg/SVGDefsElement.h >=================================================================== >--- Source/WebCore/svg/SVGDefsElement.h (revision 233069) >+++ Source/WebCore/svg/SVGDefsElement.h (working copy) >@@ -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 AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGDefsElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } >+ > 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 >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGElement.cpp (working copy) >@@ -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<QualifiedNam > > SVGElement::SVGElement(const QualifiedName& tagName, Document& document) > : StyledElement(tagName, document, CreateSVGElement) >+ , SVGLangSpace(this) > { >- registerAnimatedPropertiesForSVGElement(); >+ registerAttributes(); > } > > SVGElement::~SVGElement() >@@ -458,10 +452,18 @@ void SVGElement::setCorrespondingElement > 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 Qu > > 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::synchronizeAllAnimatedS > ASSERT(svgElement->elementData()); > ASSERT(svgElement->elementData()->animatedSVGAttributesAreDirty()); > >- svgElement->localAttributeToPropertyMap().synchronizeProperties(*svgElement); >+ svgElement->synchronizeAttributes(); > svgElement->elementData()->setAnimatedSVGAttributesAreDirty(false); > } > >@@ -708,25 +710,7 @@ void SVGElement::synchronizeAnimatedSVGA > 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 > > bool SVGElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attributeName) > { >- return !localAttributeToPropertyMap().types(attributeName).isEmpty(); >+ return !animatedTypes(attributeName).isEmpty(); > } > > bool SVGElement::isPresentationAttribute(const QualifiedName& name) const >@@ -956,21 +940,15 @@ void SVGElement::collectStyleForPresenta > addPropertyToPresentationAttributeStyle(style, propertyID, value); > } > >-bool SVGElement::isKnownAttribute(const QualifiedName& attrName) >-{ >- return attrName == HTMLNames::idAttr; >-} >- > void SVGElement::svgAttributeChanged(const QualifiedName& attrName) > { >- CSSPropertyID propId = cssPropertyIdForSVGAttributeName(attrName); >- if (propId > 0) { >+ if (cssPropertyIdForSVGAttributeName(attrName) > 0) { > invalidateInstances(); > return; > } > > if (attrName == HTMLNames::classAttr) { >- classAttributeChanged(className()); >+ classAttributeChanged(m_className.animatedValue()); > invalidateInstances(); > return; > } >@@ -985,6 +963,8 @@ void SVGElement::svgAttributeChanged(con > invalidateInstances(); > return; > } >+ >+ SVGLangSpace::svgAttributeChanged(attrName); > } > > Node::InsertedIntoAncestorResult SVGElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree) >Index: Source/WebCore/svg/SVGElement.h >=================================================================== >--- Source/WebCore/svg/SVGElement.h (revision 233069) >+++ Source/WebCore/svg/SVGElement.h (working copy) >@@ -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 "SVGAttributeRegistryBridge.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; >@@ -139,6 +129,23 @@ public: > > class InstanceUpdateBlocker; > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGElement, SVGLangSpace>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ virtual const SVGAttributeRegistryBridge& attributeRegistryBridge() const { return m_attributeRegistryBridge; } >+ virtual void animatedPropertyWillBeDeleted(const SVGAnimatedProperty& animatedProperty) { return attributeRegistryBridge().animatedPropertyWillBeDeleted(animatedProperty); } >+ >+ void synchronizeAttribute(const QualifiedName& name) { attributeRegistryBridge().synchronizeAttribute(name); } >+ void synchronizeAttributes() { attributeRegistryBridge().synchronizeAttributes(); } >+ Vector<AnimatedPropertyType> animatedTypes(const QualifiedName& attributeName) const { return attributeRegistryBridge().animatedTypes(attributeName); } >+ RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGAttribute& attribute) const { return attributeRegistryBridge().lookupAnimatedProperty(attribute); } >+ RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(const SVGAttribute& attribute) { return attributeRegistryBridge().lookupOrCreateAnimatedProperty(attribute); } >+ Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(const QualifiedName& name) { return attributeRegistryBridge().lookupOrCreateAnimatedProperties(name);} >+ >+ class InstanceInvalidationGuard; >+ > protected: > SVGElement(const QualifiedName&, Document&); > virtual ~SVGElement(); >@@ -169,8 +176,6 @@ protected: > > void willRecalcStyle(Style::Change) override; > >- class InstanceInvalidationGuard; >- > private: > const RenderStyle* computedStyle(PseudoId = PseudoId::None) final; > >@@ -189,10 +194,10 @@ private: > > HashSet<SVGElement*> m_elementsWithRelativeLengths; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES_BASE(SVGElement) >- DECLARE_ANIMATED_STRING(ClassName, className) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > >+public: >+ SVGAnimatedStringAttribute m_className { m_attributeRegistryBridge }; > }; > > class SVGElement::InstanceInvalidationGuard { >Index: Source/WebCore/svg/SVGEllipseElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGEllipseElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGEllipseElement.cpp (working copy) >@@ -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,86 +22,67 @@ > #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) > { > 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&) >Index: Source/WebCore/svg/SVGEllipseElement.h >=================================================================== >--- Source/WebCore/svg/SVGEllipseElement.h (revision 233069) >+++ Source/WebCore/svg/SVGEllipseElement.h (working copy) >@@ -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 { > >@@ -35,22 +36,27 @@ public: > private: > SVGEllipseElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGEllipseElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >+ RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; >+ >+ bool isValid() const final { return SVGTests::isValid(); } > bool selfHasRelativeLengths() const final { return true; } > >- RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > >- 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 >+public: >+ SVGAnimatedLengthAttribute m_cx { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_cy { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_rx { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_ry { m_attributeRegistryBridge, LengthModeHeight }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGExternalResourcesRequired.cpp >=================================================================== >--- Source/WebCore/svg/SVGExternalResourcesRequired.cpp (revision 233069) >+++ Source/WebCore/svg/SVGExternalResourcesRequired.cpp (working copy) >@@ -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,58 @@ > > namespace WebCore { > >-void SVGExternalResourcesRequired::parseAttribute(const QualifiedName& name, const AtomicString& value) >+SVGExternalResourcesRequired::SVGExternalResourcesRequired(SVGElement* contextElement) >+ : m_contextElement(*contextElement) >+ , m_attributeRegistryBridge(*this, *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; >+ if (auto* renderer = downcast<RenderSVGShape>(m_contextElement.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 +86,40 @@ void SVGExternalResourcesRequired::dispa > // 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(); > } > > } >Index: Source/WebCore/svg/SVGExternalResourcesRequired.h >=================================================================== >--- Source/WebCore/svg/SVGExternalResourcesRequired.h (revision 233069) >+++ Source/WebCore/svg/SVGExternalResourcesRequired.h (working copy) >@@ -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,41 +22,50 @@ > #pragma once > > #include "QualifiedName.h" >+#include "SVGAttributeRegistryBridge.h" > #include <wtf/HashSet.h> > > namespace WebCore { > > class SVGElement; > >-// Notes on a SVG 1.1 spec discrepancy: >-// The SVG DOM defines the attribute externalResourcesRequired as being of type SVGAnimatedBoolean, whereas the >-// SVG language definition says that externalResourcesRequired is not animated. Because the SVG language definition >-// 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 { > 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&); >+ 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); > > 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: >+ SVGElement& m_contextElement; >+ >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGExternalResourcesRequired>; >+ static void registerAttributes(); >+ >+ AttributeRegistryBridge m_attributeRegistryBridge; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ >+ SVGAnimatedBooleanAttribute m_externalResourcesRequired { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEBlendElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEBlendElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEBlendElement.cpp (working copy) >@@ -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 > 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; > } > >@@ -83,7 +81,7 @@ bool SVGFEBlendElement::setFilterEffectA > { > FEBlend* blend = static_cast<FEBlend*>(effect); > if (attrName == SVGNames::modeAttr) >- return blend->setBlendMode(mode()); >+ return blend->setBlendMode(m_mode.animatedValue()); > > ASSERT_NOT_REACHED(); > return false; >@@ -91,15 +89,15 @@ bool SVGFEBlendElement::setFilterEffectA > > void SVGFEBlendElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::modeAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); >- primitiveAttributeChanged(attrName); >- return; >- } > >- if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) { >- InstanceInvalidationGuard guard(*this); >- invalidate(); >+ if (attrName == SVGNames::modeAttr) >+ primitiveAttributeChanged(attrName); >+ >+ if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) >+ invalidate(); >+ > return; > } > >@@ -108,13 +106,13 @@ void SVGFEBlendElement::svgAttributeChan > > RefPtr<FilterEffect> SVGFEBlendElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >- auto input2 = filterBuilder->getEffectById(in2()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); >+ auto input2 = filterBuilder->getEffectById(m_in2.animatedValue()); > > if (!input1 || !input2) > return nullptr; > >- RefPtr<FilterEffect> effect = FEBlend::create(filter, mode()); >+ RefPtr<FilterEffect> effect = FEBlend::create(filter, m_mode.animatedValue()); > FilterEffectVector& inputEffects = effect->inputEffects(); > inputEffects.reserveCapacity(2); > inputEffects.append(input1); >Index: Source/WebCore/svg/SVGFEBlendElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEBlendElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEBlendElement.h (working copy) >@@ -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 >@@ -48,16 +49,24 @@ public: > private: > SVGFEBlendElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEBlendElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedStringAttribute m_in2 { m_attributeRegistryBridge }; >+ SVGAnimatedEnumerationAttribute<BlendMode> m_mode { m_attributeRegistryBridge, BlendModeNormal }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEColorMatrixElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEColorMatrixElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEColorMatrixElement.cpp (working copy) >@@ -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,50 +31,47 @@ 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) > { > 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(newList.size()); >+ m_values.setValue(newList); > return; > } > >@@ -84,9 +82,9 @@ bool SVGFEColorMatrixElement::setFilterE > { > FEColorMatrix* colorMatrix = static_cast<FEColorMatrix*>(effect); > if (attrName == SVGNames::typeAttr) >- return colorMatrix->setType(type()); >+ return colorMatrix->setType(m_type.animatedValue()); > if (attrName == SVGNames::valuesAttr) >- return colorMatrix->setValues(values()); >+ return colorMatrix->setValues(m_values.animatedValue()); > > ASSERT_NOT_REACHED(); > return false; >@@ -94,30 +92,26 @@ bool SVGFEColorMatrixElement::setFilterE > > void SVGFEColorMatrixElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::typeAttr || attrName == SVGNames::valuesAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); >- primitiveAttributeChanged(attrName); >+ if (attrName == SVGNames::inAttr) >+ invalidate(); >+ else >+ primitiveAttributeChanged(attrName); > return; > } >- >- if (attrName == SVGNames::inAttr) { >- InstanceInvalidationGuard guard(*this); >- invalidate(); >- return; >- } >- > SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); > } > > RefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); > > if (!input1) > return nullptr; > > Vector<float> filterValues; >- ColorMatrixType filterType = type(); >+ ColorMatrixType filterType = m_type.animatedValue(); > > // Use defaults if values is empty (SVG 1.1 15.10). > if (!hasAttribute(SVGNames::valuesAttr)) { >@@ -136,7 +130,7 @@ RefPtr<FilterEffect> SVGFEColorMatrixEle > break; > } > } else { >- filterValues = values(); >+ filterValues = m_values.animatedValue(); > unsigned size = filterValues.size(); > > if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20) >Index: Source/WebCore/svg/SVGFEColorMatrixElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEColorMatrixElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEColorMatrixElement.h (working copy) >@@ -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 >@@ -72,16 +73,24 @@ public: > private: > SVGFEColorMatrixElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEColorMatrixElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedEnumerationAttribute<ColorMatrixType> m_type { m_attributeRegistryBridge, FECOLORMATRIX_TYPE_MATRIX }; >+ SVGAnimatedNumberListAttribute m_values { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEComponentTransferElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEComponentTransferElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEComponentTransferElement.cpp (working copy) >@@ -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,30 +36,30 @@ 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) > { > 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; > } > >@@ -67,7 +68,7 @@ void SVGFEComponentTransferElement::pars > > RefPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); > > if (!input1) > return nullptr; >Index: Source/WebCore/svg/SVGFEComponentTransferElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEComponentTransferElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEComponentTransferElement.h (working copy) >@@ -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,13 +33,20 @@ public: > private: > SVGFEComponentTransferElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEComponentTransferElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static void registerAttributes(); >+ > // FIXME: svgAttributeChanged missing. >- void parseAttribute(const QualifiedName&, const AtomicString&) override; >- RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } >+ void parseAttribute(const QualifiedName&, const AtomicString&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEComponentTransferElement) >- DECLARE_ANIMATED_STRING(In1, in1) >- END_DECLARE_ANIMATED_PROPERTIES >+ RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) final; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFECompositeElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFECompositeElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFECompositeElement.cpp (working copy) >@@ -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,75 +31,68 @@ 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) > { > 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; > } > >@@ -109,15 +103,15 @@ bool SVGFECompositeElement::setFilterEff > { > FEComposite* composite = static_cast<FEComposite*>(effect); > if (attrName == SVGNames::operatorAttr) >- return composite->setOperation(svgOperator()); >+ return composite->setOperation(m_svgOperator.animatedValue()); > if (attrName == SVGNames::k1Attr) >- return composite->setK1(k1()); >+ return composite->setK1(m_k1.animatedValue()); > if (attrName == SVGNames::k2Attr) >- return composite->setK2(k2()); >+ return composite->setK2(m_k2.animatedValue()); > if (attrName == SVGNames::k3Attr) >- return composite->setK3(k3()); >+ return composite->setK3(m_k3.animatedValue()); > if (attrName == SVGNames::k4Attr) >- return composite->setK4(k4()); >+ return composite->setK4(m_k4.animatedValue()); > > ASSERT_NOT_REACHED(); > return false; >@@ -126,30 +120,26 @@ bool SVGFECompositeElement::setFilterEff > > void SVGFECompositeElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::operatorAttr || attrName == SVGNames::k1Attr || attrName == SVGNames::k2Attr || attrName == SVGNames::k3Attr || attrName == SVGNames::k4Attr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); >- primitiveAttributeChanged(attrName); >+ if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) >+ invalidate(); >+ else >+ primitiveAttributeChanged(attrName); > return; > } >- >- if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) { >- InstanceInvalidationGuard guard(*this); >- invalidate(); >- return; >- } >- > SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); > } > > RefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >- auto input2 = filterBuilder->getEffectById(in2()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); >+ auto input2 = filterBuilder->getEffectById(m_in2.animatedValue()); > > if (!input1 || !input2) > return nullptr; > >- RefPtr<FilterEffect> effect = FEComposite::create(filter, svgOperator(), k1(), k2(), k3(), k4()); >+ RefPtr<FilterEffect> effect = FEComposite::create(filter, m_svgOperator.animatedValue(), m_k1.animatedValue(), m_k2.animatedValue(), m_k3.animatedValue(), m_k4.animatedValue()); > FilterEffectVector& inputEffects = effect->inputEffects(); > inputEffects.reserveCapacity(2); > inputEffects.append(input1); >Index: Source/WebCore/svg/SVGFECompositeElement.h >=================================================================== >--- Source/WebCore/svg/SVGFECompositeElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFECompositeElement.h (working copy) >@@ -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 >@@ -87,20 +88,28 @@ public: > private: > SVGFECompositeElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFECompositeElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedStringAttribute m_in2 { m_attributeRegistryBridge }; >+ SVGAnimatedEnumerationAttribute<CompositeOperationType> m_svgOperator { m_attributeRegistryBridge, FECOMPOSITE_OPERATOR_OVER }; >+ SVGAnimatedNumberAttribute m_k1 { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_k2 { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_k3 { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_k4 { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp (working copy) >@@ -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& SVGFEConvolveMatrixE > 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::parseAt > 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::parseAt > if (name == SVGNames::kernelMatrixAttr) { > SVGNumberListValues newList; > newList.parse(value); >- detachAnimatedKernelMatrixListWrappers(newList.size()); >- setKernelMatrixBaseValue(newList); >+ m_kernelMatrix.detachAnimatedListWrappers(newList.size()); >+ m_kernelMatrix.setValue(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::parseAt > > 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; >@@ -186,19 +177,19 @@ bool SVGFEConvolveMatrixElement::setFilt > { > FEConvolveMatrix* convolveMatrix = static_cast<FEConvolveMatrix*>(effect); > if (attrName == SVGNames::edgeModeAttr) >- return convolveMatrix->setEdgeMode(edgeMode()); >+ return convolveMatrix->setEdgeMode(m_edgeMode.animatedValue()); > if (attrName == SVGNames::divisorAttr) >- return convolveMatrix->setDivisor(divisor()); >+ return convolveMatrix->setDivisor(m_divisor.animatedValue()); > if (attrName == SVGNames::biasAttr) >- return convolveMatrix->setBias(bias()); >+ return convolveMatrix->setBias(m_bias.animatedValue()); > if (attrName == SVGNames::targetXAttr) >- return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); >+ return convolveMatrix->setTargetOffset(IntPoint(m_targetX.animatedValue(), m_targetY.animatedValue())); > if (attrName == SVGNames::targetYAttr) >- return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); >+ return convolveMatrix->setTargetOffset(IntPoint(m_targetX.animatedValue(), m_targetY.animatedValue())); > if (attrName == SVGNames::kernelUnitLengthAttr) >- return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY())); >+ return convolveMatrix->setKernelUnitLength(FloatPoint(m_kernelUnitLengthX.animatedValue(), m_kernelUnitLengthY.animatedValue())); > if (attrName == SVGNames::preserveAlphaAttr) >- return convolveMatrix->setPreserveAlpha(preserveAlpha()); >+ return convolveMatrix->setPreserveAlpha(m_preserveAlpha.animatedValue()); > > ASSERT_NOT_REACHED(); > return false; >@@ -206,44 +197,40 @@ bool SVGFEConvolveMatrixElement::setFilt > > 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(); > } > > void SVGFEConvolveMatrixElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::edgeModeAttr || attrName == SVGNames::divisorAttr || attrName == SVGNames::biasAttr || attrName == SVGNames::targetXAttr || attrName == SVGNames::targetYAttr || attrName == SVGNames::kernelUnitLengthAttr || attrName == SVGNames::preserveAlphaAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); >- primitiveAttributeChanged(attrName); >- return; >- } >- >- if (attrName == SVGNames::inAttr || attrName == SVGNames::orderAttr || attrName == SVGNames::kernelMatrixAttr) { >- InstanceInvalidationGuard guard(*this); >- invalidate(); >+ if (attrName == SVGNames::inAttr || attrName == SVGNames::orderAttr || attrName == SVGNames::kernelMatrixAttr) >+ invalidate(); >+ else >+ primitiveAttributeChanged(attrName); > return; > } >- > SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); > } > > RefPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); > > if (!input1) > return nullptr; > >- int orderXValue = orderX(); >- int orderYValue = orderY(); >+ int orderXValue = m_orderX.animatedValue(); >+ int orderYValue = m_orderY.animatedValue(); > if (!hasAttribute(SVGNames::orderAttr)) { > orderXValue = 3; > orderYValue = 3; >@@ -251,14 +238,14 @@ RefPtr<FilterEffect> SVGFEConvolveMatrix > // Spec says order must be > 0. Bail if it is not. > if (orderXValue < 1 || orderYValue < 1) > return nullptr; >- auto& kernelMatrix = this->kernelMatrix(); >+ auto& kernelMatrix = m_kernelMatrix.animatedValue(); > int kernelMatrixSize = kernelMatrix.size(); > // The spec says this is a requirement, and should bail out if fails > if (orderXValue * orderYValue != kernelMatrixSize) > return nullptr; > >- int targetXValue = targetX(); >- int targetYValue = targetY(); >+ int targetXValue = m_targetX.animatedValue(); >+ int targetYValue = m_targetY.animatedValue(); > if (hasAttribute(SVGNames::targetXAttr) && (targetXValue < 0 || targetXValue >= orderXValue)) > return nullptr; > // The spec says the default value is: targetX = floor ( orderX / 2 )) >@@ -271,8 +258,8 @@ RefPtr<FilterEffect> SVGFEConvolveMatrix > targetYValue = static_cast<int>(floorf(orderYValue / 2)); > > // Spec says default kernelUnitLength is 1.0, and a specified length cannot be 0. >- int kernelUnitLengthXValue = kernelUnitLengthX(); >- int kernelUnitLengthYValue = kernelUnitLengthY(); >+ int kernelUnitLengthXValue = m_kernelUnitLengthX.animatedValue(); >+ int kernelUnitLengthYValue = m_kernelUnitLengthY.animatedValue(); > if (!hasAttribute(SVGNames::kernelUnitLengthAttr)) { > kernelUnitLengthXValue = 1; > kernelUnitLengthYValue = 1; >@@ -280,7 +267,7 @@ RefPtr<FilterEffect> SVGFEConvolveMatrix > if (kernelUnitLengthXValue <= 0 || kernelUnitLengthYValue <= 0) > return nullptr; > >- float divisorValue = divisor(); >+ float divisorValue = m_divisor.animatedValue(); > if (hasAttribute(SVGNames::divisorAttr) && !divisorValue) > return nullptr; > if (!hasAttribute(SVGNames::divisorAttr)) { >@@ -290,7 +277,7 @@ RefPtr<FilterEffect> SVGFEConvolveMatrix > divisorValue = 1; > } > >- auto effect = FEConvolveMatrix::create(filter, IntSize(orderXValue, orderYValue), divisorValue, bias(), IntPoint(targetXValue, targetYValue), edgeMode(), FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), preserveAlpha(), kernelMatrix); >+ auto effect = FEConvolveMatrix::create(filter, IntSize(orderXValue, orderYValue), divisorValue, m_bias.animatedValue(), IntPoint(targetXValue, targetYValue), m_edgeMode.animatedValue(), FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), m_preserveAlpha.animatedValue(), kernelMatrix); > effect->inputEffects().append(input1); > return WTFMove(effect); > } >Index: Source/WebCore/svg/SVGFEConvolveMatrixElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEConvolveMatrixElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEConvolveMatrixElement.h (working copy) >@@ -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 >@@ -31,6 +32,7 @@ namespace WebCore { > > template<> > struct SVGPropertyTraits<EdgeModeType> { >+ static EdgeModeType initialValue() { return EDGEMODE_NONE; } > static unsigned highestEnumValue() { return EDGEMODE_NONE; } > > static String toString(EdgeModeType type) >@@ -73,9 +75,16 @@ public: > private: > SVGFEConvolveMatrixElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEConvolveMatrixElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 +92,21 @@ 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedIntegerAttribute m_orderX { m_attributeRegistryBridge }; >+ SVGAnimatedIntegerAttribute m_orderY { m_attributeRegistryBridge }; >+ SVGAnimatedNumberListAttribute m_kernelMatrix { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_divisor { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_bias { m_attributeRegistryBridge }; >+ SVGAnimatedIntegerAttribute m_targetX { m_attributeRegistryBridge }; >+ SVGAnimatedIntegerAttribute m_targetY { m_attributeRegistryBridge }; >+ SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { m_attributeRegistryBridge, EDGEMODE_DUPLICATE }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthX { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthY { m_attributeRegistryBridge }; >+ SVGAnimatedBooleanAttribute m_preserveAlpha { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp (working copy) >@@ -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) >@@ -74,29 +57,42 @@ const AtomicString& SVGFEDiffuseLighting > static NeverDestroyed<AtomicString> s_identifier("SVGKernelUnitLengthY", AtomicString::ConstructFromLiteral); > 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; > } >@@ -115,34 +111,34 @@ bool SVGFEDiffuseLightingElement::setFil > return diffuseLighting->setLightingColor(color); > } > if (attrName == SVGNames::surfaceScaleAttr) >- return diffuseLighting->setSurfaceScale(surfaceScale()); >+ return diffuseLighting->setSurfaceScale(m_surfaceScale.animatedValue()); > if (attrName == SVGNames::diffuseConstantAttr) >- return diffuseLighting->setDiffuseConstant(diffuseConstant()); >+ return diffuseLighting->setDiffuseConstant(m_diffuseConstant.animatedValue()); > > auto& lightSource = const_cast<LightSource&>(diffuseLighting->lightSource()); > const SVGFELightElement* lightElement = SVGFELightElement::findLightElement(this); > ASSERT(lightElement); > > if (attrName == SVGNames::azimuthAttr) >- return lightSource.setAzimuth(lightElement->azimuth()); >+ return lightSource.setAzimuth(lightElement->m_azimuth.animatedValue()); > if (attrName == SVGNames::elevationAttr) >- return lightSource.setElevation(lightElement->elevation()); >+ return lightSource.setElevation(lightElement->m_elevation.animatedValue()); > if (attrName == SVGNames::xAttr) >- return lightSource.setX(lightElement->x()); >+ return lightSource.setX(lightElement->m_x.animatedValue()); > if (attrName == SVGNames::yAttr) >- return lightSource.setY(lightElement->y()); >+ return lightSource.setY(lightElement->m_y.animatedValue()); > if (attrName == SVGNames::zAttr) >- return lightSource.setZ(lightElement->z()); >+ return lightSource.setZ(lightElement->m_z.animatedValue()); > if (attrName == SVGNames::pointsAtXAttr) >- return lightSource.setPointsAtX(lightElement->pointsAtX()); >+ return lightSource.setPointsAtX(lightElement->m_pointsAtX.animatedValue()); > if (attrName == SVGNames::pointsAtYAttr) >- return lightSource.setPointsAtY(lightElement->pointsAtY()); >+ return lightSource.setPointsAtY(lightElement->m_pointsAtY.animatedValue()); > if (attrName == SVGNames::pointsAtZAttr) >- return lightSource.setPointsAtZ(lightElement->pointsAtZ()); >+ return lightSource.setPointsAtZ(lightElement->m_pointsAtZ.animatedValue()); > if (attrName == SVGNames::specularExponentAttr) >- return lightSource.setSpecularExponent(lightElement->specularExponent()); >+ return lightSource.setSpecularExponent(lightElement->m_specularExponent.animatedValue()); > if (attrName == SVGNames::limitingConeAngleAttr) >- return lightSource.setLimitingConeAngle(lightElement->limitingConeAngle()); >+ return lightSource.setLimitingConeAngle(lightElement->m_limitingConeAngle.animatedValue()); > > ASSERT_NOT_REACHED(); > return false; >@@ -150,18 +146,14 @@ bool SVGFEDiffuseLightingElement::setFil > > void SVGFEDiffuseLightingElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::surfaceScaleAttr || attrName == SVGNames::diffuseConstantAttr || attrName == SVGNames::kernelUnitLengthAttr || attrName == SVGNames::lighting_colorAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); >- primitiveAttributeChanged(attrName); >+ if (attrName == SVGNames::inAttr) >+ invalidate(); >+ else >+ primitiveAttributeChanged(attrName); > return; > } >- >- if (attrName == SVGNames::inAttr) { >- InstanceInvalidationGuard guard(*this); >- invalidate(); >- return; >- } >- > SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); > } > >@@ -176,7 +168,7 @@ void SVGFEDiffuseLightingElement::lightE > > RefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); > > if (!input1) > return nullptr; >@@ -193,7 +185,7 @@ RefPtr<FilterEffect> SVGFEDiffuseLightin > > Color color = renderer->style().colorByApplyingColorFilter(renderer->style().svgStyle().lightingColor()); > >- RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, surfaceScale(), diffuseConstant(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource)); >+ RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_surfaceScale.animatedValue(), m_diffuseConstant.animatedValue(), m_kernelUnitLengthX.animatedValue(), m_kernelUnitLengthY.animatedValue(), WTFMove(lightSource)); > effect->inputEffects().append(input1); > return effect; > } >Index: Source/WebCore/svg/SVGFEDiffuseLightingElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEDiffuseLightingElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEDiffuseLightingElement.h (working copy) >@@ -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 >@@ -38,21 +39,29 @@ public: > private: > SVGFEDiffuseLightingElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEDiffuseLightingElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_diffuseConstant { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_surfaceScale { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthX { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthY { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEDisplacementMapElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEDisplacementMapElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEDisplacementMapElement.cpp (working copy) >@@ -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> SVGFEDi > 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; > } > >@@ -97,11 +92,11 @@ bool SVGFEDisplacementMapElement::setFil > { > FEDisplacementMap* displacementMap = static_cast<FEDisplacementMap*>(effect); > if (attrName == SVGNames::xChannelSelectorAttr) >- return displacementMap->setXChannelSelector(xChannelSelector()); >+ return displacementMap->setXChannelSelector(m_xChannelSelector.animatedValue()); > if (attrName == SVGNames::yChannelSelectorAttr) >- return displacementMap->setYChannelSelector(yChannelSelector()); >+ return displacementMap->setYChannelSelector(m_yChannelSelector.animatedValue()); > if (attrName == SVGNames::scaleAttr) >- return displacementMap->setScale(scale()); >+ return displacementMap->setScale(m_scale.animatedValue()); > > ASSERT_NOT_REACHED(); > return false; >@@ -109,30 +104,26 @@ bool SVGFEDisplacementMapElement::setFil > > void SVGFEDisplacementMapElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::xChannelSelectorAttr || attrName == SVGNames::yChannelSelectorAttr || attrName == SVGNames::scaleAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); >- primitiveAttributeChanged(attrName); >+ if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) >+ invalidate(); >+ else >+ primitiveAttributeChanged(attrName); > return; > } >- >- if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) { >- InstanceInvalidationGuard guard(*this); >- invalidate(); >- return; >- } >- > SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); > } > > RefPtr<FilterEffect> SVGFEDisplacementMapElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >- auto input2 = filterBuilder->getEffectById(in2()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); >+ auto input2 = filterBuilder->getEffectById(m_in2.animatedValue()); > > if (!input1 || !input2) > return nullptr; > >- RefPtr<FilterEffect> effect = FEDisplacementMap::create(filter, xChannelSelector(), yChannelSelector(), scale()); >+ RefPtr<FilterEffect> effect = FEDisplacementMap::create(filter, m_xChannelSelector.animatedValue(), m_yChannelSelector.animatedValue(), m_scale.animatedValue()); > FilterEffectVector& inputEffects = effect->inputEffects(); > inputEffects.reserveCapacity(2); > inputEffects.append(input1); >Index: Source/WebCore/svg/SVGFEDisplacementMapElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEDisplacementMapElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEDisplacementMapElement.h (working copy) >@@ -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 >@@ -73,18 +74,26 @@ public: > private: > SVGFEDisplacementMapElement(const QualifiedName& tagName, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEDisplacementMapElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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; > >- 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedStringAttribute m_in2 { m_attributeRegistryBridge }; >+ SVGAnimatedEnumerationAttribute<ChannelSelectorType> m_xChannelSelector { m_attributeRegistryBridge, CHANNEL_A }; >+ SVGAnimatedEnumerationAttribute<ChannelSelectorType> m_yChannelSelector { m_attributeRegistryBridge, CHANNEL_A }; >+ SVGAnimatedNumberAttribute m_scale { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEDistantLightElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEDistantLightElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEDistantLightElement.cpp (working copy) >@@ -38,7 +38,7 @@ Ref<SVGFEDistantLightElement> SVGFEDista > > Ref<LightSource> SVGFEDistantLightElement::lightSource(SVGFilterBuilder&) const > { >- return DistantLightSource::create(azimuth(), elevation()); >+ return DistantLightSource::create(m_azimuth.animatedValue(), m_elevation.animatedValue()); > } > > } >Index: Source/WebCore/svg/SVGFEDropShadowElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEDropShadowElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEDropShadowElement.cpp (working copy) >@@ -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& SVGFEDropShadowEleme > > 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,12 +107,11 @@ void SVGFEDropShadowElement::parseAttrib > > 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; > } >- > SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); > } > >@@ -128,7 +121,7 @@ RefPtr<FilterEffect> SVGFEDropShadowElem > if (!renderer) > return nullptr; > >- if (stdDeviationX() < 0 || stdDeviationY() < 0) >+ if (m_stdDeviationX.animatedValue() < 0 || m_stdDeviationY.animatedValue() < 0) > return nullptr; > > const SVGRenderStyle& svgStyle = renderer->style().svgStyle(); >@@ -136,11 +129,11 @@ RefPtr<FilterEffect> SVGFEDropShadowElem > Color color = renderer->style().colorByApplyingColorFilter(svgStyle.floodColor()); > float opacity = svgStyle.floodOpacity(); > >- auto input1 = filterBuilder->getEffectById(in1()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); > if (!input1) > return nullptr; > >- RefPtr<FilterEffect> effect = FEDropShadow::create(filter, stdDeviationX(), stdDeviationY(), dx(), dy(), color, opacity); >+ RefPtr<FilterEffect> effect = FEDropShadow::create(filter, m_stdDeviationX.animatedValue(), m_stdDeviationY.animatedValue(), m_dx.animatedValue(), m_dy.animatedValue(), color, opacity); > effect->inputEffects().append(input1); > return effect; > } >Index: Source/WebCore/svg/SVGFEDropShadowElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEDropShadowElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEDropShadowElement.h (working copy) >@@ -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 >@@ -29,26 +30,34 @@ class SVGFEDropShadowElement final : pub > WTF_MAKE_ISO_ALLOCATED(SVGFEDropShadowElement); > public: > static Ref<SVGFEDropShadowElement> create(const QualifiedName&, Document&); >- >+ > void setStdDeviation(float stdDeviationX, float stdDeviationY); >- >+ > private: > SVGFEDropShadowElement(const QualifiedName&, Document&); >+ >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEDropShadowElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; >- void svgAttributeChanged(const QualifiedName&) 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 >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_dx { m_attributeRegistryBridge, 2 }; >+ SVGAnimatedNumberAttribute m_dy { m_attributeRegistryBridge, 2 }; >+ SVGAnimatedNumberAttribute m_stdDeviationX { m_attributeRegistryBridge, 2 }; >+ SVGAnimatedNumberAttribute m_stdDeviationY { m_attributeRegistryBridge, 2 }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEGaussianBlurElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEGaussianBlurElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEGaussianBlurElement.cpp (working copy) >@@ -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 >@@ -23,7 +24,6 @@ > > #include "FilterEffect.h" > #include "SVGFilterBuilder.h" >-#include "SVGNames.h" > #include "SVGParserUtilities.h" > #include <wtf/IsoMallocInlines.h> > >@@ -31,26 +31,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 +57,43 @@ const AtomicString& SVGFEGaussianBlurEle > > 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 +104,7 @@ void SVGFEGaussianBlurElement::parseAttr > > void SVGFEGaussianBlurElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr || attrName == SVGNames::edgeModeAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidate(); > return; >@@ -118,15 +115,15 @@ void SVGFEGaussianBlurElement::svgAttrib > > RefPtr<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); > > if (!input1) > return nullptr; > >- if (stdDeviationX() < 0 || stdDeviationY() < 0) >+ if (m_stdDeviationX.animatedValue() < 0 || m_stdDeviationY.animatedValue() < 0) > return nullptr; > >- RefPtr<FilterEffect> effect = FEGaussianBlur::create(filter, stdDeviationX(), stdDeviationY(), edgeMode()); >+ RefPtr<FilterEffect> effect = FEGaussianBlur::create(filter, m_stdDeviationX.animatedValue(), m_stdDeviationY.animatedValue(), m_edgeMode.animatedValue()); > effect->inputEffects().append(input1); > return effect; > } >Index: Source/WebCore/svg/SVGFEGaussianBlurElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEGaussianBlurElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEGaussianBlurElement.h (working copy) >@@ -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 >@@ -25,6 +26,7 @@ > #include "SVGAnimatedNumber.h" > #include "SVGFEConvolveMatrixElement.h" > #include "SVGFilterPrimitiveStandardAttributes.h" >+#include "SVGNames.h" > > namespace WebCore { > >@@ -38,19 +40,27 @@ public: > private: > SVGFEGaussianBlurElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEGaussianBlurElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_stdDeviationX { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_stdDeviationY { m_attributeRegistryBridge }; >+ SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { m_attributeRegistryBridge, EDGEMODE_NONE }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEImageElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEImageElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEImageElement.cpp (working copy) >@@ -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) >+ , SVGURIReference(this) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::feImageTag)); >- registerAnimatedPropertiesForSVGFEImageElement(); >+ registerAttributes(); > } > > Ref<SVGFEImageElement> SVGFEImageElement::create(const QualifiedName& tagName, Document& document) >@@ -90,7 +81,7 @@ void SVGFEImageElement::requestImageReso > ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions(); > options.contentSecurityPolicyImposition = isInUserAgentShadowTree() ? ContentSecurityPolicyImposition::SkipPolicyCheck : ContentSecurityPolicyImposition::DoPolicyCheck; > >- CachedResourceRequest request(ResourceRequest(document().completeURL(href())), options); >+ CachedResourceRequest request(ResourceRequest(document().completeURL(m_href.animatedValue())), options); > request.setInitiator(*this); > m_cachedImage = document().cachedResourceLoader().requestImage(WTFMove(request)).value_or(nullptr); > >@@ -105,7 +96,7 @@ void SVGFEImageElement::buildPendingReso > return; > > String id; >- auto target = makeRefPtr(SVGURIReference::targetElementFromIRIString(href(), document(), &id)); >+ auto target = makeRefPtr(SVGURIReference::targetElementFromIRIString(m_href.animatedValue(), document(), &id)); > if (!target) { > if (id.isEmpty()) > requestImageResource(); >@@ -122,12 +113,20 @@ void SVGFEImageElement::buildPendingReso > 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; > } > >@@ -138,9 +137,11 @@ void SVGFEImageElement::parseAttribute(c > > void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::preserveAspectRatioAttr) { >- InstanceInvalidationGuard guard(*this); >- invalidate(); >+ if (isKnownAttribute(attrName)) { >+ if (attrName == SVGNames::preserveAspectRatioAttr) { >+ InstanceInvalidationGuard guard(*this); >+ invalidate(); >+ } > return; > } > >@@ -191,15 +192,15 @@ void SVGFEImageElement::notifyFinished(C > RefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter& filter) > { > if (m_cachedImage) >- return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(renderer()), preserveAspectRatio()); >- return FEImage::createWithIRIReference(filter, document(), href(), preserveAspectRatio()); >+ return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(renderer()), m_preserveAspectRatio.animatedValue()); >+ return FEImage::createWithIRIReference(filter, document(), m_href.animatedValue(), m_preserveAspectRatio.animatedValue()); > } > > void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const > { > SVGFilterPrimitiveStandardAttributes::addSubresourceAttributeURLs(urls); > >- addSubresourceURL(urls, document().completeURL(href())); >+ addSubresourceURL(urls, document().completeURL(m_href.animatedValue())); > } > > } >Index: Source/WebCore/svg/SVGFEImageElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEImageElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEImageElement.h (working copy) >@@ -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 >@@ -45,11 +46,18 @@ private: > > void didFinishInsertingNode() override; > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEImageElement, SVGFilterPrimitiveStandardAttributes, SVGURIReference, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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; >+ > RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; > > void clearResourceReferences(); >@@ -59,13 +67,12 @@ 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 >- > CachedResourceHandle<CachedImage> m_cachedImage; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFELightElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFELightElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFELightElement.cpp (working copy) >@@ -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::fi > 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(c > > 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; >@@ -160,7 +148,6 @@ void SVGFELightElement::svgAttributeChan > > return; > } >- > SVGElement::svgAttributeChanged(attrName); > } > >Index: Source/WebCore/svg/SVGFELightElement.h >=================================================================== >--- Source/WebCore/svg/SVGFELightElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFELightElement.h (working copy) >@@ -41,22 +41,29 @@ protected: > bool rendererIsNeeded(const RenderStyle&) override { return false; } > > private: >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFELightElement, SVGElement>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedNumberAttribute m_azimuth { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_elevation { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_x { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_y { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_z { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_pointsAtX { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_pointsAtY { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_pointsAtZ { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_specularExponent { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_limitingConeAngle { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEMergeElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEMergeElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEMergeElement.cpp (working copy) >@@ -50,7 +50,7 @@ RefPtr<FilterEffect> SVGFEMergeElement:: > FilterEffectVector& mergeInputs = effect->inputEffects(); > > for (auto& mergeNode : childrenOfType<SVGFEMergeNodeElement>(*this)) { >- auto mergeEffect = filterBuilder->getEffectById(mergeNode.in1()); >+ auto mergeEffect = filterBuilder->getEffectById(mergeNode.m_in1.animatedValue()); > if (!mergeEffect) > return nullptr; > mergeInputs.append(WTFMove(mergeEffect)); >Index: Source/WebCore/svg/SVGFEMergeNodeElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEMergeNodeElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEMergeNodeElement.cpp (working copy) >@@ -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> SVGFEMergeNod > 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; > } > >@@ -62,12 +64,11 @@ void SVGFEMergeNodeElement::parseAttribu > > void SVGFEMergeNodeElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::inAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidateFilterPrimitiveParent(this); > return; > } >- > SVGElement::svgAttributeChanged(attrName); > } > >Index: Source/WebCore/svg/SVGFEMergeNodeElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEMergeNodeElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEMergeNodeElement.h (working copy) >@@ -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,13 +34,21 @@ public: > private: > SVGFEMergeNodeElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEMergeNodeElement, SVGElement>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEMorphologyElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEMorphologyElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEMorphologyElement.cpp (working copy) >@@ -30,26 +30,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) >@@ -57,6 +42,18 @@ Ref<SVGFEMorphologyElement> SVGFEMorphol > return adoptRef(*new SVGFEMorphologyElement(tagName, document)); > } > >+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>(); >+} >+ > const AtomicString& SVGFEMorphologyElement::radiusXIdentifier() > { > static NeverDestroyed<AtomicString> s_identifier("SVGRadiusX", AtomicString::ConstructFromLiteral); >@@ -71,8 +68,8 @@ const AtomicString& SVGFEMorphologyEleme > > void SVGFEMorphologyElement::setRadius(float x, float y) > { >- setRadiusXBaseValue(x); >- setRadiusYBaseValue(y); >+ m_radiusX.setValue(x); >+ m_radiusY.setValue(y); > invalidate(); > } > >@@ -81,20 +78,20 @@ void SVGFEMorphologyElement::parseAttrib > 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; > } >@@ -106,11 +103,11 @@ bool SVGFEMorphologyElement::setFilterEf > { > FEMorphology* morphology = static_cast<FEMorphology*>(effect); > if (attrName == SVGNames::operatorAttr) >- return morphology->setMorphologyOperator(svgOperator()); >+ return morphology->setMorphologyOperator(m_svgOperator.animatedValue()); > if (attrName == SVGNames::radiusAttr) { > // Both setRadius functions should be evaluated separately. >- bool isRadiusXChanged = morphology->setRadiusX(radiusX()); >- bool isRadiusYChanged = morphology->setRadiusY(radiusY()); >+ bool isRadiusXChanged = morphology->setRadiusX(m_radiusX.animatedValue()); >+ bool isRadiusYChanged = morphology->setRadiusY(m_radiusY.animatedValue()); > return isRadiusXChanged || isRadiusYChanged; > } > >@@ -120,26 +117,22 @@ bool SVGFEMorphologyElement::setFilterEf > > void SVGFEMorphologyElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::operatorAttr || attrName == SVGNames::radiusAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); >- primitiveAttributeChanged(attrName); >+ if (attrName == SVGNames::inAttr) >+ invalidate(); >+ else >+ primitiveAttributeChanged(attrName); > return; > } >- >- if (attrName == SVGNames::inAttr) { >- InstanceInvalidationGuard guard(*this); >- invalidate(); >- return; >- } >- > SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); > } > > RefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >- float xRadius = radiusX(); >- float yRadius = radiusY(); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); >+ float xRadius = m_radiusX.animatedValue(); >+ float yRadius = m_radiusY.animatedValue(); > > if (!input1) > return nullptr; >@@ -147,7 +140,7 @@ RefPtr<FilterEffect> SVGFEMorphologyElem > if (xRadius < 0 || yRadius < 0) > return nullptr; > >- RefPtr<FilterEffect> effect = FEMorphology::create(filter, svgOperator(), xRadius, yRadius); >+ RefPtr<FilterEffect> effect = FEMorphology::create(filter, m_svgOperator.animatedValue(), xRadius, yRadius); > effect->inputEffects().append(input1); > return effect; > } >Index: Source/WebCore/svg/SVGFEMorphologyElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEMorphologyElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEMorphologyElement.h (working copy) >@@ -1,5 +1,7 @@ > /* > * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> >+ * Copyright (C) 2018 Apple Inc. 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 >@@ -65,20 +67,28 @@ public: > private: > SVGFEMorphologyElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEMorphologyElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedEnumerationAttribute<MorphologyOperatorType> m_svgOperator { m_attributeRegistryBridge, FEMORPHOLOGY_OPERATOR_ERODE }; >+ SVGAnimatedNumberAttribute m_radiusX { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_radiusY { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEOffsetElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEOffsetElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEOffsetElement.cpp (working copy) >@@ -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,44 +32,42 @@ 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) > { > 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( > > void SVGFEOffsetElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::inAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidate(); > return; >@@ -88,12 +87,12 @@ void SVGFEOffsetElement::svgAttributeCha > > RefPtr<FilterEffect> SVGFEOffsetElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); > > if (!input1) > return nullptr; > >- RefPtr<FilterEffect> effect = FEOffset::create(filter, dx(), dy()); >+ RefPtr<FilterEffect> effect = FEOffset::create(filter, m_dx.animatedValue(), m_dy.animatedValue()); > effect->inputEffects().append(input1); > return effect; > } >Index: Source/WebCore/svg/SVGFEOffsetElement.h >=================================================================== >--- Source/WebCore/svg/SVGFEOffsetElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFEOffsetElement.h (working copy) >@@ -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 >@@ -33,15 +34,23 @@ public: > private: > SVGFEOffsetElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFEOffsetElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_dx { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_dy { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFEPointLightElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFEPointLightElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFEPointLightElement.cpp (working copy) >@@ -45,13 +45,13 @@ Ref<LightSource> SVGFEPointLightElement: > if (builder.primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { > FloatRect referenceBox = builder.targetBoundingBox(); > >- position.setX(referenceBox.x() + x() * referenceBox.width()); >- position.setY(referenceBox.y() + y() * referenceBox.height()); >+ position.setX(referenceBox.x() + m_x.animatedValue() * referenceBox.width()); >+ position.setY(referenceBox.y() + m_y.animatedValue() * referenceBox.height()); > > // https://www.w3.org/TR/SVG/filters.html#fePointLightZAttribute and https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage >- position.setZ(z() * euclidianDistance(referenceBox.minXMinYCorner(), referenceBox.maxXMaxYCorner()) / sqrtOfTwoFloat); >+ position.setZ(m_z.animatedValue() * euclidianDistance(referenceBox.minXMinYCorner(), referenceBox.maxXMaxYCorner()) / sqrtOfTwoFloat); > } else >- position = FloatPoint3D(x(), y(), z()); >+ position = FloatPoint3D(m_x.animatedValue(), m_y.animatedValue(), m_z.animatedValue()); > > return PointLightSource::create(position); > } >Index: Source/WebCore/svg/SVGFESpecularLightingElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFESpecularLightingElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFESpecularLightingElement.cpp (working copy) >@@ -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) >@@ -67,6 +47,20 @@ Ref<SVGFESpecularLightingElement> SVGFES > return adoptRef(*new SVGFESpecularLightingElement(tagName, document)); > } > >+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>(); >+} >+ > const AtomicString& SVGFESpecularLightingElement::kernelUnitLengthXIdentifier() > { > static NeverDestroyed<AtomicString> s_identifier("SVGKernelUnitLengthX", AtomicString::ConstructFromLiteral); >@@ -82,30 +76,30 @@ const AtomicString& SVGFESpecularLightin > 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; > } >@@ -124,36 +118,36 @@ bool SVGFESpecularLightingElement::setFi > return specularLighting->setLightingColor(color); > } > if (attrName == SVGNames::surfaceScaleAttr) >- return specularLighting->setSurfaceScale(surfaceScale()); >+ return specularLighting->setSurfaceScale(m_surfaceScale.animatedValue()); > if (attrName == SVGNames::specularConstantAttr) >- return specularLighting->setSpecularConstant(specularConstant()); >+ return specularLighting->setSpecularConstant(m_specularConstant.animatedValue()); > if (attrName == SVGNames::specularExponentAttr) >- return specularLighting->setSpecularExponent(specularExponent()); >+ return specularLighting->setSpecularExponent(m_specularExponent.animatedValue()); > > auto& lightSource = const_cast<LightSource&>(specularLighting->lightSource()); > const SVGFELightElement* lightElement = SVGFELightElement::findLightElement(this); > ASSERT(lightElement); > > if (attrName == SVGNames::azimuthAttr) >- return lightSource.setAzimuth(lightElement->azimuth()); >+ return lightSource.setAzimuth(lightElement->m_azimuth.animatedValue()); > if (attrName == SVGNames::elevationAttr) >- return lightSource.setElevation(lightElement->elevation()); >+ return lightSource.setElevation(lightElement->m_elevation.animatedValue()); > if (attrName == SVGNames::xAttr) >- return lightSource.setX(lightElement->x()); >+ return lightSource.setX(lightElement->m_x.animatedValue()); > if (attrName == SVGNames::yAttr) >- return lightSource.setY(lightElement->y()); >+ return lightSource.setY(lightElement->m_y.animatedValue()); > if (attrName == SVGNames::zAttr) >- return lightSource.setZ(lightElement->z()); >+ return lightSource.setZ(lightElement->m_z.animatedValue()); > if (attrName == SVGNames::pointsAtXAttr) >- return lightSource.setPointsAtX(lightElement->pointsAtX()); >+ return lightSource.setPointsAtX(lightElement->m_pointsAtX.animatedValue()); > if (attrName == SVGNames::pointsAtYAttr) >- return lightSource.setPointsAtY(lightElement->pointsAtY()); >+ return lightSource.setPointsAtY(lightElement->m_pointsAtY.animatedValue()); > if (attrName == SVGNames::pointsAtZAttr) >- return lightSource.setPointsAtZ(lightElement->pointsAtZ()); >+ return lightSource.setPointsAtZ(lightElement->m_pointsAtZ.animatedValue()); > if (attrName == SVGNames::specularExponentAttr) >- return lightSource.setSpecularExponent(lightElement->specularExponent()); >+ return lightSource.setSpecularExponent(lightElement->m_specularExponent.animatedValue()); > if (attrName == SVGNames::limitingConeAngleAttr) >- return lightSource.setLimitingConeAngle(lightElement->limitingConeAngle()); >+ return lightSource.setLimitingConeAngle(lightElement->m_limitingConeAngle.animatedValue()); > > ASSERT_NOT_REACHED(); > return false; >@@ -161,18 +155,14 @@ bool SVGFESpecularLightingElement::setFi > > void SVGFESpecularLightingElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::surfaceScaleAttr || attrName == SVGNames::specularConstantAttr || attrName == SVGNames::specularExponentAttr || attrName == SVGNames::kernelUnitLengthAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); >- primitiveAttributeChanged(attrName); >+ if (attrName == SVGNames::inAttr) >+ invalidate(); >+ else >+ primitiveAttributeChanged(attrName); > return; > } >- >- if (attrName == SVGNames::inAttr) { >- InstanceInvalidationGuard guard(*this); >- invalidate(); >- return; >- } >- > SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); > } > >@@ -187,7 +177,7 @@ void SVGFESpecularLightingElement::light > > RefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); > > if (!input1) > return nullptr; >@@ -204,7 +194,7 @@ RefPtr<FilterEffect> SVGFESpecularLighti > > Color color = renderer->style().colorByApplyingColorFilter(renderer->style().svgStyle().lightingColor()); > >- RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, surfaceScale(), specularConstant(), specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource)); >+ RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, m_surfaceScale.animatedValue(), m_specularConstant.animatedValue(), m_specularExponent.animatedValue(), m_kernelUnitLengthX.animatedValue(), m_kernelUnitLengthY.animatedValue(), WTFMove(lightSource)); > effect->inputEffects().append(input1); > return effect; > } >Index: Source/WebCore/svg/SVGFESpecularLightingElement.h >=================================================================== >--- Source/WebCore/svg/SVGFESpecularLightingElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFESpecularLightingElement.h (working copy) >@@ -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 >@@ -36,23 +37,31 @@ public: > > private: > SVGFESpecularLightingElement(const QualifiedName&, Document&); >+ >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFESpecularLightingElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_specularConstant { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_specularExponent { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_surfaceScale { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthX { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_kernelUnitLengthY { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFESpotLightElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFESpotLightElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFESpotLightElement.cpp (working copy) >@@ -47,21 +47,21 @@ Ref<LightSource> SVGFESpotLightElement:: > if (builder.primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { > FloatRect referenceBox = builder.targetBoundingBox(); > >- position.setX(referenceBox.x() + x() * referenceBox.width()); >- position.setY(referenceBox.y() + y() * referenceBox.height()); >+ position.setX(referenceBox.x() + m_x.animatedValue() * referenceBox.width()); >+ position.setY(referenceBox.y() + m_y.animatedValue() * referenceBox.height()); > // https://www.w3.org/TR/SVG/filters.html#fePointLightZAttribute and https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage >- position.setZ(z() * euclidianDistance(referenceBox.minXMinYCorner(), referenceBox.maxXMaxYCorner()) / sqrtOfTwoFloat); >+ position.setZ(m_z.animatedValue() * euclidianDistance(referenceBox.minXMinYCorner(), referenceBox.maxXMaxYCorner()) / sqrtOfTwoFloat); > >- pointsAt.setX(referenceBox.x() + pointsAtX() * referenceBox.width()); >- pointsAt.setY(referenceBox.y() + pointsAtY() * referenceBox.height()); >+ pointsAt.setX(referenceBox.x() + m_pointsAtX.animatedValue() * referenceBox.width()); >+ pointsAt.setY(referenceBox.y() + m_pointsAtY.animatedValue() * referenceBox.height()); > // https://www.w3.org/TR/SVG/filters.html#fePointLightZAttribute and https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage >- pointsAt.setZ(pointsAtZ() * euclidianDistance(referenceBox.minXMinYCorner(), referenceBox.maxXMaxYCorner()) / sqrtOfTwoFloat); >+ pointsAt.setZ(m_pointsAtZ.animatedValue() * euclidianDistance(referenceBox.minXMinYCorner(), referenceBox.maxXMaxYCorner()) / sqrtOfTwoFloat); > } else { >- position = FloatPoint3D(x(), y(), z()); >- pointsAt = FloatPoint3D(pointsAtX(), pointsAtY(), pointsAtZ()); >+ position = FloatPoint3D(m_x.animatedValue(), m_y.animatedValue(), m_z.animatedValue()); >+ pointsAt = FloatPoint3D(m_pointsAtX.animatedValue(), m_pointsAtY.animatedValue(), m_pointsAtZ.animatedValue()); > } > >- return SpotLightSource::create(position, pointsAt, specularExponent(), limitingConeAngle()); >+ return SpotLightSource::create(position, pointsAt, m_specularExponent.animatedValue(), m_limitingConeAngle.animatedValue()); > } > > } >Index: Source/WebCore/svg/SVGFETileElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFETileElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFETileElement.cpp (working copy) >@@ -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,30 +33,30 @@ 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) > { > 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; > } > >@@ -64,7 +65,7 @@ void SVGFETileElement::parseAttribute(co > > void SVGFETileElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::inAttr) { >+ if (isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > invalidate(); > return; >@@ -75,7 +76,7 @@ void SVGFETileElement::svgAttributeChang > > RefPtr<FilterEffect> SVGFETileElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) > { >- auto input1 = filterBuilder->getEffectById(in1()); >+ auto input1 = filterBuilder->getEffectById(m_in1.animatedValue()); > > if (!input1) > return nullptr; >Index: Source/WebCore/svg/SVGFETileElement.h >=================================================================== >--- Source/WebCore/svg/SVGFETileElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFETileElement.h (working copy) >@@ -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,13 +33,21 @@ public: > private: > SVGFETileElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFETileElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedStringAttribute m_in1 { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFETurbulenceElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFETurbulenceElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFETurbulenceElement.cpp (working copy) >@@ -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 >@@ -21,7 +22,6 @@ > #include "config.h" > #include "SVGFETurbulenceElement.h" > >-#include "SVGNames.h" > #include "SVGParserUtilities.h" > #include <wtf/IsoMallocInlines.h> > >@@ -29,32 +29,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) >@@ -73,39 +52,53 @@ const AtomicString& SVGFETurbulenceEleme > static NeverDestroyed<AtomicString> s_identifier("SVGBaseFrequencyY", AtomicString::ConstructFromLiteral); > 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; > } > >@@ -116,15 +109,15 @@ bool SVGFETurbulenceElement::setFilterEf > { > FETurbulence* turbulence = static_cast<FETurbulence*>(effect); > if (attrName == SVGNames::typeAttr) >- return turbulence->setType(type()); >+ return turbulence->setType(m_type.animatedValue()); > if (attrName == SVGNames::stitchTilesAttr) >- return turbulence->setStitchTiles(stitchTiles()); >+ return turbulence->setStitchTiles(m_stitchTiles.animatedValue()); > if (attrName == SVGNames::baseFrequencyAttr) >- return (turbulence->setBaseFrequencyX(baseFrequencyX()) || turbulence->setBaseFrequencyY(baseFrequencyY())); >+ return (turbulence->setBaseFrequencyX(m_baseFrequencyX.animatedValue()) || turbulence->setBaseFrequencyY(m_baseFrequencyY.animatedValue())); > if (attrName == SVGNames::seedAttr) >- return turbulence->setSeed(seed()); >+ return turbulence->setSeed(m_seed.animatedValue()); > if (attrName == SVGNames::numOctavesAttr) >- return turbulence->setNumOctaves(numOctaves()); >+ return turbulence->setNumOctaves(m_numOctaves.animatedValue()); > > ASSERT_NOT_REACHED(); > return false; >@@ -132,7 +125,7 @@ bool SVGFETurbulenceElement::setFilterEf > > 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; >@@ -143,9 +136,9 @@ void SVGFETurbulenceElement::svgAttribut > > RefPtr<FilterEffect> SVGFETurbulenceElement::build(SVGFilterBuilder*, Filter& filter) > { >- if (baseFrequencyX() < 0 || baseFrequencyY() < 0) >+ if (m_baseFrequencyX.animatedValue() < 0 || m_baseFrequencyY.animatedValue() < 0) > return nullptr; >- return FETurbulence::create(filter, type(), baseFrequencyX(), baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH); >+ return FETurbulence::create(filter, m_type.animatedValue(), m_baseFrequencyX.animatedValue(), m_baseFrequencyY.animatedValue(), m_numOctaves.animatedValue(), m_seed.animatedValue(), m_stitchTiles.animatedValue() == SVG_STITCHTYPE_STITCH); > } > > } >Index: Source/WebCore/svg/SVGFETurbulenceElement.h >=================================================================== >--- Source/WebCore/svg/SVGFETurbulenceElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFETurbulenceElement.h (working copy) >@@ -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 >@@ -25,6 +26,7 @@ > #include "SVGAnimatedInteger.h" > #include "SVGAnimatedNumber.h" > #include "SVGFilterPrimitiveStandardAttributes.h" >+#include "SVGNames.h" > > namespace WebCore { > >@@ -100,22 +102,30 @@ public: > private: > SVGFETurbulenceElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFETurbulenceElement, SVGFilterPrimitiveStandardAttributes>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedNumberAttribute m_baseFrequencyX { m_attributeRegistryBridge }; >+ SVGAnimatedNumberAttribute m_baseFrequencyY { m_attributeRegistryBridge }; >+ SVGAnimatedIntegerAttribute m_numOctaves { m_attributeRegistryBridge, 1 }; >+ SVGAnimatedNumberAttribute m_seed { m_attributeRegistryBridge }; >+ SVGAnimatedEnumerationAttribute<SVGStitchOptions> m_stitchTiles { m_attributeRegistryBridge, SVG_STITCHTYPE_NOSTITCH }; >+ SVGAnimatedEnumerationAttribute<TurbulenceType> m_type { m_attributeRegistryBridge, TurbulenceType::Turbulence }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFilterElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFilterElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFilterElement.cpp (working copy) >@@ -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 >@@ -28,9 +29,7 @@ > #include "RenderSVGResourceFilter.h" > #include "SVGFilterBuilder.h" > #include "SVGFilterPrimitiveStandardAttributes.h" >-#include "SVGNames.h" > #include "SVGParserUtilities.h" >-#include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> > >@@ -38,44 +37,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%") >+ , SVGURIReference(this) >+ , SVGExternalResourcesRequired(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 +67,27 @@ const AtomicString& SVGFilterElement::fi > > 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 +97,24 @@ void SVGFilterElement::parseAttribute(co > 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 +127,19 @@ void SVGFilterElement::parseAttribute(co > > 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) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >+ if (auto* renderer = this->renderer()) >+ renderer->setNeedsLayout(); > return; > } > >- if (auto* renderer = this->renderer()) >- renderer->setNeedsLayout(); >+ SVGElement::svgAttributeChanged(attrName); > } > > void SVGFilterElement::childrenChanged(const ChildChange& change) >Index: Source/WebCore/svg/SVGFilterElement.h >=================================================================== >--- Source/WebCore/svg/SVGFilterElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFilterElement.h (working copy) >@@ -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,12 +23,12 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedEnumeration.h" > #include "SVGAnimatedInteger.h" > #include "SVGAnimatedLength.h" > #include "SVGElement.h" > #include "SVGExternalResourcesRequired.h" >+#include "SVGNames.h" > #include "SVGURIReference.h" > #include "SVGUnitTypes.h" > >@@ -43,13 +44,19 @@ public: > private: > SVGFilterElement(const QualifiedName&, Document&); > >- bool needsPendingResourceHandling() const final { return false; } >- >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFilterElement, SVGElement, SVGURIReference, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isAnimatedLengthAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 +65,17 @@ 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_filterUnits { m_attributeRegistryBridge, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_primitiveUnits { m_attributeRegistryBridge, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth, "-10%" }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight, "-10%" }; >+ SVGAnimatedLengthAttribute m_width { m_attributeRegistryBridge, LengthModeWidth, "120%" }; >+ SVGAnimatedLengthAttribute m_height { m_attributeRegistryBridge, LengthModeHeight, "120%" }; >+ SVGAnimatedIntegerAttribute m_filterResX { m_attributeRegistryBridge }; >+ SVGAnimatedIntegerAttribute m_filterResY { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp >=================================================================== >--- Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp (working copy) >@@ -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,24 @@ 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 +58,15 @@ void SVGFilterPrimitiveStandardAttribute > 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 +82,13 @@ bool SVGFilterPrimitiveStandardAttribute > > 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) >Index: Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h >=================================================================== >--- Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h (revision 233069) >+++ Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h (working copy) >@@ -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 { >@@ -59,15 +61,22 @@ private: > bool rendererIsNeeded(const RenderStyle&) override; > bool childShouldCreateRenderer(const Node&) const override { return false; } > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFilterPrimitiveStandardAttributes, SVGElement>; >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const override { return m_attributeRegistryBridge; } >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } > >- 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 >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth, "0%" }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight, "0%" }; >+ SVGAnimatedLengthAttribute m_width { m_attributeRegistryBridge, LengthModeWidth, "100%" }; >+ SVGAnimatedLengthAttribute m_height { m_attributeRegistryBridge, LengthModeHeight, "100%" }; >+ SVGAnimatedStringAttribute m_result { m_attributeRegistryBridge }; > }; > > void invalidateFilterPrimitiveParent(SVGElement*); >Index: Source/WebCore/svg/SVGFitToViewBox.cpp >=================================================================== >--- Source/WebCore/svg/SVGFitToViewBox.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFitToViewBox.cpp (working copy) >@@ -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 >@@ -32,14 +33,57 @@ > > namespace WebCore { > >-bool SVGFitToViewBox::parseViewBox(Document* doc, const String& s, FloatRect& viewBox) >+SVGFitToViewBox::SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState animatedState) >+ : m_document(contextElement->document()) >+ , m_attributeRegistryBridge(*this, *contextElement, animatedState) > { >- auto upconvertedCharacters = StringView(s).upconvertedCharacters(); >- const UChar* characters = upconvertedCharacters; >- return parseViewBox(doc, characters, characters + s.length(), viewBox, true); >+ 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>(); > } > >-bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate) >+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(characters, characters + value.length(), viewBox); >+} >+ >+bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate) > { > String str(c, end - c); > >@@ -50,30 +94,35 @@ bool SVGFitToViewBox::parseViewBox(Docum > 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) { >+ if (!valid) { >+ m_document.accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); >+ return false; >+ } >+ >+ // check that width is positive >+ if (width < 0.0) { >+ m_document.accessSVGExtensions().reportError("A negative value for ViewBox width is not allowed"); >+ return false; >+ } >+ >+ // check that height is positive >+ if (height < 0.0) { >+ m_document.accessSVGExtensions().reportError("A negative value for ViewBox height is not allowed"); >+ return false; >+ } >+ >+ skipOptionalSVGSpaces(c, end); >+ >+ // nothing should come after the last, fourth number >+ if (c < end) { >+ m_document.accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); >+ return false; >+ } > } > >- viewBox = FloatRect(x, y, width, height); >+ viewBox = { x, y, width, height }; > return true; > } > >@@ -85,15 +134,4 @@ AffineTransform SVGFitToViewBox::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); >-} >- > } >Index: Source/WebCore/svg/SVGFitToViewBox.h >=================================================================== >--- Source/WebCore/svg/SVGFitToViewBox.h (revision 233069) >+++ Source/WebCore/svg/SVGFitToViewBox.h (working copy) >@@ -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> >@@ -35,34 +37,52 @@ class SVGFitToViewBox { > public: > static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatioValue&, float viewWidth, float viewHeight); > >- static bool isKnownAttribute(const QualifiedName&); >- static void addSupportedAttributes(HashSet<QualifiedName>&); >- >- template<class SVGElementTarget> >- static bool parseAttribute(SVGElementTarget* target, const QualifiedName& name, const AtomicString& value) >+ const FloatRect& viewBox() const { return m_viewBox.value(); } >+ void setViewBox(const FloatRect& viewBox) > { >- ASSERT(target); >- if (name == SVGNames::viewBoxAttr) { >- FloatRect viewBox; >- bool valueIsValid = !value.isNull() && parseViewBox(&target->document(), value, viewBox); >- target->setViewBoxBaseValue(viewBox, valueIsValid); >- return true; >- } >- >- if (name == SVGNames::preserveAspectRatioAttr) { >- SVGPreserveAspectRatioValue preserveAspectRatio; >- preserveAspectRatio.parse(value); >- target->setPreserveAspectRatioBaseValue(preserveAspectRatio); >- return true; >- } >+ m_viewBox.setValue(viewBox); >+ m_isViewBoxValid = true; >+ } > >- return false; >+ void resetViewBox() >+ { >+ m_viewBox.resetValue(); >+ m_isViewBoxValid = false; > } > >- static bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); >+ const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.value(); } >+ 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); >+ >+ 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&); >+ Document& m_document; >+ bool m_isViewBoxValid { false }; >+ >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFitToViewBox>; >+ static void registerAttributes(); >+ >+ AttributeRegistryBridge m_attributeRegistryBridge; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ >+ SVGAnimatedRectAttribute m_viewBox { m_attributeRegistryBridge }; >+ SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGFontElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGFontElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGFontElement.cpp (working copy) >@@ -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,26 +40,18 @@ 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) > { > return adoptRef(*new SVGFontElement(tagName, document)); > } >- >+ > } > > #endif // ENABLE(SVG_FONTS) >Index: Source/WebCore/svg/SVGFontElement.h >=================================================================== >--- Source/WebCore/svg/SVGFontElement.h (revision 233069) >+++ Source/WebCore/svg/SVGFontElement.h (working copy) >@@ -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 >@@ -50,11 +51,12 @@ public: > private: > SVGFontElement(const QualifiedName&, Document&); > >- bool rendererIsNeeded(const RenderStyle&) final { return false; } >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGFontElement, SVGElement, SVGExternalResourcesRequired>; >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFontElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ bool rendererIsNeeded(const RenderStyle&) final { return false; } >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGForeignObjectElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGForeignObjectElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGForeignObjectElement.cpp (working copy) >@@ -2,6 +2,7 @@ > * Copyright (C) 2006 Apple Inc. All rights reserved. > * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@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,33 +37,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 +50,15 @@ Ref<SVGForeignObjectElement> SVGForeignO > 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 +66,13 @@ void SVGForeignObjectElement::parseAttri > 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 +82,19 @@ void SVGForeignObjectElement::parseAttri > > void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >- return; >- } >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > >- InstanceInvalidationGuard guard(*this); >- >- if (attrName == SVGNames::widthAttr >- || attrName == SVGNames::heightAttr) { >- invalidateSVGPresentationAttributeStyle(); >+ if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) >+ invalidateSVGPresentationAttributeStyle(); >+ else { >+ updateRelativeLengthsInformation(); >+ if (auto renderer = this->renderer()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > return; > } >- >- if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) >- updateRelativeLengthsInformation(); >- >- if (auto renderer = this->renderer()) >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ SVGGraphicsElement::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGForeignObjectElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >Index: Source/WebCore/svg/SVGForeignObjectElement.h >=================================================================== >--- Source/WebCore/svg/SVGForeignObjectElement.h (revision 233069) >+++ Source/WebCore/svg/SVGForeignObjectElement.h (working copy) >@@ -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 >@@ -36,8 +36,12 @@ public: > private: > SVGForeignObjectElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGForeignObjectElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >@@ -45,16 +49,16 @@ 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { m_attributeRegistryBridge, LengthModeHeight }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGGElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGGElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGGElement.cpp (working copy) >@@ -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(Doc > 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,14 @@ void SVGGElement::parseAttribute(const Q > > void SVGGElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >+ if (isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ if (auto renderer = this->renderer()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > return; > } > >- InstanceInvalidationGuard guard(*this); >- >- if (auto renderer = this->renderer()) >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ SVGGraphicsElement::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGGElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >Index: Source/WebCore/svg/SVGGElement.h >=================================================================== >--- Source/WebCore/svg/SVGGElement.h (revision 233069) >+++ Source/WebCore/svg/SVGGElement.h (working copy) >@@ -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 >@@ -39,15 +40,18 @@ private: > > bool isValid() const final { return SVGTests::isValid(); } > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGGElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > > bool rendererIsNeeded(const RenderStyle&) final; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGElement) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGGeometryElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGGeometryElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGGeometryElement.cpp (working copy) >@@ -1,8 +1,6 @@ > /* >- * 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. > * 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 >@@ -24,32 +22,26 @@ > #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(); >+} >+ >+void SVGGeometryElement::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::pathLengthAttr, &SVGGeometryElement::m_pathLength>(); > } > > float SVGGeometryElement::getTotalLength() const >@@ -99,24 +91,12 @@ bool SVGGeometryElement::isPointInStroke > FloatPoint point {static_cast<float>(pointInit.x), static_cast<float>(pointInit.y)}; > return renderer->isPointInStroke(point); > } >- >-bool SVGGeometryElement::isSupportedAttribute(const QualifiedName& attrName) >-{ >- 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); >-} >- >+ > 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 +106,14 @@ void SVGGeometryElement::parseAttribute( > > 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); > } > > } >Index: Source/WebCore/svg/SVGGeometryElement.h >=================================================================== >--- Source/WebCore/svg/SVGGeometryElement.h (revision 233069) >+++ Source/WebCore/svg/SVGGeometryElement.h (working copy) >@@ -1,7 +1,6 @@ > /* >- * 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 +21,7 @@ > #pragma once > > #include "Path.h" >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedNumber.h" >-#include "SVGExternalResourcesRequired.h" > #include "SVGGraphicsElement.h" > #include "SVGNames.h" > >@@ -46,13 +43,22 @@ public: > 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: >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGGeometryElement, SVGGraphicsElement>; >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const override { return m_attributeRegistryBridge; } >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ >+ SVGAnimatedNumberAttribute m_pathLength { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGGlyphRefElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGGlyphRefElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGGlyphRefElement.cpp (working copy) >@@ -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) >Index: Source/WebCore/svg/SVGGlyphRefElement.h >=================================================================== >--- Source/WebCore/svg/SVGGlyphRefElement.h (revision 233069) >+++ Source/WebCore/svg/SVGGlyphRefElement.h (working copy) >@@ -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,12 +46,13 @@ public: > private: > SVGGlyphRefElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGGlyphRefElement, SVGElement, SVGURIReference>; >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > > float m_x { 0 }; > float m_y { 0 }; >Index: Source/WebCore/svg/SVGGradientElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGGradientElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGGradientElement.cpp (working copy) >@@ -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) >+ , SVGURIReference(this) >+ , SVGExternalResourcesRequired(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( > 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(newList.size()); >+ m_gradientTransform.setValue(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( > > 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) >@@ -137,7 +119,7 @@ Vector<Gradient::ColorStop> SVGGradientE > const Color& color = stop.stopColorIncludingOpacity(); > > // Figure out right monotonic offset. >- float offset = stop.offset(); >+ float offset = stop.m_offset.animatedValue(); > offset = std::min(std::max(previousOffset, offset), 1.0f); > previousOffset = offset; > >Index: Source/WebCore/svg/SVGGradientElement.h >=================================================================== >--- Source/WebCore/svg/SVGGradientElement.h (revision 233069) >+++ Source/WebCore/svg/SVGGradientElement.h (working copy) >@@ -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 >@@ -87,7 +88,6 @@ public: > protected: > SVGGradientElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -96,13 +96,20 @@ private: > > 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 >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGGradientElement, SVGElement, SVGURIReference, SVGExternalResourcesRequired>; >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const override { return m_attributeRegistryBridge; } >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ >+ SVGAnimatedEnumerationAttribute<SVGSpreadMethodType> m_spreadMethod { m_attributeRegistryBridge, SVGSpreadMethodPad }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_gradientUnits { m_attributeRegistryBridge, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >+ SVGAnimatedTransformListAttribute m_gradientTransform { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGGraphicsElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGGraphicsElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGGraphicsElement.cpp (working copy) >@@ -36,20 +36,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; >@@ -113,7 +105,7 @@ AffineTransform SVGGraphicsElement::anim > } > > } else >- transform().concatenate(matrix); >+ m_transform.animatedValue().concatenate(matrix); > > if (m_supplementalTransform) > return *m_supplementalTransform * matrix; >@@ -127,15 +119,12 @@ AffineTransform* SVGGraphicsElement::sup > 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 +132,8 @@ void SVGGraphicsElement::parseAttribute( > if (name == SVGNames::transformAttr) { > SVGTransformListValues newList; > newList.parse(value); >- detachAnimatedTransformListWrappers(newList.size()); >- setTransformBaseValue(newList); >+ m_transform.detachAnimatedListWrappers(newList.size()); >+ m_transform.setValue(newList); > return; > } > >@@ -154,27 +143,21 @@ void SVGGraphicsElement::parseAttribute( > > void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >- return; >- } >- >- InstanceInvalidationGuard guard(*this); >- >- if (SVGTests::handleAttributeChange(this, attrName)) >- return; >- >- auto renderer = this->renderer(); >- if (!renderer) >- return; >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > >- if (attrName == SVGNames::transformAttr) { >- renderer->setNeedsTransformUpdate(); >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ auto renderer = this->renderer(); >+ if (!renderer) >+ return; >+ >+ if (attrName == SVGNames::transformAttr) { >+ renderer->setNeedsTransformUpdate(); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > return; > } >- >- ASSERT_NOT_REACHED(); >+ SVGTests::handleAttributeChange(attrName); >+ SVGElement::svgAttributeChanged(attrName); > } > > SVGElement* SVGGraphicsElement::nearestViewportElement() const >@@ -210,19 +193,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); >-} >- > } >Index: Source/WebCore/svg/SVGGraphicsElement.h >=================================================================== >--- Source/WebCore/svg/SVGGraphicsElement.h (revision 233069) >+++ Source/WebCore/svg/SVGGraphicsElement.h (working copy) >@@ -62,38 +62,35 @@ public: > > size_t approximateMemoryCost() const override { return sizeof(*this); } > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >- > protected: > SVGGraphicsElement(const QualifiedName&, Document&); > >- bool supportsFocus() const override { return Element::supportsFocus() || hasFocusEventListeners(); } >- > 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 >+ bool supportsFocus() const override { return Element::supportsFocus() || hasFocusEventListeners(); } > > private: > bool isSVGGraphicsElement() const override { return true; } > >- static bool isSupportedAttribute(const QualifiedName&); >- >- // SVGTests >- void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } >- void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } >- void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } >- > // Used by <animateMotion> > std::unique_ptr<AffineTransform> m_supplementalTransform; > > // Used to isolate blend operations caused by masking. > bool m_shouldIsolateBlending; >+ >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGGraphicsElement, SVGElement, SVGTests>; >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const override { return m_attributeRegistryBridge; } >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ >+ SVGAnimatedTransformListAttribute m_transform { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGImageElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGImageElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGImageElement.cpp (working copy) >@@ -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 >@@ -23,11 +24,9 @@ > #include "config.h" > #include "SVGImageElement.h" > >-#include "CSSPropertyNames.h" > #include "RenderImageResource.h" > #include "RenderSVGImage.h" > #include "RenderSVGResource.h" >-#include "SVGNames.h" > #include "XLinkNames.h" > #include <wtf/IsoMallocInlines.h> > #include <wtf/NeverDestroyed.h> >@@ -36,35 +35,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 +58,16 @@ bool SVGImageElement::hasSingleSecurityO > 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 +75,20 @@ void SVGImageElement::parseAttribute(con > 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 +99,39 @@ void SVGImageElement::parseAttribute(con > > void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGGraphicsElement::svgAttributeChanged(attrName); >- return; >- } >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > >- InstanceInvalidationGuard guard(*this); >+ if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { >+ invalidateSVGPresentationAttributeStyle(); >+ return; >+ } > >- if (attrName == SVGNames::widthAttr >- || attrName == SVGNames::heightAttr) { >- invalidateSVGPresentationAttributeStyle(); >- return; >- } >+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) >+ updateRelativeLengthsInformation(); > >- bool isLengthAttribute = attrName == SVGNames::xAttr >- || attrName == SVGNames::yAttr >- || attrName == SVGNames::widthAttr >- || attrName == SVGNames::heightAttr; >+ if (auto* renderer = this->renderer()) { >+ if (attrName == SVGNames::preserveAspectRatioAttr || downcast<RenderSVGImage>(*renderer).updateImageViewport()) >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } > >- if (isLengthAttribute) >- updateRelativeLengthsInformation(); >+ return; >+ } > > if (SVGURIReference::isKnownAttribute(attrName)) { > m_imageLoader.updateFromElementIgnoringPreviousError(); > return; > } >+ >+ if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > >- auto* renderer = this->renderer(); >- if (!renderer) >- return; >- >- if (isLengthAttribute) { >- if (downcast<RenderSVGImage>(*renderer).updateImageViewport()) >+ if (auto* renderer = this->renderer()) > RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > return; > } > >- if (attrName == SVGNames::preserveAspectRatioAttr >- || SVGLangSpace::isKnownAttribute(attrName) >- || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >- return; >- } >- >- ASSERT_NOT_REACHED(); >+ SVGGraphicsElement::svgAttributeChanged(attrName); > } > > RenderPtr<RenderElement> SVGImageElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) >@@ -176,7 +141,7 @@ RenderPtr<RenderElement> SVGImageElement > > bool SVGImageElement::haveLoadedRequiredResources() > { >- return !externalResourcesRequiredBaseValue() || !m_imageLoader.hasPendingActivity(); >+ return !externalResourcesRequired() || !m_imageLoader.hasPendingActivity(); > } > > void SVGImageElement::didAttachRenderers() >@@ -209,7 +174,7 @@ void SVGImageElement::addSubresourceAttr > { > SVGGraphicsElement::addSubresourceAttributeURLs(urls); > >- addSubresourceURL(urls, document().completeURL(href())); >+ addSubresourceURL(urls, document().completeURL(m_href.animatedValue())); > } > > void SVGImageElement::didMoveToNewDocument(Document& oldDocument, Document& newDocument) >Index: Source/WebCore/svg/SVGImageElement.h >=================================================================== >--- Source/WebCore/svg/SVGImageElement.h (revision 233069) >+++ Source/WebCore/svg/SVGImageElement.h (working copy) >@@ -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,12 +21,12 @@ > > #pragma once > >-#include "SVGAnimatedBoolean.h" > #include "SVGAnimatedLength.h" > #include "SVGAnimatedPreserveAspectRatio.h" > #include "SVGExternalResourcesRequired.h" > #include "SVGGraphicsElement.h" > #include "SVGImageLoader.h" >+#include "SVGNames.h" > #include "SVGURIReference.h" > > namespace WebCore { >@@ -40,36 +41,37 @@ public: > > private: > SVGImageElement(const QualifiedName&, Document&); >- >- bool isValid() const final { return SVGTests::isValid(); } > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGImageElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 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 >+ bool isValid() const final { return SVGTests::isValid(); } >+ bool selfHasRelativeLengths() const final { return true; } > > SVGImageLoader m_imageLoader; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGImageLoader.cpp >=================================================================== >--- Source/WebCore/svg/SVGImageLoader.cpp (revision 233069) >+++ Source/WebCore/svg/SVGImageLoader.cpp (working copy) >@@ -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); > } > } >Index: Source/WebCore/svg/SVGLangSpace.cpp >=================================================================== >--- Source/WebCore/svg/SVGLangSpace.cpp (revision 233069) >+++ Source/WebCore/svg/SVGLangSpace.cpp (working copy) >@@ -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 >@@ -26,24 +27,30 @@ > > namespace WebCore { > >-void SVGLangSpace::setXmllang(const AtomicString& xmlLang) >+SVGLangSpace::SVGLangSpace(SVGElement* contextElement) >+ : m_contextElement(*contextElement) >+ , m_attributeRegistryBridge(*this, *contextElement) > { >- m_lang = xmlLang; >+ registerAttributes(); > } > >-const AtomicString& SVGLangSpace::xmlspace() const >+void SVGLangSpace::registerAttributes() > { >- if (!m_space) { >- static NeverDestroyed<const AtomicString> defaultString("default", AtomicString::ConstructFromLiteral); >+ 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>()); >+} >+ >+const String& SVGLangSpace::xmlspace() const >+{ >+ if (!m_space.value()) { >+ static NeverDestroyed<String> defaultString("default"); > return defaultString; > } > >- return m_space; >-} >- >-void SVGLangSpace::setXmlspace(const AtomicString& xmlSpace) >-{ >- m_space = xmlSpace; >+ return m_space.value(); > } > > void SVGLangSpace::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -53,23 +60,16 @@ void SVGLangSpace::parseAttribute(const > if (name.matches(XMLNames::spaceAttr)) > setXmlspace(value); > } >- >-bool SVGLangSpace::isKnownAttribute(const QualifiedName& attrName) >-{ >- return attrName.matches(XMLNames::langAttr) || attrName.matches(XMLNames::spaceAttr); >-} >- >-static void addWithAndWithoutXMLPrefix(HashSet<QualifiedName>& set, const QualifiedName& attributeName) >+ >+void SVGLangSpace::svgAttributeChanged(const QualifiedName& attrName) > { >- ASSERT(attributeName.prefix().isNull()); >- set.add(attributeName); >- set.add({ xmlAtom(), attributeName.localName(), attributeName.namespaceURI() }); >-} >+ if (!isKnownAttribute(attrName)) >+ return; > >-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); >+ } > } > > } >Index: Source/WebCore/svg/SVGLangSpace.h >=================================================================== >--- Source/WebCore/svg/SVGLangSpace.h (revision 233069) >+++ Source/WebCore/svg/SVGLangSpace.h (working copy) >@@ -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 >@@ -27,20 +28,34 @@ namespace WebCore { > > 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&); >+ >+protected: >+ SVGLangSpace(SVGElement* contextElement); > > private: >- AtomicString m_lang; >- AtomicString m_space; >+ using SVGStringAttribute = SVGPropertyAttribute<String>; >+ using SVGStringAttributeAccessor = SVGPropertyAttributeAccessor<SVGLangSpace, SVGStringAttribute>; >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGLangSpace>; >+ >+ static void registerAttributes(); >+ >+ SVGElement& m_contextElement; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge; >+ SVGStringAttribute m_lang { m_attributeRegistryBridge }; >+ SVGStringAttribute m_space { m_attributeRegistryBridge }; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return attributeRegistry().isKnownAttribute(attributeName); } > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGLengthContext.h >=================================================================== >--- Source/WebCore/svg/SVGLengthContext.h (revision 233069) >+++ Source/WebCore/svg/SVGLengthContext.h (working copy) >@@ -57,7 +57,7 @@ public: > template<typename T> > static FloatRect resolveRectangle(const T* context, SVGUnitTypes::SVGUnitType type, const FloatRect& viewport) > { >- return SVGLengthContext::resolveRectangle(context, type, viewport, context->x(), context->y(), context->width(), context->height()); >+ return SVGLengthContext::resolveRectangle(context, type, viewport, context->m_x.animatedValue(), context->m_y.animatedValue(), context->m_width.animatedValue(), context->m_height.animatedValue()); > } > > static FloatRect resolveRectangle(const SVGElement*, SVGUnitTypes::SVGUnitType, const FloatRect& viewport, const SVGLengthValue& x, const SVGLengthValue& y, const SVGLengthValue& width, const SVGLengthValue& height); >Index: Source/WebCore/svg/SVGLineElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGLineElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGLineElement.cpp (working copy) >@@ -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,19 @@ > #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 +42,15 @@ Ref<SVGLineElement> SVGLineElement::crea > 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,61 +58,42 @@ void SVGLineElement::parseAttribute(cons > 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 > { >- return x1().isRelative() >- || y1().isRelative() >- || x2().isRelative() >- || y2().isRelative(); >+ return m_x1.animatedValue().isRelative() >+ || m_y1.animatedValue().isRelative() >+ || m_x2.animatedValue().isRelative() >+ || m_y2.animatedValue().isRelative(); > } > > } >Index: Source/WebCore/svg/SVGLineElement.h >=================================================================== >--- Source/WebCore/svg/SVGLineElement.h (revision 233069) >+++ Source/WebCore/svg/SVGLineElement.h (working copy) >@@ -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 { > >@@ -35,23 +36,26 @@ public: > private: > SVGLineElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGLineElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_x1 { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y1 { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_x2 { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y2 { m_attributeRegistryBridge, LengthModeHeight }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGLinearGradientElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGLinearGradientElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGLinearGradientElement.cpp (working copy) >@@ -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> SVGLinearG > 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::parseAttr > 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::parseAttr > > 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&) >@@ -118,14 +102,14 @@ RenderPtr<RenderElement> SVGLinearGradie > static void setGradientAttributes(SVGGradientElement& element, LinearGradientAttributes& attributes, bool isLinear = true) > { > if (!attributes.hasSpreadMethod() && element.hasAttribute(SVGNames::spreadMethodAttr)) >- attributes.setSpreadMethod(element.spreadMethod()); >+ attributes.setSpreadMethod(element.m_spreadMethod.animatedValue()); > > if (!attributes.hasGradientUnits() && element.hasAttribute(SVGNames::gradientUnitsAttr)) >- attributes.setGradientUnits(element.gradientUnits()); >+ attributes.setGradientUnits(element.m_gradientUnits.animatedValue()); > > if (!attributes.hasGradientTransform() && element.hasAttribute(SVGNames::gradientTransformAttr)) { > AffineTransform transform; >- element.gradientTransform().concatenate(transform); >+ element.m_gradientTransform.animatedValue().concatenate(transform); > attributes.setGradientTransform(transform); > } > >@@ -139,16 +123,16 @@ static void setGradientAttributes(SVGGra > SVGLinearGradientElement& linear = downcast<SVGLinearGradientElement>(element); > > if (!attributes.hasX1() && element.hasAttribute(SVGNames::x1Attr)) >- attributes.setX1(linear.x1()); >+ attributes.setX1(linear.m_x1.animatedValue()); > > if (!attributes.hasY1() && element.hasAttribute(SVGNames::y1Attr)) >- attributes.setY1(linear.y1()); >+ attributes.setY1(linear.m_y1.animatedValue()); > > if (!attributes.hasX2() && element.hasAttribute(SVGNames::x2Attr)) >- attributes.setX2(linear.x2()); >+ attributes.setX2(linear.m_x2.animatedValue()); > > if (!attributes.hasY2() && element.hasAttribute(SVGNames::y2Attr)) >- attributes.setY2(linear.y2()); >+ attributes.setY2(linear.m_y2.animatedValue()); > } > } > >@@ -165,7 +149,7 @@ bool SVGLinearGradientElement::collectGr > > while (true) { > // Respect xlink:href, take attributes from referenced element >- auto refNode = makeRefPtr(SVGURIReference::targetElementFromIRIString(current->href(), document())); >+ auto refNode = makeRefPtr(SVGURIReference::targetElementFromIRIString(current->m_href.animatedValue(), document())); > if (is<SVGGradientElement>(refNode)) { > current = downcast<SVGGradientElement>(refNode.get()); > >@@ -188,10 +172,10 @@ bool SVGLinearGradientElement::collectGr > > bool SVGLinearGradientElement::selfHasRelativeLengths() const > { >- return x1().isRelative() >- || y1().isRelative() >- || x2().isRelative() >- || y2().isRelative(); >+ return m_x1.animatedValue().isRelative() >+ || m_y1.animatedValue().isRelative() >+ || m_x2.animatedValue().isRelative() >+ || m_y2.animatedValue().isRelative(); > } > > } >Index: Source/WebCore/svg/SVGLinearGradientElement.h >=================================================================== >--- Source/WebCore/svg/SVGLinearGradientElement.h (revision 233069) >+++ Source/WebCore/svg/SVGLinearGradientElement.h (working copy) >@@ -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 >@@ -38,7 +39,12 @@ public: > private: > SVGLinearGradientElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGLinearGradientElement, SVGGradientElement>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -46,12 +52,13 @@ 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_x1 { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y1 { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_x2 { m_attributeRegistryBridge, LengthModeWidth, "100%" }; >+ SVGAnimatedLengthAttribute m_y2 { m_attributeRegistryBridge, LengthModeHeight }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGMPathElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGMPathElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGMPathElement.cpp (working copy) >@@ -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) >+ , SVGURIReference(this) >+ , SVGExternalResourcesRequired(this) > { > ASSERT(hasTagName(SVGNames::mpathTag)); >- registerAnimatedPropertiesForSVGMPathElement(); > } > > Ref<SVGMPathElement> SVGMPathElement::create(const QualifiedName& tagName, Document& document) >@@ -64,7 +57,7 @@ void SVGMPathElement::buildPendingResour > return; > > String id; >- auto target = makeRefPtr(SVGURIReference::targetElementFromIRIString(href(), document(), &id)); >+ auto target = makeRefPtr(SVGURIReference::targetElementFromIRIString(m_href.animatedValue(), document(), &id)); > if (!target) { > // Do not register as pending if we are already pending this resource. > if (document().accessSVGExtensions().isPendingResource(this, id)) >@@ -123,13 +116,12 @@ void SVGMPathElement::svgAttributeChange > buildPendingResource(); > return; > } >- > SVGElement::svgAttributeChanged(attrName); > } > > RefPtr<SVGPathElement> SVGMPathElement::pathElement() > { >- Element* target = targetElementFromIRIString(href(), document()); >+ Element* target = targetElementFromIRIString(m_href.animatedValue(), document()); > if (is<SVGPathElement>(target)) > return downcast<SVGPathElement>(target); > return nullptr; >Index: Source/WebCore/svg/SVGMPathElement.h >=================================================================== >--- Source/WebCore/svg/SVGMPathElement.h (revision 233069) >+++ Source/WebCore/svg/SVGMPathElement.h (working copy) >@@ -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 >@@ -44,23 +45,23 @@ public: > private: > SVGMPathElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGMPathElement, SVGElement, SVGURIReference, SVGExternalResourcesRequired>; >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } >+ 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 >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGMarkerElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGMarkerElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGMarkerElement.cpp (working copy) >@@ -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) >@@ -105,27 +62,22 @@ const AtomicString& SVGMarkerElement::or > > AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const > { >- return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight); >+ return SVGFitToViewBox::viewBoxToViewTransform(m_viewBox.animatedValue(), m_preserveAspectRatio.animatedValue(), 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(co > 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(co > 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)) { >+ if (isAnimatedLengthAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ 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 (SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName)) { >+ if (RenderObject* object = renderer()) >+ object->setNeedsLayout(); >+ return; >+ } > >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGElement::svgAttributeChanged(attrName); > } > > void SVGMarkerElement::childrenChanged(const ChildChange& change) >@@ -197,14 +151,14 @@ void SVGMarkerElement::childrenChanged(c > > 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() >@@ -224,55 +178,10 @@ RenderPtr<RenderElement> SVGMarkerElemen > > bool SVGMarkerElement::selfHasRelativeLengths() const > { >- return refX().isRelative() >- || refY().isRelative() >- || markerWidth().isRelative() >- || 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)); >+ return m_refX.animatedValue().isRelative() >+ || m_refY.animatedValue().isRelative() >+ || m_markerWidth.animatedValue().isRelative() >+ || m_markerHeight.animatedValue().isRelative(); > } > > } >Index: Source/WebCore/svg/SVGMarkerElement.h >=================================================================== >--- Source/WebCore/svg/SVGMarkerElement.h (revision 233069) >+++ Source/WebCore/svg/SVGMarkerElement.h (working copy) >@@ -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,16 @@ public: > void setOrientToAuto(); > void setOrientToAngle(SVGAngle&); > >- static const SVGPropertyInfo* orientTypePropertyInfo(); >- > private: > SVGMarkerElement(const QualifiedName&, Document&); > >- bool needsPendingResourceHandling() const override { return false; } >- >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isAnimatedLengthAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > void childrenChanged(const ChildChange&) override; >@@ -72,38 +75,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 >- >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ > 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(); >+ struct SVGAnimatedCustomOrientTypeAttribute : public SVGAnimatedEnumerationAttribute<SVGMarkerOrientType> { >+ using Base = SVGAnimatedEnumerationAttribute<SVGMarkerOrientType>; > >-private: >- mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType; >+ SVGAnimatedCustomOrientTypeAttribute(const SVGAttributeRegistryBridge& attributeRegistryBridge, SVGMarkerOrientType baseValue) >+ : Base(attributeRegistryBridge, 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 { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_refY { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_markerWidth { m_attributeRegistryBridge, LengthModeWidth, "3" }; >+ SVGAnimatedLengthAttribute m_markerHeight { m_attributeRegistryBridge, LengthModeHeight, "3" }; >+ SVGAnimatedEnumerationAttribute<SVGMarkerUnitsType> m_markerUnits { m_attributeRegistryBridge, SVGMarkerUnitsStrokeWidth }; >+ SVGAnimatedAngleAttribute m_orientAngle { m_attributeRegistryBridge }; >+ SVGAnimatedCustomOrientTypeAttribute m_orientType { m_attributeRegistryBridge, SVGMarkerOrientAngle }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGMarkerTypes.h >=================================================================== >--- Source/WebCore/svg/SVGMarkerTypes.h (revision 233069) >+++ Source/WebCore/svg/SVGMarkerTypes.h (working copy) >@@ -76,6 +76,7 @@ struct SVGPropertyTraits<SVGMarkerUnitsT > template<> > struct SVGPropertyTraits<SVGMarkerOrientType> { > static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; } >+ static String toString(SVGMarkerOrientType) { return emptyString(); } > static SVGMarkerOrientType fromString(const String& value, SVGAngleValue& angle) > { > if (value == "auto") >Index: Source/WebCore/svg/SVGMaskElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGMaskElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGMaskElement.cpp (working copy) >@@ -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%") >+ , SVGTests(this) >+ , SVGExternalResourcesRequired(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::crea > 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::maskUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskUnits>(); >+ registry.registerAttribute<SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskContentUnits>(); >+ 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>(); > } > > void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicString& value) >@@ -105,26 +73,26 @@ void SVGMaskElement::parseAttribute(cons > 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,17 @@ void SVGMaskElement::parseAttribute(cons > > void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >- SVGElement::svgAttributeChanged(attrName); >- return; >- } >+ if (isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); > >- InstanceInvalidationGuard guard(*this); >+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) >+ invalidateSVGPresentationAttributeStyle(); >+ else if (auto* renderer = this->renderer()) >+ renderer->setNeedsLayout(); > >- if (attrName == SVGNames::xAttr >- || attrName == SVGNames::yAttr >- || attrName == SVGNames::widthAttr >- || attrName == SVGNames::heightAttr) { >- invalidateSVGPresentationAttributeStyle(); > return; > } >- >- if (RenderObject* object = renderer()) >- object->setNeedsLayout(); >+ SVGElement::svgAttributeChanged(attrName); > } > > void SVGMaskElement::childrenChanged(const ChildChange& change) >@@ -170,19 +132,4 @@ RenderPtr<RenderElement> SVGMaskElement: > 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); >-} >- > } >Index: Source/WebCore/svg/SVGMaskElement.h >=================================================================== >--- Source/WebCore/svg/SVGMaskElement.h (revision 233069) >+++ Source/WebCore/svg/SVGMaskElement.h (working copy) >@@ -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 >@@ -35,40 +36,34 @@ class SVGMaskElement final : public SVGE > public: > static Ref<SVGMaskElement> create(const QualifiedName&, Document&); > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >- > private: > SVGMaskElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- bool needsPendingResourceHandling() const final { return false; } >- >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGMaskElement, SVGElement, SVGTests, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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); } >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskUnits { m_attributeRegistryBridge, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskContentUnits { m_attributeRegistryBridge, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth, "-10%" }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight, "-10%" }; >+ SVGAnimatedLengthAttribute m_width { m_attributeRegistryBridge, LengthModeWidth, "120%" }; >+ SVGAnimatedLengthAttribute m_height { m_attributeRegistryBridge, LengthModeHeight, "120%" }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGPathElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGPathElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGPathElement.cpp (working copy) >@@ -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> > 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,34 @@ void SVGPathElement::parseAttribute(cons > 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); >- >- RenderSVGPath* renderer = downcast<RenderSVGPath>(this->renderer()); >- >- 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 (isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { >+ InstanceInvalidationGuard guard(*this); >+ 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 (renderer) >+ renderer->setNeedsShapeUpdate(); >+ >+ invalidateMPathDependencies(); > } >- >+ > if (renderer) >- renderer->setNeedsShapeUpdate(); >- >- invalidateMPathDependencies(); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ return; > } >- >- if (renderer) >- RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ >+ SVGGeometryElement::svgAttributeChanged(attrName); > } > > void SVGPathElement::invalidateMPathDependencies() >@@ -299,15 +259,14 @@ void SVGPathElement::removedFromAncestor > > 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; >- >- return *animatedPathByteStream; >+ if (auto* animatedPathByteStream = static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property.get())->animatedPathByteStream()) >+ return *animatedPathByteStream; >+ >+ return m_pathByteStream; > } > > Path SVGPathElement::pathForByteStream() const >@@ -323,42 +282,24 @@ Path SVGPathElement::pathForByteStream() > 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(); > } > >-void SVGPathElement::animatedPropertyWillBeDeleted() >+void SVGPathElement::animatedPropertyWillBeDeleted(const SVGAnimatedProperty& animatedProperty) > { > // 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); >+ SVGGraphicsElement::animatedPropertyWillBeDeleted(animatedProperty); > } > > 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::n > > 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() >@@ -395,12 +335,15 @@ void SVGPathElement::pathSegListChanged( > // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! > break; > case PathSegUnalteredRole: >- if (listModification == ListModificationAppend) { >- ASSERT(!m_pathSegList.value.isEmpty()); >- appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last().copyRef(), m_pathByteStream, UnalteredParsing); >- } else >- buildSVGPathByteStreamFromSVGPathSegListValues(m_pathSegList.value, m_pathByteStream, UnalteredParsing); >- m_cachedPath = std::nullopt; >+ { >+ auto& pathSegList = m_pathSegList.value(false); >+ if (listModification == ListModificationAppend) { >+ ASSERT(!pathSegList.isEmpty()); >+ appendSVGPathByteStreamFromSVGPathSeg(pathSegList.last().copyRef(), m_pathByteStream, UnalteredParsing); >+ } else >+ buildSVGPathByteStreamFromSVGPathSegListValues(pathSegList, m_pathByteStream, UnalteredParsing); >+ m_cachedPath = std::nullopt; >+ } > break; > case PathSegUndefinedRole: > return; >Index: Source/WebCore/svg/SVGPathElement.h >=================================================================== >--- Source/WebCore/svg/SVGPathElement.h (revision 233069) >+++ Source/WebCore/svg/SVGPathElement.h (working copy) >@@ -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,45 +97,60 @@ public: > > FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) final; > >- static const SVGPropertyInfo* dPropertyInfo(); >- > bool isAnimValObserved() const { return m_isAnimValObserved; } > >- void animatedPropertyWillBeDeleted(); >- > size_t approximateMemoryCost() const final; > > private: > SVGPathElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGPathElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); > >- static bool isSupportedAttribute(const QualifiedName&); >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 >+ void animatedPropertyWillBeDeleted(const SVGAnimatedProperty&) final; >+ >+ bool supportsMarkers() const final { return true; } >+ RefPtr<SVGAnimatedProperty> lookupOrCreateDWrapper(); > > RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; > > Node::InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; > void removedFromAncestor(RemovalType, ContainerNode&) final; >- > void invalidateMPathDependencies(); > >+ bool isValid() const final { return SVGTests::isValid(); } >+ > private: > SVGPathByteStream m_pathByteStream; > mutable std::optional<Path> m_cachedPath; >- mutable SVGSynchronizableAnimatedProperty<SVGPathSegListValues> m_pathSegList; >- bool m_isAnimValObserved; >+ bool m_isAnimValObserved { false }; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ struct SVGAnimatedCustomPathSegListAttribute : public SVGAnimatedPathSegListAttribute { >+ SVGAnimatedCustomPathSegListAttribute(SVGPathElement& element, const SVGAttributeRegistryBridge& attributeRegistryBridge) >+ : SVGAnimatedPathSegListAttribute(attributeRegistryBridge, 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; >+ } >+ SVGPathElement& m_element; >+ }; >+ >+ using SVGAnimatedCustomPathSegListAttributeAccessor = SVGAnimatedAttributeAccessor<SVGPathElement, SVGAnimatedCustomPathSegListAttribute, AnimatedPath>; >+ SVGAnimatedCustomPathSegListAttribute m_pathSegList { *this, m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGPathSegList.cpp >=================================================================== >--- Source/WebCore/svg/SVGPathSegList.cpp (revision 233069) >+++ Source/WebCore/svg/SVGPathSegList.cpp (working copy) >@@ -21,7 +21,6 @@ > #include "config.h" > #include "SVGPathSegList.h" > >-#include "SVGAnimatedPathSegListPropertyTearOff.h" > #include "SVGPathElement.h" > #include "SVGPathSegWithContext.h" > >Index: Source/WebCore/svg/SVGPathSegListValues.h >=================================================================== >--- Source/WebCore/svg/SVGPathSegListValues.h (revision 233069) >+++ Source/WebCore/svg/SVGPathSegListValues.h (working copy) >@@ -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>>; >Index: Source/WebCore/svg/SVGPathSegWithContext.h >=================================================================== >--- Source/WebCore/svg/SVGPathSegWithContext.h (revision 233069) >+++ Source/WebCore/svg/SVGPathSegWithContext.h (working copy) >@@ -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->m_pathSegList.animatedProperty(); > case PathSegNormalizedRole: > // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! > return nullptr; >Index: Source/WebCore/svg/SVGPatternElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGPatternElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGPatternElement.cpp (working copy) >@@ -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) >+ , SVGURIReference(this) >+ , SVGTests(this) >+ , SVGExternalResourcesRequired(this) >+ , SVGFitToViewBox(this) > { > ASSERT(hasTagName(SVGNames::patternTag)); >- registerAnimatedPropertiesForSVGPatternElement(); >+ registerAttributes(); > } > > Ref<SVGPatternElement> SVGPatternElement::create(const QualifiedName& tagName, Document& document) >@@ -92,22 +62,18 @@ Ref<SVGPatternElement> SVGPatternElement > 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(c > 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(newList.size()); >+ m_patternTransform.setValue(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,12 +115,12 @@ void SVGPatternElement::parseAttribute(c > 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)) { >+ if (!isKnownAttribute(attrName)) { > SVGElement::svgAttributeChanged(attrName); > return; > } >@@ -192,32 +158,32 @@ RenderPtr<RenderElement> SVGPatternEleme > void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) const > { > if (!attributes.hasX() && hasAttribute(SVGNames::xAttr)) >- attributes.setX(x()); >+ attributes.setX(m_x.animatedValue()); > > if (!attributes.hasY() && hasAttribute(SVGNames::yAttr)) >- attributes.setY(y()); >+ attributes.setY(m_y.animatedValue()); > > if (!attributes.hasWidth() && hasAttribute(SVGNames::widthAttr)) >- attributes.setWidth(width()); >+ attributes.setWidth(m_width.animatedValue()); > > if (!attributes.hasHeight() && hasAttribute(SVGNames::heightAttr)) >- attributes.setHeight(height()); >+ attributes.setHeight(m_height.animatedValue()); > >- if (!attributes.hasViewBox() && hasAttribute(SVGNames::viewBoxAttr) && viewBoxIsValid()) >- attributes.setViewBox(viewBox()); >+ if (!attributes.hasViewBox() && hasAttribute(SVGNames::viewBoxAttr) && hasValidViewBox()) >+ attributes.setViewBox(m_viewBox.animatedValue()); > > if (!attributes.hasPreserveAspectRatio() && hasAttribute(SVGNames::preserveAspectRatioAttr)) >- attributes.setPreserveAspectRatio(preserveAspectRatio()); >+ attributes.setPreserveAspectRatio(m_preserveAspectRatio.animatedValue()); > > if (!attributes.hasPatternUnits() && hasAttribute(SVGNames::patternUnitsAttr)) >- attributes.setPatternUnits(patternUnits()); >+ attributes.setPatternUnits(m_patternUnits.animatedValue()); > > if (!attributes.hasPatternContentUnits() && hasAttribute(SVGNames::patternContentUnitsAttr)) >- attributes.setPatternContentUnits(patternContentUnits()); >+ attributes.setPatternContentUnits(m_patternContentUnits.animatedValue()); > > if (!attributes.hasPatternTransform() && hasAttribute(SVGNames::patternTransformAttr)) { > AffineTransform transform; >- patternTransform().concatenate(transform); >+ m_patternTransform.animatedValue().concatenate(transform); > attributes.setPatternTransform(transform); > } > >@@ -228,23 +194,8 @@ void SVGPatternElement::collectPatternAt > AffineTransform SVGPatternElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const > { > AffineTransform matrix; >- patternTransform().concatenate(matrix); >+ m_patternTransform.animatedValue().concatenate(matrix); > 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); >-} >- > } >Index: Source/WebCore/svg/SVGPatternElement.h >=================================================================== >--- Source/WebCore/svg/SVGPatternElement.h (revision 233069) >+++ Source/WebCore/svg/SVGPatternElement.h (working copy) >@@ -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 >@@ -47,44 +48,35 @@ public: > > AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const final; > >- // SVGTests >- Ref<SVGStringList> requiredFeatures(); >- Ref<SVGStringList> requiredExtensions(); >- Ref<SVGStringList> systemLanguage(); >- > private: > SVGPatternElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >- bool needsPendingResourceHandling() const final { return false; } >- >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGPatternElement, SVGElement, SVGURIReference, SVGTests, SVGExternalResourcesRequired, SVGFitToViewBox>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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); } >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternUnits { m_attributeRegistryBridge, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; >+ SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternContentUnits { m_attributeRegistryBridge, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; >+ SVGAnimatedTransformListAttribute m_patternTransform { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGPointListValues.h >=================================================================== >--- Source/WebCore/svg/SVGPointListValues.h (revision 233069) >+++ Source/WebCore/svg/SVGPointListValues.h (working copy) >@@ -44,7 +44,7 @@ struct SVGPropertyTraits<SVGPointListVal > 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; >Index: Source/WebCore/svg/SVGPolyElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGPolyElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGPolyElement.cpp (working copy) >@@ -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,20 +55,20 @@ void SVGPolyElement::parseAttribute(cons > 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); > } > > void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::pointsAttr) { >+ if (isKnownAttribute(attrName)) { > if (auto* renderer = downcast<RenderSVGPath>(this->renderer())) { > InstanceInvalidationGuard guard(*this); > renderer->setNeedsShapeUpdate(); >@@ -95,43 +77,20 @@ void SVGPolyElement::svgAttributeChanged > 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 >Index: Source/WebCore/svg/SVGPolyElement.h >=================================================================== >--- Source/WebCore/svg/SVGPolyElement.h (revision 233069) >+++ Source/WebCore/svg/SVGPolyElement.h (working copy) >@@ -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,22 @@ protected: > SVGPolyElement(const QualifiedName&, Document&); > > private: >- bool isValid() const override { return SVGTests::isValid(); } >- >- void parseAttribute(const QualifiedName&, const AtomicString&) override; >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGPolyElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } >+ 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > >-protected: >- mutable SVGSynchronizableAnimatedProperty<SVGPointListValues> m_points; >+public: >+ SVGAnimatedPointListAttribute m_points { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp >=================================================================== >--- Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp (revision 233069) >+++ Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp (working copy) >@@ -180,7 +180,7 @@ bool SVGPreserveAspectRatioValue::parseI > return true; > } > >-void SVGPreserveAspectRatioValue::transformRect(FloatRect& destRect, FloatRect& srcRect) >+void SVGPreserveAspectRatioValue::transformRect(FloatRect& destRect, FloatRect& srcRect) const > { > if (m_align == SVG_PRESERVEASPECTRATIO_NONE) > return; >Index: Source/WebCore/svg/SVGPreserveAspectRatioValue.h >=================================================================== >--- Source/WebCore/svg/SVGPreserveAspectRatioValue.h (revision 233069) >+++ Source/WebCore/svg/SVGPreserveAspectRatioValue.h (working copy) >@@ -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; > >Index: Source/WebCore/svg/SVGRadialGradientElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGRadialGradientElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGRadialGradientElement.cpp (working copy) >@@ -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> SVGRadialG > 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::parseAttr > 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::parseAttr > > 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&) >@@ -128,14 +108,14 @@ RenderPtr<RenderElement> SVGRadialGradie > static void setGradientAttributes(SVGGradientElement& element, RadialGradientAttributes& attributes, bool isRadial = true) > { > if (!attributes.hasSpreadMethod() && element.hasAttribute(SVGNames::spreadMethodAttr)) >- attributes.setSpreadMethod(element.spreadMethod()); >+ attributes.setSpreadMethod(element.m_spreadMethod.animatedValue()); > > if (!attributes.hasGradientUnits() && element.hasAttribute(SVGNames::gradientUnitsAttr)) >- attributes.setGradientUnits(element.gradientUnits()); >+ attributes.setGradientUnits(element.m_gradientUnits.animatedValue()); > > if (!attributes.hasGradientTransform() && element.hasAttribute(SVGNames::gradientTransformAttr)) { > AffineTransform transform; >- element.gradientTransform().concatenate(transform); >+ element.m_gradientTransform.animatedValue().concatenate(transform); > attributes.setGradientTransform(transform); > } > >@@ -149,22 +129,22 @@ static void setGradientAttributes(SVGGra > SVGRadialGradientElement& radial = downcast<SVGRadialGradientElement>(element); > > if (!attributes.hasCx() && element.hasAttribute(SVGNames::cxAttr)) >- attributes.setCx(radial.cx()); >+ attributes.setCx(radial.m_cx.animatedValue()); > > if (!attributes.hasCy() && element.hasAttribute(SVGNames::cyAttr)) >- attributes.setCy(radial.cy()); >+ attributes.setCy(radial.m_cy.animatedValue()); > > if (!attributes.hasR() && element.hasAttribute(SVGNames::rAttr)) >- attributes.setR(radial.r()); >+ attributes.setR(radial.m_r.animatedValue()); > > if (!attributes.hasFx() && element.hasAttribute(SVGNames::fxAttr)) >- attributes.setFx(radial.fx()); >+ attributes.setFx(radial.m_fx.animatedValue()); > > if (!attributes.hasFy() && element.hasAttribute(SVGNames::fyAttr)) >- attributes.setFy(radial.fy()); >+ attributes.setFy(radial.m_fy.animatedValue()); > > if (!attributes.hasFr() && element.hasAttribute(SVGNames::frAttr)) >- attributes.setFr(radial.fr()); >+ attributes.setFr(radial.m_fr.animatedValue()); > } > } > >@@ -181,7 +161,7 @@ bool SVGRadialGradientElement::collectGr > > while (true) { > // Respect xlink:href, take attributes from referenced element >- auto refNode = makeRefPtr(SVGURIReference::targetElementFromIRIString(current->href(), document())); >+ auto refNode = makeRefPtr(SVGURIReference::targetElementFromIRIString(current->m_href.animatedValue(), document())); > if (is<SVGGradientElement>(refNode)) { > current = downcast<SVGGradientElement>(refNode.get()); > >@@ -210,12 +190,12 @@ bool SVGRadialGradientElement::collectGr > > bool SVGRadialGradientElement::selfHasRelativeLengths() const > { >- return cx().isRelative() >- || cy().isRelative() >- || r().isRelative() >- || fx().isRelative() >- || fy().isRelative() >- || fr().isRelative(); >+ return m_cx.animatedValue().isRelative() >+ || m_cy.animatedValue().isRelative() >+ || m_r.animatedValue().isRelative() >+ || m_fx.animatedValue().isRelative() >+ || m_fy.animatedValue().isRelative() >+ || m_fr.animatedValue().isRelative(); > } > > } >Index: Source/WebCore/svg/SVGRadialGradientElement.h >=================================================================== >--- Source/WebCore/svg/SVGRadialGradientElement.h (revision 233069) >+++ Source/WebCore/svg/SVGRadialGradientElement.h (working copy) >@@ -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 >@@ -38,7 +39,11 @@ public: > private: > SVGRadialGradientElement(const QualifiedName&, Document&); > >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGRadialGradientElement, SVGGradientElement>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -46,14 +51,15 @@ 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_cx { m_attributeRegistryBridge, LengthModeWidth, "50%" }; >+ SVGAnimatedLengthAttribute m_cy { m_attributeRegistryBridge, LengthModeHeight, "50%" }; >+ SVGAnimatedLengthAttribute m_r { m_attributeRegistryBridge, LengthModeOther, "50%" }; >+ SVGAnimatedLengthAttribute m_fx { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_fy { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_fr { m_attributeRegistryBridge, LengthModeOther, "0%" }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGRectElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGRectElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGRectElement.cpp (working copy) >@@ -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::crea > 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&) >Index: Source/WebCore/svg/SVGRectElement.h >=================================================================== >--- Source/WebCore/svg/SVGRectElement.h (revision 233069) >+++ Source/WebCore/svg/SVGRectElement.h (working copy) >@@ -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 "SVGExternalResourcesRequired.h" > #include "SVGGeometryElement.h" >@@ -35,9 +35,15 @@ public: > > private: > SVGRectElement(const QualifiedName&, Document&); >- >+ > bool isValid() const final { return SVGTests::isValid(); } > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGRectElement, SVGGeometryElement, SVGExternalResourcesRequired>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >@@ -45,15 +51,15 @@ private: > > 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_rx { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_ry { m_attributeRegistryBridge, LengthModeHeight}; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGSVGElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGSVGElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGSVGElement.cpp (working copy) >@@ -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,37 +52,16 @@ 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, ASCIILiteral("100%")) >- , m_height(LengthModeHeight, ASCIILiteral("100%")) >+ , SVGExternalResourcesRequired(this) >+ , SVGFitToViewBox(this) >+ , SVGZoomAndPan(this) > , m_timeContainer(SMILTimeContainer::create(*this)) > { > ASSERT(hasTagName(SVGNames::svgTag)); >- registerAnimatedPropertiesForSVGSVGElement(); > document.registerForDocumentSuspensionCallbacks(this); >+ registerAttributes(); > } > > Ref<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Document& document) >@@ -214,6 +193,17 @@ void SVGSVGElement::updateCurrentTransla > 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 +242,9 @@ void SVGSVGElement::parseAttribute(const > 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 +252,7 @@ void SVGSVGElement::parseAttribute(const > // Not sure it's correct for the empty string or for something that can't be parsed. > length = SVGLengthValue(LengthModeWidth, ASCIILiteral("100%")); > } >- 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 +260,44 @@ void SVGSVGElement::parseAttribute(const > // Not sure it's correct for the empty string or for something that can't be parsed. > length = SVGLengthValue(LengthModeHeight, ASCIILiteral("100%")); > } >- setHeightBaseValue(length); >+ m_height.setValue(length); > } > > reportAttributeParsingError(parseError, name, value); > > SVGExternalResourcesRequired::parseAttribute(name, value); >- SVGFitToViewBox::parseAttribute(this, name, value); >- SVGZoomAndPan::parseAttribute(*this, name, value); >+ SVGFitToViewBox::parseAttribute(name, value); >+ SVGZoomAndPan::parseAttribute(name, value); > SVGGraphicsElement::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) { >+ InstanceInvalidationGuard guard(*this); >+ >+ if (isKnownAttribute(attrName)) { > 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(); >+ RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); >+ } >+ return; > } > >- InstanceInvalidationGuard guard(*this); >- >- if (updateRelativeLengthsOrViewBox >- || SVGLangSpace::isKnownAttribute(attrName) >- || SVGExternalResourcesRequired::isKnownAttribute(attrName) >- || SVGZoomAndPan::isKnownAttribute(attrName)) { >+ if (SVGZoomAndPan::isKnownAttribute(attrName)) { > if (auto renderer = this->renderer()) > RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > return; > } > > SVGGraphicsElement::svgAttributeChanged(attrName); >+ SVGExternalResourcesRequired::svgAttributeChanged(attrName); > } > > unsigned SVGSVGElement::suspendRedraw(unsigned) >@@ -431,7 +422,7 @@ AffineTransform SVGSVGElement::localCoor > AffineTransform transform; > if (!isOutermostSVGSVGElement()) { > SVGLengthContext lengthContext(this); >- transform.translate(x().value(lengthContext), y().value(lengthContext)); >+ transform.translate(m_x.animatedValue().value(lengthContext), m_y.animatedValue().value(lengthContext)); > } else if (mode == SVGLocatable::ScreenScope) { > if (auto* renderer = this->renderer()) { > FloatPoint location; >@@ -548,10 +539,10 @@ void SVGSVGElement::setCurrentTime(float > > bool SVGSVGElement::selfHasRelativeLengths() const > { >- return x().isRelative() >- || y().isRelative() >- || width().isRelative() >- || height().isRelative() >+ return m_x.animatedValue().isRelative() >+ || m_y.animatedValue().isRelative() >+ || m_width.animatedValue().isRelative() >+ || m_height.animatedValue().isRelative() > || hasAttribute(SVGNames::viewBoxAttr); > } > >@@ -560,7 +551,7 @@ FloatRect SVGSVGElement::currentViewBoxR > if (m_useCurrentView) > return m_viewSpec ? m_viewSpec->viewBox() : FloatRect(); > >- FloatRect viewBox = this->viewBox(); >+ FloatRect viewBox = m_viewBox.animatedValue(); > if (!viewBox.isEmpty()) > return viewBox; > >@@ -602,39 +593,39 @@ FloatSize SVGSVGElement::currentViewport > > bool SVGSVGElement::hasIntrinsicWidth() const > { >- return width().unitType() != LengthTypePercentage; >+ return m_width.animatedValue().unitType() != LengthTypePercentage; > } > > bool SVGSVGElement::hasIntrinsicHeight() const > { >- return height().unitType() != LengthTypePercentage; >+ return m_height.animatedValue().unitType() != LengthTypePercentage; > } > > Length SVGSVGElement::intrinsicWidth() const > { >- if (width().unitType() == LengthTypePercentage) >+ if (m_width.animatedValue().unitType() == LengthTypePercentage) > return Length(0, Fixed); > > SVGLengthContext lengthContext(this); >- return Length(width().value(lengthContext), Fixed); >+ return Length(m_width.animatedValue().value(lengthContext), Fixed); > } > > Length SVGSVGElement::intrinsicHeight() const > { >- if (height().unitType() == LengthTypePercentage) >+ if (m_height.animatedValue().unitType() == LengthTypePercentage) > return Length(0, Fixed); > > SVGLengthContext lengthContext(this); >- return Length(height().value(lengthContext), Fixed); >+ return Length(m_height.animatedValue().value(lengthContext), Fixed); > } > > AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const > { > if (!m_useCurrentView || !m_viewSpec) >- return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), preserveAspectRatio(), viewWidth, viewHeight); >+ return SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_preserveAspectRatio.animatedValue(), 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 +707,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(m_viewBox.animatedValue()); >+ view.setPreserveAspectRatio(m_preserveAspectRatio.value()); >+ view.setZoomAndPan(zoomAndPan()); > m_currentViewFragmentIdentifier = { }; > } > } >@@ -734,19 +725,19 @@ void SVGSVGElement::inheritViewAttribute > m_useCurrentView = true; > > if (viewElement.hasAttribute(SVGNames::viewBoxAttr)) >- view.setViewBoxBaseValue(viewElement.viewBox()); >+ view.setViewBox(viewElement.m_viewBox.animatedValue()); > else >- view.setViewBoxBaseValue(viewBox()); >+ view.setViewBox(m_viewBox.animatedValue()); > > if (viewElement.hasAttribute(SVGNames::preserveAspectRatioAttr)) >- view.setPreserveAspectRatioBaseValue(viewElement.preserveAspectRatioBaseValue()); >+ view.setPreserveAspectRatio(viewElement.m_preserveAspectRatio.value()); > else >- view.setPreserveAspectRatioBaseValue(preserveAspectRatioBaseValue()); >+ view.setPreserveAspectRatio(m_preserveAspectRatio.value()); > > if (viewElement.hasAttribute(SVGNames::zoomAndPanAttr)) >- view.setZoomAndPanBaseValue(viewElement.zoomAndPan()); >+ view.setZoomAndPan(viewElement.zoomAndPan()); > else >- view.setZoomAndPanBaseValue(zoomAndPan()); >+ view.setZoomAndPan(zoomAndPan()); > } > > void SVGSVGElement::prepareForDocumentSuspension() >Index: Source/WebCore/svg/SVGSVGElement.h >=================================================================== >--- Source/WebCore/svg/SVGSVGElement.h (revision 233069) >+++ Source/WebCore/svg/SVGSVGElement.h (working copy) >@@ -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,33 @@ public: > FloatSize currentViewportSize() const; > FloatRect currentViewBoxRect() const; > >- bool hasEmptyViewBox() const; > AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; > > private: > SVGSVGElement(const QualifiedName&, Document&); > virtual ~SVGSVGElement(); > >- bool isValid() const override; >- void didMoveToNewDocument(Document& oldDocument, Document& newDocument) override; >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGSVGElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 +155,18 @@ 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(); >-} >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight}; >+ SVGAnimatedLengthAttribute m_width { m_attributeRegistryBridge, LengthModeWidth, ASCIILiteral("100%") }; >+ SVGAnimatedLengthAttribute m_height { m_attributeRegistryBridge, LengthModeHeight, ASCIILiteral("100%") }; >+}; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGScriptElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGScriptElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGScriptElement.cpp (working copy) >@@ -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) >+ , SVGURIReference(this) >+ , SVGExternalResourcesRequired(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) >@@ -66,19 +58,19 @@ void SVGScriptElement::svgAttributeChang > InstanceInvalidationGuard guard(*this); > > if (SVGURIReference::isKnownAttribute(attrName)) { >- handleSourceAttribute(href()); >+ handleSourceAttribute(m_href.animatedValue()); > 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(c > ScriptElement::childrenChanged(change); > } > >-bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const >-{ >- return attribute.name() == sourceAttributeValue(); >-} >- > void SVGScriptElement::finishParsingChildren() > { > SVGElement::finishParsingChildren(); >@@ -108,57 +95,7 @@ void SVGScriptElement::addSubresourceAtt > { > SVGElement::addSubresourceAttributeURLs(urls); > >- 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); >+ addSubresourceURL(urls, document().completeURL(m_href.animatedValue())); > } > > Ref<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren(Document& targetDocument) >@@ -166,11 +103,4 @@ Ref<Element> SVGScriptElement::cloneElem > return adoptRef(*new SVGScriptElement(tagQName(), targetDocument, false, alreadyStarted())); > } > >-#ifndef NDEBUG >-bool SVGScriptElement::filterOutAnimatableAttribute(const QualifiedName& name) const >-{ >- return name == SVGNames::typeAttr; >-} >-#endif >- > } >Index: Source/WebCore/svg/SVGScriptElement.h >=================================================================== >--- Source/WebCore/svg/SVGScriptElement.h (revision 233069) >+++ Source/WebCore/svg/SVGScriptElement.h (working copy) >@@ -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,6 +27,7 @@ > #include "SVGExternalResourcesRequired.h" > #include "SVGURIReference.h" > #include "ScriptElement.h" >+#include "XLinkNames.h" > > namespace WebCore { > >@@ -41,31 +42,34 @@ public: > private: > SVGScriptElement(const QualifiedName&, Document&, bool wasInsertedByParser, bool alreadyStarted); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGScriptElement, SVGElement, SVGURIReference, SVGExternalResourcesRequired>; >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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 m_href.animatedValue(); } >+ 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,15 +81,12 @@ 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 >- > Timer m_svgLoadEventTimer; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGStopElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGStopElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGStopElement.cpp (working copy) >@@ -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::crea > 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; > } > >@@ -68,14 +68,13 @@ void SVGStopElement::parseAttribute(cons > > void SVGStopElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (attrName == SVGNames::offsetAttr) { >+ if (isKnownAttribute(attrName)) { > if (auto renderer = this->renderer()) { > InstanceInvalidationGuard guard(*this); > RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > } > return; > } >- > SVGElement::svgAttributeChanged(attrName); > } > >Index: Source/WebCore/svg/SVGStopElement.h >=================================================================== >--- Source/WebCore/svg/SVGStopElement.h (revision 233069) >+++ Source/WebCore/svg/SVGStopElement.h (working copy) >@@ -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,6 +36,12 @@ public: > private: > SVGStopElement(const QualifiedName&, Document&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGStopElement, SVGElement>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) final; > void svgAttributeChanged(const QualifiedName&) final; > >@@ -43,9 +50,10 @@ 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 >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedNumberAttribute m_offset { m_attributeRegistryBridge, 0 }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGStringListValues.h >=================================================================== >--- Source/WebCore/svg/SVGStringListValues.h (revision 233069) >+++ Source/WebCore/svg/SVGStringListValues.h (working copy) >@@ -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,16 +22,24 @@ > #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: >@@ -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; >Index: Source/WebCore/svg/SVGSwitchElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGSwitchElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGSwitchElement.cpp (working copy) >@@ -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,26 +31,18 @@ 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) > { > return adoptRef(*new SVGSwitchElement(tagName, document)); > } >- >+ > bool SVGSwitchElement::childShouldCreateRenderer(const Node& child) const > { > // We create a renderer for the first valid SVG element child. >Index: Source/WebCore/svg/SVGSwitchElement.h >=================================================================== >--- Source/WebCore/svg/SVGSwitchElement.h (revision 233069) >+++ Source/WebCore/svg/SVGSwitchElement.h (working copy) >@@ -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,16 @@ public: > private: > SVGSwitchElement(const QualifiedName&, Document&); > >- bool isValid() const final { return SVGTests::isValid(); } >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGSwitchElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > > 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 >+ bool isValid() const final { return SVGTests::isValid(); } >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGSymbolElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGSymbolElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGSymbolElement.cpp (working copy) >@@ -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,7 +48,7 @@ void SVGSymbolElement::parseAttribute(co > { > SVGElement::parseAttribute(name, value); > SVGExternalResourcesRequired::parseAttribute(name, value); >- SVGFitToViewBox::parseAttribute(this, name, value); >+ SVGFitToViewBox::parseAttribute(name, value); > } > > void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) >@@ -68,7 +58,6 @@ void SVGSymbolElement::svgAttributeChang > updateRelativeLengthsInformation(); > return; > } >- > SVGElement::svgAttributeChanged(attrName); > } > >Index: Source/WebCore/svg/SVGSymbolElement.h >=================================================================== >--- Source/WebCore/svg/SVGSymbolElement.h (revision 233069) >+++ Source/WebCore/svg/SVGSymbolElement.h (working copy) >@@ -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,18 @@ public: > private: > SVGSymbolElement(const QualifiedName&, Document&); > >- 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 >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGSymbolElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>; >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } >+ >+ void parseAttribute(const QualifiedName&, const AtomicString&) final; >+ void svgAttributeChanged(const QualifiedName&) final; >+ >+ RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; >+ >+ bool selfHasRelativeLengths() const final; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGTRefElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGTRefElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGTRefElement.cpp (working copy) >@@ -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)); >@@ -130,10 +123,10 @@ void SVGTRefTargetEventListener::handleE > > 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() >@@ -175,7 +168,7 @@ void SVGTRefElement::detachTarget() > > // Mark the referenced ID as pending. > String id; >- SVGURIReference::targetElementFromIRIString(href(), document(), &id); >+ SVGURIReference::targetElementFromIRIString(m_href.animatedValue(), document(), &id); > if (!id.isEmpty()) > document().accessSVGExtensions().addPendingResource(id, this); > } >@@ -195,7 +188,6 @@ void SVGTRefElement::svgAttributeChanged > RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); > return; > } >- > SVGTextPositioningElement::svgAttributeChanged(attrName); > } > >@@ -239,7 +231,7 @@ void SVGTRefElement::buildPendingResourc > return; > > String id; >- RefPtr<Element> target = SVGURIReference::targetElementFromIRIString(href(), document(), &id); >+ RefPtr<Element> target = SVGURIReference::targetElementFromIRIString(m_href.animatedValue(), document(), &id); > if (!target.get()) { > if (id.isEmpty()) > return; >Index: Source/WebCore/svg/SVGTRefElement.h >=================================================================== >--- Source/WebCore/svg/SVGTRefElement.h (revision 233069) >+++ Source/WebCore/svg/SVGTRefElement.h (working copy) >@@ -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 AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGTRefElement, SVGTextPositioningElement, SVGURIReference>; >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -50,18 +54,13 @@ 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 >- > Ref<SVGTRefTargetEventListener> m_targetListener; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGTests.cpp >=================================================================== >--- Source/WebCore/svg/SVGTests.cpp (revision 233069) >+++ Source/WebCore/svg/SVGTests.cpp (working copy) >@@ -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 "SVGAttributeRegistryBridge.h" > #include "SVGElement.h" > #include "SVGNames.h" > #include "SVGStringList.h" >@@ -106,40 +107,34 @@ static const HashSet<String, ASCIICaseIn > return features; > } > >-SVGTests::SVGTests() >- : m_requiredFeatures(requiredFeaturesAttr) >- , m_requiredExtensions(requiredExtensionsAttr) >- , m_systemLanguage(systemLanguageAttr) >+SVGTests::SVGTests(SVGElement* contextElement) >+ : m_contextElement(*contextElement) >+ , m_attributeRegistryBridge(std::make_unique<AttributeRegistryBridge>(*this, *contextElement)) >+ , m_requiredFeatures(*m_attributeRegistryBridge, SVGNames::requiredFeaturesAttr) >+ , m_requiredExtensions(*m_attributeRegistryBridge, SVGNames::requiredExtensionsAttr) >+ , m_systemLanguage(*m_attributeRegistryBridge, SVGNames::systemLanguageAttr) > { >+ 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 AttributeRegistryBridge::attributeRegistry(); > } > >-const SVGAttributeToPropertyMap& SVGTests::attributeToPropertyMap() >+bool SVGTests::isKnownAttribute(const QualifiedName& attributeName) > { >- static NeverDestroyed<SVGAttributeToPropertyMap> map = createSVGTextAttributeToPropertyMap(); >- return map; >+ return AttributeRegistryBridge::isKnownAttribute(attributeName); > } > > bool SVGTests::hasExtension(const String& extension) >@@ -154,15 +149,15 @@ bool SVGTests::hasExtension(const String > > 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,28 +167,20 @@ 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); >-} >- >-bool SVGTests::isKnownAttribute(const QualifiedName& attributeName) >-{ >- return attributeName == requiredFeaturesAttr >- || attributeName == requiredExtensionsAttr >- || attributeName == systemLanguageAttr; >+ m_systemLanguage.value().reset(value); > } > >-bool SVGTests::handleAttributeChange(SVGElement* targetElement, const QualifiedName& attributeName) >+bool SVGTests::handleAttributeChange(const QualifiedName& attributeName) > { >- ASSERT(targetElement); > if (!isKnownAttribute(attributeName)) > return false; >- if (!targetElement->isConnected()) >+ if (!m_contextElement.isConnected()) > return true; >- targetElement->invalidateStyleAndRenderersForSubtree(); >+ m_contextElement.invalidateStyleAndRenderersForSubtree(); > return true; > } > >@@ -204,44 +191,22 @@ void SVGTests::addSupportedAttributes(Ha > 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) >Index: Source/WebCore/svg/SVGTests.h >=================================================================== >--- Source/WebCore/svg/SVGTests.h (revision 233069) >+++ Source/WebCore/svg/SVGTests.h (working copy) >@@ -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 SVGAttributeRegistryBridgeImpl; >+ > class 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&); >+ bool handleAttributeChange(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(); >+ Ref<SVGStringList> requiredExtensions(); >+ Ref<SVGStringList> systemLanguage(); > >- Ref<SVGStringList> requiredFeatures(SVGElement&); >- Ref<SVGStringList> requiredExtensions(SVGElement&); >- Ref<SVGStringList> systemLanguage(SVGElement&); >- >- void synchronizeRequiredFeatures(SVGElement&); >- void synchronizeRequiredExtensions(SVGElement&); >- void synchronizeSystemLanguage(SVGElement&); >+protected: >+ SVGTests(SVGElement* contextElement); > > private: >- void synchronizeAttribute(SVGElement& contextElement, SVGSynchronizableAnimatedProperty<SVGStringListValues>&, const QualifiedName& attributeName); >+ SVGElement& m_contextElement; > >- SVGSynchronizableAnimatedProperty<SVGStringListValues> m_requiredFeatures; >- SVGSynchronizableAnimatedProperty<SVGStringListValues> m_requiredExtensions; >- SVGSynchronizableAnimatedProperty<SVGStringListValues> m_systemLanguage; >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGTests>; >+ static void registerAttributes(); >+ >+ std::unique_ptr<AttributeRegistryBridge> m_attributeRegistryBridge; >+ >+ SVGStringListValuesAttribute m_requiredFeatures; >+ SVGStringListValuesAttribute m_requiredExtensions; >+ SVGStringListValuesAttribute m_systemLanguage; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGTextContentElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGTextContentElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGTextContentElement.cpp (working copy) >@@ -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 >@@ -41,68 +42,12 @@ > 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: > 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::collectStyle > 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::parseAttribu > 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::parseAttribu > > 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 >Index: Source/WebCore/svg/SVGTextContentElement.h >=================================================================== >--- Source/WebCore/svg/SVGTextContentElement.h (revision 233069) >+++ Source/WebCore/svg/SVGTextContentElement.h (working copy) >@@ -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 >@@ -88,8 +89,6 @@ public: > // 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(); > > protected: > SVGTextContentElement(const QualifiedName&, Document&); >@@ -97,27 +96,61 @@ protected: > bool isValid() const override { return SVGTests::isValid(); } > > void parseAttribute(const QualifiedName&, const AtomicString&) override; >+ void svgAttributeChanged(const QualifiedName&) override; > bool isPresentationAttribute(const QualifiedName&) const override; > void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; >- void svgAttributeChanged(const QualifiedName&) override; > > bool selfHasRelativeLengths() const override; > > private: > bool isTextContent() const final { return true; } > >- 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; >+ SVGLengthValue m_specifiedTextLength { LengthModeOther }; > >- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement) >- DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjustType) >- DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) >- END_DECLARE_ANIMATED_PROPERTIES >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>; >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const override { return m_attributeRegistryBridge; } >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ >+ struct SVGAnimatedCustomLengthAttribute : public SVGAnimatedLengthAttribute { >+ using SVGAnimatedLengthAttribute::operator=; >+ >+ SVGAnimatedCustomLengthAttribute(SVGTextContentElement& element, SVGAttributeRegistryBridge& attributeRegistryBridge, SVGLengthMode lengthMode) >+ : SVGAnimatedLengthAttribute(attributeRegistryBridge, 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() >+ { >+ 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>(m_attributeRegistryBridge.lookupOrCreateAnimatedProperty(*this).releaseNonNull()); >+ } >+ SVGTextContentElement& m_element; >+ }; >+ >+ using SVGAnimatedCustomLengthAttributeAccessor = SVGAnimatedAttributeAccessor<SVGTextContentElement, SVGAnimatedCustomLengthAttribute, AnimatedLength>; >+ >+ SVGAnimatedCustomLengthAttribute m_textLength { *this, m_attributeRegistryBridge, LengthModeOther }; >+ SVGAnimatedEnumerationAttribute<SVGLengthAdjustType> m_lengthAdjust { m_attributeRegistryBridge, SVGLengthAdjustSpacing }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGTextElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGTextElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGTextElement.cpp (working copy) >@@ -59,7 +59,7 @@ AffineTransform SVGTextElement::animated > // Flatten any 3D transform > matrix = t.toAffineTransform(); > } else >- transform().concatenate(matrix); >+ m_transform.animatedValue().concatenate(matrix); > > const AffineTransform* transform = const_cast<SVGTextElement*>(this)->supplementalTransform(); > if (transform) >Index: Source/WebCore/svg/SVGTextPathElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGTextPathElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGTextPathElement.cpp (working copy) >@@ -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::clearResourceRe > 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( > 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,7 +91,7 @@ void SVGTextPathElement::parseAttribute( > > void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName) > { >- if (!isSupportedAttribute(attrName)) { >+ if (!isKnownAttribute(attrName)) { > SVGTextContentElement::svgAttributeChanged(attrName); > return; > } >@@ -159,7 +143,7 @@ void SVGTextPathElement::buildPendingRes > return; > > String id; >- auto target = makeRefPtr(SVGURIReference::targetElementFromIRIString(href(), document(), &id)); >+ auto target = makeRefPtr(SVGURIReference::targetElementFromIRIString(m_href.animatedValue(), document(), &id)); > if (!target) { > // Do not register as pending if we are already pending this resource. > if (document().accessSVGExtensions().isPendingResource(this, id)) >@@ -196,8 +180,7 @@ void SVGTextPathElement::removedFromAnce > > bool SVGTextPathElement::selfHasRelativeLengths() const > { >- return startOffset().isRelative() >- || SVGTextContentElement::selfHasRelativeLengths(); >+ return m_startOffset.animatedValue().isRelative() || SVGTextContentElement::selfHasRelativeLengths(); > } > > } >Index: Source/WebCore/svg/SVGTextPathElement.h >=================================================================== >--- Source/WebCore/svg/SVGTextPathElement.h (revision 233069) >+++ Source/WebCore/svg/SVGTextPathElement.h (working copy) >@@ -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 >@@ -115,16 +116,14 @@ protected: > > private: > SVGTextPathElement(const QualifiedName&, Document&); >- > virtual ~SVGTextPathElement(); > >- void clearResourceReferences(); >- >- void buildPendingResource() override; >- InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; >- void removedFromAncestor(RemovalType, ContainerNode&) override; >- >- static bool isSupportedAttribute(const QualifiedName&); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGTextPathElement, SVGTextContentElement, SVGURIReference>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > void parseAttribute(const QualifiedName&, const AtomicString&) override; > void svgAttributeChanged(const QualifiedName&) override; > >@@ -132,14 +131,19 @@ 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 >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_startOffset { m_attributeRegistryBridge, LengthModeOther }; >+ SVGAnimatedEnumerationAttribute<SVGTextPathMethodType> m_method { m_attributeRegistryBridge, SVGTextPathMethodAlign }; >+ SVGAnimatedEnumerationAttribute<SVGTextPathSpacingType> m_spacing { m_attributeRegistryBridge, SVGTextPathSpacingExact }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGTextPositioningElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGTextPositioningElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGTextPositioningElement.cpp (working copy) >@@ -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::parseAtt > if (name == SVGNames::xAttr) { > SVGLengthListValues newList; > newList.parse(value, LengthModeWidth); >- detachAnimatedXListWrappers(newList.size()); >- setXBaseValue(newList); >+ m_x.detachAnimatedListWrappers(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(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(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(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(newList.size()); >+ m_rotate.setValue(WTFMove(newList)); > return; > } > >@@ -121,7 +118,7 @@ bool SVGTextPositioningElement::isPresen > > 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) >@@ -135,7 +132,6 @@ void SVGTextPositioningElement::svgAttri > > return; > } >- > SVGTextContentElement::svgAttributeChanged(attrName); > } > >Index: Source/WebCore/svg/SVGTextPositioningElement.h >=================================================================== >--- Source/WebCore/svg/SVGTextPositioningElement.h (revision 233069) >+++ Source/WebCore/svg/SVGTextPositioningElement.h (working copy) >@@ -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 >@@ -41,13 +42,22 @@ 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 >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGTextPositioningElement, SVGTextContentElement>; >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const override { return m_attributeRegistryBridge; } >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ >+ SVGAnimatedLengthListAttribute m_x { m_attributeRegistryBridge }; >+ SVGAnimatedLengthListAttribute m_y { m_attributeRegistryBridge }; >+ SVGAnimatedLengthListAttribute m_dx { m_attributeRegistryBridge }; >+ SVGAnimatedLengthListAttribute m_dy { m_attributeRegistryBridge }; >+ SVGAnimatedNumberListAttribute m_rotate { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGTransformListValues.h >=================================================================== >--- Source/WebCore/svg/SVGTransformListValues.h (revision 233069) >+++ Source/WebCore/svg/SVGTransformListValues.h (working copy) >@@ -20,8 +20,10 @@ > > #pragma once > >+#include "SVGAttributeAccessor.h" > #include "SVGPropertyTraits.h" > #include "SVGTransform.h" >+ > #include <wtf/Vector.h> > > namespace WebCore { >@@ -30,6 +32,12 @@ template<typename T> > class SVGListPropertyTearOff; > > class SVGTransformList; >+class SVGTransformListValues; >+ >+using SVGTransformListValuesAttribute = SVGPropertyAttribute<SVGTransformListValues>; >+ >+template<typename OwnerType> >+using SVGTransformListValuesAttributeAccessor = SVGPropertyAttributeAccessor<OwnerType, SVGTransformListValuesAttribute>; > > class SVGTransformListValues final : public Vector<SVGTransformValue, 0, CrashOnOverflow, 2> { > public: >Index: Source/WebCore/svg/SVGURIReference.cpp >=================================================================== >--- Source/WebCore/svg/SVGURIReference.cpp (revision 233069) >+++ Source/WebCore/svg/SVGURIReference.cpp (working copy) >@@ -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,41 @@ > > #include "Document.h" > #include "Element.h" >+#include "SVGAttributeRegistryBridge.h" > #include "URL.h" > #include "XLinkNames.h" > > namespace WebCore { > >-void SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value) >+SVGURIReference::SVGURIReference(SVGElement* contextElement) >+ : m_attributeRegistryBridge(std::make_unique<AttributeRegistryBridge>(*this, *contextElement)) >+ , m_href(*m_attributeRegistryBridge) > { >- if (name.matches(XLinkNames::hrefAttr)) >- setHrefBaseValue(value); >+ registerAttributes(); >+} >+ >+void SVGURIReference::registerAttributes() >+{ >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<XLinkNames::hrefAttr, &SVGURIReference::m_href>(); >+} >+ >+SVGURIReference::AttributeRegistry& SVGURIReference::attributeRegistry() >+{ >+ return AttributeRegistryBridge::attributeRegistry(); > } > >-bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName) >+bool SVGURIReference::isKnownAttribute(const QualifiedName& attributeName) > { >- return attrName.matches(XLinkNames::hrefAttr); >+ return AttributeRegistryBridge::isKnownAttribute(attributeName); >+} >+ >+void SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value) >+{ >+ if (name.matches(XLinkNames::hrefAttr)) >+ m_href.setValue(value); > } > > String SVGURIReference::fragmentIdentifierFromIRIString(const String& url, const Document& document) >@@ -98,9 +120,4 @@ Element* SVGURIReference::targetElementF > return document.getElementById(id); > } > >-void SVGURIReference::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes) >-{ >- supportedAttributes.add(XLinkNames::hrefAttr); >-} >- > } >Index: Source/WebCore/svg/SVGURIReference.h >=================================================================== >--- Source/WebCore/svg/SVGURIReference.h (revision 233069) >+++ Source/WebCore/svg/SVGURIReference.h (working copy) >@@ -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,21 @@ > > #include "Document.h" > #include "QualifiedName.h" >+#include "SVGAnimatedString.h" > > namespace WebCore { >- >+ >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeRegistry; >+ >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeRegistryBridgeImpl; >+ > class 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); >@@ -49,8 +55,20 @@ public: > } > > protected: >- virtual String& hrefBaseValue() const = 0; >- virtual void setHrefBaseValue(const String&, const bool validValue = true) = 0; >+ SVGURIReference(SVGElement* contextElement); >+ >+private: >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGURIReference>; >+ static void registerAttributes(); >+ >+ std::unique_ptr<AttributeRegistryBridge> m_attributeRegistryBridge; >+ >+public: >+ using AttributeRegistry = SVGAttributeRegistry<SVGURIReference>; >+ static AttributeRegistry& attributeRegistry(); >+ static bool isKnownAttribute(const QualifiedName& attributeName); >+ >+ SVGAnimatedStringAttribute m_href; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGUseElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGUseElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGUseElement.cpp (working copy) >@@ -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) >@@ -86,19 +67,30 @@ SVGUseElement::~SVGUseElement() > if (m_externalDocument) > 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 SVGUseE > if (insertionType.connectedToDocument) { > if (m_shadowTreeNeedsUpdate) > document().addSVGUseElement(*this); >- SVGExternalResourcesRequired::insertedIntoDocument(this); >+ SVGExternalResourcesRequired::insertedIntoDocument(); > invalidateShadowTree(); > updateExternalDocument(); > } >@@ -150,14 +142,14 @@ void SVGUseElement::transferSizeAttribut > // 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, m_width.animatedValue().valueInSpecifiedUnits() ? AtomicString(m_width.animatedValue().valueAsString()) : "100%"); >+ shadowElement.setAttribute(SVGNames::heightAttr, m_height.animatedValue().valueInSpecifiedUnits() ? AtomicString(m_height.animatedValue().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, m_width.animatedValue().valueInSpecifiedUnits() ? AtomicString(m_width.animatedValue().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom())); >+ shadowElement.setAttribute(SVGNames::heightAttr, m_height.animatedValue().valueInSpecifiedUnits() ? AtomicString(m_height.animatedValue().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom())); > } > } > >@@ -165,7 +157,7 @@ void SVGUseElement::svgAttributeChanged( > { > 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. >@@ -177,21 +169,17 @@ void SVGUseElement::svgAttributeChanged( > 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() >@@ -314,7 +302,7 @@ Path SVGUseElement::toClipPath() > Path path = downcast<SVGGraphicsElement>(*targetClone).toClipPath(); > SVGLengthContext lengthContext(this); > // FIXME: Find a way to do this without manual resolution of x/y here. It's potentially incorrect. >- path.translate(FloatSize(x().value(lengthContext), y().value(lengthContext))); >+ path.translate(FloatSize(m_x.animatedValue().value(lengthContext), m_y.animatedValue().value(lengthContext))); > path.transform(animatedLocalTransform()); > return path; > } >@@ -413,13 +401,13 @@ SVGElement* SVGUseElement::findTarget(St > auto* correspondingElement = this->correspondingElement(); > auto& original = correspondingElement ? downcast<SVGUseElement>(*correspondingElement) : *this; > >- auto targetCandidate = makeRefPtr(targetElementFromIRIString(original.href(), original.document(), targetID, original.externalDocument())); >+ auto targetCandidate = makeRefPtr(targetElementFromIRIString(original.m_href.animatedValue(), original.document(), targetID, original.externalDocument())); > if (targetID && !targetID->isNull()) { > // If the reference is external, don't return the target ID to the caller. > // The caller would use the target ID to wait for a pending resource on the wrong document. > // If we ever want the change that and let the caller to wait on the external document, > // we should change this function so it returns the appropriate document to go with the ID. >- if (isExternalURIReference(original.href(), original.document())) >+ if (isExternalURIReference(original.m_href.animatedValue(), original.document())) > *targetID = String(); > } > if (!is<SVGElement>(targetCandidate)) >@@ -549,7 +537,7 @@ void SVGUseElement::invalidateDependentS > > bool SVGUseElement::selfHasRelativeLengths() const > { >- if (x().isRelative() || y().isRelative() || width().isRelative() || height().isRelative()) >+ if (m_x.animatedValue().isRelative() || m_y.animatedValue().isRelative() || m_width.animatedValue().isRelative() || m_height.animatedValue().isRelative()) > return true; > > auto targetClone = this->targetClone(); >@@ -562,7 +550,7 @@ void SVGUseElement::notifyFinished(Cache > if (resource.errorOccurred()) > dispatchEvent(Event::create(eventNames().errorEvent, false, false)); > else if (!resource.wasCanceled()) >- SVGExternalResourcesRequired::dispatchLoadEvent(this); >+ SVGExternalResourcesRequired::dispatchLoadEvent(); > } > > void SVGUseElement::finishParsingChildren() >@@ -574,8 +562,8 @@ void SVGUseElement::finishParsingChildre > void SVGUseElement::updateExternalDocument() > { > URL externalDocumentURL; >- if (isConnected() && isExternalURIReference(href(), document())) { >- externalDocumentURL = document().completeURL(href()); >+ if (isConnected() && isExternalURIReference(m_href.animatedValue(), document())) { >+ externalDocumentURL = document().completeURL(m_href.animatedValue()); > if (!externalDocumentURL.hasFragmentIdentifier()) > externalDocumentURL = URL(); > } >Index: Source/WebCore/svg/SVGUseElement.h >=================================================================== >--- Source/WebCore/svg/SVGUseElement.h (revision 233069) >+++ Source/WebCore/svg/SVGUseElement.h (working copy) >@@ -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(); >@@ -63,8 +53,16 @@ private: > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; > void removedFromAncestor(RemovalType, ContainerNode&) override; > void buildPendingResource() override; >+ >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGUseElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>; >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ static void registerAttributes(); >+ >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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; >@@ -95,6 +93,14 @@ private: > bool m_shadowTreeNeedsUpdate { true }; > CachedResourceHandle<CachedSVGDocument> m_externalDocument; > Timer m_svgLoadEventTimer; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; >+ >+public: >+ SVGAnimatedLengthAttribute m_x { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_y { m_attributeRegistryBridge, LengthModeHeight }; >+ SVGAnimatedLengthAttribute m_width { m_attributeRegistryBridge, LengthModeWidth }; >+ SVGAnimatedLengthAttribute m_height { m_attributeRegistryBridge, LengthModeHeight }; > }; > > } >Index: Source/WebCore/svg/SVGValue.h >=================================================================== >--- Source/WebCore/svg/SVGValue.h (revision 233069) >+++ Source/WebCore/svg/SVGValue.h (working copy) >@@ -35,7 +35,6 @@ > #include "SVGPathByteStream.h" > #include "SVGPointListValues.h" > #include "SVGPreserveAspectRatioValue.h" >-#include "SVGPropertyInfo.h" > #include "SVGPropertyTraits.h" > #include "SVGTransformListValues.h" > >Index: Source/WebCore/svg/SVGViewElement.cpp >=================================================================== >--- Source/WebCore/svg/SVGViewElement.cpp (revision 233069) >+++ Source/WebCore/svg/SVGViewElement.cpp (working copy) >@@ -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,14 @@ 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) >+ , SVGZoomAndPan(this) > , m_viewTarget(SVGNames::viewTargetAttr) > { > ASSERT(hasTagName(SVGNames::viewTag)); >- registerAnimatedPropertiesForSVGViewElement(); > } > > Ref<SVGViewElement> SVGViewElement::create(const QualifiedName& tagName, Document& document) >@@ -66,8 +56,8 @@ void SVGViewElement::parseAttribute(cons > m_viewTarget.reset(value); > > SVGExternalResourcesRequired::parseAttribute(name, value); >- SVGFitToViewBox::parseAttribute(this, name, value); >- SVGZoomAndPan::parseAttribute(*this, name, value); >+ SVGFitToViewBox::parseAttribute(name, value); >+ SVGZoomAndPan::parseAttribute(name, value); > SVGElement::parseAttribute(name, value); > } > >Index: Source/WebCore/svg/SVGViewElement.h >=================================================================== >--- Source/WebCore/svg/SVGViewElement.h (revision 233069) >+++ Source/WebCore/svg/SVGViewElement.h (working copy) >@@ -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 >@@ -42,25 +43,21 @@ 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&); > >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGViewElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan>; >+ > // FIXME: svgAttributeChanged missing. >+ const SVGAttributeRegistryBridge& attributeRegistryBridge() const final { return m_attributeRegistryBridge; } > 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; > SVGStringListValues m_viewTarget; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge { *this }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGViewSpec.cpp >=================================================================== >--- Source/WebCore/svg/SVGViewSpec.cpp (revision 233069) >+++ Source/WebCore/svg/SVGViewSpec.cpp (working copy) >@@ -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,96 +32,29 @@ > > 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) >+ : SVGFitToViewBox(&contextElement, PropertyIsReadOnly) >+ , SVGZoomAndPan(&contextElement) >+ , m_contextElement(&contextElement) >+ , m_attributeRegistryBridge(*this, contextElement) > { >+ registerAttributes(); > } > >-const AtomicString& SVGViewSpec::viewBoxIdentifier() >+void SVGViewSpec::registerAttributes() > { >- static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecViewBoxAttribute", AtomicString::ConstructFromLiteral); >- return s_identifier; >+ auto& registry = attributeRegistry(); >+ if (!registry.isEmpty()) >+ return; >+ registry.registerAttribute<SVGNames::transformAttr, &SVGViewSpec::m_transform>(); > } >- >-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) >-{ >- // SVGViewSpec and all of its content is read-only. >- return Exception { NoModificationAllowedError }; >-} >- >-String SVGViewSpec::transformString() const >-{ >- 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); >-} >- > SVGElement* SVGViewSpec::viewTarget() const > { > if (!m_contextElement) >@@ -136,51 +70,16 @@ RefPtr<SVGTransformList> SVGViewSpec::tr > 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); >+ auto& attributeAccessor = SVGAnimatedTransformListAttributeAccessor<SVGViewSpec>::singleton<SVGNames::transformAttr, &SVGViewSpec::transformIdentifier, &SVGViewSpec::m_transform>(); >+ return static_pointer_cast<SVGAnimatedTransformList>(attributeAccessor.lookupOrCreateAnimatedProperty(*this, *m_contextElement, m_transform, PropertyIsReadOnly))->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 +112,9 @@ bool SVGViewSpec::parseViewSpec(const St > 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 +136,7 @@ bool SVGViewSpec::parseViewSpec(const St > 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 +150,7 @@ bool SVGViewSpec::parseViewSpec(const St > SVGPreserveAspectRatioValue preserveAspectRatio; > if (!preserveAspectRatio.parse(currViewSpec, end, false)) > return false; >- setPreserveAspectRatioBaseValue(preserveAspectRatio); >+ setPreserveAspectRatio(preserveAspectRatio); > if (currViewSpec >= end || *currViewSpec != ')') > return false; > currViewSpec++; >@@ -261,7 +160,7 @@ bool SVGViewSpec::parseViewSpec(const St > 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++; >Index: Source/WebCore/svg/SVGViewSpec.h >=================================================================== >--- Source/WebCore/svg/SVGViewSpec.h (revision 233069) >+++ Source/WebCore/svg/SVGViewSpec.h (working copy) >@@ -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,34 @@ 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(); >+ static RefPtr<SVGAnimatedProperty> lookupOrCreateTransformWrapper(SVGViewSpec* contextElement); > >- static Ref<SVGAnimatedProperty> lookupOrCreateTransformWrapper(SVGViewSpec* contextElement); >- static Ref<SVGAnimatedProperty> lookupOrCreateViewBoxWrapper(SVGViewSpec* contextElement); >- static Ref<SVGAnimatedProperty> lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* contextElement); >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGViewSpec, SVGFitToViewBox, SVGZoomAndPan>; >+ static void registerAttributes(); > > SVGElement* m_contextElement; >- SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify }; >- SVGTransformListValues m_transform; >- FloatRect m_viewBox; >- SVGPreserveAspectRatioValue m_preserveAspectRatio; > String m_viewTargetString; >+ >+ AttributeRegistryBridge m_attributeRegistryBridge; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } >+ >+ SVGAnimatedTransformListAttribute m_transform { m_attributeRegistryBridge }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGViewSpec.idl >=================================================================== >--- Source/WebCore/svg/SVGViewSpec.idl (revision 233069) >+++ Source/WebCore/svg/SVGViewSpec.idl (working copy) >@@ -35,9 +35,7 @@ > readonly attribute DOMString preserveAspectRatioString; > readonly attribute DOMString transformString; > readonly attribute DOMString viewTargetString; >- >- // SVGZoomAndPan >- attribute unsigned short zoomAndPan; > }; > >+SVGViewSpec implements SVGZoomAndPan; > SVGViewSpec implements SVGFitToViewBox; >Index: Source/WebCore/svg/SVGZoomAndPan.cpp >=================================================================== >--- Source/WebCore/svg/SVGZoomAndPan.cpp (revision 233069) >+++ Source/WebCore/svg/SVGZoomAndPan.cpp (working copy) >@@ -21,32 +21,44 @@ > #include "config.h" > #include "SVGZoomAndPan.h" > >-#include "SVGParserUtilities.h" >- > namespace WebCore { > >-bool SVGZoomAndPan::parse(const UChar*& start, const UChar* end, SVGZoomAndPanType& zoomAndPan) >+SVGZoomAndPan::SVGZoomAndPan(SVGElement* contextElement) >+ : m_attributeRegistryBridge(*this, *contextElement) >+{ >+ 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)); > } > > } >Index: Source/WebCore/svg/SVGZoomAndPan.h >=================================================================== >--- Source/WebCore/svg/SVGZoomAndPan.h (revision 233069) >+++ Source/WebCore/svg/SVGZoomAndPan.h (working copy) >@@ -25,8 +25,6 @@ > > namespace WebCore { > >-enum SVGZoomAndPanType { SVGZoomAndPanUnknown, SVGZoomAndPanDisable, SVGZoomAndPanMagnify }; >- > class SVGZoomAndPan { > public: > // Forward declare enumerations in the W3C naming scheme, for IDL generation. >@@ -36,33 +34,29 @@ public: > SVG_ZOOMANDPAN_MAGNIFY = SVGZoomAndPanMagnify > }; > >- static bool isKnownAttribute(const QualifiedName&); >- >- static SVGZoomAndPanType parseFromNumber(unsigned short); >+ SVGZoomAndPan(SVGElement* contextElement); >+ >+ void parseAttribute(const QualifiedName&, const AtomicString&); >+ >+ 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 bool parse(const UChar*& start, const UChar* end, SVGZoomAndPanType&); >- template<class DerivedClass> static void parseAttribute(DerivedClass&, const QualifiedName&, const AtomicString& value); >+protected: >+ bool parseZoomAndPan(const UChar*&, const UChar*); > > private: >- static SVGZoomAndPanType parseAttributeValue(const AtomicString&); >-}; >+ using AttributeRegistryBridge = SVGAttributeRegistryBridgeImpl<SVGZoomAndPan>; >+ static void registerAttributes(); >+ >+ AttributeRegistryBridge m_attributeRegistryBridge; >+ >+public: >+ static auto& attributeRegistry() { return AttributeRegistryBridge::attributeRegistry(); } >+ static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeRegistryBridge::isKnownAttribute(attributeName); } > >-inline bool SVGZoomAndPan::isKnownAttribute(const QualifiedName& name) >-{ >- return name == SVGNames::zoomAndPanAttr; >-} >- >-inline SVGZoomAndPanType SVGZoomAndPan::parseFromNumber(unsigned short number) >-{ >- if (number > SVGZoomAndPanMagnify) >- return SVGZoomAndPanUnknown; >- return static_cast<SVGZoomAndPanType>(number); >-} >- >-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 { m_attributeRegistryBridge }; >+}; > > } // namespace WebCore >Index: Source/WebCore/svg/SVGZoomAndPanType.h >=================================================================== >--- Source/WebCore/svg/SVGZoomAndPanType.h (nonexistent) >+++ Source/WebCore/svg/SVGZoomAndPanType.h (working copy) >@@ -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; >+ } >+}; >+ >+} >Index: Source/WebCore/svg/graphics/SVGImage.cpp >=================================================================== >--- Source/WebCore/svg/graphics/SVGImage.cpp (revision 233069) >+++ Source/WebCore/svg/graphics/SVGImage.cpp (working copy) >@@ -371,10 +371,10 @@ void SVGImage::computeIntrinsicDimension > > intrinsicWidth = rootElement->intrinsicWidth(); > intrinsicHeight = rootElement->intrinsicHeight(); >- if (rootElement->preserveAspectRatio().align() == SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_NONE) >+ if (rootElement->m_preserveAspectRatio.animatedValue().align() == SVGPreserveAspectRatioValue::SVG_PRESERVEASPECTRATIO_NONE) > return; > >- intrinsicRatio = rootElement->viewBox().size(); >+ intrinsicRatio = rootElement->m_viewBox.animatedValue().size(); > if (intrinsicRatio.isEmpty() && intrinsicWidth.isFixed() && intrinsicHeight.isFixed()) > intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0)); > } >Index: Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h (revision 233069) >+++ Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h (working copy) >@@ -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(); >Index: Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp >=================================================================== >--- Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp (nonexistent) >+++ Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp (working copy) >@@ -0,0 +1,56 @@ >+/* >+ * 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)); >+} >+ >+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(); >+} >+ >+} >Index: Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h (revision 233069) >+++ Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h (working copy) >@@ -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,14 @@ 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&); > >- SVGPathByteStream* m_animatedPathByteStream; >+ SVGPathByteStream* m_animatedPathByteStream { nullptr }; > }; > > } // namespace WebCore >Index: Source/WebCore/svg/properties/SVGAnimatedProperty.cpp >=================================================================== >--- Source/WebCore/svg/properties/SVGAnimatedProperty.cpp (revision 233069) >+++ Source/WebCore/svg/properties/SVGAnimatedProperty.cpp (working copy) >@@ -36,16 +36,9 @@ SVGAnimatedProperty::SVGAnimatedProperty > > SVGAnimatedProperty::~SVGAnimatedProperty() > { >- // Remove wrapper from cache. >- for (auto& cache : *animatedPropertyCache()) { >- if (cache.value == this) { >- animatedPropertyCache()->remove(cache.key); >- break; >- } >- } >- > // Assure that animationEnded() was called, if animationStarted() was called before. > ASSERT(!isAnimating()); >+ m_contextElement->animatedPropertyWillBeDeleted(*this); > } > > void SVGAnimatedProperty::commitChange() >@@ -58,10 +51,4 @@ void SVGAnimatedProperty::commitChange() > m_contextElement->synchronizeAnimatedSVGAttribute(m_attributeName); > } > >-SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache() >-{ >- static Cache* s_cache = new Cache; >- return s_cache; >-} >- > } // namespace WebCore >Index: Source/WebCore/svg/properties/SVGAnimatedProperty.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAnimatedProperty.h (revision 233069) >+++ Source/WebCore/svg/properties/SVGAnimatedProperty.h (working copy) >@@ -21,8 +21,9 @@ > > #pragma once > >+#include "QualifiedName.h" > #include "SVGAnimatedPropertyDescription.h" >-#include "SVGPropertyInfo.h" >+#include "SVGAnimatedPropertyType.h" > #include <wtf/RefCounted.h> > > namespace WebCore { >@@ -43,51 +44,11 @@ public: > 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) >- { >- ASSERT(info); >- SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); >- >- auto result = animatedPropertyCache()->add(key, nullptr); >- if (!result.isNewEntry) >- return static_cast<TearOffType&>(*result.iterator->value); >- >- Ref<SVGAnimatedProperty> wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property); >- if (info->animatedPropertyState == PropertyIsReadOnly) >- wrapper->setIsReadOnly(); >- >- // Cache the raw pointer but return a Ref<>. 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)); >- } >- >- template<typename OwnerType, typename TearOffType> >- static RefPtr<TearOffType> lookupWrapper(const OwnerType* element, const SVGPropertyInfo* info) >- { >- return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(element), info); >- } >- > protected: > SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType); > > private: >- static Cache* animatedPropertyCache(); >- > RefPtr<SVGElement> m_contextElement; > const QualifiedName& m_attributeName; > AnimatedPropertyType m_animatedPropertyType; >Index: Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h (revision 233069) >+++ Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h (nonexistent) >@@ -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 > >Property changes on: Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h >___________________________________________________________________ >Deleted: svn:eol-style >## -1 +0,0 ## >-native >\ No newline at end of property >Index: Source/WebCore/svg/properties/SVGAnimatedPropertyType.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAnimatedPropertyType.h (nonexistent) >+++ Source/WebCore/svg/properties/SVGAnimatedPropertyType.h (working copy) >@@ -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 >+}; >+ >+} >Index: Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h (revision 233069) >+++ Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h (working copy) >@@ -28,7 +28,7 @@ namespace WebCore { > template<typename PropertyType> > class SVGAnimatedStaticPropertyTearOff : public SVGAnimatedProperty { > public: >- typedef PropertyType ContentType; >+ using ContentType = PropertyType; > > virtual const PropertyType& baseVal() > { >Index: Source/WebCore/svg/properties/SVGAttribute.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAttribute.h (nonexistent) >+++ Source/WebCore/svg/properties/SVGAttribute.h (working copy) >@@ -0,0 +1,137 @@ >+/* >+ * 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 "SVGPropertyTraits.h" >+ >+namespace WebCore { >+ >+class SVGAttributeRegistryBridge; >+ >+struct SVGAttribute { }; >+ >+template<typename PropertyType> >+struct SVGPropertyAttribute : public SVGAttribute { >+ SVGPropertyAttribute(const SVGAttributeRegistryBridge& attributeRegistryBridge) >+ : m_property(SVGPropertyTraits<PropertyType>::initialValue()) >+ , m_attributeRegistryBridge(attributeRegistryBridge) >+ { >+ } >+ >+ template<typename... Arguments> >+ SVGPropertyAttribute(const SVGAttributeRegistryBridge& attributeRegistryBridge, Arguments&&... arguments) >+ : m_property(std::forward<Arguments>(arguments)...) >+ , m_attributeRegistryBridge(attributeRegistryBridge) >+ { >+ } >+ >+ 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 }; >+ const SVGAttributeRegistryBridge& m_attributeRegistryBridge; >+}; >+ >+template<typename TearOffType> >+struct SVGAnimatedAttribute : public SVGPropertyAttribute<typename TearOffType::ContentType> { >+ using PropertyTearOffType = TearOffType; >+ using PropertyType = typename PropertyTearOffType::ContentType; >+ using Base = SVGPropertyAttribute<PropertyType>; >+ using Base::m_shouldSynchronize; >+ using Base::m_property; >+ using Base::m_attributeRegistryBridge; >+ >+ SVGAnimatedAttribute(const SVGAttributeRegistryBridge& attributeRegistryBridge) >+ : Base(attributeRegistryBridge) >+ { >+ } >+ >+ template<typename... Arguments> >+ SVGAnimatedAttribute(const SVGAttributeRegistryBridge& attributeRegistryBridge, Arguments&&... arguments) >+ : Base(attributeRegistryBridge, std::forward<Arguments>(arguments)...) >+ { >+ } >+ >+ const PropertyType& animatedValue() const >+ { >+ if (auto wrapper = m_attributeRegistryBridge.lookupAnimatedProperty(*this)) { >+ if (wrapper->isAnimating()) >+ return static_pointer_cast<PropertyTearOffType>(wrapper)->currentAnimatedValue(); >+ } >+ return m_property; >+ } >+ >+ RefPtr<PropertyTearOffType> animatedProperty() >+ { >+ m_shouldSynchronize = true; >+ return static_reference_cast<PropertyTearOffType>(m_attributeRegistryBridge.lookupOrCreateAnimatedProperty(*this).releaseNonNull()); >+ } >+}; >+ >+template<typename TearOffType> >+struct SVGAnimatedAttributeList : public SVGAnimatedAttribute<TearOffType> { >+ using PropertyTearOffType = TearOffType; >+ using PropertyType = typename PropertyTearOffType::ContentType; >+ using Base = SVGAnimatedAttribute<PropertyTearOffType>; >+ using Base::m_attributeRegistryBridge; >+ >+ SVGAnimatedAttributeList(const SVGAttributeRegistryBridge& attributeRegistryBridge) >+ : Base(attributeRegistryBridge) >+ { >+ } >+ >+ template<typename... Arguments> >+ SVGAnimatedAttributeList(const SVGAttributeRegistryBridge& attributeRegistryBridge, Arguments&&... arguments) >+ : Base(attributeRegistryBridge, std::forward<Arguments>(arguments)...) >+ { >+ } >+ >+ void detachAnimatedListWrappers(unsigned newListSize) >+ { >+ if (auto wrapper = m_attributeRegistryBridge.lookupAnimatedProperty(*this)) >+ static_pointer_cast<PropertyTearOffType>(wrapper)->detachListWrappers(newListSize); >+ } >+}; >+ >+} >Index: Source/WebCore/svg/properties/SVGAttributeAccessor.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAttributeAccessor.h (nonexistent) >+++ Source/WebCore/svg/properties/SVGAttributeAccessor.h (working copy) >@@ -0,0 +1,280 @@ >+/* >+ * 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 "SVGAnimatedPropertyDescription.h" >+#include "SVGAnimatedPropertyType.h" >+#include "SVGAttribute.h" >+#include "SVGLengthValue.h" >+#include "SVGNames.h" >+#include "SVGPropertyTraits.h" >+ >+namespace WebCore { >+ >+class SVGAnimatedProperty; >+class SVGElement; >+ >+struct SVGAttribute; >+ >+template<typename OwnerType> >+struct SVGAttributeAccessor { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ SVGAttributeAccessor(const QualifiedName& attributeName) >+ : m_attributeName(attributeName) >+ { >+ } >+ >+ const QualifiedName& attributeName() const { return m_attributeName; } >+ >+ virtual ~SVGAttributeAccessor() = default; >+ 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 { }; } >+ virtual bool animatedPropertyWillBeDeleted(const SVGAnimatedProperty&) const { return false; } >+ >+protected: >+ const QualifiedName& m_attributeName; >+}; >+ >+template<typename OwnerType, typename AttributeType> >+struct SVGPropertyAttributeAccessor : public SVGAttributeAccessor<OwnerType> { >+ 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> >+struct SVGAnimatedAttributeAccessor : public SVGPropertyAttributeAccessor<OwnerType, AnimatedAttributeType> { >+ 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: >+ bool isAnimatedLengthAttribute() const override { return std::is_same<PropertyType, SVGLengthValue>::value; } >+ AnimatedPropertyType animatedType() const override { return type; } >+ >+ template<typename PropertyTearOff = PropertyTearOffType, typename Property = PropertyType, AnimatedPropertyType animatedType = type> >+ RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(SVGElement& element, const AtomicString& identifier, Property& property, AnimatedPropertyState animatedState) const >+ { >+ SVGAnimatedPropertyDescription key(&element, identifier); >+ >+ auto result = animatedPropertyCache().add(key, nullptr); >+ if (!result.isNewEntry) >+ return result.iterator->value; >+ >+ auto wrapper = PropertyTearOff::create(&element, m_attributeName, animatedType, property); >+ if (animatedState == PropertyIsReadOnly) >+ wrapper->setIsReadOnly(); >+ >+ // Cache the raw pointer but return a Ref<>. 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<SVGAnimatedProperty>(wrapper); >+ } >+ >+ RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(OwnerType& owner, SVGElement& element, const SVGAttribute& attribute, AnimatedPropertyState animatedState) const override >+ { >+ ASSERT_UNUSED(attribute, isMatched(owner, attribute)); >+ return lookupOrCreateAnimatedProperty(element, m_identifier, this->attribute(owner).value(), animatedState); >+ } >+ >+ RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGElement& element, const AtomicString& identifier) const >+ { >+ SVGAnimatedPropertyDescription key(const_cast<SVGElement*>(&element), identifier); >+ return animatedPropertyCache().get(key); >+ } >+ >+ 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_identifier, attribute(owner).value(), animatedState) }; >+ } >+ >+ bool animatedPropertyWillBeDeleted(const SVGAnimatedProperty& animatedProperty) const override >+ { >+ for (auto& cache : animatedPropertyCache()) { >+ if (cache.value == &animatedProperty) { >+ animatedPropertyCache().remove(cache.key); >+ return true; >+ } >+ } >+ return false; >+ } >+ >+ using Cache = HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits>; >+ static Cache& animatedPropertyCache() >+ { >+ static NeverDestroyed<Cache> s_cache; >+ return s_cache; >+ } >+}; >+ >+template<typename OwnerType, typename AnimatedAttributeType, AnimatedPropertyType type, typename SecondAnimatedAttributeType, AnimatedPropertyType secondType> >+struct SVGAnimatedPairAttributeAccessor : public SVGAnimatedAttributeAccessor<OwnerType, AnimatedAttributeType, type> { >+ 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_identifier, this->attribute(owner).value(), animatedState); >+ ASSERT(&secondAttribute(owner) == &attribute); >+ return Base::template lookupOrCreateAnimatedProperty<SecondPropertyTearOffType, SecondPropertyType, secondType>(element, 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_identifier, attribute(owner).value(), animatedState), >+ Base::template lookupOrCreateAnimatedProperty<SecondPropertyTearOffType, SecondPropertyType, secondType>(element, 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 >Index: Source/WebCore/svg/properties/SVGAttributeRegistry.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAttributeRegistry.h (nonexistent) >+++ Source/WebCore/svg/properties/SVGAttributeRegistry.h (working copy) >@@ -0,0 +1,354 @@ >+/* >+ * 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 "SVGAnimatedAngle.h" >+#include "SVGAnimatedBoolean.h" >+#include "SVGAnimatedEnumeration.h" >+#include "SVGAnimatedInteger.h" >+#include "SVGAnimatedLength.h" >+#include "SVGAnimatedLengthList.h" >+#include "SVGAnimatedNumber.h" >+#include "SVGAnimatedNumberList.h" >+#include "SVGAnimatedPath.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; >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGZoomAndPanTypeAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGZoomAndPanTypeAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGBooleanAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGBooleanAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGStringListValuesAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGStringListValuesAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGTransformListValuesAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGTransformListValuesAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ 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, SVGAnimatedPathSegListAttribute OwnerType::*attribute> >+ void registerAttribute() >+ { >+ registerAttribute(SVGAnimatedPathSegListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>()); >+ } >+ >+ 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 >+ { >+ 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 (const auto* attributeAccessor = findAttributeAccessor(attributeName)) >+ return attributeAccessor->animatedTypes(); >+ 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); >+ } >+ >+ bool animatedPropertyWillBeDeleted(const SVGAnimatedProperty& animatedProperty) const >+ { >+ if (const auto* attributeAccessor = findAttributeAccessor(animatedProperty.attributeName())) >+ return attributeAccessor->animatedPropertyWillBeDeleted(animatedProperty); >+ return animatedPropertyWillBeDeletedBaseTypes(animatedProperty); >+ } >+ >+ void registerAttribute(const SVGAttributeAccessor<OwnerType>& attributeAccessor) >+ { >+ m_map.add(attributeAccessor.attributeName(), &attributeAccessor); >+ } >+ >+private: >+ template<size_t I = 0> >+ static typename std::enable_if<I == sizeof...(BaseTypes), Vector<AnimatedPropertyType>>::type animatedTypesBaseTypes(const QualifiedName&) { return { }; } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I < sizeof...(BaseTypes), Vector<AnimatedPropertyType>>::type animatedTypesBaseTypes(const QualifiedName& attributeName) >+ { >+ using BaseType = typename std::tuple_element<I, typename std::tuple<BaseTypes...>>::type; >+ auto animatedTypes = BaseType::attributeRegistry().animatedTypes(attributeName); >+ if (!animatedTypes.isEmpty()) >+ return animatedTypes; >+ 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); >+ } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I == sizeof...(BaseTypes), bool>::type animatedPropertyWillBeDeletedBaseTypes(const SVGAnimatedProperty&) { return false; } >+ >+ template<size_t I = 0> >+ static typename std::enable_if<I < sizeof...(BaseTypes), bool>::type animatedPropertyWillBeDeletedBaseTypes(const SVGAnimatedProperty& animatedProperty) >+ { >+ using BaseType = typename std::tuple_element<I, typename std::tuple<BaseTypes...>>::type; >+ if (BaseType::attributeRegistry().animatedPropertyWillBeDeleted(animatedProperty)) >+ return true; >+ return animatedPropertyWillBeDeletedBaseTypes<I + 1>(animatedProperty); >+ } >+ >+ 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; >+}; >+ >+} >Index: Source/WebCore/svg/properties/SVGAttributeRegistryBridge.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAttributeRegistryBridge.h (nonexistent) >+++ Source/WebCore/svg/properties/SVGAttributeRegistryBridge.h (working copy) >@@ -0,0 +1,122 @@ >+/* >+ * 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 "SVGAttributeRegistry.h" >+ >+namespace WebCore { >+ >+class SVGAttributeRegistryBridge { >+public: >+ virtual ~SVGAttributeRegistryBridge() = default; >+ >+ 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; >+ virtual void animatedPropertyWillBeDeleted(const SVGAnimatedProperty&) const = 0; >+}; >+ >+template<typename OwnerType, typename... BaseTypes> >+class SVGAttributeRegistryBridgeImpl : public SVGAttributeRegistryBridge { >+public: >+ using AttributeRegistry = SVGAttributeRegistry<OwnerType, BaseTypes...>; >+ >+ SVGAttributeRegistryBridgeImpl(OwnerType& owner, SVGElement& element, AnimatedPropertyState animatedState = PropertyIsReadWrite) >+ : m_owner(owner) >+ , m_element(element) >+ , m_animatedState(animatedState) >+ { >+ } >+ >+ SVGAttributeRegistryBridgeImpl(OwnerType& owner) >+ : m_owner(owner) >+ , m_element(owner) >+ { >+ static_assert(std::is_base_of<SVGElement, OwnerType>::value, "The owner of SVGAttributeRegistryBridge should be an 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); >+ } >+ >+ void animatedPropertyWillBeDeleted(const SVGAnimatedProperty& animatedProperty) const override >+ { >+ attributeRegistry().animatedPropertyWillBeDeleted(animatedProperty); >+ } >+ >+ OwnerType& m_owner; >+ SVGElement& m_element; >+ AnimatedPropertyState m_animatedState { PropertyIsReadWrite }; >+}; >+ >+} >Index: Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp >=================================================================== >--- Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp (revision 233069) >+++ Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp (nonexistent) >@@ -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; >-} >- >-} > >Property changes on: Source/WebCore/svg/properties/SVGAttributeToPropertyMap.cpp >___________________________________________________________________ >Deleted: svn:eol-style >## -1 +0,0 ## >-native >\ No newline at end of property >Index: Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h >=================================================================== >--- Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h (revision 233069) >+++ Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h (nonexistent) >@@ -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 > >Property changes on: Source/WebCore/svg/properties/SVGAttributeToPropertyMap.h >___________________________________________________________________ >Deleted: svn:eol-style >## -1 +0,0 ## >-native >\ No newline at end of property >Index: Source/WebCore/svg/properties/SVGPropertyInfo.cpp >=================================================================== >--- Source/WebCore/svg/properties/SVGPropertyInfo.cpp (revision 233069) >+++ Source/WebCore/svg/properties/SVGPropertyInfo.cpp (nonexistent) >@@ -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 >Index: Source/WebCore/svg/properties/SVGPropertyInfo.h >=================================================================== >--- Source/WebCore/svg/properties/SVGPropertyInfo.h (revision 233069) >+++ Source/WebCore/svg/properties/SVGPropertyInfo.h (nonexistent) >@@ -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 > >Property changes on: Source/WebCore/svg/properties/SVGPropertyInfo.h >___________________________________________________________________ >Deleted: svn:eol-style >## -1 +0,0 ## >-native >\ No newline at end of property
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