Changeset 234620 in webkit
- Timestamp:
- Aug 6, 2018, 2:08:53 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 added
- 5 deleted
- 163 edited
- 4 copied
-
ChangeLog (modified) (1 diff)
-
Sources.txt (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (17 diffs)
-
rendering/svg/RenderSVGResourceMarker.cpp (modified) (1 diff)
-
svg/SVGAElement.cpp (modified) (4 diffs)
-
svg/SVGAElement.h (modified) (5 diffs)
-
svg/SVGAElement.idl (modified) (1 diff)
-
svg/SVGAltGlyphElement.cpp (modified) (2 diffs)
-
svg/SVGAltGlyphElement.h (modified) (2 diffs)
-
svg/SVGAnimatedAngle.h (modified) (2 diffs)
-
svg/SVGAnimatedBoolean.h (modified) (2 diffs)
-
svg/SVGAnimatedEnumeration.h (modified) (2 diffs)
-
svg/SVGAnimatedInteger.h (modified) (2 diffs)
-
svg/SVGAnimatedLength.h (modified) (2 diffs)
-
svg/SVGAnimatedLengthList.h (modified) (3 diffs)
-
svg/SVGAnimatedNumber.h (modified) (2 diffs)
-
svg/SVGAnimatedNumberList.h (modified) (3 diffs)
-
svg/SVGAnimatedPath.h (modified) (2 diffs)
-
svg/SVGAnimatedPointList.h (modified) (2 diffs)
-
svg/SVGAnimatedPreserveAspectRatio.h (modified) (2 diffs)
-
svg/SVGAnimatedRect.h (modified) (2 diffs)
-
svg/SVGAnimatedString.h (modified) (2 diffs)
-
svg/SVGAnimatedTransformList.h (modified) (2 diffs)
-
svg/SVGAnimatedTypeAnimator.cpp (modified) (3 diffs)
-
svg/SVGAnimationElement.cpp (modified) (2 diffs)
-
svg/SVGAnimationElement.h (modified) (4 diffs)
-
svg/SVGCircleElement.cpp (modified) (7 diffs)
-
svg/SVGCircleElement.h (modified) (3 diffs)
-
svg/SVGClipPathElement.cpp (modified) (5 diffs)
-
svg/SVGClipPathElement.h (modified) (3 diffs)
-
svg/SVGComponentTransferFunctionElement.cpp (modified) (5 diffs)
-
svg/SVGComponentTransferFunctionElement.h (modified) (3 diffs)
-
svg/SVGCursorElement.cpp (modified) (6 diffs)
-
svg/SVGCursorElement.h (modified) (3 diffs)
-
svg/SVGDefsElement.cpp (modified) (2 diffs)
-
svg/SVGDefsElement.h (modified) (3 diffs)
-
svg/SVGElement.cpp (modified) (10 diffs)
-
svg/SVGElement.h (modified) (8 diffs)
-
svg/SVGEllipseElement.cpp (modified) (7 diffs)
-
svg/SVGEllipseElement.h (modified) (3 diffs)
-
svg/SVGExternalResourcesRequired.cpp (modified) (8 diffs)
-
svg/SVGExternalResourcesRequired.h (modified) (4 diffs)
-
svg/SVGFEBlendElement.cpp (modified) (4 diffs)
-
svg/SVGFEBlendElement.h (modified) (2 diffs)
-
svg/SVGFEColorMatrixElement.cpp (modified) (5 diffs)
-
svg/SVGFEColorMatrixElement.h (modified) (2 diffs)
-
svg/SVGFEComponentTransferElement.cpp (modified) (3 diffs)
-
svg/SVGFEComponentTransferElement.h (modified) (2 diffs)
-
svg/SVGFECompositeElement.cpp (modified) (4 diffs)
-
svg/SVGFECompositeElement.h (modified) (2 diffs)
-
svg/SVGFEConvolveMatrixElement.cpp (modified) (13 diffs)
-
svg/SVGFEConvolveMatrixElement.h (modified) (4 diffs)
-
svg/SVGFEDiffuseLightingElement.cpp (modified) (4 diffs)
-
svg/SVGFEDiffuseLightingElement.h (modified) (3 diffs)
-
svg/SVGFEDisplacementMapElement.cpp (modified) (5 diffs)
-
svg/SVGFEDisplacementMapElement.h (modified) (2 diffs)
-
svg/SVGFEDropShadowElement.cpp (modified) (6 diffs)
-
svg/SVGFEDropShadowElement.h (modified) (3 diffs)
-
svg/SVGFEGaussianBlurElement.cpp (modified) (7 diffs)
-
svg/SVGFEGaussianBlurElement.h (modified) (3 diffs)
-
svg/SVGFEImageElement.cpp (modified) (4 diffs)
-
svg/SVGFEImageElement.h (modified) (4 diffs)
-
svg/SVGFELightElement.cpp (modified) (4 diffs)
-
svg/SVGFELightElement.h (modified) (3 diffs)
-
svg/SVGFEMergeNodeElement.cpp (modified) (3 diffs)
-
svg/SVGFEMergeNodeElement.h (modified) (2 diffs)
-
svg/SVGFEMorphologyElement.cpp (modified) (5 diffs)
-
svg/SVGFEMorphologyElement.h (modified) (3 diffs)
-
svg/SVGFEOffsetElement.cpp (modified) (4 diffs)
-
svg/SVGFEOffsetElement.h (modified) (2 diffs)
-
svg/SVGFESpecularLightingElement.cpp (modified) (4 diffs)
-
svg/SVGFESpecularLightingElement.h (modified) (3 diffs)
-
svg/SVGFETileElement.cpp (modified) (3 diffs)
-
svg/SVGFETileElement.h (modified) (2 diffs)
-
svg/SVGFETurbulenceElement.cpp (modified) (9 diffs)
-
svg/SVGFETurbulenceElement.h (modified) (3 diffs)
-
svg/SVGFilterElement.cpp (modified) (6 diffs)
-
svg/SVGFilterElement.h (modified) (5 diffs)
-
svg/SVGFilterPrimitiveStandardAttributes.cpp (modified) (5 diffs)
-
svg/SVGFilterPrimitiveStandardAttributes.h (modified) (5 diffs)
-
svg/SVGFitToViewBox.cpp (modified) (5 diffs)
-
svg/SVGFitToViewBox.h (modified) (3 diffs)
-
svg/SVGFontElement.cpp (modified) (2 diffs)
-
svg/SVGFontElement.h (modified) (2 diffs)
-
svg/SVGForeignObjectElement.cpp (modified) (5 diffs)
-
svg/SVGForeignObjectElement.h (modified) (3 diffs)
-
svg/SVGGElement.cpp (modified) (4 diffs)
-
svg/SVGGElement.h (modified) (2 diffs)
-
svg/SVGGeometryElement.cpp (modified) (5 diffs)
-
svg/SVGGeometryElement.h (modified) (3 diffs)
-
svg/SVGGlyphRefElement.cpp (modified) (2 diffs)
-
svg/SVGGlyphRefElement.h (modified) (3 diffs)
-
svg/SVGGradientElement.cpp (modified) (6 diffs)
-
svg/SVGGradientElement.h (modified) (4 diffs)
-
svg/SVGGraphicsElement.cpp (modified) (6 diffs)
-
svg/SVGGraphicsElement.h (modified) (4 diffs)
-
svg/SVGImageElement.cpp (modified) (8 diffs)
-
svg/SVGImageElement.h (modified) (4 diffs)
-
svg/SVGImageLoader.cpp (modified) (1 diff)
-
svg/SVGLangSpace.cpp (modified) (4 diffs)
-
svg/SVGLangSpace.h (modified) (2 diffs)
-
svg/SVGLineElement.cpp (modified) (6 diffs)
-
svg/SVGLineElement.h (modified) (3 diffs)
-
svg/SVGLinearGradientElement.cpp (modified) (5 diffs)
-
svg/SVGLinearGradientElement.h (modified) (3 diffs)
-
svg/SVGMPathElement.cpp (modified) (3 diffs)
-
svg/SVGMPathElement.h (modified) (4 diffs)
-
svg/SVGMarkerElement.cpp (modified) (9 diffs)
-
svg/SVGMarkerElement.h (modified) (3 diffs)
-
svg/SVGMaskElement.cpp (modified) (8 diffs)
-
svg/SVGMaskElement.h (modified) (3 diffs)
-
svg/SVGPathElement.cpp (modified) (9 diffs)
-
svg/SVGPathElement.h (modified) (5 diffs)
-
svg/SVGPathSegListValues.h (modified) (1 diff)
-
svg/SVGPathSegWithContext.h (modified) (2 diffs)
-
svg/SVGPatternElement.cpp (modified) (10 diffs)
-
svg/SVGPatternElement.h (modified) (4 diffs)
-
svg/SVGPointListValues.h (modified) (2 diffs)
-
svg/SVGPolyElement.cpp (modified) (5 diffs)
-
svg/SVGPolyElement.h (modified) (4 diffs)
-
svg/SVGPreserveAspectRatioValue.cpp (modified) (1 diff)
-
svg/SVGPreserveAspectRatioValue.h (modified) (1 diff)
-
svg/SVGRadialGradientElement.cpp (modified) (5 diffs)
-
svg/SVGRadialGradientElement.h (modified) (3 diffs)
-
svg/SVGRectElement.cpp (modified) (7 diffs)
-
svg/SVGRectElement.h (modified) (2 diffs)
-
svg/SVGSVGElement.cpp (modified) (9 diffs)
-
svg/SVGSVGElement.h (modified) (9 diffs)
-
svg/SVGScriptElement.cpp (modified) (8 diffs)
-
svg/SVGScriptElement.h (modified) (4 diffs)
-
svg/SVGStopElement.cpp (modified) (3 diffs)
-
svg/SVGStopElement.h (modified) (3 diffs)
-
svg/SVGStringListValues.h (modified) (4 diffs)
-
svg/SVGSwitchElement.cpp (modified) (2 diffs)
-
svg/SVGSwitchElement.h (modified) (3 diffs)
-
svg/SVGSymbolElement.cpp (modified) (3 diffs)
-
svg/SVGSymbolElement.h (modified) (3 diffs)
-
svg/SVGTRefElement.cpp (modified) (3 diffs)
-
svg/SVGTRefElement.h (modified) (3 diffs)
-
svg/SVGTests.cpp (modified) (6 diffs)
-
svg/SVGTests.h (modified) (3 diffs)
-
svg/SVGTextContentElement.cpp (modified) (6 diffs)
-
svg/SVGTextContentElement.h (modified) (3 diffs)
-
svg/SVGTextPathElement.cpp (modified) (6 diffs)
-
svg/SVGTextPathElement.h (modified) (4 diffs)
-
svg/SVGTextPositioningElement.cpp (modified) (8 diffs)
-
svg/SVGTextPositioningElement.h (modified) (3 diffs)
-
svg/SVGURIReference.cpp (modified) (4 diffs)
-
svg/SVGURIReference.h (modified) (3 diffs)
-
svg/SVGUseElement.cpp (modified) (10 diffs)
-
svg/SVGUseElement.h (modified) (5 diffs)
-
svg/SVGValue.h (modified) (1 diff)
-
svg/SVGViewElement.cpp (modified) (3 diffs)
-
svg/SVGViewElement.h (modified) (4 diffs)
-
svg/SVGViewSpec.cpp (modified) (7 diffs)
-
svg/SVGViewSpec.h (modified) (3 diffs)
-
svg/SVGViewSpec.idl (modified) (2 diffs)
-
svg/SVGZoomAndPan.cpp (modified) (2 diffs)
-
svg/SVGZoomAndPan.h (modified) (3 diffs)
-
svg/SVGZoomAndPanType.h (copied) (copied from trunk/Source/WebCore/svg/SVGValue.h ) (1 diff)
-
svg/properties/SVGAnimatedEnumerationPropertyTearOff.h (modified) (1 diff)
-
svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp (copied) (copied from trunk/Source/WebCore/svg/SVGValue.h ) (1 diff)
-
svg/properties/SVGAnimatedPathSegListPropertyTearOff.h (modified) (3 diffs)
-
svg/properties/SVGAnimatedProperty.cpp (modified) (4 diffs)
-
svg/properties/SVGAnimatedProperty.h (modified) (6 diffs)
-
svg/properties/SVGAnimatedPropertyMacros.h (deleted)
-
svg/properties/SVGAnimatedPropertyType.h (copied) (copied from trunk/Source/WebCore/svg/SVGAElement.idl ) (2 diffs)
-
svg/properties/SVGAttribute.h (added)
-
svg/properties/SVGAttributeAccessor.h (added)
-
svg/properties/SVGAttributeOwnerProxy.h (copied) (copied from trunk/Source/WebCore/svg/SVGValue.h ) (1 diff)
-
svg/properties/SVGAttributeOwnerProxyImpl.h (added)
-
svg/properties/SVGAttributeRegistry.h (added)
-
svg/properties/SVGAttributeToPropertyMap.cpp (deleted)
-
svg/properties/SVGAttributeToPropertyMap.h (deleted)
-
svg/properties/SVGPropertyInfo.cpp (deleted)
-
svg/properties/SVGPropertyInfo.h (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r234619 r234620 1 2018-08-06 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Remove the SVG elements' attributes macros 4 https://bugs.webkit.org/show_bug.cgi?id=186751 5 6 Reviewed by Simon Fraser. 7 8 This is how the SVG attributes are implemented after removing the SVG macros: 9 10 1) The SVG attribute is defined as a super class of SVGAttribute. The super 11 classes of SVGAttribute are template classes. The type of these template 12 are the property type or the TearOff type. 13 14 2) To unify accessing attributes of the SVGElements and its super classes 15 an SVGAttributeAccessor template class is added. It is inherited by other 16 template classes. The types of these templates are the owner and the 17 attributes types. The main functions of these classes is to synchronize 18 the new property value with the document attributes pool and to create 19 and cache the TearOff objects. 20 21 3) To make code shorter and more readable, attribute types and attribute 22 accessors are defined for every SVG TearOff type, e.g. 23 -- SVGLength: 24 SVGAnimatedLengthAttribute and SVGAnimatedLengthAttributeAccessor 25 -- SVGAnimatedNumber: 26 SVGAnimatedNumberAttribute and SVGAnimatedNumberAttributeAccessor 27 28 4) A special accessor is defined for animated pair and optional attributes: 29 SVGAnimatedPairAttributeAccessor, e.g. 30 -- SVGMarkerElement: 31 orient attribute: "angle" or "type" 32 -- SVGFEGaussianBlurElement: 33 stdDeviation attribute: "x" and "y" 34 35 5) The SVG attributes have to be registered into an singleton SVGAttributeRegistry. 36 The SVGAttributeRegistry is a template class. The types of this template 37 class are the the type of the owner and the base classes of this owner. 38 This registry holds a map from "attribute name" to "attribute accessor". 39 40 6) To make the code easier to read, the SVGAttributeRegistry implements 41 registerAttribute() for different attribute types. The owner needs only 42 to provide the attribute name and a pointer to the class member of this 43 attribute to the same function "registerAttribute()". The compiler will 44 pick the right function to call based on the type of the attribute. 45 46 7) Given a reference to the owner element, SVGAttributeRegistry can loop 47 through the attributes of this owner and through the attributes of its 48 base classes as well to do operations like synchronizing all the attributes 49 or creating the TearOff object of a certain attribute. 50 51 8) To make the base class SVGElement have the ability to access the attributes 52 of any of its super classes, SVGAttributeOwnerProxy will be used. 53 SVGAttributeOwnerProxy is a base class which have all the functions that 54 SVGElement needs as pure virtual functions. 55 56 9) SVGAttributeOwnerProxyImpl is a template class which implements 57 SVGAttributeOwnerProxy and whose types are the owner and its base classes. 58 SVGAttributeOwnerProxyImpl keeps a reference to the owner and the context 59 SVGElement. 60 61 10) All the SVG attribute owners have to implement the virtual function 62 attributeOwnerProxy() which returns a reference to SVGAttributeOwnerProxy. 63 The local attributeOwnerProxy() returns a reference to a local 64 SVGAttributeOwnerProxyImpl. Its type and base types are the class 65 hierarchy of this element. 66 67 All the attributes of the non-SVGElement-based classes are moved as members 68 of these classes instead of adding them to all the super classes. These 69 classes are: 70 -- SVGExternalResourcesRequired 71 -- SVGURIReference 72 -- SVGFitToViewBox 73 -- SVGZoomAndPan 74 -- SVGLangSpace 75 76 The svgAttributeChanged() of all the SVGElement-based classes are now 77 simplified by distributing the responsibilities of changing an attribute 78 to the base classes. One exception is the SVGURIReference since the action 79 to be taken when changing the "href" is different for every super class. 80 81 Other work will be done in separate patches. 82 -- Shrinking the memory of the SVGElements. 83 -- Making all the attributes RefCounted objects. 84 85 * Sources.txt: 86 * WebCore.xcodeproj/project.pbxproj: 87 * rendering/svg/RenderSVGResourceMarker.cpp: 88 (WebCore::RenderSVGResourceMarker::draw): 89 * svg/SVGAElement.cpp: 90 (WebCore::SVGAElement::SVGAElement): 91 (WebCore::SVGAElement::registerAttributes): 92 (WebCore::SVGAElement::parseAttribute): 93 (WebCore::SVGAElement::svgAttributeChanged): 94 * svg/SVGAElement.h: 95 * svg/SVGAElement.idl: 96 * svg/SVGAltGlyphElement.cpp: 97 (WebCore::SVGAltGlyphElement::SVGAltGlyphElement): 98 * svg/SVGAltGlyphElement.h: 99 * svg/SVGAnimatedAngle.h: 100 * svg/SVGAnimatedBoolean.h: 101 * svg/SVGAnimatedEnumeration.h: 102 * svg/SVGAnimatedInteger.h: 103 * svg/SVGAnimatedLength.h: 104 * svg/SVGAnimatedLengthList.h: 105 * svg/SVGAnimatedNumber.h: 106 * svg/SVGAnimatedNumberList.h: 107 * svg/SVGAnimatedPath.h: 108 * svg/SVGAnimatedPointList.h: 109 * svg/SVGAnimatedPreserveAspectRatio.h: 110 * svg/SVGAnimatedRect.h: 111 * svg/SVGAnimatedString.h: 112 * svg/SVGAnimatedTransformList.h: 113 * svg/SVGAnimatedTypeAnimator.cpp: 114 (WebCore::SVGAnimatedTypeAnimator::findAnimatedPropertiesForAttributeName): 115 * svg/SVGAnimationElement.cpp: 116 (WebCore::SVGAnimationElement::SVGAnimationElement): 117 (WebCore::SVGAnimationElement::requiredFeatures): Deleted. 118 (WebCore::SVGAnimationElement::requiredExtensions): Deleted. 119 (WebCore::SVGAnimationElement::systemLanguage): Deleted. 120 * svg/SVGAnimationElement.h: 121 (WebCore::SVGAnimationElement::attributeRegistry): 122 * svg/SVGCircleElement.cpp: 123 (WebCore::SVGCircleElement::SVGCircleElement): 124 (WebCore::SVGCircleElement::registerAttributes): 125 (WebCore::SVGCircleElement::parseAttribute): 126 (WebCore::SVGCircleElement::svgAttributeChanged): 127 * svg/SVGCircleElement.h: 128 * svg/SVGClipPathElement.cpp: 129 (WebCore::SVGClipPathElement::SVGClipPathElement): 130 (WebCore::SVGClipPathElement::registerAttributes): 131 (WebCore::SVGClipPathElement::parseAttribute): 132 (WebCore::SVGClipPathElement::svgAttributeChanged): 133 (WebCore::SVGClipPathElement::isSupportedAttribute): Deleted. 134 * svg/SVGClipPathElement.h: 135 * svg/SVGComponentTransferFunctionElement.cpp: 136 (WebCore::SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement): 137 (WebCore::SVGComponentTransferFunctionElement::registerAttributes): 138 (WebCore::SVGComponentTransferFunctionElement::parseAttribute): 139 (WebCore::SVGComponentTransferFunctionElement::svgAttributeChanged): 140 (WebCore::SVGComponentTransferFunctionElement::transferFunction const): 141 (WebCore::SVGComponentTransferFunctionElement::isSupportedAttribute): Deleted. 142 * svg/SVGComponentTransferFunctionElement.h: 143 (WebCore::SVGComponentTransferFunctionElement::type const): 144 (WebCore::SVGComponentTransferFunctionElement::tableValues const): 145 (WebCore::SVGComponentTransferFunctionElement::slope const): 146 (WebCore::SVGComponentTransferFunctionElement::intercept const): 147 (WebCore::SVGComponentTransferFunctionElement::amplitude const): 148 (WebCore::SVGComponentTransferFunctionElement::exponent const): 149 (WebCore::SVGComponentTransferFunctionElement::offset const): 150 (WebCore::SVGComponentTransferFunctionElement::typeAnimated): 151 (WebCore::SVGComponentTransferFunctionElement::tableValuesAnimated): 152 (WebCore::SVGComponentTransferFunctionElement::slopeAnimated): 153 (WebCore::SVGComponentTransferFunctionElement::interceptAnimated): 154 (WebCore::SVGComponentTransferFunctionElement::amplitudeAnimated): 155 (WebCore::SVGComponentTransferFunctionElement::exponentAnimated): 156 (WebCore::SVGComponentTransferFunctionElement::offsetAnimated): 157 (WebCore::SVGComponentTransferFunctionElement::attributeRegistry): 158 (WebCore::SVGComponentTransferFunctionElement::isKnownAttribute): 159 * svg/SVGCursorElement.cpp: 160 (WebCore::SVGCursorElement::SVGCursorElement): 161 (WebCore::SVGCursorElement::registerAttributes): 162 (WebCore::SVGCursorElement::parseAttribute): 163 (WebCore::SVGCursorElement::svgAttributeChanged): 164 (WebCore::SVGCursorElement::isSupportedAttribute): Deleted. 165 (WebCore::SVGCursorElement::requiredFeatures): Deleted. 166 (WebCore::SVGCursorElement::requiredExtensions): Deleted. 167 (WebCore::SVGCursorElement::systemLanguage): Deleted. 168 * svg/SVGCursorElement.h: 169 * svg/SVGDefsElement.cpp: 170 (WebCore::SVGDefsElement::SVGDefsElement): 171 * svg/SVGDefsElement.h: 172 * svg/SVGElement.cpp: 173 (WebCore::SVGElement::SVGElement): 174 (WebCore::SVGElement::registerAttributes): 175 (WebCore::SVGElement::parseAttribute): 176 (WebCore::SVGElement::animatedPropertyTypesForAttribute): 177 (WebCore::SVGElement::synchronizeAllAnimatedSVGAttribute): 178 (WebCore::SVGElement::synchronizeAnimatedSVGAttribute const): 179 (WebCore::SVGElement::isPresentationAttributeWithSVGDOM): 180 (WebCore::SVGElement::svgAttributeChanged): 181 (WebCore::SVGElement::synchronizeRequiredFeatures): Deleted. 182 (WebCore::SVGElement::synchronizeRequiredExtensions): Deleted. 183 (WebCore::SVGElement::synchronizeSystemLanguage): Deleted. 184 (WebCore::SVGElement::isKnownAttribute): Deleted. 185 * svg/SVGElement.h: 186 (WebCore::SVGElement::attributeRegistry): 187 (WebCore::SVGElement::isKnownAttribute): 188 (WebCore::SVGElement::attributeOwnerProxy const): 189 (WebCore::SVGElement::synchronizeAttribute): 190 (WebCore::SVGElement::synchronizeAttributes): 191 (WebCore::SVGElement::animatedTypes const): 192 (WebCore::SVGElement::lookupAnimatedProperty const): 193 (WebCore::SVGElement::lookupOrCreateAnimatedProperty): 194 (WebCore::SVGElement::lookupOrCreateAnimatedProperties): 195 (WebCore::SVGElement::className const): 196 (WebCore::SVGElement::classNameAnimated): 197 (WebCore::SVGElement::synchronizeRequiredFeatures): Deleted. 198 (WebCore::SVGElement::synchronizeRequiredExtensions): Deleted. 199 (WebCore::SVGElement::synchronizeSystemLanguage): Deleted. 200 * svg/SVGEllipseElement.cpp: 201 (WebCore::SVGEllipseElement::SVGEllipseElement): 202 (WebCore::SVGEllipseElement::registerAttributes): 203 (WebCore::SVGEllipseElement::parseAttribute): 204 (WebCore::SVGEllipseElement::svgAttributeChanged): 205 * svg/SVGEllipseElement.h: 206 * svg/SVGExternalResourcesRequired.cpp: 207 (WebCore::SVGExternalResourcesRequired::SVGExternalResourcesRequired): 208 (WebCore::SVGExternalResourcesRequired::registerAttributes): 209 (WebCore::SVGExternalResourcesRequired::parseAttribute): 210 (WebCore::SVGExternalResourcesRequired::svgAttributeChanged): 211 (WebCore::SVGExternalResourcesRequired::addSupportedAttributes): 212 (WebCore::SVGExternalResourcesRequired::dispatchLoadEvent): 213 (WebCore::SVGExternalResourcesRequired::insertedIntoDocument): 214 (WebCore::SVGExternalResourcesRequired::finishParsingChildren): 215 (WebCore::SVGExternalResourcesRequired::haveLoadedRequiredResources const): 216 (WebCore::SVGExternalResourcesRequired::isKnownAttribute): Deleted. 217 (WebCore::SVGExternalResourcesRequired::handleAttributeChange): Deleted. 218 * svg/SVGExternalResourcesRequired.h: 219 (WebCore::SVGExternalResourcesRequired::attributeRegistry): 220 (WebCore::SVGExternalResourcesRequired::externalResourcesRequiredAnimated): 221 (WebCore::SVGExternalResourcesRequired::externalResourcesRequired const): 222 (WebCore::SVGExternalResourcesRequired::setExternalResourcesRequired): 223 (WebCore::SVGExternalResourcesRequired::isKnownAttribute): 224 (WebCore::SVGExternalResourcesRequired::attributeOwnerProxy): 225 * svg/SVGFEBlendElement.cpp: 226 (WebCore::SVGFEBlendElement::SVGFEBlendElement): 227 (WebCore::SVGFEBlendElement::registerAttributes): 228 (WebCore::SVGFEBlendElement::parseAttribute): 229 * svg/SVGFEBlendElement.h: 230 * svg/SVGFEColorMatrixElement.cpp: 231 (WebCore::SVGFEColorMatrixElement::SVGFEColorMatrixElement): 232 (WebCore::SVGFEColorMatrixElement::registerAttributes): 233 (WebCore::SVGFEColorMatrixElement::parseAttribute): 234 * svg/SVGFEColorMatrixElement.h: 235 * svg/SVGFEComponentTransferElement.cpp: 236 (WebCore::SVGFEComponentTransferElement::SVGFEComponentTransferElement): 237 (WebCore::SVGFEComponentTransferElement::registerAttributes): 238 (WebCore::SVGFEComponentTransferElement::parseAttribute): 239 * svg/SVGFEComponentTransferElement.h: 240 * svg/SVGFECompositeElement.cpp: 241 (WebCore::SVGFECompositeElement::SVGFECompositeElement): 242 (WebCore::SVGFECompositeElement::registerAttributes): 243 (WebCore::SVGFECompositeElement::parseAttribute): 244 * svg/SVGFECompositeElement.h: 245 * svg/SVGFEConvolveMatrixElement.cpp: 246 (WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement): 247 (WebCore::SVGFEConvolveMatrixElement::registerAttributes): 248 (WebCore::SVGFEConvolveMatrixElement::parseAttribute): 249 (WebCore::SVGFEConvolveMatrixElement::setFilterEffectAttribute): 250 (WebCore::SVGFEConvolveMatrixElement::setOrder): 251 (WebCore::SVGFEConvolveMatrixElement::setKernelUnitLength): 252 * svg/SVGFEConvolveMatrixElement.h: 253 (WebCore::SVGPropertyTraits<EdgeModeType>::initialValue): 254 * svg/SVGFEDiffuseLightingElement.cpp: 255 (WebCore::SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement): 256 (WebCore::SVGFEDiffuseLightingElement::registerAttributes): 257 (WebCore::SVGFEDiffuseLightingElement::parseAttribute): 258 * svg/SVGFEDiffuseLightingElement.h: 259 * svg/SVGFEDisplacementMapElement.cpp: 260 (WebCore::SVGFEDisplacementMapElement::SVGFEDisplacementMapElement): 261 (WebCore::SVGFEDisplacementMapElement::registerAttributes): 262 (WebCore::SVGFEDisplacementMapElement::parseAttribute): 263 * svg/SVGFEDisplacementMapElement.h: 264 * svg/SVGFEDropShadowElement.cpp: 265 (WebCore::SVGFEDropShadowElement::SVGFEDropShadowElement): 266 (WebCore::SVGFEDropShadowElement::setStdDeviation): 267 (WebCore::SVGFEDropShadowElement::registerAttributes): 268 (WebCore::SVGFEDropShadowElement::parseAttribute): 269 (WebCore::SVGFEDropShadowElement::svgAttributeChanged): 270 * svg/SVGFEDropShadowElement.h: 271 * svg/SVGFEGaussianBlurElement.cpp: 272 (WebCore::SVGFEGaussianBlurElement::SVGFEGaussianBlurElement): 273 (WebCore::SVGFEGaussianBlurElement::setStdDeviation): 274 (WebCore::SVGFEGaussianBlurElement::registerAttributes): 275 (WebCore::SVGFEGaussianBlurElement::parseAttribute): 276 (WebCore::SVGFEGaussianBlurElement::svgAttributeChanged): 277 * svg/SVGFEGaussianBlurElement.h: 278 * svg/SVGFEImageElement.cpp: 279 (WebCore::SVGFEImageElement::SVGFEImageElement): 280 (WebCore::SVGFEImageElement::registerAttributes): 281 (WebCore::SVGFEImageElement::parseAttribute): 282 * svg/SVGFEImageElement.h: 283 * svg/SVGFELightElement.cpp: 284 (WebCore::SVGFELightElement::SVGFELightElement): 285 (WebCore::SVGFELightElement::registerAttributes): 286 (WebCore::SVGFELightElement::parseAttribute): 287 (WebCore::SVGFELightElement::svgAttributeChanged): 288 * svg/SVGFELightElement.h: 289 (WebCore::SVGFELightElement::azimuth const): 290 (WebCore::SVGFELightElement::elevation const): 291 (WebCore::SVGFELightElement::x const): 292 (WebCore::SVGFELightElement::y const): 293 (WebCore::SVGFELightElement::z const): 294 (WebCore::SVGFELightElement::pointsAtX const): 295 (WebCore::SVGFELightElement::pointsAtY const): 296 (WebCore::SVGFELightElement::pointsAtZ const): 297 (WebCore::SVGFELightElement::specularExponent const): 298 (WebCore::SVGFELightElement::limitingConeAngle const): 299 (WebCore::SVGFELightElement::azimuthAnimated): 300 (WebCore::SVGFELightElement::elevationAnimated): 301 (WebCore::SVGFELightElement::xAnimated): 302 (WebCore::SVGFELightElement::yAnimated): 303 (WebCore::SVGFELightElement::zAnimated): 304 (WebCore::SVGFELightElement::pointsAtXAnimated): 305 (WebCore::SVGFELightElement::pointsAtYAnimated): 306 (WebCore::SVGFELightElement::pointsAtZAnimated): 307 (WebCore::SVGFELightElement::specularExponentAnimated): 308 (WebCore::SVGFELightElement::limitingConeAngleAnimated): 309 (WebCore::SVGFELightElement::attributeRegistry): 310 (WebCore::SVGFELightElement::isKnownAttribute): 311 * svg/SVGFEMergeNodeElement.cpp: 312 (WebCore::SVGFEMergeNodeElement::SVGFEMergeNodeElement): 313 (WebCore::SVGFEMergeNodeElement::registerAttributes): 314 (WebCore::SVGFEMergeNodeElement::parseAttribute): 315 * svg/SVGFEMergeNodeElement.h: 316 * svg/SVGFEMorphologyElement.cpp: 317 (WebCore::SVGFEMorphologyElement::SVGFEMorphologyElement): 318 (WebCore::SVGFEMorphologyElement::setRadius): 319 (WebCore::SVGFEMorphologyElement::registerAttributes): 320 (WebCore::SVGFEMorphologyElement::parseAttribute): 321 * svg/SVGFEMorphologyElement.h: 322 * svg/SVGFEOffsetElement.cpp: 323 (WebCore::SVGFEOffsetElement::SVGFEOffsetElement): 324 (WebCore::SVGFEOffsetElement::registerAttributes): 325 (WebCore::SVGFEOffsetElement::parseAttribute): 326 (WebCore::SVGFEOffsetElement::svgAttributeChanged): 327 * svg/SVGFEOffsetElement.h: 328 * svg/SVGFESpecularLightingElement.cpp: 329 (WebCore::SVGFESpecularLightingElement::SVGFESpecularLightingElement): 330 (WebCore::SVGFESpecularLightingElement::registerAttributes): 331 (WebCore::SVGFESpecularLightingElement::parseAttribute): 332 * svg/SVGFESpecularLightingElement.h: 333 * svg/SVGFETileElement.cpp: 334 (WebCore::SVGFETileElement::SVGFETileElement): 335 (WebCore::SVGFETileElement::registerAttributes): 336 (WebCore::SVGFETileElement::parseAttribute): 337 * svg/SVGFETileElement.h: 338 * svg/SVGFETurbulenceElement.cpp: 339 (WebCore::SVGFETurbulenceElement::SVGFETurbulenceElement): 340 (WebCore::SVGFETurbulenceElement::registerAttributes): 341 (WebCore::SVGFETurbulenceElement::parseAttribute): 342 (WebCore::SVGFETurbulenceElement::setFilterEffectAttribute): 343 (WebCore::SVGFETurbulenceElement::svgAttributeChanged): 344 * svg/SVGFETurbulenceElement.h: 345 * svg/SVGFilterElement.cpp: 346 (WebCore::SVGFilterElement::SVGFilterElement): 347 (WebCore::SVGFilterElement::setFilterRes): 348 (WebCore::SVGFilterElement::registerAttributes): 349 (WebCore::SVGFilterElement::parseAttribute): 350 (WebCore::SVGFilterElement::svgAttributeChanged): 351 (WebCore::SVGFilterElement::isSupportedAttribute): Deleted. 352 * svg/SVGFilterElement.h: 353 * svg/SVGFilterPrimitiveStandardAttributes.cpp: 354 (WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes): 355 (WebCore::SVGFilterPrimitiveStandardAttributes::registerAttributes): 356 (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute): 357 (WebCore::SVGFilterPrimitiveStandardAttributes::svgAttributeChanged): 358 (WebCore::SVGFilterPrimitiveStandardAttributes::isSupportedAttribute): Deleted. 359 * svg/SVGFilterPrimitiveStandardAttributes.h: 360 (WebCore::SVGFilterPrimitiveStandardAttributes::attributeRegistry): 361 (WebCore::SVGFilterPrimitiveStandardAttributes::x const): 362 (WebCore::SVGFilterPrimitiveStandardAttributes::y const): 363 (WebCore::SVGFilterPrimitiveStandardAttributes::width const): 364 (WebCore::SVGFilterPrimitiveStandardAttributes::height const): 365 (WebCore::SVGFilterPrimitiveStandardAttributes::result const): 366 (WebCore::SVGFilterPrimitiveStandardAttributes::xAnimated): 367 (WebCore::SVGFilterPrimitiveStandardAttributes::yAnimated): 368 (WebCore::SVGFilterPrimitiveStandardAttributes::widthAnimated): 369 (WebCore::SVGFilterPrimitiveStandardAttributes::heightAnimated): 370 (WebCore::SVGFilterPrimitiveStandardAttributes::resultAnimated): 371 (WebCore::SVGFilterPrimitiveStandardAttributes::isKnownAttribute): 372 * svg/SVGFitToViewBox.cpp: 373 (WebCore::SVGFitToViewBox::SVGFitToViewBox): 374 (WebCore::SVGFitToViewBox::registerAttributes): 375 (WebCore::SVGFitToViewBox::setViewBox): 376 (WebCore::SVGFitToViewBox::resetViewBox): 377 (WebCore::SVGFitToViewBox::reset): 378 (WebCore::SVGFitToViewBox::parseAttribute): 379 (WebCore::SVGFitToViewBox::parseViewBox): 380 (WebCore::SVGFitToViewBox::isKnownAttribute): Deleted. 381 (WebCore::SVGFitToViewBox::addSupportedAttributes): Deleted. 382 * svg/SVGFitToViewBox.h: 383 (WebCore::SVGFitToViewBox::attributeRegistry): 384 (WebCore::SVGFitToViewBox::viewBox const): 385 (WebCore::SVGFitToViewBox::preserveAspectRatio const): 386 (WebCore::SVGFitToViewBox::viewBoxAnimated): 387 (WebCore::SVGFitToViewBox::preserveAspectRatioAnimated): 388 (WebCore::SVGFitToViewBox::setPreserveAspectRatio): 389 (WebCore::SVGFitToViewBox::resetPreserveAspectRatio): 390 (WebCore::SVGFitToViewBox::viewBoxString const): 391 (WebCore::SVGFitToViewBox::preserveAspectRatioString const): 392 (WebCore::SVGFitToViewBox::hasValidViewBox const): 393 (WebCore::SVGFitToViewBox::hasEmptyViewBox const): 394 (WebCore::SVGFitToViewBox::isKnownAttribute): 395 (WebCore::SVGFitToViewBox::parseAttribute): Deleted. 396 * svg/SVGFontElement.cpp: 397 (WebCore::SVGFontElement::SVGFontElement): 398 * svg/SVGFontElement.h: 399 * svg/SVGForeignObjectElement.cpp: 400 (WebCore::SVGForeignObjectElement::SVGForeignObjectElement): 401 (WebCore::SVGForeignObjectElement::registerAttributes): 402 (WebCore::SVGForeignObjectElement::parseAttribute): 403 (WebCore::SVGForeignObjectElement::svgAttributeChanged): 404 (WebCore::SVGForeignObjectElement::isSupportedAttribute): Deleted. 405 * svg/SVGForeignObjectElement.h: 406 * svg/SVGGElement.cpp: 407 (WebCore::SVGGElement::SVGGElement): 408 (WebCore::SVGGElement::svgAttributeChanged): 409 (WebCore::SVGGElement::isSupportedAttribute): Deleted. 410 * svg/SVGGElement.h: 411 * svg/SVGGeometryElement.cpp: 412 (WebCore::SVGGeometryElement::SVGGeometryElement): 413 (WebCore::SVGGeometryElement::registerAttributes): 414 (WebCore::SVGGeometryElement::parseAttribute): 415 (WebCore::SVGGeometryElement::svgAttributeChanged): 416 (WebCore::SVGGeometryElement::isSupportedAttribute): Deleted. 417 * svg/SVGGeometryElement.h: 418 (WebCore::SVGGeometryElement::attributeRegistry): 419 (WebCore::SVGGeometryElement::pathLengthAnimated): 420 (WebCore::SVGGeometryElement::isKnownAttribute): 421 * svg/SVGGlyphRefElement.cpp: 422 (WebCore::SVGGlyphRefElement::SVGGlyphRefElement): 423 * svg/SVGGlyphRefElement.h: 424 * svg/SVGGradientElement.cpp: 425 (WebCore::SVGGradientElement::SVGGradientElement): 426 (WebCore::SVGGradientElement::registerAttributes): 427 (WebCore::SVGGradientElement::parseAttribute): 428 (WebCore::SVGGradientElement::svgAttributeChanged): 429 (WebCore::SVGGradientElement::isSupportedAttribute): Deleted. 430 * svg/SVGGradientElement.h: 431 (WebCore::SVGGradientElement::attributeRegistry): 432 (WebCore::SVGGradientElement::spreadMethod const): 433 (WebCore::SVGGradientElement::gradientUnits const): 434 (WebCore::SVGGradientElement::gradientTransform const): 435 (WebCore::SVGGradientElement::spreadMethodAnimated): 436 (WebCore::SVGGradientElement::gradientUnitsAnimated): 437 (WebCore::SVGGradientElement::gradientTransformAnimated): 438 (WebCore::SVGGradientElement::isKnownAttribute): 439 * svg/SVGGraphicsElement.cpp: 440 (WebCore::SVGGraphicsElement::SVGGraphicsElement): 441 (WebCore::SVGGraphicsElement::registerAttributes): 442 (WebCore::SVGGraphicsElement::parseAttribute): 443 (WebCore::SVGGraphicsElement::svgAttributeChanged): 444 (WebCore::SVGGraphicsElement::isSupportedAttribute): Deleted. 445 (WebCore::SVGGraphicsElement::requiredFeatures): Deleted. 446 (WebCore::SVGGraphicsElement::requiredExtensions): Deleted. 447 (WebCore::SVGGraphicsElement::systemLanguage): Deleted. 448 * svg/SVGGraphicsElement.h: 449 (WebCore::SVGGraphicsElement::attributeRegistry): 450 (WebCore::SVGGraphicsElement::transform const): 451 (WebCore::SVGGraphicsElement::transformAnimated): 452 (WebCore::SVGGraphicsElement::isKnownAttribute): 453 * svg/SVGImageElement.cpp: 454 (WebCore::SVGImageElement::SVGImageElement): 455 (WebCore::SVGImageElement::registerAttributes): 456 (WebCore::SVGImageElement::parseAttribute): 457 (WebCore::SVGImageElement::svgAttributeChanged): 458 (WebCore::SVGImageElement::haveLoadedRequiredResources): 459 (WebCore::SVGImageElement::isSupportedAttribute): Deleted. 460 * svg/SVGImageElement.h: 461 * svg/SVGImageLoader.cpp: 462 (WebCore::SVGImageLoader::dispatchLoadEvent): 463 * svg/SVGLangSpace.cpp: 464 (WebCore::SVGLangSpace::SVGLangSpace): 465 (WebCore::SVGLangSpace::registerAttributes): 466 (WebCore::SVGLangSpace::xmlspace const): 467 (WebCore::SVGLangSpace::svgAttributeChanged): 468 (WebCore::SVGLangSpace::setXmllang): Deleted. 469 (WebCore::SVGLangSpace::setXmlspace): Deleted. 470 (WebCore::SVGLangSpace::isKnownAttribute): Deleted. 471 (WebCore::addWithAndWithoutXMLPrefix): Deleted. 472 (WebCore::SVGLangSpace::addSupportedAttributes): Deleted. 473 * svg/SVGLangSpace.h: 474 (WebCore::SVGLangSpace::xmllang const): 475 (WebCore::SVGLangSpace::setXmllang): 476 (WebCore::SVGLangSpace::setXmlspace): 477 (WebCore::SVGLangSpace::attributeRegistry): 478 (WebCore::SVGLangSpace::isKnownAttribute): 479 * svg/SVGLineElement.cpp: 480 (WebCore::SVGLineElement::SVGLineElement): 481 (WebCore::SVGLineElement::registerAttributes): 482 (WebCore::SVGLineElement::parseAttribute): 483 (WebCore::SVGLineElement::svgAttributeChanged): 484 (WebCore::SVGLineElement::isSupportedAttribute): Deleted. 485 * svg/SVGLineElement.h: 486 * svg/SVGLinearGradientElement.cpp: 487 (WebCore::SVGLinearGradientElement::SVGLinearGradientElement): 488 (WebCore::SVGLinearGradientElement::registerAttributes): 489 (WebCore::SVGLinearGradientElement::parseAttribute): 490 (WebCore::SVGLinearGradientElement::svgAttributeChanged): 491 (WebCore::SVGLinearGradientElement::isSupportedAttribute): Deleted. 492 * svg/SVGLinearGradientElement.h: 493 * svg/SVGMPathElement.cpp: 494 (WebCore::SVGMPathElement::SVGMPathElement): 495 (WebCore::SVGMPathElement::svgAttributeChanged): 496 * svg/SVGMPathElement.h: 497 * svg/SVGMarkerElement.cpp: 498 (WebCore::SVGMarkerElement::SVGMarkerElement): 499 (WebCore::SVGMarkerElement::registerAttributes): 500 (WebCore::SVGMarkerElement::parseAttribute): 501 (WebCore::SVGMarkerElement::svgAttributeChanged): 502 (WebCore::SVGMarkerElement::setOrient): 503 (WebCore::SVGMarkerElement::orientTypePropertyInfo): Deleted. 504 (WebCore::SVGMarkerElement::isSupportedAttribute): Deleted. 505 (WebCore::SVGMarkerElement::synchronizeOrientType): Deleted. 506 (WebCore::SVGMarkerElement::lookupOrCreateOrientTypeWrapper): Deleted. 507 (WebCore::SVGMarkerElement::orientType const): Deleted. 508 (WebCore::SVGMarkerElement::orientTypeAnimated): Deleted. 509 * svg/SVGMarkerElement.h: 510 * svg/SVGMaskElement.cpp: 511 (WebCore::SVGMaskElement::SVGMaskElement): 512 (WebCore::SVGMaskElement::registerAttributes): 513 (WebCore::SVGMaskElement::parseAttribute): 514 (WebCore::SVGMaskElement::svgAttributeChanged): 515 (WebCore::SVGMaskElement::isSupportedAttribute): Deleted. 516 (WebCore::SVGMaskElement::requiredFeatures): Deleted. 517 (WebCore::SVGMaskElement::requiredExtensions): Deleted. 518 (WebCore::SVGMaskElement::systemLanguage): Deleted. 519 * svg/SVGMaskElement.h: 520 * svg/SVGPathElement.cpp: 521 (WebCore::SVGPathElement::SVGPathElement): 522 (WebCore::SVGPathElement::registerAttributes): 523 (WebCore::SVGPathElement::parseAttribute): 524 (WebCore::SVGPathElement::svgAttributeChanged): 525 (WebCore::SVGPathElement::pathByteStream const): 526 (WebCore::SVGPathElement::lookupOrCreateDWrapper): 527 (WebCore::SVGPathElement::animatedPropertyWillBeDeleted): 528 (WebCore::SVGPathElement::pathSegList): 529 (WebCore::SVGPathElement::animatedPathSegList): 530 (WebCore::SVGPathElement::pathSegListChanged): 531 (WebCore::SVGPathElement::dPropertyInfo): Deleted. 532 (WebCore::SVGPathElement::isSupportedAttribute): Deleted. 533 (WebCore::SVGPathElement::synchronizeD): Deleted. 534 * svg/SVGPathElement.h: 535 * svg/SVGPathSegListValues.h: 536 (WebCore::SVGPropertyTraits<SVGPathSegListValues>::toString): 537 * svg/SVGPathSegWithContext.h: 538 (WebCore::SVGPathSegWithContext::animatedProperty const): 539 * svg/SVGPatternElement.cpp: 540 (WebCore::SVGPatternElement::SVGPatternElement): 541 (WebCore::SVGPatternElement::registerAttributes): 542 (WebCore::SVGPatternElement::parseAttribute): 543 (WebCore::SVGPatternElement::svgAttributeChanged): 544 (WebCore::SVGPatternElement::collectPatternAttributes const): 545 (WebCore::SVGPatternElement::isSupportedAttribute): Deleted. 546 (WebCore::SVGPatternElement::requiredFeatures): Deleted. 547 (WebCore::SVGPatternElement::requiredExtensions): Deleted. 548 (WebCore::SVGPatternElement::systemLanguage): Deleted. 549 * svg/SVGPatternElement.h: 550 * svg/SVGPointListValues.h: 551 (WebCore::SVGPropertyTraits<SVGPointListValues>::toString): 552 * svg/SVGPolyElement.cpp: 553 (WebCore::SVGPolyElement::SVGPolyElement): 554 (WebCore::SVGPolyElement::registerAttributes): 555 (WebCore::SVGPolyElement::parseAttribute): 556 (WebCore::SVGPolyElement::svgAttributeChanged): 557 (WebCore::SVGPolyElement::points): 558 (WebCore::SVGPolyElement::animatedPoints): 559 (WebCore::SVGPolyElement::pointsPropertyInfo): Deleted. 560 (WebCore::SVGPolyElement::synchronizePoints): Deleted. 561 (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper): Deleted. 562 * svg/SVGPolyElement.h: 563 (WebCore::SVGPolyElement::pointList const): 564 (WebCore::SVGPolyElement::attributeRegistry): 565 (WebCore::SVGPolyElement::isKnownAttribute): 566 * svg/SVGPreserveAspectRatioValue.cpp: 567 (WebCore::SVGPreserveAspectRatioValue::transformRect const): 568 (WebCore::SVGPreserveAspectRatioValue::transformRect): Deleted. 569 * svg/SVGPreserveAspectRatioValue.h: 570 * svg/SVGRadialGradientElement.cpp: 571 (WebCore::SVGRadialGradientElement::SVGRadialGradientElement): 572 (WebCore::SVGRadialGradientElement::registerAttributes): 573 (WebCore::SVGRadialGradientElement::parseAttribute): 574 (WebCore::SVGRadialGradientElement::svgAttributeChanged): 575 (WebCore::SVGRadialGradientElement::isSupportedAttribute): Deleted. 576 * svg/SVGRadialGradientElement.h: 577 * svg/SVGRectElement.cpp: 578 (WebCore::SVGRectElement::SVGRectElement): 579 (WebCore::SVGRectElement::registerAttributes): 580 (WebCore::SVGRectElement::parseAttribute): 581 (WebCore::SVGRectElement::svgAttributeChanged): 582 * svg/SVGRectElement.h: 583 * svg/SVGSVGElement.cpp: 584 (WebCore::SVGSVGElement::SVGSVGElement): 585 (WebCore::SVGSVGElement::registerAttributes): 586 (WebCore::SVGSVGElement::parseAttribute): 587 (WebCore::SVGSVGElement::svgAttributeChanged): 588 (WebCore::SVGSVGElement::viewBoxToViewTransform const): 589 (WebCore::SVGSVGElement::resetScrollAnchor): 590 (WebCore::SVGSVGElement::inheritViewAttributes): 591 * svg/SVGSVGElement.h: 592 (WebCore::SVGSVGElement::useCurrentView const): Deleted. 593 (WebCore::SVGSVGElement::currentTranslateValue): Deleted. 594 (WebCore::SVGSVGElement::zoomAndPan const): Deleted. 595 (WebCore::SVGSVGElement::setZoomAndPan): Deleted. 596 (WebCore::SVGSVGElement::timeContainer): Deleted. 597 (WebCore::SVGSVGElement::hasEmptyViewBox const): Deleted. 598 * svg/SVGScriptElement.cpp: 599 (WebCore::SVGScriptElement::SVGScriptElement): 600 (WebCore::SVGScriptElement::svgAttributeChanged): 601 (WebCore::SVGScriptElement::insertedIntoAncestor): 602 (WebCore::SVGScriptElement::addSubresourceAttributeURLs const): 603 (WebCore::SVGScriptElement::isURLAttribute const): Deleted. 604 (WebCore::SVGScriptElement::sourceAttributeValue const): Deleted. 605 (WebCore::SVGScriptElement::charsetAttributeValue const): Deleted. 606 (WebCore::SVGScriptElement::typeAttributeValue const): Deleted. 607 (WebCore::SVGScriptElement::languageAttributeValue const): Deleted. 608 (WebCore::SVGScriptElement::forAttributeValue const): Deleted. 609 (WebCore::SVGScriptElement::eventAttributeValue const): Deleted. 610 (WebCore::SVGScriptElement::hasAsyncAttribute const): Deleted. 611 (WebCore::SVGScriptElement::hasDeferAttribute const): Deleted. 612 (WebCore::SVGScriptElement::hasNoModuleAttribute const): Deleted. 613 (WebCore::SVGScriptElement::hasSourceAttribute const): Deleted. 614 (WebCore::SVGScriptElement::filterOutAnimatableAttribute const): Deleted. 615 * svg/SVGScriptElement.h: 616 * svg/SVGStopElement.cpp: 617 (WebCore::SVGStopElement::SVGStopElement): 618 (WebCore::SVGStopElement::registerAttributes): 619 (WebCore::SVGStopElement::parseAttribute): 620 * svg/SVGStopElement.h: 621 * svg/SVGStringListValues.h: 622 (WebCore::SVGPropertyTraits<SVGStringListValues>::toString): 623 * svg/SVGSwitchElement.cpp: 624 (WebCore::SVGSwitchElement::SVGSwitchElement): 625 * svg/SVGSwitchElement.h: 626 * svg/SVGSymbolElement.cpp: 627 (WebCore::SVGSymbolElement::SVGSymbolElement): 628 (WebCore::SVGSymbolElement::parseAttribute): 629 (WebCore::SVGSymbolElement::svgAttributeChanged): 630 * svg/SVGSymbolElement.h: 631 * svg/SVGTRefElement.cpp: 632 (WebCore::SVGTRefElement::SVGTRefElement): 633 * svg/SVGTRefElement.h: 634 * svg/SVGTests.cpp: 635 (WebCore::SVGTests::SVGTests): 636 (WebCore::SVGTests::registerAttributes): 637 (WebCore::SVGTests::attributeRegistry): 638 (WebCore::SVGTests::isKnownAttribute): 639 (WebCore::SVGTests::isValid const): 640 (WebCore::SVGTests::parseAttribute): 641 (WebCore::SVGTests::svgAttributeChanged): 642 (WebCore::SVGTests::requiredFeatures): 643 (WebCore::SVGTests::requiredExtensions): 644 (WebCore::SVGTests::systemLanguage): 645 (WebCore::createSVGTestPropertyInfo): Deleted. 646 (WebCore::createSVGTextAttributeToPropertyMap): Deleted. 647 (WebCore::SVGTests::attributeToPropertyMap): Deleted. 648 (WebCore::SVGTests::handleAttributeChange): Deleted. 649 (WebCore::SVGTests::synchronizeAttribute): Deleted. 650 (WebCore::SVGTests::synchronizeRequiredFeatures): Deleted. 651 (WebCore::SVGTests::synchronizeRequiredExtensions): Deleted. 652 (WebCore::SVGTests::synchronizeSystemLanguage): Deleted. 653 * svg/SVGTests.h: 654 * svg/SVGTextContentElement.cpp: 655 (WebCore::SVGTextContentElement::SVGTextContentElement): 656 (WebCore::SVGTextContentElement::registerAttributes): 657 (WebCore::SVGTextContentElement::parseAttribute): 658 (WebCore::SVGTextContentElement::svgAttributeChanged): 659 (WebCore::SVGTextContentElement::textLengthPropertyInfo): Deleted. 660 (WebCore::SVGTextContentElement::synchronizeTextLength): Deleted. 661 (WebCore::SVGTextContentElement::lookupOrCreateTextLengthWrapper): Deleted. 662 (WebCore::SVGTextContentElement::textLengthAnimated): Deleted. 663 (WebCore::SVGTextContentElement::isSupportedAttribute): Deleted. 664 * svg/SVGTextContentElement.h: 665 (WebCore::SVGTextContentElement::specifiedTextLength): 666 (WebCore::SVGTextContentElement::attributeRegistry): 667 (WebCore::SVGTextContentElement::textLength const): 668 (WebCore::SVGTextContentElement::lengthAdjust const): 669 (WebCore::SVGTextContentElement::textLengthAnimated): 670 (WebCore::SVGTextContentElement::lengthAdjustAnimated): 671 (WebCore::SVGTextContentElement::isKnownAttribute): 672 (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::SVGAnimatedCustomLengthAttribute): 673 (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::synchronize): 674 (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::animatedProperty): 675 * svg/SVGTextPathElement.cpp: 676 (WebCore::SVGTextPathElement::SVGTextPathElement): 677 (WebCore::SVGTextPathElement::registerAttributes): 678 (WebCore::SVGTextPathElement::parseAttribute): 679 (WebCore::SVGTextPathElement::svgAttributeChanged): 680 (WebCore::SVGTextPathElement::isSupportedAttribute): Deleted. 681 * svg/SVGTextPathElement.h: 682 * svg/SVGTextPositioningElement.cpp: 683 (WebCore::SVGTextPositioningElement::SVGTextPositioningElement): 684 (WebCore::SVGTextPositioningElement::registerAttributes): 685 (WebCore::SVGTextPositioningElement::parseAttribute): 686 (WebCore::SVGTextPositioningElement::svgAttributeChanged): 687 * svg/SVGTextPositioningElement.h: 688 (WebCore::SVGTextPositioningElement::attributeRegistry): 689 (WebCore::SVGTextPositioningElement::x const): 690 (WebCore::SVGTextPositioningElement::y const): 691 (WebCore::SVGTextPositioningElement::dx const): 692 (WebCore::SVGTextPositioningElement::dy const): 693 (WebCore::SVGTextPositioningElement::rotate const): 694 (WebCore::SVGTextPositioningElement::xAnimated): 695 (WebCore::SVGTextPositioningElement::yAnimated): 696 (WebCore::SVGTextPositioningElement::dxAnimated): 697 (WebCore::SVGTextPositioningElement::dyAnimated): 698 (WebCore::SVGTextPositioningElement::rotateAnimated): 699 (WebCore::SVGTextPositioningElement::isKnownAttribute): 700 * svg/SVGURIReference.cpp: 701 (WebCore::SVGURIReference::SVGURIReference): 702 (WebCore::SVGURIReference::registerAttributes): 703 (WebCore::SVGURIReference::attributeRegistry): 704 (WebCore::SVGURIReference::isKnownAttribute): 705 (WebCore::SVGURIReference::parseAttribute): 706 (WebCore::SVGURIReference::href const): 707 (WebCore::SVGURIReference::hrefAnimated): 708 (WebCore::SVGURIReference::addSupportedAttributes): Deleted. 709 * svg/SVGURIReference.h: 710 * svg/SVGUseElement.cpp: 711 (WebCore::SVGUseElement::SVGUseElement): 712 (WebCore::SVGUseElement::registerAttributes): 713 (WebCore::SVGUseElement::parseAttribute): 714 (WebCore::SVGUseElement::insertedIntoAncestor): 715 (WebCore::SVGUseElement::transferSizeAttributesToTargetClone const): 716 (WebCore::SVGUseElement::svgAttributeChanged): 717 (WebCore::SVGUseElement::notifyFinished): 718 * svg/SVGUseElement.h: 719 * svg/SVGValue.h: 720 * svg/SVGViewElement.cpp: 721 (WebCore::SVGViewElement::SVGViewElement): 722 (WebCore::SVGViewElement::parseAttribute): 723 * svg/SVGViewElement.h: 724 * svg/SVGViewSpec.cpp: 725 (WebCore::SVGViewSpec::SVGViewSpec): 726 (WebCore::SVGViewSpec::registerAttributes): 727 (WebCore::SVGViewSpec::transform): 728 (WebCore::SVGViewSpec::reset): 729 (WebCore::SVGViewSpec::parseViewSpec): 730 (WebCore::SVGViewSpec::viewBoxPropertyInfo): Deleted. 731 (WebCore::SVGViewSpec::preserveAspectRatioPropertyInfo): Deleted. 732 (WebCore::SVGViewSpec::transformPropertyInfo): Deleted. 733 (WebCore::SVGViewSpec::viewBoxIdentifier): Deleted. 734 (WebCore::SVGViewSpec::preserveAspectRatioIdentifier): Deleted. 735 (WebCore::SVGViewSpec::transformIdentifier): Deleted. 736 (WebCore::SVGViewSpec::setZoomAndPan): Deleted. 737 (WebCore::SVGViewSpec::transformString const): Deleted. 738 (WebCore::SVGViewSpec::viewBoxString const): Deleted. 739 (WebCore::SVGViewSpec::preserveAspectRatioString const): Deleted. 740 (WebCore::SVGViewSpec::viewBoxAnimated): Deleted. 741 (WebCore::SVGViewSpec::preserveAspectRatioAnimated): Deleted. 742 (WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): Deleted. 743 (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper): Deleted. 744 (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): Deleted. 745 * svg/SVGViewSpec.h: 746 * svg/SVGViewSpec.idl: 747 * svg/SVGZoomAndPan.cpp: 748 (WebCore::SVGZoomAndPan::SVGZoomAndPan): 749 (WebCore::SVGZoomAndPan::registerAttributes): 750 (WebCore::SVGZoomAndPan::parseZoomAndPan): 751 (WebCore::SVGZoomAndPan::parseAttribute): 752 (WebCore::SVGZoomAndPan::parse): Deleted. 753 (WebCore::SVGZoomAndPan::parseAttributeValue): Deleted. 754 * svg/SVGZoomAndPan.h: 755 (WebCore::SVGZoomAndPan::zoomAndPan const): 756 (WebCore::SVGZoomAndPan::setZoomAndPan): 757 (WebCore::SVGZoomAndPan::reset): 758 (WebCore::SVGZoomAndPan::attributeRegistry): 759 (WebCore::SVGZoomAndPan::isKnownAttribute): 760 (WebCore::SVGZoomAndPan::parseFromNumber): Deleted. 761 (WebCore::SVGZoomAndPan::parseAttribute): Deleted. 762 * svg/SVGZoomAndPanType.h: Copied from Source/WebCore/svg/SVGValue.h. 763 (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::initialValue): 764 (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::toString): 765 (WebCore::SVGPropertyTraits<SVGZoomAndPanType>::fromString): 766 * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h: 767 * svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp: Copied from Source/WebCore/svg/SVGValue.h. 768 (WebCore::SVGAnimatedPathSegListPropertyTearOff::SVGAnimatedPathSegListPropertyTearOff): 769 (WebCore::SVGAnimatedPathSegListPropertyTearOff::~SVGAnimatedPathSegListPropertyTearOff): 770 (WebCore::SVGAnimatedPathSegListPropertyTearOff::animValDidChange): 771 * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h: 772 * svg/properties/SVGAnimatedProperty.cpp: 773 (WebCore::SVGAnimatedProperty::SVGAnimatedProperty): 774 (WebCore::SVGAnimatedProperty::~SVGAnimatedProperty): 775 (WebCore::SVGAnimatedProperty::animatedPropertyCache): Deleted. 776 * svg/properties/SVGAnimatedProperty.h: 777 (WebCore::SVGAnimatedProperty::isAnimating const): 778 (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const): 779 (WebCore::SVGAnimatedProperty::lookupOrCreateAnimatedProperty): 780 (WebCore::SVGAnimatedProperty::lookupAnimatedProperty): 781 (WebCore::SVGAnimatedProperty::animatedPropertyCache): 782 (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper): Deleted. 783 (WebCore::SVGAnimatedProperty::lookupWrapper): Deleted. 784 * svg/properties/SVGAnimatedPropertyMacros.h: Removed. 785 * svg/properties/SVGAnimatedPropertyType.h: Copied from Source/WebCore/svg/SVGAElement.idl. 786 * svg/properties/SVGAttribute.h: Added. 787 (WebCore::SVGPropertyAttribute::SVGPropertyAttribute): 788 (WebCore::SVGPropertyAttribute::value): 789 (WebCore::SVGPropertyAttribute::value const): 790 (WebCore::SVGPropertyAttribute::setValue): 791 (WebCore::SVGPropertyAttribute::resetValue): 792 (WebCore::SVGPropertyAttribute::toString const): 793 (WebCore::SVGPropertyAttribute::setShouldSynchronize): 794 (WebCore::SVGPropertyAttribute::shouldSynchronize const): 795 (WebCore::SVGPropertyAttribute::synchronize): 796 (WebCore::SVGAnimatedAttribute::SVGAnimatedAttribute): 797 (WebCore::SVGAnimatedAttribute::currentValue const): 798 (WebCore::SVGAnimatedAttribute::animatedProperty): 799 (WebCore::SVGAnimatedAttributeList::SVGAnimatedAttributeList): 800 (WebCore::SVGAnimatedAttributeList::detachAnimatedListWrappers): 801 * svg/properties/SVGAttributeAccessor.h: Added. 802 (WebCore::SVGAttributeAccessor::SVGAttributeAccessor): 803 (WebCore::SVGAttributeAccessor::attributeName const): 804 (WebCore::SVGAttributeAccessor::isAnimatedLengthAttribute const): 805 (WebCore::SVGAttributeAccessor::animatedType const): 806 (WebCore::SVGAttributeAccessor::animatedTypes const): 807 (WebCore::SVGAttributeAccessor::lookupOrCreateAnimatedProperty const): 808 (WebCore::SVGAttributeAccessor::lookupAnimatedProperty const): 809 (WebCore::SVGAttributeAccessor::lookupOrCreateAnimatedProperties const): 810 (WebCore::SVGPropertyAttributeAccessor::singleton): 811 (WebCore::SVGPropertyAttributeAccessor::SVGPropertyAttributeAccessor): 812 (WebCore::SVGPropertyAttributeAccessor::attribute const): 813 (WebCore::SVGAnimatedAttributeAccessor::singleton): 814 (WebCore::SVGAnimatedAttributeAccessor::SVGAnimatedAttributeAccessor): 815 (WebCore::SVGAnimatedAttributeAccessor::lookupOrCreateAnimatedProperty): 816 (WebCore::SVGAnimatedAttributeAccessor::lookupAnimatedProperty): 817 (WebCore::SVGAnimatedPairAttributeAccessor::SVGAnimatedPairAttributeAccessor): 818 (WebCore::SVGAnimatedPairAttributeAccessor::secondAttribute const): 819 * svg/properties/SVGAttributeOwnerProxy.h: Copied from Source/WebCore/svg/SVGValue.h. 820 (WebCore::SVGAttributeOwnerProxy::SVGAttributeOwnerProxy): 821 (WebCore::SVGAttributeOwnerProxy::element const): 822 * svg/properties/SVGAttributeOwnerProxyImpl.h: Added. 823 (WebCore::SVGAttributeOwnerProxyImpl::SVGAttributeOwnerProxyImpl): 824 (WebCore::SVGAttributeOwnerProxyImpl::attributeRegistry): 825 (WebCore::SVGAttributeOwnerProxyImpl::isKnownAttribute): 826 (WebCore::SVGAttributeOwnerProxyImpl::isAnimatedLengthAttribute): 827 * svg/properties/SVGAttributeRegistry.h: Added. 828 (WebCore::SVGAttributeRegistry::registerAttribute): 829 (WebCore::SVGAttributeRegistry::isEmpty const): 830 (WebCore::SVGAttributeRegistry::isKnownAttribute const): 831 (WebCore::SVGAttributeRegistry::isAnimatedLengthAttribute const): 832 (WebCore::SVGAttributeRegistry::animatedTypes const): 833 (WebCore::SVGAttributeRegistry::synchronizeAttributes const): 834 (WebCore::SVGAttributeRegistry::synchronizeAttribute const): 835 (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedProperty const): 836 (WebCore::SVGAttributeRegistry::lookupAnimatedProperty const): 837 (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedProperties const): 838 (WebCore::SVGAttributeRegistry::animatedTypesBaseTypes): 839 (WebCore::SVGAttributeRegistry::synchronizeAttributesBaseTypes): 840 (WebCore::SVGAttributeRegistry::synchronizeAttributeBaseTypes): 841 (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedPropertyBaseTypes): 842 (WebCore::SVGAttributeRegistry::lookupAnimatedPropertyBaseTypes): 843 (WebCore::SVGAttributeRegistry::lookupOrCreateAnimatedPropertiesBaseTypes): 844 (WebCore::SVGAttributeRegistry::findAttributeAccessor const): 845 * svg/properties/SVGAttributeToPropertyMap.cpp: Removed. 846 * svg/properties/SVGAttributeToPropertyMap.h: Removed. 847 * svg/properties/SVGPropertyInfo.cpp: Removed. 848 * svg/properties/SVGPropertyInfo.h: Removed. 849 1 850 2018-08-06 Alex Christensen <achristensen@webkit.org> 2 851 -
trunk/Source/WebCore/Sources.txt
r234586 r234620 2275 2275 svg/graphics/filters/SVGFilterBuilder.cpp 2276 2276 2277 svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp 2277 2278 svg/properties/SVGAnimatedProperty.cpp 2278 svg/properties/SVGAttributeToPropertyMap.cpp2279 svg/properties/SVGPropertyInfo.cpp2280 2279 2281 2280 workers/AbstractWorker.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r234586 r234620 233 233 081668DA125603D5006F25DE /* SVGTextLayoutEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 081668D8125603D5006F25DE /* SVGTextLayoutEngine.h */; }; 234 234 081AA8DA1111237E002AB06E /* SVGElementRareData.h in Headers */ = {isa = PBXBuildFile; fileRef = 081AA8D91111237E002AB06E /* SVGElementRareData.h */; }; 235 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };236 235 081EBF3B0FD34F4100DA7559 /* SVGFilterBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */; }; 237 236 0823D159127AD6AC000EBC95 /* SVGAnimatedInteger.h in Headers */ = {isa = PBXBuildFile; fileRef = 0823D158127AD6AC000EBC95 /* SVGAnimatedInteger.h */; }; … … 265 264 0885068011DA045B00182B98 /* PaintPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0885067E11DA045B00182B98 /* PaintPhase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 266 265 088A0E04126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */; }; 267 088A0E05126EF1DB00978F7A /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };268 266 088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */; settings = {ATTRIBUTES = (Private, ); }; }; 269 088A0E07126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };270 267 088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */; }; 271 268 088A0E09126EF1DB00978F7A /* SVGListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */; }; … … 293 290 08F859D51463F9CD0067D933 /* SVGImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 08F859D31463F9CD0067D933 /* SVGImageCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 294 291 08F859D51463F9CD0067D934 /* SVGImageForContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 08F859D31463F9CD0067D934 /* SVGImageForContainer.h */; }; 295 08FB3F8413BC754C0099FC18 /* SVGAttributeToPropertyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */; settings = {ATTRIBUTES = (Private, ); }; };296 292 08FE0BC5127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FE0BC4127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h */; }; 297 293 0AFDAC3D10F5448C00E1F3D2 /* PluginViewBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AFDAC3C10F5448C00E1F3D2 /* PluginViewBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 1713 1709 53ED3FDF167A88E7006762E6 /* JSInternalSettingsGenerated.h in Headers */ = {isa = PBXBuildFile; fileRef = 53ED3FDD167A88E7006762E6 /* JSInternalSettingsGenerated.h */; }; 1714 1710 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1711 55346AF121150FAF0059BCDD /* SVGAttributeOwnerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1715 1712 5546757B1FD212A9003B10B0 /* ImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 554675781FD1FC1A003B10B0 /* ImageSource.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1716 1713 5550CB421E955E3C00111AA0 /* ImageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5550CB411E955E3C00111AA0 /* ImageTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 1722 1719 55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1723 1720 55EC9599206AA7A0007DD0A9 /* PaintFrequencyTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1721 55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1722 55FA7FF5210FB6B1005AEFE7 /* SVGAttributeAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1723 55FA7FF7210FBE3E005AEFE7 /* SVGAttributeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */; }; 1724 55FA7FFB2110ECD7005AEFE7 /* SVGZoomAndPanType.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1725 55FA7FFF21110E6E005AEFE7 /* SVGAnimatedPropertyType.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1726 55FA8001211113EE005AEFE7 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1724 1727 5704405A1E53936200356601 /* JSAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 570440591E53936200356601 /* JSAesCbcCfbParams.h */; }; 1725 1728 5706A6961DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */; }; … … 5452 5455 081668D8125603D5006F25DE /* SVGTextLayoutEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutEngine.h; sourceTree = "<group>"; }; 5453 5456 081AA8D91111237E002AB06E /* SVGElementRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGElementRareData.h; sourceTree = "<group>"; }; 5454 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyInfo.h; sourceTree = "<group>"; };5455 5457 081EBF380FD34F4100DA7559 /* SVGFilterBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFilterBuilder.cpp; sourceTree = "<group>"; }; 5456 5458 081EBF390FD34F4100DA7559 /* SVGFilterBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFilterBuilder.h; sourceTree = "<group>"; }; … … 5501 5503 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedProperty.h; sourceTree = "<group>"; }; 5502 5504 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyDescription.h; sourceTree = "<group>"; }; 5503 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyMacros.h; sourceTree = "<group>"; };5504 5505 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyTearOff.h; sourceTree = "<group>"; }; 5505 5506 088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGListPropertyTearOff.h; sourceTree = "<group>"; }; … … 5535 5536 08F859D31463F9CD0067D933 /* SVGImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageCache.h; sourceTree = "<group>"; }; 5536 5537 08F859D31463F9CD0067D934 /* SVGImageForContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageForContainer.h; sourceTree = "<group>"; }; 5537 08FB17C013BC7E9100040086 /* SVGAttributeToPropertyMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAttributeToPropertyMap.cpp; sourceTree = "<group>"; };5538 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeToPropertyMap.h; sourceTree = "<group>"; };5539 5538 08FE0BC4127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPreserveAspectRatio.h; sourceTree = "<group>"; }; 5540 5539 0AFDAC3C10F5448C00E1F3D2 /* PluginViewBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginViewBase.h; sourceTree = "<group>"; }; … … 8381 8380 55137B2C20379E550001004B /* SVGMarkerTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerTypes.h; sourceTree = "<group>"; }; 8382 8381 55137B34203CEB710001004B /* SVGValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGValue.h; sourceTree = "<group>"; }; 8382 55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeOwnerProxy.h; sourceTree = "<group>"; }; 8383 55346AFA2117FFAF0059BCDD /* SVGAttributeOwnerProxyImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeOwnerProxyImpl.h; sourceTree = "<group>"; }; 8383 8384 554675771FD1FC1A003B10B0 /* ImageSource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageSource.cpp; sourceTree = "<group>"; }; 8384 8385 554675781FD1FC1A003B10B0 /* ImageSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageSource.h; sourceTree = "<group>"; }; … … 8396 8397 55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; }; 8397 8398 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaintFrequencyTracker.h; sourceTree = "<group>"; }; 8399 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttribute.h; sourceTree = "<group>"; }; 8400 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeAccessor.h; sourceTree = "<group>"; }; 8401 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAttributeRegistry.h; sourceTree = "<group>"; }; 8402 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGZoomAndPanType.h; sourceTree = "<group>"; }; 8403 55FA7FFC2110F813005AEFE7 /* SVGAnimatedPathSegListPropertyTearOff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPathSegListPropertyTearOff.cpp; sourceTree = "<group>"; }; 8404 55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyType.h; sourceTree = "<group>"; }; 8398 8405 570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; }; 8399 8406 570440591E53936200356601 /* JSAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcCfbParams.h; sourceTree = "<group>"; }; … … 12545 12552 B5320D69122A24E9002D1440 /* FontPlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontPlatformData.h; sourceTree = "<group>"; }; 12546 12553 B5320D6A122A24E9002D1440 /* FontPlatformDataCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FontPlatformDataCocoa.mm; sourceTree = "<group>"; }; 12547 B543B85617EB758F003BE93A /* SVGPropertyInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPropertyInfo.cpp; sourceTree = "<group>"; };12548 12554 B562DB5E17D3CD560010AF96 /* HTMLElementTypeHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HTMLElementTypeHelpers.h; sourceTree = "<group>"; }; 12549 12555 B562DB5F17D3CD560010AF96 /* SVGElementTypeHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGElementTypeHelpers.h; sourceTree = "<group>"; }; … … 15461 15467 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */, 15462 15468 088A0DFB126EF1DB00978F7A /* SVGAnimatedListPropertyTearOff.h */, 15469 55FA7FFC2110F813005AEFE7 /* SVGAnimatedPathSegListPropertyTearOff.cpp */, 15463 15470 089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */, 15464 15471 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */, 15465 15472 088A0DFC126EF1DB00978F7A /* SVGAnimatedProperty.h */, 15466 15473 088A0DFD126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h */, 15467 088A0DFE126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h */,15468 15474 088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */, 15475 55FA7FFE21110E6E005AEFE7 /* SVGAnimatedPropertyType.h */, 15469 15476 08525E621278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h */, 15470 15477 085A15921289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h */, 15471 08FB17C013BC7E9100040086 /* SVGAttributeToPropertyMap.cpp */, 15472 08FB3F8313BC754C0099FC18 /* SVGAttributeToPropertyMap.h */, 15478 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */, 15479 55FA7FF4210FB688005AEFE7 /* SVGAttributeAccessor.h */, 15480 55346AF021150FAF0059BCDD /* SVGAttributeOwnerProxy.h */, 15481 55346AFA2117FFAF0059BCDD /* SVGAttributeOwnerProxyImpl.h */, 15482 55FA7FF6210FBE3E005AEFE7 /* SVGAttributeRegistry.h */, 15473 15483 0810764312828556007C63BA /* SVGListProperty.h */, 15474 15484 088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */, 15475 15485 08CA3D4312894A3800FFF260 /* SVGMatrixTearOff.h */, 15476 15486 088A0E01126EF1DB00978F7A /* SVGProperty.h */, 15477 B543B85617EB758F003BE93A /* SVGPropertyInfo.cpp */,15478 081DD49B13BA1A6000DC7627 /* SVGPropertyInfo.h */,15479 15487 088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */, 15480 15488 088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */, … … 23492 23500 B22279600D00BF210071B782 /* SVGZoomAndPan.h */, 23493 23501 B22279610D00BF210071B782 /* SVGZoomAndPan.idl */, 23502 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */, 23494 23503 B2E4EC940D00C22B00432643 /* SVGZoomEvent.cpp */, 23495 23504 B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */, … … 30447 30456 43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */, 30448 30457 08FE0BC5127E2AC1000C4FB5 /* SVGAnimatedPreserveAspectRatio.h in Headers */, 30449 088A0E05126EF1DB00978F7A/* SVGAnimatedProperty.h in Headers */,30458 55FA8001211113EE005AEFE7 /* SVGAnimatedProperty.h in Headers */, 30450 30459 088A0E06126EF1DB00978F7A /* SVGAnimatedPropertyDescription.h in Headers */, 30451 088A0E07126EF1DB00978F7A /* SVGAnimatedPropertyMacros.h in Headers */,30452 30460 088A0E08126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h in Headers */, 30461 55FA7FFF21110E6E005AEFE7 /* SVGAnimatedPropertyType.h in Headers */, 30453 30462 08C859C01274575400A5728D /* SVGAnimatedRect.h in Headers */, 30454 30463 08525E631278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h in Headers */, … … 30464 30473 B22279980D00BF220071B782 /* SVGAnimationElement.h in Headers */, 30465 30474 439D334513A6911C00C20F4F /* SVGAnimatorFactory.h in Headers */, 30466 08FB3F8413BC754C0099FC18 /* SVGAttributeToPropertyMap.h in Headers */, 30475 55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */, 30476 55FA7FF5210FB6B1005AEFE7 /* SVGAttributeAccessor.h in Headers */, 30477 55346AF121150FAF0059BCDD /* SVGAttributeOwnerProxy.h in Headers */, 30478 55FA7FF7210FBE3E005AEFE7 /* SVGAttributeRegistry.h in Headers */, 30467 30479 B222799C0D00BF220071B782 /* SVGCircleElement.h in Headers */, 30468 30480 B222799F0D00BF220071B782 /* SVGClipPathElement.h in Headers */, … … 30607 30619 B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */, 30608 30620 088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */, 30609 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */,30610 30621 088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */, 30611 30622 088A0E0C126EF1DB00978F7A /* SVGPropertyTraits.h in Headers */, … … 30668 30679 8485228B1190173C006EDC7F /* SVGVKernElement.h in Headers */, 30669 30680 B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */, 30681 55FA7FFB2110ECD7005AEFE7 /* SVGZoomAndPanType.h in Headers */, 30670 30682 B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */, 30671 30683 46ECB6381FD0A3C80088E5AD /* SWClientConnection.h in Headers */, -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp
r224537 r234620 116 116 { 117 117 // An empty viewBox disables rendering. 118 if (markerElement().hasAttribute(SVGNames::viewBoxAttr) && markerElement(). viewBoxIsValid() && markerElement().viewBox().isEmpty())118 if (markerElement().hasAttribute(SVGNames::viewBoxAttr) && markerElement().hasEmptyViewBox()) 119 119 return; 120 120 -
trunk/Source/WebCore/svg/SVGAElement.cpp
r229694 r234620 3 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2010 Apple Inc. All rights reserved.5 * Copyright (C) 2010-2018 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 47 47 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAElement); 48 48 49 // Animated property definitions50 DEFINE_ANIMATED_STRING(SVGAElement, SVGNames::targetAttr, SVGTarget, svgTarget)51 DEFINE_ANIMATED_STRING(SVGAElement, XLinkNames::hrefAttr, Href, href)52 DEFINE_ANIMATED_BOOLEAN(SVGAElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)53 54 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAElement)55 REGISTER_LOCAL_ANIMATED_PROPERTY(svgTarget)56 REGISTER_LOCAL_ANIMATED_PROPERTY(href)57 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)58 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)59 END_REGISTER_ANIMATED_PROPERTIES60 61 49 inline SVGAElement::SVGAElement(const QualifiedName& tagName, Document& document) 62 50 : SVGGraphicsElement(tagName, document) 51 , SVGExternalResourcesRequired(this) 52 , SVGURIReference(this) 63 53 { 64 54 ASSERT(hasTagName(SVGNames::aTag)); 65 registerA nimatedPropertiesForSVGAElement();55 registerAttributes(); 66 56 } 67 57 … … 82 72 } 83 73 74 void SVGAElement::registerAttributes() 75 { 76 auto& registry = attributeRegistry(); 77 if (!registry.isEmpty()) 78 return; 79 registry.registerAttribute<SVGNames::targetAttr, &SVGAElement::m_target>(); 80 } 81 84 82 void SVGAElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 85 83 { 86 84 if (name == SVGNames::targetAttr) { 87 setSVGTargetBaseValue(value);85 m_target.setValue(value); 88 86 return; 89 87 } … … 103 101 invalidateStyleForSubtree(); 104 102 } 103 return; 105 104 } 106 105 107 106 SVGGraphicsElement::svgAttributeChanged(attrName); 107 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 108 108 } 109 109 -
trunk/Source/WebCore/svg/SVGAElement.h
r229694 r234620 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 22 23 #pragma once 23 24 24 #include "SVGAnimatedBoolean.h"25 25 #include "SVGExternalResourcesRequired.h" 26 26 #include "SVGGraphicsElement.h" … … 29 29 namespace WebCore { 30 30 31 class SVGAElement final : public SVGGraphicsElement, public SVG URIReference, public SVGExternalResourcesRequired{31 class SVGAElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGURIReference { 32 32 WTF_MAKE_ISO_ALLOCATED(SVGAElement); 33 33 public: 34 34 static Ref<SVGAElement> create(const QualifiedName&, Document&); 35 35 36 String target() const final { return m_target.currentValue(attributeOwnerProxy()); } 37 RefPtr<SVGAnimatedString> targetAnimated() { return m_target.animatedProperty(attributeOwnerProxy()); } 38 36 39 private: 37 40 SVGAElement(const QualifiedName&, Document&); 38 41 39 bool isValid() const final { return SVGTests::isValid(); } 40 41 String title() const final; 42 String target() const final { return svgTarget(); } 42 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>; 43 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 44 static void registerAttributes(); 43 45 46 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 44 47 void parseAttribute(const QualifiedName&, const AtomicString&) final; 45 48 void svgAttributeChanged(const QualifiedName&) final; … … 48 51 bool childShouldCreateRenderer(const Node&) const final; 49 52 53 bool isValid() const final { return SVGTests::isValid(); } 54 String title() const final; 50 55 void defaultEventHandler(Event&) final; 51 56 … … 59 64 bool willRespondToMouseClickEvents() final; 60 65 61 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAElement) 62 // This declaration used to define a non-virtual "String& target() const" method, that clashes with "virtual String Element::target() const". 63 // That's why it has been renamed to "svgTarget", the CodeGenerators take care of calling svgTargetAnimated() instead of targetAnimated(), see CodeGenerator.pm. 64 DECLARE_ANIMATED_STRING(SVGTarget, svgTarget) 65 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 66 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 67 END_DECLARE_ANIMATED_PROPERTIES 66 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 67 SVGAnimatedStringAttribute m_target; 68 68 }; 69 69 -
trunk/Source/WebCore/svg/SVGAElement.idl
r163440 r234620 25 25 26 26 interface SVGAElement : SVGGraphicsElement { 27 [ImplementedAs=svgTarget]readonly attribute SVGAnimatedString target;27 readonly attribute SVGAnimatedString target; 28 28 }; 29 29 -
trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2008 Apple Inc. All rights reserved.4 * Copyright (C) 2008-2018 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 6 6 * … … 38 38 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAltGlyphElement); 39 39 40 // Animated property definitions41 DEFINE_ANIMATED_STRING(SVGAltGlyphElement, XLinkNames::hrefAttr, Href, href)42 43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAltGlyphElement)44 REGISTER_LOCAL_ANIMATED_PROPERTY(href)45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextPositioningElement)46 END_REGISTER_ANIMATED_PROPERTIES47 48 40 inline SVGAltGlyphElement::SVGAltGlyphElement(const QualifiedName& tagName, Document& document) 49 41 : SVGTextPositioningElement(tagName, document) 42 , SVGURIReference(this) 50 43 { 51 44 ASSERT(hasTagName(SVGNames::altGlyphTag)); 52 registerAnimatedPropertiesForSVGAltGlyphElement();53 45 } 54 46 -
trunk/Source/WebCore/svg/SVGAltGlyphElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2008 Apple Inc. All rights reserved.4 * Copyright (C) 2008-2018 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 46 46 SVGAltGlyphElement(const QualifiedName&, Document&); 47 47 48 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAltGlyphElement, SVGTextPositioningElement, SVGURIReference>; 49 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 50 48 51 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; 49 52 bool childShouldCreateRenderer(const Node&) const override; 50 53 51 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAltGlyphElement) 52 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 53 END_DECLARE_ANIMATED_PROPERTIES 54 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 54 55 }; 55 56 -
trunk/Source/WebCore/svg/SVGAnimatedAngle.h
r208668 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 23 24 #include "SVGAnimatedPropertyTearOff.h" 24 25 #include "SVGAnimatedTypeAnimator.h" 26 #include "SVGAttribute.h" 25 27 26 28 namespace WebCore { 27 29 30 class SVGAnimationElement; 31 28 32 using SVGAnimatedAngle = SVGAnimatedPropertyTearOff<SVGAngle>; 29 30 // Helper macros to declare/define a SVGAnimatedAngle object. SVGAnimatedAngle is only used in the SVG DOM for SVGMarkerElement. 31 #define DECLARE_ANIMATED_ANGLE(UpperProperty, LowerProperty) \ 32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedAngle, SVGAngleValue, UpperProperty, LowerProperty, ) 33 34 // Only used for SVGMarkerElements orientAttr, which maps to SVGAnimatedAngle orientAngle and SVGAnimatedEnumeration orientType. 35 #define DEFINE_ANIMATED_ANGLE_AND_ENUMERATION(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ 36 DEFINE_ANIMATED_PROPERTY(AnimatedAngle, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) 37 38 class SVGAnimationElement; 33 using SVGAnimatedAngleAttribute = SVGAnimatedAttribute<SVGAnimatedAngle>; 39 34 40 35 class SVGAnimatedAngleAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedBoolean.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGAnimatedStaticPropertyTearOff.h" 23 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 24 26 25 27 namespace WebCore { 26 28 27 typedef SVGAnimatedStaticPropertyTearOff<bool> SVGAnimatedBoolean;29 class SVGAnimationElement; 28 30 29 // Helper macros to declare/define a SVGAnimatedBoolean object 30 #define DECLARE_ANIMATED_BOOLEAN(UpperProperty, LowerProperty) \ 31 DECLARE_ANIMATED_PROPERTY(SVGAnimatedBoolean, bool, UpperProperty, LowerProperty, ) 31 using SVGAnimatedBoolean = SVGAnimatedStaticPropertyTearOff<bool>; 32 using SVGAnimatedBooleanAttribute = SVGAnimatedAttribute<SVGAnimatedBoolean>; 32 33 33 #define DECLARE_ANIMATED_BOOLEAN_OVERRIDE(UpperProperty, LowerProperty) \ 34 DECLARE_ANIMATED_PROPERTY(SVGAnimatedBoolean, bool, UpperProperty, LowerProperty, override) 35 36 #define DEFINE_ANIMATED_BOOLEAN(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 37 DEFINE_ANIMATED_PROPERTY(AnimatedBoolean, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 38 39 class SVGAnimationElement; 34 template<typename OwnerType> 35 using SVGAnimatedBooleanAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedBooleanAttribute, AnimatedBoolean>; 40 36 41 37 class SVGAnimatedBooleanAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedEnumeration.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 21 22 22 23 #include "SVGAnimatedEnumerationPropertyTearOff.h" 23 #include "SVGAnimatedPropertyMacros.h"24 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 25 26 26 27 namespace WebCore { 27 28 28 typedef SVGAnimatedStaticPropertyTearOff<unsigned> SVGAnimatedEnumeration;29 class SVGAnimationElement; 29 30 30 // Helper macros to declare/define a SVGAnimatedEnumeration object 31 #define DECLARE_ANIMATED_ENUMERATION(UpperProperty, LowerProperty, EnumType) \ 32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedEnumerationPropertyTearOff<EnumType>, EnumType, UpperProperty, LowerProperty, ) 31 using SVGAnimatedEnumeration = SVGAnimatedStaticPropertyTearOff<unsigned>; 33 32 34 #define DEFINE_ANIMATED_ENUMERATION(OwnerType, DOMAttribute, UpperProperty, LowerProperty, EnumType) \ 35 DEFINE_ANIMATED_PROPERTY(AnimatedEnumeration, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 33 template<typename EnumType> 34 using SVGAnimatedEnumerationAttribute = SVGAnimatedAttribute<SVGAnimatedEnumerationPropertyTearOff<EnumType>>; 35 36 template<typename OwnerType, typename EnumType> 37 using SVGAnimatedEnumerationAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedEnumerationAttribute<EnumType>, AnimatedEnumeration>; 36 38 37 39 class SVGAnimatedEnumerationAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedInteger.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 20 21 #pragma once 21 22 22 #include "SVGAnimatedPropertyMacros.h"23 23 #include "SVGAnimatedStaticPropertyTearOff.h" 24 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 25 26 26 27 namespace WebCore { 27 28 28 typedef SVGAnimatedStaticPropertyTearOff<int> SVGAnimatedInteger;29 class SVGAnimationElement; 29 30 30 // Helper macros to declare/define a SVGAnimatedInteger object 31 #define DECLARE_ANIMATED_INTEGER(UpperProperty, LowerProperty) \ 32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedInteger, int, UpperProperty, LowerProperty, ) 31 using SVGAnimatedInteger = SVGAnimatedStaticPropertyTearOff<int>; 32 using SVGAnimatedIntegerAttribute = SVGAnimatedAttribute<SVGAnimatedInteger>; 33 33 34 #define DEFINE_ANIMATED_INTEGER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 35 DEFINE_ANIMATED_PROPERTY(AnimatedInteger, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 34 template<typename OwnerType> 35 using SVGAnimatedIntegerAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedIntegerAttribute, AnimatedInteger>; 36 36 37 #define DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ 38 DEFINE_ANIMATED_PROPERTY(AnimatedIntegerOptionalInteger, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) 39 40 class SVGAnimationElement; 37 template<typename OwnerType> 38 using SVGAnimatedOptionalIntegerAttributeAccessor = SVGAnimatedOptionalAttributeAccessor<OwnerType, SVGAnimatedIntegerAttribute, AnimatedIntegerOptionalInteger>; 41 39 42 40 class SVGAnimatedIntegerAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedLength.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGAnimatedPropertyTearOff.h" 23 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 24 26 #include "SVGLength.h" 25 27 26 28 namespace WebCore { 27 29 30 class SVGAnimationElement; 31 28 32 using SVGAnimatedLength = SVGAnimatedPropertyTearOff<SVGLength>; 33 using SVGAnimatedLengthAttribute = SVGAnimatedAttribute<SVGAnimatedLength>; 29 34 30 // Helper macros to declare/define a SVGAnimatedLength object 31 #define DECLARE_ANIMATED_LENGTH(UpperProperty, LowerProperty) \ 32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedLength, SVGLengthValue, UpperProperty, LowerProperty, ) 33 34 #define DEFINE_ANIMATED_LENGTH(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 35 DEFINE_ANIMATED_PROPERTY(AnimatedLength, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 36 37 class SVGAnimationElement; 35 template<typename OwnerType> 36 using SVGAnimatedLengthAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedLengthAttribute, AnimatedLength>; 38 37 39 38 class SVGAnimatedLengthAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedLengthList.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGAnimatedListPropertyTearOff.h" 23 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 24 26 #include "SVGLength.h" 25 27 #include "SVGLengthList.h" … … 27 29 namespace WebCore { 28 30 31 class SVGAnimationElement; 32 29 33 using SVGAnimatedLengthList = SVGAnimatedListPropertyTearOff<SVGLengthListValues>; 34 using SVGAnimatedLengthListAttribute = SVGAnimatedAttributeList<SVGAnimatedLengthList>; 30 35 31 // Helper macros to declare/define a SVGAnimatedLengthList object 32 #define DECLARE_ANIMATED_LENGTH_LIST(UpperProperty, LowerProperty) \ 33 DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedLengthList, SVGLengthListValues, UpperProperty, LowerProperty) 34 35 #define DEFINE_ANIMATED_LENGTH_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 36 DEFINE_ANIMATED_PROPERTY(AnimatedLengthList, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 37 38 class SVGAnimationElement; 36 template<typename OwnerType> 37 using SVGAnimatedLengthListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedLengthListAttribute, AnimatedLengthList>; 39 38 40 39 class SVGAnimatedLengthListAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedNumber.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 20 21 #pragma once 21 22 22 #include "SVGAnimatedPropertyMacros.h"23 23 #include "SVGAnimatedStaticPropertyTearOff.h" 24 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 25 26 26 27 namespace WebCore { 27 28 28 typedef SVGAnimatedStaticPropertyTearOff<float> SVGAnimatedNumber;29 class SVGAnimationElement; 29 30 30 // Helper macros to declare/define a SVGAnimatedNumber object 31 #define DECLARE_ANIMATED_NUMBER(UpperProperty, LowerProperty) \ 32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedNumber, float, UpperProperty, LowerProperty, ) 31 using SVGAnimatedNumber = SVGAnimatedStaticPropertyTearOff<float>; 32 using SVGAnimatedNumberAttribute = SVGAnimatedAttribute<SVGAnimatedNumber>; 33 33 34 #define DEFINE_ANIMATED_NUMBER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 35 DEFINE_ANIMATED_PROPERTY(AnimatedNumber, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 34 template<typename OwnerType> 35 using SVGAnimatedNumberAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedNumberAttribute, AnimatedNumber>; 36 36 37 #define DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \ 38 DEFINE_ANIMATED_PROPERTY(AnimatedNumberOptionalNumber, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) 39 40 class SVGAnimationElement; 37 template<typename OwnerType> 38 using SVGAnimatedOptionalNumberAttributeAccessor = SVGAnimatedOptionalAttributeAccessor<OwnerType, SVGAnimatedNumberAttribute, AnimatedNumberOptionalNumber>; 41 39 42 40 class SVGAnimatedNumberAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedNumberList.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGAnimatedListPropertyTearOff.h" 23 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 24 26 #include "SVGNumber.h" 25 27 #include "SVGNumberList.h" … … 27 29 namespace WebCore { 28 30 31 class SVGAnimationElement; 32 29 33 using SVGAnimatedNumberList = SVGAnimatedListPropertyTearOff<SVGNumberListValues>; 34 using SVGAnimatedNumberListAttribute = SVGAnimatedAttributeList<SVGAnimatedNumberList>; 30 35 31 // Helper macros to declare/define a SVGAnimatedNumberList object 32 #define DECLARE_ANIMATED_NUMBER_LIST(UpperProperty, LowerProperty) \ 33 DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedNumberList, SVGNumberListValues, UpperProperty, LowerProperty) 34 35 #define DEFINE_ANIMATED_NUMBER_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 36 DEFINE_ANIMATED_PROPERTY(AnimatedNumberList, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 37 38 class SVGAnimationElement; 36 template<typename OwnerType> 37 using SVGAnimatedNumberListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedNumberListAttribute, AnimatedNumberList>; 39 38 40 39 class SVGAnimatedNumberListAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedPath.h
r208668 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2011, 2012. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 20 21 #pragma once 21 22 23 #include "SVGAnimatedPathSegListPropertyTearOff.h" 22 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 23 26 24 27 namespace WebCore { 25 28 26 29 class SVGAnimationElement; 30 31 using SVGAnimatedPathSegList = SVGAnimatedPathSegListPropertyTearOff; 32 using SVGAnimatedPathSegListAttribute = SVGAnimatedAttributeList<SVGAnimatedPathSegList>; 27 33 28 34 class SVGAnimatedPathAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedPointList.h
r208863 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 26 27 namespace WebCore { 27 28 29 class SVGAnimationElement; 30 28 31 using SVGAnimatedPointList = SVGAnimatedListPropertyTearOff<SVGPointListValues>; 32 using SVGAnimatedPointListAttribute = SVGAnimatedAttributeList<SVGAnimatedPointList>; 29 33 30 class SVGAnimationElement; 34 template<typename OwnerType> 35 using SVGAnimatedPointListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedPointListAttribute, AnimatedPoints>; 31 36 32 37 class SVGAnimatedPointListAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGAnimatedPropertyTearOff.h" 23 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 24 26 #include "SVGPreserveAspectRatio.h" 25 27 26 28 namespace WebCore { 27 29 28 template<typename T> 29 class SVGPropertyTearOff; 30 class SVGAnimationElement; 30 31 31 32 using SVGAnimatedPreserveAspectRatio = SVGAnimatedPropertyTearOff<SVGPreserveAspectRatio>; 33 using SVGAnimatedPreserveAspectRatioAttribute = SVGAnimatedAttribute<SVGAnimatedPreserveAspectRatio>; 32 34 33 // Helper macros to declare/define a SVGAnimatedPreserveAspectRatio object 34 #define DECLARE_ANIMATED_PRESERVEASPECTRATIO(UpperProperty, LowerProperty) \ 35 DECLARE_ANIMATED_PROPERTY(SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatioValue, UpperProperty, LowerProperty, ) 36 37 #define DEFINE_ANIMATED_PRESERVEASPECTRATIO(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 38 DEFINE_ANIMATED_PROPERTY(AnimatedPreserveAspectRatio, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 39 40 class SVGAnimationElement; 35 template<typename OwnerType> 36 using SVGAnimatedPreserveAspectRatioAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedPreserveAspectRatioAttribute, AnimatedPreserveAspectRatio>; 41 37 42 38 class SVGAnimatedPreserveAspectRatioAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedRect.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 20 21 #pragma once 21 22 22 #include "SVGAnimatedPropertyMacros.h"23 23 #include "SVGAnimatedPropertyTearOff.h" 24 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 25 26 #include "SVGRect.h" 26 27 27 28 namespace WebCore { 28 29 30 class SVGAnimationElement; 29 31 class SVGRect; 30 32 31 33 using SVGAnimatedRect = SVGAnimatedPropertyTearOff<SVGRect>; 34 using SVGAnimatedRectAttribute = SVGAnimatedAttribute<SVGAnimatedRect>; 32 35 33 // Helper macros to declare/define a SVGAnimatedRect object 34 #define DECLARE_ANIMATED_RECT(UpperProperty, LowerProperty) \ 35 DECLARE_ANIMATED_PROPERTY(SVGAnimatedRect, FloatRect, UpperProperty, LowerProperty, ) 36 37 #define DEFINE_ANIMATED_RECT(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 38 DEFINE_ANIMATED_PROPERTY(AnimatedRect, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 39 40 class SVGAnimationElement; 36 template<typename OwnerType> 37 using SVGAnimatedRectAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedRectAttribute, AnimatedRect>; 41 38 42 39 class SVGAnimatedRectAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedString.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 20 21 #pragma once 21 22 22 #include "SVGAnimatedPropertyMacros.h"23 23 #include "SVGAnimatedStaticPropertyTearOff.h" 24 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 25 26 26 27 namespace WebCore { 27 28 28 typedef SVGAnimatedStaticPropertyTearOff<String> SVGAnimatedString;29 class SVGAnimationElement; 29 30 30 // Helper macros to declare/define a SVGAnimatedString object 31 #define DECLARE_ANIMATED_STRING(UpperProperty, LowerProperty) \ 32 DECLARE_ANIMATED_PROPERTY(SVGAnimatedString, String, UpperProperty, LowerProperty, ) 31 using SVGAnimatedString = SVGAnimatedStaticPropertyTearOff<String>; 32 using SVGAnimatedStringAttribute = SVGAnimatedAttribute<SVGAnimatedString>; 33 33 34 #define DECLARE_ANIMATED_STRING_OVERRIDE(UpperProperty, LowerProperty) \ 35 DECLARE_ANIMATED_PROPERTY(SVGAnimatedString, String, UpperProperty, LowerProperty, override) 36 37 #define DEFINE_ANIMATED_STRING(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 38 DEFINE_ANIMATED_PROPERTY(AnimatedString, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 39 40 class SVGAnimationElement; 34 template<typename OwnerType> 35 using SVGAnimatedStringAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedStringAttribute, AnimatedString>; 41 36 42 37 class SVGAnimatedStringAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedTransformList.h
r224213 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGAnimatedTransformListPropertyTearOff.h" 23 24 #include "SVGAnimatedTypeAnimator.h" 25 #include "SVGAttributeAccessor.h" 24 26 #include "SVGTransformList.h" 25 27 26 28 namespace WebCore { 27 29 30 class SVGAnimationElement; 31 28 32 using SVGAnimatedTransformList = SVGAnimatedTransformListPropertyTearOff; 33 using SVGAnimatedTransformListAttribute = SVGAnimatedAttributeList<SVGAnimatedTransformList>; 29 34 30 // Helper macros to declare/define a SVGAnimatedTransformList object 31 #define DECLARE_ANIMATED_TRANSFORM_LIST(UpperProperty, LowerProperty) \ 32 DECLARE_ANIMATED_LIST_PROPERTY(SVGAnimatedTransformList, SVGTransformListValues, UpperProperty, LowerProperty) 33 34 #define DEFINE_ANIMATED_TRANSFORM_LIST(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \ 35 DEFINE_ANIMATED_PROPERTY(AnimatedTransformList, OwnerType, DOMAttribute, DOMAttribute->localName(), UpperProperty, LowerProperty) 36 37 class SVGAnimationElement; 35 template<typename OwnerType> 36 using SVGAnimatedTransformListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedTransformListAttribute, AnimatedTransformList>; 38 37 39 38 class SVGAnimatedTransformListAnimator final : public SVGAnimatedTypeAnimator { -
trunk/Source/WebCore/svg/SVGAnimatedTypeAnimator.cpp
r223728 r234620 23 23 #include "SVGAnimatedTypeAnimator.h" 24 24 25 #include "SVGAttributeToPropertyMap.h"26 25 #include "SVGElement.h" 27 26 … … 57 56 return result; 58 57 59 auto& propertyMap = targetElement.localAttributeToPropertyMap(); 60 auto targetProperties = propertyMap.properties(targetElement, attributeName); 61 58 auto targetProperties = targetElement.lookupOrCreateAnimatedProperties(attributeName); 62 59 if (targetProperties.isEmpty()) 63 60 return result; … … 66 63 67 64 for (SVGElement* instance : targetElement.instances()) 68 result.append(SVGElementAnimatedProperties { instance, propertyMap.properties(*instance,attributeName) });65 result.append(SVGElementAnimatedProperties { instance, instance->lookupOrCreateAnimatedProperties(attributeName) }); 69 66 70 67 #if !ASSERT_DISABLED -
trunk/Source/WebCore/svg/SVGAnimationElement.cpp
r234278 r234620 48 48 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAnimationElement); 49 49 50 // Animated property definitions51 DEFINE_ANIMATED_BOOLEAN(SVGAnimationElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)52 53 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAnimationElement)54 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)55 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)56 END_REGISTER_ANIMATED_PROPERTIES57 58 50 SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document& document) 59 51 : SVGSMILElement(tagName, document) 60 { 61 registerAnimatedPropertiesForSVGAnimationElement(); 52 , SVGExternalResourcesRequired(this) 53 , SVGTests(this) 54 { 62 55 } 63 56 … … 692 685 } 693 686 694 Ref<SVGStringList> SVGAnimationElement::requiredFeatures() 695 { 696 return SVGTests::requiredFeatures(*this); 697 } 698 699 Ref<SVGStringList> SVGAnimationElement::requiredExtensions() 700 { 701 return SVGTests::requiredExtensions(*this); 702 } 703 704 Ref<SVGStringList> SVGAnimationElement::systemLanguage() 705 { 706 return SVGTests::systemLanguage(*this); 707 } 708 709 } 687 } -
trunk/Source/WebCore/svg/SVGAnimationElement.h
r229694 r234620 53 53 enum class CalcMode { Discrete, Linear, Paced, Spline }; 54 54 55 class SVGAnimationElement : public SVGSMILElement, public SVG Tests, public SVGExternalResourcesRequired{55 class SVGAnimationElement : public SVGSMILElement, public SVGExternalResourcesRequired, public SVGTests { 56 56 WTF_MAKE_ISO_ALLOCATED(SVGAnimationElement); 57 57 public: … … 147 147 } 148 148 149 // SVGTests150 Ref<SVGStringList> requiredFeatures();151 Ref<SVGStringList> requiredExtensions();152 Ref<SVGStringList> systemLanguage();153 154 149 protected: 155 150 SVGAnimationElement(const QualifiedName&, Document&); 151 152 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGAnimationElement, SVGElement, SVGExternalResourcesRequired, SVGTests>; 153 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 154 const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } 156 155 157 156 void computeCSSPropertyValue(SVGElement*, CSSPropertyID, String& value); … … 208 207 void applyAnimatedValue(ShouldApplyAnimation, SVGElement* targetElement, const QualifiedName& attributeName, SVGAnimatedType*); 209 208 void adjustForInheritance(SVGElement* targetElement, const QualifiedName& attributeName, String&); 210 211 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAnimationElement)212 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)213 END_DECLARE_ANIMATED_PROPERTIES214 215 // SVGTests216 void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); }217 void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); }218 void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); }219 209 220 210 void setCalcMode(const AtomicString&); … … 232 222 CalcMode m_calcMode { CalcMode::Linear }; 233 223 AnimationMode m_animationMode { NoAnimation }; 224 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 234 225 }; 235 226 -
trunk/Source/WebCore/svg/SVGCircleElement.cpp
r231955 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGCircleElement.h" 23 24 24 #include "FloatPoint.h"25 25 #include "RenderSVGEllipse.h" 26 #include "RenderSVGPath.h"27 26 #include "RenderSVGResource.h" 28 #include "SVGLengthValue.h"29 #include "SVGNames.h"30 27 #include <wtf/IsoMallocInlines.h> 31 28 … … 34 31 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGCircleElement); 35 32 36 // Animated property definitions37 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cxAttr, Cx, cx)38 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::cyAttr, Cy, cy)39 DEFINE_ANIMATED_LENGTH(SVGCircleElement, SVGNames::rAttr, R, r)40 DEFINE_ANIMATED_BOOLEAN(SVGCircleElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)41 42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCircleElement)43 REGISTER_LOCAL_ANIMATED_PROPERTY(cx)44 REGISTER_LOCAL_ANIMATED_PROPERTY(cy)45 REGISTER_LOCAL_ANIMATED_PROPERTY(r)46 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)47 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)48 END_REGISTER_ANIMATED_PROPERTIES49 50 33 inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document& document) 51 34 : SVGGeometryElement(tagName, document) 52 , m_cx(LengthModeWidth) 53 , m_cy(LengthModeHeight) 54 , m_r(LengthModeOther) 35 , SVGExternalResourcesRequired(this) 55 36 { 56 37 ASSERT(hasTagName(SVGNames::circleTag)); 57 registerA nimatedPropertiesForSVGCircleElement();38 registerAttributes(); 58 39 } 59 40 … … 63 44 } 64 45 46 void SVGCircleElement::registerAttributes() 47 { 48 auto& registry = attributeRegistry(); 49 if (!registry.isEmpty()) 50 return; 51 registry.registerAttribute<SVGNames::cxAttr, &SVGCircleElement::m_cx>(); 52 registry.registerAttribute<SVGNames::cyAttr, &SVGCircleElement::m_cy>(); 53 registry.registerAttribute<SVGNames::rAttr, &SVGCircleElement::m_r>(); 54 } 55 65 56 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 66 57 { … … 68 59 69 60 if (name == SVGNames::cxAttr) 70 setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));61 m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 71 62 else if (name == SVGNames::cyAttr) 72 setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));63 m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 73 64 else if (name == SVGNames::rAttr) 74 setRBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));65 m_r.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); 75 66 76 67 reportAttributeParsingError(parseError, name, value); 77 68 78 SVGG raphicsElement::parseAttribute(name, value);69 SVGGeometryElement::parseAttribute(name, value); 79 70 SVGExternalResourcesRequired::parseAttribute(name, value); 80 71 } … … 82 73 void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) 83 74 { 84 SVGGraphicsElement::svgAttributeChanged(attrName); 85 86 if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || attrName == SVGNames::rAttr) { 75 if (isKnownAttribute(attrName)) { 87 76 InstanceInvalidationGuard guard(*this); 88 77 invalidateSVGPresentationAttributeStyle(); … … 90 79 } 91 80 92 auto* renderer = downcast<RenderSVGShape>(this->renderer()); 93 if (!renderer) 94 return; 95 96 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { 97 InstanceInvalidationGuard guard(*this); 98 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 99 } 81 SVGGeometryElement::svgAttributeChanged(attrName); 82 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 100 83 } 101 84 -
trunk/Source/WebCore/svg/SVGCircleElement.h
r231955 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 21 22 #pragma once 22 23 23 #include "SVGAnimatedBoolean.h"24 24 #include "SVGAnimatedLength.h" 25 25 #include "SVGExternalResourcesRequired.h" 26 26 #include "SVGGeometryElement.h" 27 #include "SVGNames.h" 27 28 28 29 namespace WebCore { … … 33 34 static Ref<SVGCircleElement> create(const QualifiedName&, Document&); 34 35 36 const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); } 37 const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); } 38 const SVGLengthValue& r() const { return m_r.currentValue(attributeOwnerProxy()); } 39 40 RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); } 41 RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); } 42 RefPtr<SVGAnimatedLength> rAnimated() { return m_r.animatedProperty(attributeOwnerProxy()); } 43 35 44 private: 36 45 SVGCircleElement(const QualifiedName&, Document&); 37 46 38 bool isValid() const final { return SVGTests::isValid(); } 47 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCircleElement, SVGGeometryElement, SVGExternalResourcesRequired>; 48 static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 49 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 50 static void registerAttributes(); 39 51 52 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 40 53 void parseAttribute(const QualifiedName&, const AtomicString&) final; 41 54 void svgAttributeChanged(const QualifiedName&) final; 42 55 56 bool isValid() const final { return SVGTests::isValid(); } 43 57 bool selfHasRelativeLengths() const final { return true; } 44 58 45 59 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 46 60 47 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGCircleElement) 48 DECLARE_ANIMATED_LENGTH(Cx, cx) 49 DECLARE_ANIMATED_LENGTH(Cy, cy) 50 DECLARE_ANIMATED_LENGTH(R, r) 51 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 52 END_DECLARE_ANIMATED_PROPERTIES 61 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 62 SVGAnimatedLengthAttribute m_cx { LengthModeWidth }; 63 SVGAnimatedLengthAttribute m_cy { LengthModeHeight }; 64 SVGAnimatedLengthAttribute m_r { LengthModeOther }; 53 65 }; 54 66 -
trunk/Source/WebCore/svg/SVGClipPathElement.cpp
r229694 r234620 3 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 4 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 34 35 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGClipPathElement); 35 36 36 // Animated property definitions37 DEFINE_ANIMATED_ENUMERATION(SVGClipPathElement, SVGNames::clipPathUnitsAttr, ClipPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType)38 DEFINE_ANIMATED_BOOLEAN(SVGClipPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)39 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement)41 REGISTER_LOCAL_ANIMATED_PROPERTY(clipPathUnits)42 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)43 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)44 END_REGISTER_ANIMATED_PROPERTIES45 46 37 inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document& document) 47 38 : SVGGraphicsElement(tagName, document) 48 , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)39 , SVGExternalResourcesRequired(this) 49 40 { 50 41 ASSERT(hasTagName(SVGNames::clipPathTag)); 51 registerA nimatedPropertiesForSVGClipPathElement();42 registerAttributes(); 52 43 } 53 44 … … 57 48 } 58 49 59 bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName)50 void SVGClipPathElement::registerAttributes() 60 51 { 61 static const auto supportedAttributes = makeNeverDestroyed([] { 62 HashSet<QualifiedName> set; 63 SVGLangSpace::addSupportedAttributes(set); 64 SVGExternalResourcesRequired::addSupportedAttributes(set); 65 set.add(SVGNames::clipPathUnitsAttr); 66 return set; 67 }()); 68 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 52 auto& registry = attributeRegistry(); 53 if (!registry.isEmpty()) 54 return; 55 registry.registerAttribute<SVGNames::clipPathUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGClipPathElement::m_clipPathUnits>(); 69 56 } 70 57 … … 74 61 auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 75 62 if (propertyValue > 0) 76 setClipPathUnitsBaseValue(propertyValue);63 m_clipPathUnits.setValue(propertyValue); 77 64 return; 78 65 } … … 84 71 void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) 85 72 { 86 if (!isSupportedAttribute(attrName)) { 87 SVGGraphicsElement::svgAttributeChanged(attrName); 73 if (isKnownAttribute(attrName)) { 74 InstanceInvalidationGuard guard(*this); 75 76 if (RenderObject* object = renderer()) 77 object->setNeedsLayout(); 88 78 return; 89 79 } 90 80 91 InstanceInvalidationGuard guard(*this); 92 93 if (RenderObject* object = renderer()) 94 object->setNeedsLayout(); 81 SVGGraphicsElement::svgAttributeChanged(attrName); 82 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 95 83 } 96 84 -
trunk/Source/WebCore/svg/SVGClipPathElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 36 37 static Ref<SVGClipPathElement> create(const QualifiedName&, Document&); 37 38 39 SVGUnitTypes::SVGUnitType clipPathUnits() const { return m_clipPathUnits.currentValue(attributeOwnerProxy()); } 40 RefPtr<SVGAnimatedEnumeration> clipPathUnitsAnimated() { return m_clipPathUnits.animatedProperty(attributeOwnerProxy()); } 41 38 42 private: 39 43 SVGClipPathElement(const QualifiedName&, Document&); 44 45 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGClipPathElement, SVGGraphicsElement, SVGExternalResourcesRequired>; 46 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 47 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 48 static void registerAttributes(); 49 50 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 51 void parseAttribute(const QualifiedName&, const AtomicString&) final; 52 void svgAttributeChanged(const QualifiedName&) final; 53 void childrenChanged(const ChildChange&) final; 40 54 41 55 bool isValid() const final { return SVGTests::isValid(); } … … 43 57 bool needsPendingResourceHandling() const final { return false; } 44 58 45 static bool isSupportedAttribute(const QualifiedName&);46 void parseAttribute(const QualifiedName&, const AtomicString&) final;47 void svgAttributeChanged(const QualifiedName&) final;48 void childrenChanged(const ChildChange&) final;49 50 59 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 51 60 52 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGClipPathElement) 53 DECLARE_ANIMATED_ENUMERATION(ClipPathUnits, clipPathUnits, SVGUnitTypes::SVGUnitType) 54 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 55 END_DECLARE_ANIMATED_PROPERTIES 61 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 62 SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_clipPathUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; 56 63 }; 57 64 -
trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 32 33 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGComponentTransferFunctionElement); 33 34 34 // Animated property definitions35 DEFINE_ANIMATED_ENUMERATION(SVGComponentTransferFunctionElement, SVGNames::typeAttr, Type, type, ComponentTransferType)36 DEFINE_ANIMATED_NUMBER_LIST(SVGComponentTransferFunctionElement, SVGNames::tableValuesAttr, TableValues, tableValues)37 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::slopeAttr, Slope, slope)38 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::interceptAttr, Intercept, intercept)39 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::amplitudeAttr, Amplitude, amplitude)40 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::exponentAttr, Exponent, exponent)41 DEFINE_ANIMATED_NUMBER(SVGComponentTransferFunctionElement, SVGNames::offsetAttr, Offset, offset)42 43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement)44 REGISTER_LOCAL_ANIMATED_PROPERTY(type)45 REGISTER_LOCAL_ANIMATED_PROPERTY(tableValues)46 REGISTER_LOCAL_ANIMATED_PROPERTY(slope)47 REGISTER_LOCAL_ANIMATED_PROPERTY(intercept)48 REGISTER_LOCAL_ANIMATED_PROPERTY(amplitude)49 REGISTER_LOCAL_ANIMATED_PROPERTY(exponent)50 REGISTER_LOCAL_ANIMATED_PROPERTY(offset)51 END_REGISTER_ANIMATED_PROPERTIES52 53 35 SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document& document) 54 36 : SVGElement(tagName, document) 55 , m_type(FECOMPONENTTRANSFER_TYPE_IDENTITY)56 , m_slope(1)57 , m_amplitude(1)58 , m_exponent(1)59 37 { 60 registerA nimatedPropertiesForSVGComponentTransferFunctionElement();38 registerAttributes(); 61 39 } 62 40 63 bool SVGComponentTransferFunctionElement::isSupportedAttribute(const QualifiedName& attrName)41 void SVGComponentTransferFunctionElement::registerAttributes() 64 42 { 65 static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> {66 SVGNames::typeAttr,67 SVGNames::tableValuesAttr,68 SVGNames::slopeAttr,69 SVGNames::interceptAttr,70 SVGNames::amplitudeAttr,71 SVGNames::exponentAttr,72 SVGNames::offsetAttr,73 });74 re turn supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);43 auto& registry = attributeRegistry(); 44 if (!registry.isEmpty()) 45 return; 46 registry.registerAttribute<SVGNames::typeAttr, ComponentTransferType, &SVGComponentTransferFunctionElement::m_type>(); 47 registry.registerAttribute<SVGNames::tableValuesAttr, &SVGComponentTransferFunctionElement::m_tableValues>(); 48 registry.registerAttribute<SVGNames::slopeAttr, &SVGComponentTransferFunctionElement::m_slope>(); 49 registry.registerAttribute<SVGNames::interceptAttr, &SVGComponentTransferFunctionElement::m_intercept>(); 50 registry.registerAttribute<SVGNames::amplitudeAttr, &SVGComponentTransferFunctionElement::m_amplitude>(); 51 registry.registerAttribute<SVGNames::exponentAttr, &SVGComponentTransferFunctionElement::m_exponent>(); 52 registry.registerAttribute<SVGNames::offsetAttr, &SVGComponentTransferFunctionElement::m_offset>(); 75 53 } 76 54 … … 80 58 ComponentTransferType propertyValue = SVGPropertyTraits<ComponentTransferType>::fromString(value); 81 59 if (propertyValue > 0) 82 setTypeBaseValue(propertyValue);60 m_type.setValue(propertyValue); 83 61 return; 84 62 } … … 87 65 SVGNumberListValues newList; 88 66 newList.parse(value); 89 detachAnimatedTableValuesListWrappers(newList.size());90 setTableValuesBaseValue(newList);67 m_tableValues.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 68 m_tableValues.setValue(WTFMove(newList)); 91 69 return; 92 70 } 93 71 94 72 if (name == SVGNames::slopeAttr) { 95 setSlopeBaseValue(value.toFloat());73 m_slope.setValue(value.toFloat()); 96 74 return; 97 75 } 98 76 99 77 if (name == SVGNames::interceptAttr) { 100 setInterceptBaseValue(value.toFloat());78 m_intercept.setValue(value.toFloat()); 101 79 return; 102 80 } 103 81 104 82 if (name == SVGNames::amplitudeAttr) { 105 setAmplitudeBaseValue(value.toFloat());83 m_amplitude.setValue(value.toFloat()); 106 84 return; 107 85 } 108 86 109 87 if (name == SVGNames::exponentAttr) { 110 setExponentBaseValue(value.toFloat());88 m_exponent.setValue(value.toFloat()); 111 89 return; 112 90 } 113 91 114 92 if (name == SVGNames::offsetAttr) { 115 setOffsetBaseValue(value.toFloat());93 m_offset.setValue(value.toFloat()); 116 94 return; 117 95 } … … 122 100 void SVGComponentTransferFunctionElement::svgAttributeChanged(const QualifiedName& attrName) 123 101 { 124 if (!isSupportedAttribute(attrName)) { 125 SVGElement::svgAttributeChanged(attrName); 102 if (isKnownAttribute(attrName)) { 103 InstanceInvalidationGuard guard(*this); 104 invalidateFilterPrimitiveParent(this); 126 105 return; 127 106 } 128 107 129 InstanceInvalidationGuard guard(*this); 130 131 invalidateFilterPrimitiveParent(this); 108 SVGElement::svgAttributeChanged(attrName); 132 109 } 133 110 134 111 ComponentTransferFunction SVGComponentTransferFunctionElement::transferFunction() const 135 112 { 136 ComponentTransferFunction func;137 func.type = type();138 func.slope = slope();139 func.intercept = intercept();140 func.amplitude = amplitude();141 func.exponent = exponent();142 func.offset = offset();143 func.tableValues = tableValues();144 return func;113 return { 114 type(), 115 slope(), 116 intercept(), 117 amplitude(), 118 exponent(), 119 offset(), 120 tableValues() 121 }; 145 122 } 146 123 -
trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.h
r233122 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 75 76 ComponentTransferFunction transferFunction() const; 76 77 78 ComponentTransferType type() const { return m_type.currentValue(attributeOwnerProxy()); } 79 const SVGNumberListValues& tableValues() const { return m_tableValues.currentValue(attributeOwnerProxy()); } 80 float slope() const { return m_slope.currentValue(attributeOwnerProxy()); } 81 float intercept() const { return m_intercept.currentValue(attributeOwnerProxy()); } 82 float amplitude() const { return m_amplitude.currentValue(attributeOwnerProxy()); } 83 float exponent() const { return m_exponent.currentValue(attributeOwnerProxy()); } 84 float offset() const { return m_offset.currentValue(attributeOwnerProxy()); } 85 86 RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(attributeOwnerProxy()); } 87 RefPtr<SVGAnimatedNumberList> tableValuesAnimated() { return m_tableValues.animatedProperty(attributeOwnerProxy()); } 88 RefPtr<SVGAnimatedNumber> slopeAnimated() { return m_slope.animatedProperty(attributeOwnerProxy()); } 89 RefPtr<SVGAnimatedNumber> interceptAnimated() { return m_intercept.animatedProperty(attributeOwnerProxy()); } 90 RefPtr<SVGAnimatedNumber> amplitudeAnimated() { return m_amplitude.animatedProperty(attributeOwnerProxy()); } 91 RefPtr<SVGAnimatedNumber> exponentAnimated() { return m_exponent.animatedProperty(attributeOwnerProxy()); } 92 RefPtr<SVGAnimatedNumber> offsetAnimated() { return m_offset.animatedProperty(attributeOwnerProxy()); } 93 77 94 protected: 78 95 SVGComponentTransferFunctionElement(const QualifiedName&, Document&); 79 96 97 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGComponentTransferFunctionElement, SVGElement>; 98 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 99 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 100 static void registerAttributes(); 101 102 const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } 80 103 void parseAttribute(const QualifiedName&, const AtomicString&) override; 81 104 void svgAttributeChanged(const QualifiedName&) override; … … 84 107 85 108 private: 86 static bool isSupportedAttribute(const QualifiedName&); 87 88 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement) 89 DECLARE_ANIMATED_ENUMERATION(Type, type, ComponentTransferType) 90 DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues) 91 DECLARE_ANIMATED_NUMBER(Slope, slope) 92 DECLARE_ANIMATED_NUMBER(Intercept, intercept) 93 DECLARE_ANIMATED_NUMBER(Amplitude, amplitude) 94 DECLARE_ANIMATED_NUMBER(Exponent, exponent) 95 DECLARE_ANIMATED_NUMBER(Offset, offset) 96 END_DECLARE_ANIMATED_PROPERTIES 109 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 110 SVGAnimatedEnumerationAttribute<ComponentTransferType> m_type { FECOMPONENTTRANSFER_TYPE_IDENTITY }; 111 SVGAnimatedNumberListAttribute m_tableValues; 112 SVGAnimatedNumberAttribute m_slope { 1 }; 113 SVGAnimatedNumberAttribute m_intercept; 114 SVGAnimatedNumberAttribute m_amplitude { 1 }; 115 SVGAnimatedNumberAttribute m_exponent { 1 }; 116 SVGAnimatedNumberAttribute m_offset; 97 117 }; 98 118 -
trunk/Source/WebCore/svg/SVGCursorElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 34 35 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGCursorElement); 35 36 36 // Animated property definitions37 DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::xAttr, X, x)38 DEFINE_ANIMATED_LENGTH(SVGCursorElement, SVGNames::yAttr, Y, y)39 DEFINE_ANIMATED_STRING(SVGCursorElement, XLinkNames::hrefAttr, Href, href)40 DEFINE_ANIMATED_BOOLEAN(SVGCursorElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)41 42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement)43 REGISTER_LOCAL_ANIMATED_PROPERTY(x)44 REGISTER_LOCAL_ANIMATED_PROPERTY(y)45 REGISTER_LOCAL_ANIMATED_PROPERTY(href)46 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)47 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)48 END_REGISTER_ANIMATED_PROPERTIES49 50 37 inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document& document) 51 38 : SVGElement(tagName, document) 52 , m_x(LengthModeWidth) 53 , m_y(LengthModeHeight) 39 , SVGExternalResourcesRequired(this) 40 , SVGTests(this) 41 , SVGURIReference(this) 54 42 { 55 43 ASSERT(hasTagName(SVGNames::cursorTag)); 56 registerA nimatedPropertiesForSVGCursorElement();44 registerAttributes(); 57 45 } 58 46 … … 68 56 } 69 57 70 bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName)58 void SVGCursorElement::registerAttributes() 71 59 { 72 static const auto supportedAttributes = makeNeverDestroyed([] { 73 HashSet<QualifiedName> set; 74 SVGTests::addSupportedAttributes(set); 75 SVGExternalResourcesRequired::addSupportedAttributes(set); 76 SVGURIReference::addSupportedAttributes(set); 77 set.add({ SVGNames::xAttr.get(), SVGNames::yAttr.get() }); 78 return set; 79 }()); 80 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 60 auto& registry = attributeRegistry(); 61 if (!registry.isEmpty()) 62 return; 63 registry.registerAttribute<SVGNames::xAttr, &SVGCursorElement::m_x>(); 64 registry.registerAttribute<SVGNames::yAttr, &SVGCursorElement::m_y>(); 81 65 } 82 66 … … 86 70 87 71 if (name == SVGNames::xAttr) 88 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));72 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 89 73 else if (name == SVGNames::yAttr) 90 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));74 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 91 75 92 76 reportAttributeParsingError(parseError, name, value); … … 110 94 void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) 111 95 { 112 if (!isSupportedAttribute(attrName)) { 113 SVGElement::svgAttributeChanged(attrName); 96 if (isKnownAttribute(attrName)) { 97 InstanceInvalidationGuard guard(*this); 98 for (auto& client : m_clients) 99 client->cursorElementChanged(*this); 114 100 return; 115 101 } 116 102 117 InstanceInvalidationGuard guard(*this); 118 for (auto& client : m_clients) 119 client->cursorElementChanged(*this); 103 SVGElement::svgAttributeChanged(attrName); 120 104 } 121 105 … … 127 111 } 128 112 129 Ref<SVGStringList> SVGCursorElement::requiredFeatures()130 {131 return SVGTests::requiredFeatures(*this);132 113 } 133 134 Ref<SVGStringList> SVGCursorElement::requiredExtensions()135 {136 return SVGTests::requiredExtensions(*this);137 }138 139 Ref<SVGStringList> SVGCursorElement::systemLanguage()140 {141 return SVGTests::systemLanguage(*this);142 }143 144 } -
trunk/Source/WebCore/svg/SVGCursorElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 33 34 class CSSCursorImageValue; 34 35 35 class SVGCursorElement final : public SVGElement, public SVG Tests, public SVGExternalResourcesRequired, public SVGURIReference {36 class SVGCursorElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGTests, public SVGURIReference { 36 37 WTF_MAKE_ISO_ALLOCATED(SVGCursorElement); 37 38 public: … … 43 44 void removeClient(CSSCursorImageValue&); 44 45 45 // SVGTests 46 Ref<SVGStringList> requiredFeatures(); 47 Ref<SVGStringList> requiredExtensions(); 48 Ref<SVGStringList> systemLanguage(); 46 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 47 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 48 49 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 50 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 49 51 50 52 private: 51 53 SVGCursorElement(const QualifiedName&, Document&); 52 54 53 bool isValid() const final { return SVGTests::isValid(); } 55 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCursorElement, SVGElement, SVGExternalResourcesRequired, SVGTests, SVGURIReference>; 56 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 57 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 58 static void registerAttributes(); 54 59 55 static bool isSupportedAttribute(const QualifiedName&);60 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 56 61 void parseAttribute(const QualifiedName&, const AtomicString&) final; 57 62 void svgAttributeChanged(const QualifiedName&) final; 58 63 64 bool isValid() const final { return SVGTests::isValid(); } 59 65 bool rendererIsNeeded(const RenderStyle&) final { return false; } 60 66 61 67 void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; 62 68 63 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGCursorElement) 64 DECLARE_ANIMATED_LENGTH(X, x) 65 DECLARE_ANIMATED_LENGTH(Y, y) 66 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 67 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 68 END_DECLARE_ANIMATED_PROPERTIES 69 70 // SVGTests 71 void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } 72 void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } 73 void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } 74 69 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 70 SVGAnimatedLengthAttribute m_x { LengthModeWidth }; 71 SVGAnimatedLengthAttribute m_y { LengthModeHeight }; 75 72 HashSet<CSSCursorImageValue*> m_clients; 76 73 }; -
trunk/Source/WebCore/svg/SVGDefsElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 30 31 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGDefsElement); 31 32 32 // Animated property definitions33 DEFINE_ANIMATED_BOOLEAN(SVGDefsElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)34 35 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGDefsElement)36 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)37 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)38 END_REGISTER_ANIMATED_PROPERTIES39 40 33 inline SVGDefsElement::SVGDefsElement(const QualifiedName& tagName, Document& document) 41 34 : SVGGraphicsElement(tagName, document) 35 , SVGExternalResourcesRequired(this) 42 36 { 43 37 ASSERT(hasTagName(SVGNames::defsTag)); 44 registerAnimatedPropertiesForSVGDefsElement();45 38 } 46 39 -
trunk/Source/WebCore/svg/SVGDefsElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 35 36 SVGDefsElement(const QualifiedName&, Document&); 36 37 38 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGDefsElement, SVGGraphicsElement, SVGExternalResourcesRequired>; 39 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 40 37 41 bool isValid() const final; 38 42 bool supportsFocus() const final { return false; } … … 40 44 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 41 45 42 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGDefsElement) 43 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 44 END_DECLARE_ANIMATED_PROPERTIES 46 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 45 47 }; 46 48 -
trunk/Source/WebCore/svg/SVGElement.cpp
r234563 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2008-201 7Apple Inc. All rights reserved.4 * Copyright (C) 2008-2018 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 6 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> … … 64 64 65 65 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGElement); 66 67 // Animated property definitions68 DEFINE_ANIMATED_STRING(SVGElement, HTMLNames::classAttr, ClassName, className)69 70 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGElement)71 REGISTER_LOCAL_ANIMATED_PROPERTY(className)72 END_REGISTER_ANIMATED_PROPERTIES73 66 74 67 static NEVER_INLINE HashMap<AtomicStringImpl*, CSSPropertyID> createAttributeNameToCSSPropertyIDMap() … … 283 276 SVGElement::SVGElement(const QualifiedName& tagName, Document& document) 284 277 : StyledElement(tagName, document, CreateSVGElement) 285 { 286 registerAnimatedPropertiesForSVGElement(); 278 , SVGLangSpace(this) 279 { 280 registerAttributes(); 287 281 } 288 282 … … 459 453 } 460 454 455 void SVGElement::registerAttributes() 456 { 457 auto& registry = attributeRegistry(); 458 if (!registry.isEmpty()) 459 return; 460 registry.registerAttribute<HTMLNames::classAttr, &SVGElement::m_className>(); 461 } 462 461 463 void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 462 464 { 463 465 if (name == HTMLNames::classAttr) { 464 setClassNameBaseValue(value);466 m_className.setValue(value); 465 467 return; 466 468 } … … 485 487 Vector<AnimatedPropertyType> SVGElement::animatedPropertyTypesForAttribute(const QualifiedName& attributeName) 486 488 { 487 auto types = localAttributeToPropertyMap().types(attributeName);489 auto types = animatedTypes(attributeName); 488 490 if (!types.isEmpty()) 489 491 return types; … … 696 698 ASSERT(svgElement->elementData()->animatedSVGAttributesAreDirty()); 697 699 698 svgElement-> localAttributeToPropertyMap().synchronizeProperties(*svgElement);700 svgElement->synchronizeAttributes(); 699 701 svgElement->elementData()->setAnimatedSVGAttributesAreDirty(false); 700 702 } … … 709 711 synchronizeAllAnimatedSVGAttribute(nonConstThis); 710 712 else 711 nonConstThis->localAttributeToPropertyMap().synchronizeProperty(*nonConstThis, name); 712 } 713 714 void SVGElement::synchronizeRequiredFeatures(SVGElement* contextElement) 715 { 716 ASSERT(contextElement); 717 contextElement->synchronizeRequiredFeatures(); 718 } 719 720 void SVGElement::synchronizeRequiredExtensions(SVGElement* contextElement) 721 { 722 ASSERT(contextElement); 723 contextElement->synchronizeRequiredExtensions(); 724 } 725 726 void SVGElement::synchronizeSystemLanguage(SVGElement* contextElement) 727 { 728 ASSERT(contextElement); 729 contextElement->synchronizeSystemLanguage(); 713 nonConstThis->synchronizeAttribute(name); 730 714 } 731 715 … … 940 924 bool SVGElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attributeName) 941 925 { 942 return ! localAttributeToPropertyMap().types(attributeName).isEmpty();926 return !animatedTypes(attributeName).isEmpty(); 943 927 } 944 928 … … 955 939 if (propertyID > 0) 956 940 addPropertyToPresentationAttributeStyle(style, propertyID, value); 957 }958 959 bool SVGElement::isKnownAttribute(const QualifiedName& attrName)960 {961 return attrName == HTMLNames::idAttr;962 941 } 963 942 … … 986 965 return; 987 966 } 967 968 SVGLangSpace::svgAttributeChanged(attrName); 988 969 } 989 970 -
trunk/Source/WebCore/svg/SVGElement.h
r232178 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2009-201 6Apple Inc. All rights reserved.4 * Copyright (C) 2009-2018 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 6 6 * … … 24 24 25 25 #include "SVGAnimatedString.h" 26 #include "SVGAttributeOwnerProxy.h" 26 27 #include "SVGLangSpace.h" 27 28 #include "SVGLocatable.h" 28 29 #include "SVGNames.h" 29 30 #include "SVGParsingError.h" 30 #include "SVGPropertyInfo.h"31 31 #include "StyledElement.h" 32 32 #include <wtf/HashMap.h> … … 39 39 class DeprecatedCSSOMValue; 40 40 class Document; 41 class SVGAttributeToPropertyMap;42 41 class SVGDocumentExtensions; 43 42 class SVGElementRareData; … … 58 57 static bool isAnimatableCSSProperty(const QualifiedName&); 59 58 bool isPresentationAttributeWithSVGDOM(const QualifiedName&); 60 bool isKnownAttribute(const QualifiedName&);61 59 RefPtr<DeprecatedCSSOMValue> getPresentationAttribute(const String& name); 62 60 virtual bool supportsMarkers() const { return false; } … … 110 108 std::optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override; 111 109 112 static void synchronizeRequiredFeatures(SVGElement* contextElement);113 static void synchronizeRequiredExtensions(SVGElement* contextElement);114 static void synchronizeSystemLanguage(SVGElement* contextElement);115 116 virtual void synchronizeRequiredFeatures() { }117 virtual void synchronizeRequiredExtensions() { }118 virtual void synchronizeSystemLanguage() { }119 120 110 static QualifiedName animatableAttributeForName(const AtomicString&); 121 111 #ifndef NDEBUG … … 139 129 140 130 class InstanceUpdateBlocker; 131 class InstanceInvalidationGuard; 132 133 // The definition of the owner proxy has to match the class inheritance but we are interested in the SVG objects only. 134 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGElement, SVGLangSpace>; 135 static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 136 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 137 static void registerAttributes(); 138 139 // A super class will override this function to return its owner proxy. The attributes of the super class will 140 // be accessible through the registry of the owner proxy. 141 virtual const SVGAttributeOwnerProxy& attributeOwnerProxy() const { return m_attributeOwnerProxy; } 142 143 // Helper functions which return info for the super class' attributes. 144 void synchronizeAttribute(const QualifiedName& name) { attributeOwnerProxy().synchronizeAttribute(name); } 145 void synchronizeAttributes() { attributeOwnerProxy().synchronizeAttributes(); } 146 Vector<AnimatedPropertyType> animatedTypes(const QualifiedName& attributeName) const { return attributeOwnerProxy().animatedTypes(attributeName); } 147 RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGAttribute& attribute) const { return attributeOwnerProxy().lookupAnimatedProperty(attribute); } 148 RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(const SVGAttribute& attribute) { return attributeOwnerProxy().lookupOrCreateAnimatedProperty(attribute); } 149 Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(const QualifiedName& name) { return attributeOwnerProxy().lookupOrCreateAnimatedProperties(name); } 150 151 // These are needed for the RenderTree, animation and DOM. 152 const auto& className() const { return m_className.currentValue(attributeOwnerProxy()); } 153 auto classNameAnimated() { return m_className.animatedProperty(attributeOwnerProxy()); } 141 154 142 155 protected: … … 170 183 void willRecalcStyle(Style::Change) override; 171 184 172 class InstanceInvalidationGuard;173 174 185 private: 175 186 const RenderStyle* computedStyle(PseudoId = PseudoId::None) final; … … 190 201 HashSet<SVGElement*> m_elementsWithRelativeLengths; 191 202 192 BEGIN_DECLARE_ANIMATED_PROPERTIES_BASE(SVGElement) 193 DECLARE_ANIMATED_STRING(ClassName, className) 194 END_DECLARE_ANIMATED_PROPERTIES 195 203 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 204 SVGAnimatedStringAttribute m_className; 196 205 }; 197 206 -
trunk/Source/WebCore/svg/SVGEllipseElement.cpp
r231955 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGEllipseElement.h" 23 24 24 #include "FloatPoint.h"25 25 #include "RenderSVGEllipse.h" 26 #include "RenderSVGPath.h"27 26 #include "RenderSVGResource.h" 28 #include "SVGLengthValue.h"29 #include "SVGNames.h"30 27 #include <wtf/IsoMallocInlines.h> 31 28 … … 34 31 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGEllipseElement); 35 32 36 // Animated property definitions37 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cxAttr, Cx, cx)38 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cyAttr, Cy, cy)39 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx)40 DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry)41 DEFINE_ANIMATED_BOOLEAN(SVGEllipseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)42 43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement)44 REGISTER_LOCAL_ANIMATED_PROPERTY(cx)45 REGISTER_LOCAL_ANIMATED_PROPERTY(cy)46 REGISTER_LOCAL_ANIMATED_PROPERTY(rx)47 REGISTER_LOCAL_ANIMATED_PROPERTY(ry)48 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)49 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)50 END_REGISTER_ANIMATED_PROPERTIES51 52 33 inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document& document) 53 34 : SVGGeometryElement(tagName, document) 54 , m_cx(LengthModeWidth) 55 , m_cy(LengthModeHeight) 56 , m_rx(LengthModeWidth) 57 , m_ry(LengthModeHeight) 35 , SVGExternalResourcesRequired(this) 58 36 { 59 37 ASSERT(hasTagName(SVGNames::ellipseTag)); 60 registerA nimatedPropertiesForSVGEllipseElement();38 registerAttributes(); 61 39 } 62 40 … … 66 44 } 67 45 46 void SVGEllipseElement::registerAttributes() 47 { 48 auto& registry = attributeRegistry(); 49 if (!registry.isEmpty()) 50 return; 51 registry.registerAttribute<SVGNames::cxAttr, &SVGEllipseElement::m_cx>(); 52 registry.registerAttribute<SVGNames::cyAttr, &SVGEllipseElement::m_cy>(); 53 registry.registerAttribute<SVGNames::rxAttr, &SVGEllipseElement::m_rx>(); 54 registry.registerAttribute<SVGNames::ryAttr, &SVGEllipseElement::m_ry>(); 55 } 56 68 57 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 69 58 { … … 71 60 72 61 if (name == SVGNames::cxAttr) 73 setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));62 m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 74 63 else if (name == SVGNames::cyAttr) 75 setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));64 m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 76 65 else if (name == SVGNames::rxAttr) 77 setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));66 m_rx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 78 67 else if (name == SVGNames::ryAttr) 79 setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));68 m_ry.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 80 69 81 70 reportAttributeParsingError(parseError, name, value); 82 71 83 SVGG raphicsElement::parseAttribute(name, value);72 SVGGeometryElement::parseAttribute(name, value); 84 73 SVGExternalResourcesRequired::parseAttribute(name, value); 85 74 } … … 87 76 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) 88 77 { 89 if ( attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) {78 if (isKnownAttribute(attrName)) { 90 79 InstanceInvalidationGuard guard(*this); 91 80 invalidateSVGPresentationAttributeStyle(); … … 93 82 } 94 83 95 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { 96 if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) { 97 InstanceInvalidationGuard guard(*this); 98 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 99 } 100 return; 101 } 102 103 SVGGraphicsElement::svgAttributeChanged(attrName); 84 SVGGeometryElement::svgAttributeChanged(attrName); 85 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 104 86 } 105 87 -
trunk/Source/WebCore/svg/SVGEllipseElement.h
r231955 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 21 22 #pragma once 22 23 23 #include "SVGAnimatedBoolean.h"24 24 #include "SVGAnimatedLength.h" 25 25 #include "SVGExternalResourcesRequired.h" 26 26 #include "SVGGeometryElement.h" 27 #include "SVGNames.h" 27 28 28 29 namespace WebCore { … … 33 34 static Ref<SVGEllipseElement> create(const QualifiedName&, Document&); 34 35 36 const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); } 37 const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); } 38 const SVGLengthValue& rx() const { return m_rx.currentValue(attributeOwnerProxy()); } 39 const SVGLengthValue& ry() const { return m_ry.currentValue(attributeOwnerProxy()); } 40 41 RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); } 42 RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); } 43 RefPtr<SVGAnimatedLength> rxAnimated() { return m_rx.animatedProperty(attributeOwnerProxy()); } 44 RefPtr<SVGAnimatedLength> ryAnimated() { return m_ry.animatedProperty(attributeOwnerProxy()); } 45 35 46 private: 36 47 SVGEllipseElement(const QualifiedName&, Document&); 37 38 bool isValid() const final { return SVGTests::isValid(); }39 48 49 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGEllipseElement, SVGGeometryElement, SVGExternalResourcesRequired>; 50 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 51 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 52 static void registerAttributes(); 53 54 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 40 55 void parseAttribute(const QualifiedName&, const AtomicString&) final; 41 56 void svgAttributeChanged(const QualifiedName&) final; 42 57 58 bool isValid() const final { return SVGTests::isValid(); } 43 59 bool selfHasRelativeLengths() const final { return true; } 44 60 45 61 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 46 62 47 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGEllipseElement) 48 DECLARE_ANIMATED_LENGTH(Cx, cx) 49 DECLARE_ANIMATED_LENGTH(Cy, cy) 50 DECLARE_ANIMATED_LENGTH(Rx, rx) 51 DECLARE_ANIMATED_LENGTH(Ry, ry) 52 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 53 END_DECLARE_ANIMATED_PROPERTIES 63 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 64 SVGAnimatedLengthAttribute m_cx { LengthModeWidth }; 65 SVGAnimatedLengthAttribute m_cy { LengthModeHeight }; 66 SVGAnimatedLengthAttribute m_rx { LengthModeWidth }; 67 SVGAnimatedLengthAttribute m_ry { LengthModeHeight }; 54 68 }; 55 69 -
trunk/Source/WebCore/svg/SVGExternalResourcesRequired.cpp
r211591 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 27 28 namespace WebCore { 28 29 30 SVGExternalResourcesRequired::SVGExternalResourcesRequired(SVGElement* contextElement) 31 : m_contextElement(*contextElement) 32 { 33 registerAttributes(); 34 } 35 36 void SVGExternalResourcesRequired::registerAttributes() 37 { 38 auto& registry = attributeRegistry(); 39 if (!registry.isEmpty()) 40 return; 41 registry.registerAttribute<SVGNames::externalResourcesRequiredAttr, &SVGEllipseElement::m_externalResourcesRequired>(); 42 } 43 29 44 void SVGExternalResourcesRequired::parseAttribute(const QualifiedName& name, const AtomicString& value) 30 45 { 31 46 if (name == SVGNames::externalResourcesRequiredAttr) 32 setExternalResourcesRequired BaseValue(value == "true");47 setExternalResourcesRequired(value == "true"); 33 48 } 34 49 35 bool SVGExternalResourcesRequired::isKnownAttribute(const QualifiedName& attrName)50 void SVGExternalResourcesRequired::svgAttributeChanged(const QualifiedName& attrName) 36 51 { 37 return attrName == SVGNames::externalResourcesRequiredAttr; 52 if (!isKnownAttribute(attrName)) 53 return; 54 if (!m_contextElement.isConnected()) 55 return; 56 57 // Handle dynamic updates of the 'externalResourcesRequired' attribute. Only possible case: changing from 'true' to 'false' 58 // causes an immediate dispatch of the SVGLoad event. If the attribute value was 'false' before inserting the script element 59 // in the document, the SVGLoad event has already been dispatched. 60 if (!externalResourcesRequired() && !haveFiredLoadEvent() && !isParserInserted()) { 61 setHaveFiredLoadEvent(true); 62 63 ASSERT(m_contextElement.haveLoadedRequiredResources()); 64 m_contextElement.sendSVGLoadEventIfPossible(); 65 } 66 67 auto* renderer = m_contextElement.renderer(); 68 if (renderer && is<RenderSVGShape>(renderer)) { 69 SVGElement::InstanceInvalidationGuard guard(m_contextElement); 70 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 71 } 38 72 } 39 73 … … 43 77 } 44 78 45 bool SVGExternalResourcesRequired::handleAttributeChange(SVGElement* targetElement, const QualifiedName& attrName)79 void SVGExternalResourcesRequired::dispatchLoadEvent() 46 80 { 47 ASSERT(targetElement);48 if (!isKnownAttribute(attrName))49 return false;50 if (!targetElement->isConnected())51 return true;52 53 // Handle dynamic updates of the 'externalResourcesRequired' attribute. Only possible case: changing from 'true' to 'false'54 // causes an immediate dispatch of the SVGLoad event. If the attribute value was 'false' before inserting the script element55 // in the document, the SVGLoad event has already been dispatched.56 if (!externalResourcesRequiredBaseValue() && !haveFiredLoadEvent() && !isParserInserted()) {57 setHaveFiredLoadEvent(true);58 ASSERT(targetElement->haveLoadedRequiredResources());59 60 targetElement->sendSVGLoadEventIfPossible();61 }62 63 return true;64 }65 66 void SVGExternalResourcesRequired::dispatchLoadEvent(SVGElement* targetElement)67 {68 bool externalResourcesRequired = externalResourcesRequiredBaseValue();69 70 81 if (isParserInserted()) 71 ASSERT(externalResourcesRequired != haveFiredLoadEvent());82 ASSERT(externalResourcesRequired() != haveFiredLoadEvent()); 72 83 else if (haveFiredLoadEvent()) 73 84 return; … … 77 88 // SVG fires the SVGLoad event immediately after parsing the <script> element, if externalResourcesRequired 78 89 // is set to 'false', otherwise it dispatches the 'SVGLoad' event just after loading the remote resource. 79 if (!externalResourcesRequired )90 if (!externalResourcesRequired()) 80 91 return; 81 92 … … 84 95 // Dispatch SVGLoad event 85 96 setHaveFiredLoadEvent(true); 86 ASSERT( targetElement->haveLoadedRequiredResources());97 ASSERT(m_contextElement.haveLoadedRequiredResources()); 87 98 88 targetElement->sendSVGLoadEventIfPossible();99 m_contextElement.sendSVGLoadEventIfPossible(); 89 100 } 90 101 91 void SVGExternalResourcesRequired::insertedIntoDocument( SVGElement* targetElement)102 void SVGExternalResourcesRequired::insertedIntoDocument() 92 103 { 93 104 if (isParserInserted()) … … 95 106 96 107 // Eventually send SVGLoad event now for the dynamically inserted script element. 97 if (externalResourcesRequired BaseValue())108 if (externalResourcesRequired()) 98 109 return; 99 110 setHaveFiredLoadEvent(true); 100 targetElement->sendSVGLoadEventIfPossibleAsynchronously();111 m_contextElement.sendSVGLoadEventIfPossibleAsynchronously(); 101 112 } 102 113 … … 104 115 { 105 116 // A SVGLoad event has been fired by SVGElement::finishParsingChildren. 106 if (!externalResourcesRequired BaseValue())117 if (!externalResourcesRequired()) 107 118 setHaveFiredLoadEvent(true); 108 119 } … … 110 121 bool SVGExternalResourcesRequired::haveLoadedRequiredResources() const 111 122 { 112 return !externalResourcesRequired BaseValue() || haveFiredLoadEvent();123 return !externalResourcesRequired() || haveFiredLoadEvent(); 113 124 } 114 125 -
trunk/Source/WebCore/svg/SVGExternalResourcesRequired.h
r223728 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 22 23 23 24 #include "QualifiedName.h" 25 #include "SVGAttributeOwnerProxyImpl.h" 24 26 #include <wtf/HashSet.h> 25 27 … … 34 36 // FIXME: When implementing animVal support, make sure that animVal==baseVal for externalResourcesRequired 35 37 class SVGExternalResourcesRequired { 38 WTF_MAKE_NONCOPYABLE(SVGExternalResourcesRequired); 36 39 public: 37 40 virtual ~SVGExternalResourcesRequired() = default; 38 41 39 42 void parseAttribute(const QualifiedName&, const AtomicString&); 43 void svgAttributeChanged(const QualifiedName&); 40 44 41 static bool isKnownAttribute(const QualifiedName&);42 45 static void addSupportedAttributes(HashSet<QualifiedName>&); 43 46 44 bool handleAttributeChange(SVGElement*, const QualifiedName&); 47 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGExternalResourcesRequired>; 48 static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 49 50 auto externalResourcesRequiredAnimated() { return m_externalResourcesRequired.animatedProperty(attributeOwnerProxy()); } 51 52 bool externalResourcesRequired() const { return m_externalResourcesRequired.value(); } 53 void setExternalResourcesRequired(bool externalResourcesRequired) { m_externalResourcesRequired.setValue(externalResourcesRequired); } 45 54 46 55 protected: 47 // These types look a bit awkward, but have to match the generic types of the SVGAnimatedProperty macros.48 virtual void setExternalResourcesRequiredBaseValue(const bool&, const bool validValue = true) = 0; 49 virtual bool& externalResourcesRequiredBaseValue() const = 0;56 SVGExternalResourcesRequired(SVGElement* contextElement); 57 58 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 50 59 51 60 virtual void setHaveFiredLoadEvent(bool) { } … … 53 62 virtual bool haveFiredLoadEvent() const { return false; } 54 63 55 void dispatchLoadEvent( SVGElement*);56 void insertedIntoDocument( SVGElement*);64 void dispatchLoadEvent(); 65 void insertedIntoDocument(); 57 66 void finishParsingChildren(); 58 67 bool haveLoadedRequiredResources() const; 68 69 private: 70 static void registerAttributes(); 71 AttributeOwnerProxy attributeOwnerProxy() { return { *this, m_contextElement }; } 72 73 SVGElement& m_contextElement; 74 SVGAnimatedBooleanAttribute m_externalResourcesRequired; 59 75 }; 60 76 -
trunk/Source/WebCore/svg/SVGFEBlendElement.cpp
r234610 r234620 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 33 34 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEBlendElement); 34 35 35 // Animated property definitions36 DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::inAttr, In1, in1)37 DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::in2Attr, In2, in2)38 DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode, BlendMode)39 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEBlendElement)41 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)42 REGISTER_LOCAL_ANIMATED_PROPERTY(in2)43 REGISTER_LOCAL_ANIMATED_PROPERTY(mode)44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)45 END_REGISTER_ANIMATED_PROPERTIES46 47 36 inline SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document& document) 48 37 : SVGFilterPrimitiveStandardAttributes(tagName, document) 49 , m_mode(BlendMode::Normal)50 38 { 51 39 ASSERT(hasTagName(SVGNames::feBlendTag)); 52 registerA nimatedPropertiesForSVGFEBlendElement();40 registerAttributes(); 53 41 } 54 42 … … 56 44 { 57 45 return adoptRef(*new SVGFEBlendElement(tagName, document)); 46 } 47 48 void SVGFEBlendElement::registerAttributes() 49 { 50 auto& registry = attributeRegistry(); 51 if (!registry.isEmpty()) 52 return; 53 registry.registerAttribute<SVGNames::inAttr, &SVGFEBlendElement::m_in1>(); 54 registry.registerAttribute<SVGNames::in2Attr, &SVGFEBlendElement::m_in2>(); 55 registry.registerAttribute<SVGNames::modeAttr, BlendMode, &SVGFEBlendElement::m_mode>(); 58 56 } 59 57 … … 63 61 BlendMode mode = BlendMode::Normal; 64 62 if (parseBlendMode(value, mode)) 65 setModeBaseValue(mode);63 m_mode.setValue(mode); 66 64 return; 67 65 } 68 66 69 67 if (name == SVGNames::inAttr) { 70 setIn1BaseValue(value);68 m_in1.setValue(value); 71 69 return; 72 70 } 73 71 74 72 if (name == SVGNames::in2Attr) { 75 setIn2BaseValue(value);73 m_in2.setValue(value); 76 74 return; 77 75 } -
trunk/Source/WebCore/svg/SVGFEBlendElement.h
r234610 r234620 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 46 47 static Ref<SVGFEBlendElement> create(const QualifiedName&, Document&); 47 48 49 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 50 String in2() const { return m_in2.currentValue(attributeOwnerProxy()); } 51 BlendMode mode() const { return m_mode.currentValue(attributeOwnerProxy()); } 52 53 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 54 RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); } 55 RefPtr<SVGAnimatedEnumeration> modeAnimated() { return m_mode.animatedProperty(attributeOwnerProxy()); } 56 48 57 private: 49 58 SVGFEBlendElement(const QualifiedName&, Document&); 50 59 60 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEBlendElement, SVGFilterPrimitiveStandardAttributes>; 61 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 62 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 63 static void registerAttributes(); 64 65 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 51 66 void parseAttribute(const QualifiedName&, const AtomicString&) override; 67 void svgAttributeChanged(const QualifiedName&) override; 68 69 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 52 70 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; 53 void svgAttributeChanged(const QualifiedName&) override;54 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;55 71 56 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEBlendElement) 57 DECLARE_ANIMATED_STRING(In1, in1) 58 DECLARE_ANIMATED_STRING(In2, in2) 59 DECLARE_ANIMATED_ENUMERATION(Mode, mode, BlendMode) 60 END_DECLARE_ANIMATED_PROPERTIES 72 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 73 SVGAnimatedStringAttribute m_in1; 74 SVGAnimatedStringAttribute m_in2; 75 SVGAnimatedEnumerationAttribute<BlendMode> m_mode { BlendMode::Normal }; 61 76 }; 62 77 -
trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 31 32 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEColorMatrixElement); 32 33 33 // Animated property definitions34 DEFINE_ANIMATED_STRING(SVGFEColorMatrixElement, SVGNames::inAttr, In1, in1)35 DEFINE_ANIMATED_ENUMERATION(SVGFEColorMatrixElement, SVGNames::typeAttr, Type, type, ColorMatrixType)36 DEFINE_ANIMATED_NUMBER_LIST(SVGFEColorMatrixElement, SVGNames::valuesAttr, Values, values)37 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEColorMatrixElement)39 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)40 REGISTER_LOCAL_ANIMATED_PROPERTY(type)41 REGISTER_LOCAL_ANIMATED_PROPERTY(values)42 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)43 END_REGISTER_ANIMATED_PROPERTIES44 45 34 inline SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document& document) 46 35 : SVGFilterPrimitiveStandardAttributes(tagName, document) 47 , m_type(FECOLORMATRIX_TYPE_MATRIX)48 36 { 49 37 ASSERT(hasTagName(SVGNames::feColorMatrixTag)); 50 registerA nimatedPropertiesForSVGFEColorMatrixElement();38 registerAttributes(); 51 39 } 52 40 … … 56 44 } 57 45 46 void SVGFEColorMatrixElement::registerAttributes() 47 { 48 auto& registry = attributeRegistry(); 49 if (!registry.isEmpty()) 50 return; 51 registry.registerAttribute<SVGNames::inAttr, &SVGFEColorMatrixElement::m_in1>(); 52 registry.registerAttribute<SVGNames::typeAttr, ColorMatrixType, &SVGFEColorMatrixElement::m_type>(); 53 registry.registerAttribute<SVGNames::valuesAttr, &SVGFEColorMatrixElement::m_values>(); 54 } 55 58 56 void SVGFEColorMatrixElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 59 57 { … … 61 59 auto propertyValue = SVGPropertyTraits<ColorMatrixType>::fromString(value); 62 60 if (propertyValue > 0) 63 setTypeBaseValue(propertyValue);61 m_type.setValue(propertyValue); 64 62 return; 65 63 } 66 64 67 65 if (name == SVGNames::inAttr) { 68 setIn1BaseValue(value);66 m_in1.setValue(value); 69 67 return; 70 68 } … … 73 71 SVGNumberListValues newList; 74 72 newList.parse(value); 75 detachAnimatedValuesListWrappers(newList.size());76 setValuesBaseValue(newList);73 m_values.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 74 m_values.setValue(WTFMove(newList)); 77 75 return; 78 76 } -
trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h
r233122 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 70 71 static Ref<SVGFEColorMatrixElement> create(const QualifiedName&, Document&); 71 72 73 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 74 ColorMatrixType type() const { return m_type.currentValue(attributeOwnerProxy()); } 75 const SVGNumberListValues& values() const { return m_values.currentValue(attributeOwnerProxy()); } 76 77 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 78 RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(attributeOwnerProxy()); } 79 RefPtr<SVGAnimatedNumberList> valuesAnimated() { return m_values.animatedProperty(attributeOwnerProxy()); } 80 72 81 private: 73 82 SVGFEColorMatrixElement(const QualifiedName&, Document&); 74 83 84 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEColorMatrixElement, SVGFilterPrimitiveStandardAttributes>; 85 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 86 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 87 static void registerAttributes(); 88 89 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 75 90 void parseAttribute(const QualifiedName&, const AtomicString&) override; 91 void svgAttributeChanged(const QualifiedName&) override; 92 76 93 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 77 void svgAttributeChanged(const QualifiedName&) override;78 94 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 79 95 80 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEColorMatrixElement) 81 DECLARE_ANIMATED_STRING(In1, in1) 82 DECLARE_ANIMATED_ENUMERATION(Type, type, ColorMatrixType) 83 DECLARE_ANIMATED_NUMBER_LIST(Values, values) 84 END_DECLARE_ANIMATED_PROPERTIES 96 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 97 SVGAnimatedStringAttribute m_in1; 98 SVGAnimatedEnumerationAttribute<ColorMatrixType> m_type { FECOLORMATRIX_TYPE_MATRIX }; 99 SVGAnimatedNumberListAttribute m_values; 85 100 }; 86 101 -
trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 36 37 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEComponentTransferElement); 37 38 38 // Animated property definitions39 DEFINE_ANIMATED_STRING(SVGFEComponentTransferElement, SVGNames::inAttr, In1, in1)40 41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEComponentTransferElement)42 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)43 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)44 END_REGISTER_ANIMATED_PROPERTIES45 46 39 inline SVGFEComponentTransferElement::SVGFEComponentTransferElement(const QualifiedName& tagName, Document& document) 47 40 : SVGFilterPrimitiveStandardAttributes(tagName, document) 48 41 { 49 42 ASSERT(hasTagName(SVGNames::feComponentTransferTag)); 50 registerA nimatedPropertiesForSVGFEComponentTransferElement();43 registerAttributes(); 51 44 } 52 45 … … 56 49 } 57 50 51 void SVGFEComponentTransferElement::registerAttributes() 52 { 53 auto& registry = attributeRegistry(); 54 if (!registry.isEmpty()) 55 return; 56 registry.registerAttribute<SVGNames::inAttr, &SVGFEComponentTransferElement::m_in1>(); 57 } 58 58 59 void SVGFEComponentTransferElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 59 60 { 60 61 if (name == SVGNames::inAttr) { 61 setIn1BaseValue(value);62 m_in1.setValue(value); 62 63 return; 63 64 } -
trunk/Source/WebCore/svg/SVGFEComponentTransferElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 30 31 static Ref<SVGFEComponentTransferElement> create(const QualifiedName&, Document&); 31 32 33 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 34 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 35 32 36 private: 33 37 SVGFEComponentTransferElement(const QualifiedName&, Document&); 34 38 39 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEComponentTransferElement, SVGFilterPrimitiveStandardAttributes>; 40 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 41 static void registerAttributes(); 42 35 43 // FIXME: svgAttributeChanged missing. 44 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 36 45 void parseAttribute(const QualifiedName&, const AtomicString&) override; 46 37 47 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 38 48 39 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEComponentTransferElement) 40 DECLARE_ANIMATED_STRING(In1, in1) 41 END_DECLARE_ANIMATED_PROPERTIES 49 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 50 SVGAnimatedStringAttribute m_in1; 42 51 }; 43 52 -
trunk/Source/WebCore/svg/SVGFECompositeElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 31 32 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFECompositeElement); 32 33 33 // Animated property definitions34 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::inAttr, In1, in1)35 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::in2Attr, In2, in2)36 DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, SVGOperator, svgOperator, CompositeOperationType)37 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k1Attr, K1, k1)38 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k2Attr, K2, k2)39 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k3Attr, K3, k3)40 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k4Attr, K4, k4)41 42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFECompositeElement)43 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)44 REGISTER_LOCAL_ANIMATED_PROPERTY(in2)45 REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator)46 REGISTER_LOCAL_ANIMATED_PROPERTY(k1)47 REGISTER_LOCAL_ANIMATED_PROPERTY(k2)48 REGISTER_LOCAL_ANIMATED_PROPERTY(k3)49 REGISTER_LOCAL_ANIMATED_PROPERTY(k4)50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)51 END_REGISTER_ANIMATED_PROPERTIES52 53 34 inline SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document& document) 54 35 : SVGFilterPrimitiveStandardAttributes(tagName, document) 55 , m_svgOperator(FECOMPOSITE_OPERATOR_OVER)56 36 { 57 37 ASSERT(hasTagName(SVGNames::feCompositeTag)); 58 registerA nimatedPropertiesForSVGFECompositeElement();38 registerAttributes(); 59 39 } 60 40 … … 64 44 } 65 45 46 void SVGFECompositeElement::registerAttributes() 47 { 48 auto& registry = attributeRegistry(); 49 if (!registry.isEmpty()) 50 return; 51 registry.registerAttribute<SVGNames::inAttr, &SVGFECompositeElement::m_in1>(); 52 registry.registerAttribute<SVGNames::in2Attr, &SVGFECompositeElement::m_in2>(); 53 registry.registerAttribute<SVGNames::operatorAttr, CompositeOperationType, &SVGFECompositeElement::m_svgOperator>(); 54 registry.registerAttribute<SVGNames::k1Attr, &SVGFECompositeElement::m_k1>(); 55 registry.registerAttribute<SVGNames::k2Attr, &SVGFECompositeElement::m_k2>(); 56 registry.registerAttribute<SVGNames::k3Attr, &SVGFECompositeElement::m_k3>(); 57 registry.registerAttribute<SVGNames::k4Attr, &SVGFECompositeElement::m_k4>(); 58 } 59 66 60 void SVGFECompositeElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 67 61 { … … 69 63 CompositeOperationType propertyValue = SVGPropertyTraits<CompositeOperationType>::fromString(value); 70 64 if (propertyValue > 0) 71 setSVGOperatorBaseValue(propertyValue);65 m_svgOperator.setValue(propertyValue); 72 66 return; 73 67 } 74 68 75 69 if (name == SVGNames::inAttr) { 76 setIn1BaseValue(value);70 m_in1.setValue(value); 77 71 return; 78 72 } 79 73 80 74 if (name == SVGNames::in2Attr) { 81 setIn2BaseValue(value);75 m_in2.setValue(value); 82 76 return; 83 77 } 84 78 85 79 if (name == SVGNames::k1Attr) { 86 setK1BaseValue(value.toFloat());80 m_k1.setValue(value.toFloat()); 87 81 return; 88 82 } 89 83 90 84 if (name == SVGNames::k2Attr) { 91 setK2BaseValue(value.toFloat());85 m_k2.setValue(value.toFloat()); 92 86 return; 93 87 } 94 88 95 89 if (name == SVGNames::k3Attr) { 96 setK3BaseValue(value.toFloat());90 m_k3.setValue(value.toFloat()); 97 91 return; 98 92 } 99 93 100 94 if (name == SVGNames::k4Attr) { 101 setK4BaseValue(value.toFloat());95 m_k4.setValue(value.toFloat()); 102 96 return; 103 97 } -
trunk/Source/WebCore/svg/SVGFECompositeElement.h
r233122 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 85 86 static Ref<SVGFECompositeElement> create(const QualifiedName&, Document&); 86 87 88 String in1() { return m_in1.currentValue(attributeOwnerProxy()); } 89 String in2() { return m_in2.currentValue(attributeOwnerProxy()); } 90 CompositeOperationType svgOperator() const { return m_svgOperator.currentValue(attributeOwnerProxy()); } 91 float k1() const { return m_k1.currentValue(attributeOwnerProxy()); } 92 float k2() const { return m_k2.currentValue(attributeOwnerProxy()); } 93 float k3() const { return m_k3.currentValue(attributeOwnerProxy()); } 94 float k4() const { return m_k4.currentValue(attributeOwnerProxy()); } 95 96 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 97 RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); } 98 RefPtr<SVGAnimatedEnumeration> svgOperatorAnimated() { return m_svgOperator.animatedProperty(attributeOwnerProxy()); } 99 RefPtr<SVGAnimatedNumber> k1Animated() { return m_k1.animatedProperty(attributeOwnerProxy()); } 100 RefPtr<SVGAnimatedNumber> k2Animated() { return m_k2.animatedProperty(attributeOwnerProxy()); } 101 RefPtr<SVGAnimatedNumber> k3Animated() { return m_k3.animatedProperty(attributeOwnerProxy()); } 102 RefPtr<SVGAnimatedNumber> k4Animated() { return m_k4.animatedProperty(attributeOwnerProxy()); } 103 87 104 private: 88 105 SVGFECompositeElement(const QualifiedName&, Document&); 89 106 107 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFECompositeElement, SVGFilterPrimitiveStandardAttributes>; 108 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 109 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 110 static void registerAttributes(); 111 112 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 90 113 void parseAttribute(const QualifiedName&, const AtomicString&) override; 114 void svgAttributeChanged(const QualifiedName&) override; 115 91 116 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 92 void svgAttributeChanged(const QualifiedName&) override;93 117 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 94 118 95 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFECompositeElement) 96 DECLARE_ANIMATED_STRING(In1, in1) 97 DECLARE_ANIMATED_STRING(In2, in2) 98 DECLARE_ANIMATED_ENUMERATION(SVGOperator, svgOperator, CompositeOperationType) 99 DECLARE_ANIMATED_NUMBER(K1, k1) 100 DECLARE_ANIMATED_NUMBER(K2, k2) 101 DECLARE_ANIMATED_NUMBER(K3, k3) 102 DECLARE_ANIMATED_NUMBER(K4, k4) 103 END_DECLARE_ANIMATED_PROPERTIES 119 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 120 SVGAnimatedStringAttribute m_in1; 121 SVGAnimatedStringAttribute m_in2; 122 SVGAnimatedEnumerationAttribute<CompositeOperationType> m_svgOperator { FECOMPOSITE_OPERATOR_OVER }; 123 SVGAnimatedNumberAttribute m_k1; 124 SVGAnimatedNumberAttribute m_k2; 125 SVGAnimatedNumberAttribute m_k3; 126 SVGAnimatedNumberAttribute m_k4; 104 127 }; 105 128 -
trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp
r229694 r234620 1 1 /* 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 35 36 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEConvolveMatrixElement); 36 37 37 // Animated property definitions38 DEFINE_ANIMATED_STRING(SVGFEConvolveMatrixElement, SVGNames::inAttr, In1, in1)39 DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderXIdentifier(), OrderX, orderX)40 DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderYIdentifier(), OrderY, orderY)41 DEFINE_ANIMATED_NUMBER_LIST(SVGFEConvolveMatrixElement, SVGNames::kernelMatrixAttr, KernelMatrix, kernelMatrix)42 DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::divisorAttr, Divisor, divisor)43 DEFINE_ANIMATED_NUMBER(SVGFEConvolveMatrixElement, SVGNames::biasAttr, Bias, bias)44 DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, TargetX, targetX)45 DEFINE_ANIMATED_INTEGER(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, TargetY, targetY)46 DEFINE_ANIMATED_ENUMERATION(SVGFEConvolveMatrixElement, SVGNames::edgeModeAttr, EdgeMode, edgeMode, EdgeModeType)47 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX)48 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEConvolveMatrixElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY)49 DEFINE_ANIMATED_BOOLEAN(SVGFEConvolveMatrixElement, SVGNames::preserveAlphaAttr, PreserveAlpha, preserveAlpha)50 51 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement)52 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)53 REGISTER_LOCAL_ANIMATED_PROPERTY(orderX)54 REGISTER_LOCAL_ANIMATED_PROPERTY(orderY)55 REGISTER_LOCAL_ANIMATED_PROPERTY(kernelMatrix)56 REGISTER_LOCAL_ANIMATED_PROPERTY(divisor)57 REGISTER_LOCAL_ANIMATED_PROPERTY(bias)58 REGISTER_LOCAL_ANIMATED_PROPERTY(targetX)59 REGISTER_LOCAL_ANIMATED_PROPERTY(targetY)60 REGISTER_LOCAL_ANIMATED_PROPERTY(edgeMode)61 REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX)62 REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY)63 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAlpha)64 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)65 END_REGISTER_ANIMATED_PROPERTIES66 67 38 inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const QualifiedName& tagName, Document& document) 68 39 : SVGFilterPrimitiveStandardAttributes(tagName, document) 69 , m_edgeMode(EDGEMODE_DUPLICATE)70 40 { 71 41 ASSERT(hasTagName(SVGNames::feConvolveMatrixTag)); 72 registerA nimatedPropertiesForSVGFEConvolveMatrixElement();42 registerAttributes(); 73 43 } 74 44 … … 102 72 } 103 73 74 void SVGFEConvolveMatrixElement::registerAttributes() 75 { 76 auto& registry = attributeRegistry(); 77 if (!registry.isEmpty()) 78 return; 79 registry.registerAttribute<SVGNames::inAttr, &SVGFEConvolveMatrixElement::m_in1>(); 80 registry.registerAttribute<SVGNames::orderAttr, 81 &SVGFEConvolveMatrixElement::orderXIdentifier, &SVGFEConvolveMatrixElement::m_orderX, 82 &SVGFEConvolveMatrixElement::orderYIdentifier, &SVGFEConvolveMatrixElement::m_orderY>(); 83 registry.registerAttribute<SVGNames::kernelMatrixAttr, &SVGFEConvolveMatrixElement::m_kernelMatrix>(); 84 registry.registerAttribute<SVGNames::divisorAttr, &SVGFEConvolveMatrixElement::m_divisor>(); 85 registry.registerAttribute<SVGNames::biasAttr, &SVGFEConvolveMatrixElement::m_bias>(); 86 registry.registerAttribute<SVGNames::targetXAttr, &SVGFEConvolveMatrixElement::m_targetX>(); 87 registry.registerAttribute<SVGNames::targetYAttr, &SVGFEConvolveMatrixElement::m_targetY>(); 88 registry.registerAttribute<SVGNames::edgeModeAttr, EdgeModeType, &SVGFEConvolveMatrixElement::m_edgeMode>(); 89 registry.registerAttribute<SVGNames::kernelUnitLengthAttr, 90 &SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthX, 91 &SVGFEConvolveMatrixElement::kernelUnitLengthYIdentifier, &SVGFEConvolveMatrixElement::m_kernelUnitLengthY>(); 92 registry.registerAttribute<SVGNames::preserveAlphaAttr, &SVGFEConvolveMatrixElement::m_preserveAlpha>(); 93 } 94 104 95 void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 105 96 { 106 97 if (name == SVGNames::inAttr) { 107 setIn1BaseValue(value);98 m_in1.setValue(value); 108 99 return; 109 100 } … … 112 103 float x, y; 113 104 if (parseNumberOptionalNumber(value, x, y) && x >= 1 && y >= 1) { 114 setOrderXBaseValue(x);115 setOrderYBaseValue(y);105 m_orderX.setValue(x); 106 m_orderY.setValue(y); 116 107 } else 117 108 document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing order=\"" + value + "\". Filtered element will not be displayed."); … … 122 113 EdgeModeType propertyValue = SVGPropertyTraits<EdgeModeType>::fromString(value); 123 114 if (propertyValue > 0) 124 setEdgeModeBaseValue(propertyValue);115 m_edgeMode.setValue(propertyValue); 125 116 else 126 117 document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing edgeMode=\"" + value + "\". Filtered element will not be displayed."); … … 131 122 SVGNumberListValues newList; 132 123 newList.parse(value); 133 detachAnimatedKernelMatrixListWrappers(newList.size());134 setKernelMatrixBaseValue(newList);124 m_kernelMatrix.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 125 m_kernelMatrix.setValue(WTFMove(newList)); 135 126 return; 136 127 } … … 139 130 float divisor = value.toFloat(); 140 131 if (divisor) 141 setDivisorBaseValue(divisor);132 m_divisor.setValue(divisor); 142 133 else 143 134 document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing divisor=\"" + value + "\". Filtered element will not be displayed."); … … 146 137 147 138 if (name == SVGNames::biasAttr) { 148 setBiasBaseValue(value.toFloat());139 m_bias.setValue(value.toFloat()); 149 140 return; 150 141 } 151 142 152 143 if (name == SVGNames::targetXAttr) { 153 setTargetXBaseValue(value.string().toUIntStrict());144 m_targetX.setValue(value.string().toUIntStrict()); 154 145 return; 155 146 } 156 147 157 148 if (name == SVGNames::targetYAttr) { 158 setTargetYBaseValue(value.string().toUIntStrict());149 m_targetY.setValue(value.string().toUIntStrict()); 159 150 return; 160 151 } … … 163 154 float x, y; 164 155 if (parseNumberOptionalNumber(value, x, y) && x > 0 && y > 0) { 165 setKernelUnitLengthXBaseValue(x);166 setKernelUnitLengthYBaseValue(y);156 m_kernelUnitLengthX.setValue(x); 157 m_kernelUnitLengthY.setValue(y); 167 158 } else 168 159 document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing kernelUnitLength=\"" + value + "\". Filtered element will not be displayed."); … … 172 163 if (name == SVGNames::preserveAlphaAttr) { 173 164 if (value == "true") 174 setPreserveAlphaBaseValue(true);165 m_preserveAlpha.setValue(true); 175 166 else if (value == "false") 176 setPreserveAlphaBaseValue(false);167 m_preserveAlpha.setValue(false); 177 168 else 178 169 document().accessSVGExtensions().reportWarning("feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value + "\". Filtered element will not be displayed."); … … 193 184 return convolveMatrix->setBias(bias()); 194 185 if (attrName == SVGNames::targetXAttr) 195 return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY()));186 return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); 196 187 if (attrName == SVGNames::targetYAttr) 197 return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY()));188 return convolveMatrix->setTargetOffset(IntPoint(targetX(), targetY())); 198 189 if (attrName == SVGNames::kernelUnitLengthAttr) 199 return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY()));190 return convolveMatrix->setKernelUnitLength(FloatPoint(kernelUnitLengthX(), kernelUnitLengthY())); 200 191 if (attrName == SVGNames::preserveAlphaAttr) 201 192 return convolveMatrix->setPreserveAlpha(preserveAlpha()); … … 207 198 void SVGFEConvolveMatrixElement::setOrder(float x, float y) 208 199 { 209 setOrderXBaseValue(x);210 setOrderYBaseValue(y);200 m_orderX.setValue(x); 201 m_orderY.setValue(y); 211 202 invalidate(); 212 203 } … … 214 205 void SVGFEConvolveMatrixElement::setKernelUnitLength(float x, float y) 215 206 { 216 setKernelUnitLengthXBaseValue(x);217 setKernelUnitLengthYBaseValue(y);207 m_kernelUnitLengthX.setValue(x); 208 m_kernelUnitLengthY.setValue(y); 218 209 invalidate(); 219 210 } -
trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h
r233122 r234620 1 1 /* 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 33 34 struct SVGPropertyTraits<EdgeModeType> { 34 35 static unsigned highestEnumValue() { return EDGEMODE_NONE; } 36 static EdgeModeType initialValue() { return EDGEMODE_NONE; } 35 37 36 38 static String toString(EdgeModeType type) … … 71 73 void setKernelUnitLength(float kernelUnitLengthX, float kernelUnitLengthY); 72 74 75 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 76 int orderX() const { return m_orderX.currentValue(attributeOwnerProxy()); } 77 int orderY() const { return m_orderY.currentValue(attributeOwnerProxy()); } 78 const SVGNumberListValues& kernelMatrix() const { return m_kernelMatrix.currentValue(attributeOwnerProxy()); } 79 float divisor() const { return m_divisor.currentValue(attributeOwnerProxy()); } 80 float bias() const { return m_bias.currentValue(attributeOwnerProxy()); } 81 int targetX() const { return m_targetX.currentValue(attributeOwnerProxy()); } 82 int targetY() const { return m_targetY.currentValue(attributeOwnerProxy()); } 83 EdgeModeType edgeMode() const { return m_edgeMode.currentValue(attributeOwnerProxy()); } 84 float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); } 85 float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); } 86 bool preserveAlpha() const { return m_preserveAlpha.currentValue(attributeOwnerProxy()); } 87 88 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 89 RefPtr<SVGAnimatedInteger> orderXAnimated() { return m_orderX.animatedProperty(attributeOwnerProxy()); } 90 RefPtr<SVGAnimatedInteger> orderYAnimated() { return m_orderY.animatedProperty(attributeOwnerProxy()); } 91 RefPtr<SVGAnimatedNumberList> kernelMatrixAnimated() { return m_kernelMatrix.animatedProperty(attributeOwnerProxy()); } 92 RefPtr<SVGAnimatedNumber> divisorAnimated() { return m_divisor.animatedProperty(attributeOwnerProxy()); } 93 RefPtr<SVGAnimatedNumber> biasAnimated() { return m_bias.animatedProperty(attributeOwnerProxy()); } 94 RefPtr<SVGAnimatedInteger> targetXAnimated() { return m_targetX.animatedProperty(attributeOwnerProxy()); } 95 RefPtr<SVGAnimatedInteger> targetYAnimated() { return m_targetY.animatedProperty(attributeOwnerProxy()); } 96 RefPtr<SVGAnimatedEnumeration> edgeModeAnimated() { return m_edgeMode.animatedProperty(attributeOwnerProxy()); } 97 RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); } 98 RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); } 99 RefPtr<SVGAnimatedBoolean> preserveAlphaAnimated() { return m_preserveAlpha.animatedProperty(attributeOwnerProxy()); } 100 73 101 private: 74 102 SVGFEConvolveMatrixElement(const QualifiedName&, Document&); 75 103 104 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEConvolveMatrixElement, SVGFilterPrimitiveStandardAttributes>; 105 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 106 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 107 static void registerAttributes(); 108 109 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 76 110 void parseAttribute(const QualifiedName&, const AtomicString&) override; 111 void svgAttributeChanged(const QualifiedName&) override; 112 77 113 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 78 void svgAttributeChanged(const QualifiedName&) override;79 114 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 80 115 … … 84 119 static const AtomicString& kernelUnitLengthYIdentifier(); 85 120 86 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement) 87 DECLARE_ANIMATED_STRING(In1, in1) 88 DECLARE_ANIMATED_INTEGER(OrderX, orderX) 89 DECLARE_ANIMATED_INTEGER(OrderY, orderY) 90 DECLARE_ANIMATED_NUMBER_LIST(KernelMatrix, kernelMatrix) 91 DECLARE_ANIMATED_NUMBER(Divisor, divisor) 92 DECLARE_ANIMATED_NUMBER(Bias, bias) 93 DECLARE_ANIMATED_INTEGER(TargetX, targetX) 94 DECLARE_ANIMATED_INTEGER(TargetY, targetY) 95 DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode, EdgeModeType) 96 DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) 97 DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) 98 DECLARE_ANIMATED_BOOLEAN(PreserveAlpha, preserveAlpha) 99 END_DECLARE_ANIMATED_PROPERTIES 121 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 122 SVGAnimatedStringAttribute m_in1; 123 SVGAnimatedIntegerAttribute m_orderX; 124 SVGAnimatedIntegerAttribute m_orderY; 125 SVGAnimatedNumberListAttribute m_kernelMatrix; 126 SVGAnimatedNumberAttribute m_divisor; 127 SVGAnimatedNumberAttribute m_bias; 128 SVGAnimatedIntegerAttribute m_targetX; 129 SVGAnimatedIntegerAttribute m_targetY; 130 SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { EDGEMODE_DUPLICATE }; 131 SVGAnimatedNumberAttribute m_kernelUnitLengthX; 132 SVGAnimatedNumberAttribute m_kernelUnitLengthY; 133 SVGAnimatedBooleanAttribute m_preserveAlpha; 100 134 }; 101 135 -
trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
r231153 r234620 1 1 /* 2 2 * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 34 35 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEDiffuseLightingElement); 35 36 36 // Animated property definitions37 DEFINE_ANIMATED_STRING(SVGFEDiffuseLightingElement, SVGNames::inAttr, In1, in1)38 DEFINE_ANIMATED_NUMBER(SVGFEDiffuseLightingElement, SVGNames::diffuseConstantAttr, DiffuseConstant, diffuseConstant)39 DEFINE_ANIMATED_NUMBER(SVGFEDiffuseLightingElement, SVGNames::surfaceScaleAttr, SurfaceScale, surfaceScale)40 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX)41 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDiffuseLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY)42 43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDiffuseLightingElement)44 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)45 REGISTER_LOCAL_ANIMATED_PROPERTY(diffuseConstant)46 REGISTER_LOCAL_ANIMATED_PROPERTY(surfaceScale)47 REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX)48 REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY)49 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)50 END_REGISTER_ANIMATED_PROPERTIES51 52 37 inline SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const QualifiedName& tagName, Document& document) 53 38 : SVGFilterPrimitiveStandardAttributes(tagName, document) 54 , m_diffuseConstant(1)55 , m_surfaceScale(1)56 39 { 57 40 ASSERT(hasTagName(SVGNames::feDiffuseLightingTag)); 58 registerA nimatedPropertiesForSVGFEDiffuseLightingElement();41 registerAttributes(); 59 42 } 60 43 … … 76 59 } 77 60 61 void SVGFEDiffuseLightingElement::registerAttributes() 62 { 63 auto& registry = attributeRegistry(); 64 if (!registry.isEmpty()) 65 return; 66 registry.registerAttribute<SVGNames::inAttr, &SVGFEDiffuseLightingElement::m_in1>(); 67 registry.registerAttribute<SVGNames::diffuseConstantAttr, &SVGFEDiffuseLightingElement::m_diffuseConstant>(); 68 registry.registerAttribute<SVGNames::surfaceScaleAttr, &SVGFEDiffuseLightingElement::m_surfaceScale>(); 69 registry.registerAttribute<SVGNames::kernelUnitLengthAttr, 70 &SVGFEDiffuseLightingElement::kernelUnitLengthXIdentifier, &SVGFEDiffuseLightingElement::m_kernelUnitLengthX, 71 &SVGFEDiffuseLightingElement::kernelUnitLengthYIdentifier, &SVGFEDiffuseLightingElement::m_kernelUnitLengthY>(); 72 } 73 78 74 void SVGFEDiffuseLightingElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 79 75 { 80 76 if (name == SVGNames::inAttr) { 81 setIn1BaseValue(value);77 m_in1.setValue(value); 82 78 return; 83 79 } 84 80 85 81 if (name == SVGNames::surfaceScaleAttr) { 86 setSurfaceScaleBaseValue(value.toFloat());82 m_surfaceScale.setValue(value.toFloat()); 87 83 return; 88 84 } 89 85 90 86 if (name == SVGNames::diffuseConstantAttr) { 91 setDiffuseConstantBaseValue(value.toFloat());87 m_diffuseConstant.setValue(value.toFloat()); 92 88 return; 93 89 } … … 96 92 float x, y; 97 93 if (parseNumberOptionalNumber(value, x, y)) { 98 setKernelUnitLengthXBaseValue(x);99 setKernelUnitLengthYBaseValue(y);94 m_kernelUnitLengthX.setValue(x); 95 m_kernelUnitLengthY.setValue(y); 100 96 } 101 97 return; -
trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.h
r229694 r234620 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 36 37 void lightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&); 37 38 39 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 40 float diffuseConstant() const { return m_diffuseConstant.currentValue(attributeOwnerProxy()); } 41 float surfaceScale() const { return m_surfaceScale.currentValue(attributeOwnerProxy()); } 42 float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); } 43 float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); } 44 45 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 46 RefPtr<SVGAnimatedNumber> diffuseConstantAnimated() { return m_diffuseConstant.animatedProperty(attributeOwnerProxy()); } 47 RefPtr<SVGAnimatedNumber> surfaceScaleAnimated() { return m_surfaceScale.animatedProperty(attributeOwnerProxy()); } 48 RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); } 49 RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); } 50 38 51 private: 39 52 SVGFEDiffuseLightingElement(const QualifiedName&, Document&); 40 53 54 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEDiffuseLightingElement, SVGFilterPrimitiveStandardAttributes>; 55 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 56 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 57 static void registerAttributes(); 58 59 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 41 60 void parseAttribute(const QualifiedName&, const AtomicString&) override; 61 void svgAttributeChanged(const QualifiedName&) override; 62 42 63 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 43 void svgAttributeChanged(const QualifiedName&) override;44 64 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 45 65 … … 47 67 static const AtomicString& kernelUnitLengthYIdentifier(); 48 68 49 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDiffuseLightingElement) 50 DECLARE_ANIMATED_STRING(In1, in1) 51 DECLARE_ANIMATED_NUMBER(DiffuseConstant, diffuseConstant) 52 DECLARE_ANIMATED_NUMBER(SurfaceScale, surfaceScale) 53 DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) 54 DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) 55 END_DECLARE_ANIMATED_PROPERTIES 69 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 70 SVGAnimatedStringAttribute m_in1; 71 SVGAnimatedNumberAttribute m_diffuseConstant { 1 }; 72 SVGAnimatedNumberAttribute m_surfaceScale { 1 }; 73 SVGAnimatedNumberAttribute m_kernelUnitLengthX; 74 SVGAnimatedNumberAttribute m_kernelUnitLengthY; 56 75 }; 57 76 -
trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp
r229694 r234620 1 1 /* 2 2 * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 30 31 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEDisplacementMapElement); 31 32 32 // Animated property definitions33 DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::inAttr, In1, in1)34 DEFINE_ANIMATED_STRING(SVGFEDisplacementMapElement, SVGNames::in2Attr, In2, in2)35 DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::xChannelSelectorAttr, XChannelSelector, xChannelSelector, ChannelSelectorType)36 DEFINE_ANIMATED_ENUMERATION(SVGFEDisplacementMapElement, SVGNames::yChannelSelectorAttr, YChannelSelector, yChannelSelector, ChannelSelectorType)37 DEFINE_ANIMATED_NUMBER(SVGFEDisplacementMapElement, SVGNames::scaleAttr, Scale, scale)38 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement)40 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)41 REGISTER_LOCAL_ANIMATED_PROPERTY(in2)42 REGISTER_LOCAL_ANIMATED_PROPERTY(xChannelSelector)43 REGISTER_LOCAL_ANIMATED_PROPERTY(yChannelSelector)44 REGISTER_LOCAL_ANIMATED_PROPERTY(scale)45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)46 END_REGISTER_ANIMATED_PROPERTIES47 48 33 inline SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const QualifiedName& tagName, Document& document) 49 34 : SVGFilterPrimitiveStandardAttributes(tagName, document) 50 , m_xChannelSelector(CHANNEL_A)51 , m_yChannelSelector(CHANNEL_A)52 35 { 53 36 ASSERT(hasTagName(SVGNames::feDisplacementMapTag)); 54 registerA nimatedPropertiesForSVGFEDisplacementMapElement();37 registerAttributes(); 55 38 } 56 39 … … 60 43 } 61 44 45 void SVGFEDisplacementMapElement::registerAttributes() 46 { 47 auto& registry = attributeRegistry(); 48 if (!registry.isEmpty()) 49 return; 50 registry.registerAttribute<SVGNames::inAttr, &SVGFEDisplacementMapElement::m_in1>(); 51 registry.registerAttribute<SVGNames::in2Attr, &SVGFEDisplacementMapElement::m_in2>(); 52 registry.registerAttribute<SVGNames::xChannelSelectorAttr, ChannelSelectorType, &SVGFEDisplacementMapElement::m_xChannelSelector>(); 53 registry.registerAttribute<SVGNames::yChannelSelectorAttr, ChannelSelectorType, &SVGFEDisplacementMapElement::m_yChannelSelector>(); 54 registry.registerAttribute<SVGNames::scaleAttr, &SVGFEDisplacementMapElement::m_scale>(); 55 } 56 62 57 void SVGFEDisplacementMapElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 63 58 { … … 65 60 auto propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); 66 61 if (propertyValue > 0) 67 setXChannelSelectorBaseValue(propertyValue);62 m_xChannelSelector.setValue(propertyValue); 68 63 return; 69 64 } … … 72 67 auto propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); 73 68 if (propertyValue > 0) 74 setYChannelSelectorBaseValue(propertyValue);69 m_yChannelSelector.setValue(propertyValue); 75 70 return; 76 71 } 77 72 78 73 if (name == SVGNames::inAttr) { 79 setIn1BaseValue(value);74 m_in1.setValue(value); 80 75 return; 81 76 } 82 77 83 78 if (name == SVGNames::in2Attr) { 84 setIn2BaseValue(value);79 m_in2.setValue(value); 85 80 return; 86 81 } 87 82 88 83 if (name == SVGNames::scaleAttr) { 89 setScaleBaseValue(value.toFloat());84 m_scale.setValue(value.toFloat()); 90 85 return; 91 86 } -
trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h
r233122 r234620 1 1 /* 2 2 * Copyright (C) 2006 Oliver Hunt <oliver@nerget.com> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 70 71 71 72 static ChannelSelectorType stringToChannel(const String&); 72 73 74 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 75 String in2() const { return m_in2.currentValue(attributeOwnerProxy()); } 76 ChannelSelectorType xChannelSelector() const { return m_xChannelSelector.currentValue(attributeOwnerProxy()); } 77 ChannelSelectorType yChannelSelector() const { return m_yChannelSelector.currentValue(attributeOwnerProxy()); } 78 float scale() const { return m_scale.currentValue(attributeOwnerProxy()); } 79 80 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 81 RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); } 82 RefPtr<SVGAnimatedEnumeration> xChannelSelectorAnimated() { return m_xChannelSelector.animatedProperty(attributeOwnerProxy()); } 83 RefPtr<SVGAnimatedEnumeration> yChannelSelectorAnimated() { return m_yChannelSelector.animatedProperty(attributeOwnerProxy()); } 84 RefPtr<SVGAnimatedNumber> scaleAnimated() { return m_scale.animatedProperty(attributeOwnerProxy()); } 85 73 86 private: 74 87 SVGFEDisplacementMapElement(const QualifiedName& tagName, Document&); 75 88 89 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEDisplacementMapElement, SVGFilterPrimitiveStandardAttributes>; 90 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 91 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 92 static void registerAttributes(); 93 94 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 76 95 void parseAttribute(const QualifiedName&, const AtomicString&) override; 96 void svgAttributeChanged(const QualifiedName&) override; 97 77 98 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; 78 void svgAttributeChanged(const QualifiedName&) override;79 99 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 80 100 81 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement) 82 DECLARE_ANIMATED_STRING(In1, in1) 83 DECLARE_ANIMATED_STRING(In2, in2) 84 DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector, ChannelSelectorType) 85 DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector, ChannelSelectorType) 86 DECLARE_ANIMATED_NUMBER(Scale, scale) 87 END_DECLARE_ANIMATED_PROPERTIES 101 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 102 SVGAnimatedStringAttribute m_in1; 103 SVGAnimatedStringAttribute m_in2; 104 SVGAnimatedEnumerationAttribute<ChannelSelectorType> m_xChannelSelector { CHANNEL_A }; 105 SVGAnimatedEnumerationAttribute<ChannelSelectorType> m_yChannelSelector { CHANNEL_A }; 106 SVGAnimatedNumberAttribute m_scale; 88 107 }; 89 108 -
trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp
r231153 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 32 33 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEDropShadowElement); 33 34 34 // Animated property definitions35 DEFINE_ANIMATED_STRING(SVGFEDropShadowElement, SVGNames::inAttr, In1, in1)36 DEFINE_ANIMATED_NUMBER(SVGFEDropShadowElement, SVGNames::dxAttr, Dx, dx)37 DEFINE_ANIMATED_NUMBER(SVGFEDropShadowElement, SVGNames::dyAttr, Dy, dy)38 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDropShadowElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), StdDeviationX, stdDeviationX)39 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEDropShadowElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), StdDeviationY, stdDeviationY)40 41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDropShadowElement)42 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)43 REGISTER_LOCAL_ANIMATED_PROPERTY(dx)44 REGISTER_LOCAL_ANIMATED_PROPERTY(dy)45 REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationX)46 REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationY)47 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)48 END_REGISTER_ANIMATED_PROPERTIES49 50 35 inline SVGFEDropShadowElement::SVGFEDropShadowElement(const QualifiedName& tagName, Document& document) 51 36 : SVGFilterPrimitiveStandardAttributes(tagName, document) 52 , m_dx(2)53 , m_dy(2)54 , m_stdDeviationX(2)55 , m_stdDeviationY(2)56 37 { 57 38 ASSERT(hasTagName(SVGNames::feDropShadowTag)); 58 registerA nimatedPropertiesForSVGFEDropShadowElement();39 registerAttributes(); 59 40 } 60 41 … … 78 59 void SVGFEDropShadowElement::setStdDeviation(float x, float y) 79 60 { 80 setStdDeviationXBaseValue(x);81 setStdDeviationYBaseValue(y);61 m_stdDeviationX.setValue(x); 62 m_stdDeviationY.setValue(y); 82 63 invalidate(); 64 } 65 66 void SVGFEDropShadowElement::registerAttributes() 67 { 68 auto& registry = attributeRegistry(); 69 if (!registry.isEmpty()) 70 return; 71 registry.registerAttribute<SVGNames::inAttr, &SVGFEDropShadowElement::m_in1>(); 72 registry.registerAttribute<SVGNames::dxAttr, &SVGFEDropShadowElement::m_dx>(); 73 registry.registerAttribute<SVGNames::dyAttr, &SVGFEDropShadowElement::m_dy>(); 74 registry.registerAttribute<SVGNames::stdDeviationAttr, 75 &SVGFEDropShadowElement::stdDeviationXIdentifier, &SVGFEDropShadowElement::m_stdDeviationX, 76 &SVGFEDropShadowElement::stdDeviationYIdentifier, &SVGFEDropShadowElement::m_stdDeviationY>(); 83 77 } 84 78 … … 88 82 float x, y; 89 83 if (parseNumberOptionalNumber(value, x, y)) { 90 setStdDeviationXBaseValue(x);91 setStdDeviationYBaseValue(y);84 m_stdDeviationX.setValue(x); 85 m_stdDeviationY.setValue(y); 92 86 } 93 87 return; … … 95 89 96 90 if (name == SVGNames::inAttr) { 97 setIn1BaseValue(value);91 m_in1.setValue(value); 98 92 return; 99 93 } 100 94 101 95 if (name == SVGNames::dxAttr) { 102 setDxBaseValue(value.toFloat());96 m_dx.setValue(value.toFloat()); 103 97 return; 104 98 } 105 99 106 100 if (name == SVGNames::dyAttr) { 107 setDyBaseValue(value.toFloat());101 m_dy.setValue(value.toFloat()); 108 102 return; 109 103 } … … 114 108 void SVGFEDropShadowElement::svgAttributeChanged(const QualifiedName& attrName) 115 109 { 116 if ( attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr) {110 if (isKnownAttribute(attrName)) { 117 111 InstanceInvalidationGuard guard(*this); 118 112 invalidate(); -
trunk/Source/WebCore/svg/SVGFEDropShadowElement.h
r229694 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 25 26 26 27 namespace WebCore { 27 28 28 29 class SVGFEDropShadowElement final : public SVGFilterPrimitiveStandardAttributes { 29 30 WTF_MAKE_ISO_ALLOCATED(SVGFEDropShadowElement); … … 32 33 33 34 void setStdDeviation(float stdDeviationX, float stdDeviationY); 34 35 36 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 37 float dx() const { return m_dx.currentValue(attributeOwnerProxy()); } 38 float dy() const { return m_dy.currentValue(attributeOwnerProxy()); } 39 float stdDeviationX() const { return m_stdDeviationX.currentValue(attributeOwnerProxy()); } 40 float stdDeviationY() const { return m_stdDeviationY.currentValue(attributeOwnerProxy()); } 41 42 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 43 RefPtr<SVGAnimatedNumber> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); } 44 RefPtr<SVGAnimatedNumber> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); } 45 RefPtr<SVGAnimatedNumber> stdDeviationXAnimated() { return m_stdDeviationX.animatedProperty(attributeOwnerProxy()); } 46 RefPtr<SVGAnimatedNumber> stdDeviationYAnimated() { return m_stdDeviationY.animatedProperty(attributeOwnerProxy()); } 47 35 48 private: 36 49 SVGFEDropShadowElement(const QualifiedName&, Document&); 37 50 51 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEDropShadowElement, SVGFilterPrimitiveStandardAttributes>; 52 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 53 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 54 static void registerAttributes(); 55 56 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 38 57 void parseAttribute(const QualifiedName&, const AtomicString&) override; 39 58 void svgAttributeChanged(const QualifiedName&) override; 59 40 60 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 41 61 42 62 static const AtomicString& stdDeviationXIdentifier(); 43 63 static const AtomicString& stdDeviationYIdentifier(); 44 45 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDropShadowElement) 46 DECLARE_ANIMATED_STRING(In1, in1) 47 DECLARE_ANIMATED_NUMBER(Dx, dx) 48 DECLARE_ANIMATED_NUMBER(Dy, dy) 49 DECLARE_ANIMATED_NUMBER(StdDeviationX, stdDeviationX) 50 DECLARE_ANIMATED_NUMBER(StdDeviationY, stdDeviationY) 51 END_DECLARE_ANIMATED_PROPERTIES 64 65 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 66 SVGAnimatedStringAttribute m_in1; 67 SVGAnimatedNumberAttribute m_dx { 2 }; 68 SVGAnimatedNumberAttribute m_dy { 2 }; 69 SVGAnimatedNumberAttribute m_stdDeviationX { 2 }; 70 SVGAnimatedNumberAttribute m_stdDeviationY { 2 }; 52 71 }; 53 72 -
trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 32 33 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEGaussianBlurElement); 33 34 34 // Animated property definitions35 DEFINE_ANIMATED_STRING(SVGFEGaussianBlurElement, SVGNames::inAttr, In1, in1)36 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationXIdentifier(), StdDeviationX, stdDeviationX)37 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEGaussianBlurElement, SVGNames::stdDeviationAttr, stdDeviationYIdentifier(), StdDeviationY, stdDeviationY)38 DEFINE_ANIMATED_ENUMERATION(SVGFEGaussianBlurElement, SVGNames::edgeModeAttr, EdgeMode, edgeMode, EdgeModeType)39 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEGaussianBlurElement)41 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)42 REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationX)43 REGISTER_LOCAL_ANIMATED_PROPERTY(stdDeviationY)44 REGISTER_LOCAL_ANIMATED_PROPERTY(edgeMode)45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)46 END_REGISTER_ANIMATED_PROPERTIES47 48 35 inline SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName& tagName, Document& document) 49 36 : SVGFilterPrimitiveStandardAttributes(tagName, document) 50 , m_edgeMode(EDGEMODE_NONE)51 37 { 52 38 ASSERT(hasTagName(SVGNames::feGaussianBlurTag)); 53 registerA nimatedPropertiesForSVGFEGaussianBlurElement();39 registerAttributes(); 54 40 } 55 41 … … 73 59 void SVGFEGaussianBlurElement::setStdDeviation(float x, float y) 74 60 { 75 setStdDeviationXBaseValue(x);76 setStdDeviationYBaseValue(y);61 m_stdDeviationX.setValue(x); 62 m_stdDeviationY.setValue(y); 77 63 invalidate(); 64 } 65 66 void SVGFEGaussianBlurElement::registerAttributes() 67 { 68 auto& registry = attributeRegistry(); 69 if (!registry.isEmpty()) 70 return; 71 registry.registerAttribute<SVGNames::inAttr, &SVGFEGaussianBlurElement::m_in1>(); 72 registry.registerAttribute<SVGNames::stdDeviationAttr, 73 &SVGFEGaussianBlurElement::stdDeviationXIdentifier, &SVGFEGaussianBlurElement::m_stdDeviationX, 74 &SVGFEGaussianBlurElement::stdDeviationYIdentifier, &SVGFEGaussianBlurElement::m_stdDeviationY>(); 75 registry.registerAttribute<SVGNames::edgeModeAttr, EdgeModeType, &SVGFEGaussianBlurElement::m_edgeMode>(); 78 76 } 79 77 … … 83 81 float x, y; 84 82 if (parseNumberOptionalNumber(value, x, y)) { 85 setStdDeviationXBaseValue(x);86 setStdDeviationYBaseValue(y);83 m_stdDeviationX.setValue(x); 84 m_stdDeviationY.setValue(y); 87 85 } 88 86 return; … … 90 88 91 89 if (name == SVGNames::inAttr) { 92 setIn1BaseValue(value);90 m_in1.setValue(value); 93 91 return; 94 92 } … … 97 95 auto propertyValue = SVGPropertyTraits<EdgeModeType>::fromString(value); 98 96 if (propertyValue > 0) 99 setEdgeModeBaseValue(propertyValue);97 m_edgeMode.setValue(propertyValue); 100 98 else 101 99 document().accessSVGExtensions().reportWarning("feGaussianBlur: problem parsing edgeMode=\"" + value + "\". Filtered element will not be displayed."); … … 108 106 void SVGFEGaussianBlurElement::svgAttributeChanged(const QualifiedName& attrName) 109 107 { 110 if ( attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr || attrName == SVGNames::edgeModeAttr) {108 if (isKnownAttribute(attrName)) { 111 109 InstanceInvalidationGuard guard(*this); 112 110 invalidate(); -
trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 36 37 void setStdDeviation(float stdDeviationX, float stdDeviationY); 37 38 39 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 40 float stdDeviationX() const { return m_stdDeviationX.currentValue(attributeOwnerProxy()); } 41 float stdDeviationY() const { return m_stdDeviationY.currentValue(attributeOwnerProxy()); } 42 EdgeModeType edgeMode() const { return m_edgeMode.currentValue(attributeOwnerProxy()); } 43 44 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 45 RefPtr<SVGAnimatedNumber> stdDeviationXAnimated() { return m_stdDeviationX.animatedProperty(attributeOwnerProxy()); } 46 RefPtr<SVGAnimatedNumber> stdDeviationYAnimated() { return m_stdDeviationY.animatedProperty(attributeOwnerProxy()); } 47 RefPtr<SVGAnimatedEnumeration> edgeModeAnimated() { return m_edgeMode.animatedProperty(attributeOwnerProxy()); } 48 38 49 private: 39 50 SVGFEGaussianBlurElement(const QualifiedName&, Document&); 40 51 52 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEGaussianBlurElement, SVGFilterPrimitiveStandardAttributes>; 53 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 54 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 55 static void registerAttributes(); 56 57 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 41 58 void parseAttribute(const QualifiedName&, const AtomicString&) override; 42 59 void svgAttributeChanged(const QualifiedName&) override; 60 43 61 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 44 62 … … 46 64 static const AtomicString& stdDeviationYIdentifier(); 47 65 48 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEGaussianBlurElement) 49 DECLARE_ANIMATED_STRING(In1, in1) 50 DECLARE_ANIMATED_NUMBER(StdDeviationX, stdDeviationX) 51 DECLARE_ANIMATED_NUMBER(StdDeviationY, stdDeviationY) 52 DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode, EdgeModeType) 53 END_DECLARE_ANIMATED_PROPERTIES 66 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 67 SVGAnimatedStringAttribute m_in1; 68 SVGAnimatedNumberAttribute m_stdDeviationX; 69 SVGAnimatedNumberAttribute m_stdDeviationY; 70 SVGAnimatedEnumerationAttribute<EdgeModeType> m_edgeMode { EDGEMODE_NONE }; 54 71 }; 55 72 -
trunk/Source/WebCore/svg/SVGFEImageElement.cpp
r229694 r234620 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 39 40 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEImageElement); 40 41 41 // Animated property definitions42 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)43 DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href)44 DEFINE_ANIMATED_BOOLEAN(SVGFEImageElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)45 46 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement)47 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)48 REGISTER_LOCAL_ANIMATED_PROPERTY(href)49 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)51 END_REGISTER_ANIMATED_PROPERTIES52 53 42 inline SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Document& document) 54 43 : SVGFilterPrimitiveStandardAttributes(tagName, document) 44 , SVGExternalResourcesRequired(this) 45 , SVGURIReference(this) 55 46 { 56 47 ASSERT(hasTagName(SVGNames::feImageTag)); 57 registerA nimatedPropertiesForSVGFEImageElement();48 registerAttributes(); 58 49 } 59 50 … … 123 114 } 124 115 116 void SVGFEImageElement::registerAttributes() 117 { 118 auto& registry = attributeRegistry(); 119 if (!registry.isEmpty()) 120 return; 121 registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGFEImageElement::m_preserveAspectRatio>(); 122 } 123 125 124 void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 126 125 { … … 128 127 SVGPreserveAspectRatioValue preserveAspectRatio; 129 128 preserveAspectRatio.parse(value); 130 setPreserveAspectRatioBaseValue(preserveAspectRatio);129 m_preserveAspectRatio.setValue(preserveAspectRatio); 131 130 return; 132 131 } -
trunk/Source/WebCore/svg/SVGFEImageElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 32 33 namespace WebCore { 33 34 34 class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes, public SVG URIReference, public SVGExternalResourcesRequired, public CachedImageClient {35 class SVGFEImageElement final : public SVGFilterPrimitiveStandardAttributes, public SVGExternalResourcesRequired, public SVGURIReference, public CachedImageClient { 35 36 WTF_MAKE_ISO_ALLOCATED(SVGFEImageElement); 36 37 public: … … 41 42 bool hasSingleSecurityOrigin() const; 42 43 44 const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(attributeOwnerProxy()); } 45 RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(attributeOwnerProxy()); } 46 43 47 private: 44 48 SVGFEImageElement(const QualifiedName&, Document&); 45 49 50 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEImageElement, SVGFilterPrimitiveStandardAttributes, SVGExternalResourcesRequired, SVGURIReference>; 51 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 52 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 53 static void registerAttributes(); 54 55 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 56 void parseAttribute(const QualifiedName&, const AtomicString&) override; 57 void svgAttributeChanged(const QualifiedName&) override; 58 59 void notifyFinished(CachedResource&) final; 60 void addSubresourceAttributeURLs(ListHashSet<URL>&) const override; 61 46 62 void didFinishInsertingNode() override; 47 63 48 void parseAttribute(const QualifiedName&, const AtomicString&) override;49 void svgAttributeChanged(const QualifiedName&) override;50 void notifyFinished(CachedResource&) final;51 52 void addSubresourceAttributeURLs(ListHashSet<URL>&) const override;53 64 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 54 65 … … 60 71 void removedFromAncestor(RemovalType, ContainerNode&) override; 61 72 62 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEImageElement) 63 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) 64 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 65 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 66 END_DECLARE_ANIMATED_PROPERTIES 67 73 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 74 SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio; 68 75 CachedResourceHandle<CachedImage> m_cachedImage; 69 76 }; -
trunk/Source/WebCore/svg/SVGFELightElement.cpp
r229694 r234620 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 40 41 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFELightElement); 41 42 42 // Animated property definitions43 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::azimuthAttr, Azimuth, azimuth)44 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::elevationAttr, Elevation, elevation)45 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::xAttr, X, x)46 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::yAttr, Y, y)47 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::zAttr, Z, z)48 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtXAttr, PointsAtX, pointsAtX)49 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtYAttr, PointsAtY, pointsAtY)50 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::pointsAtZAttr, PointsAtZ, pointsAtZ)51 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::specularExponentAttr, SpecularExponent, specularExponent)52 DEFINE_ANIMATED_NUMBER(SVGFELightElement, SVGNames::limitingConeAngleAttr, LimitingConeAngle, limitingConeAngle)53 54 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFELightElement)55 REGISTER_LOCAL_ANIMATED_PROPERTY(azimuth)56 REGISTER_LOCAL_ANIMATED_PROPERTY(elevation)57 REGISTER_LOCAL_ANIMATED_PROPERTY(x)58 REGISTER_LOCAL_ANIMATED_PROPERTY(y)59 REGISTER_LOCAL_ANIMATED_PROPERTY(z)60 REGISTER_LOCAL_ANIMATED_PROPERTY(pointsAtX)61 REGISTER_LOCAL_ANIMATED_PROPERTY(pointsAtY)62 REGISTER_LOCAL_ANIMATED_PROPERTY(pointsAtZ)63 REGISTER_LOCAL_ANIMATED_PROPERTY(specularExponent)64 REGISTER_LOCAL_ANIMATED_PROPERTY(limitingConeAngle)65 END_REGISTER_ANIMATED_PROPERTIES66 67 43 SVGFELightElement::SVGFELightElement(const QualifiedName& tagName, Document& document) 68 44 : SVGElement(tagName, document) 69 , m_specularExponent(1)70 45 { 71 registerA nimatedPropertiesForSVGFELightElement();46 registerAttributes(); 72 47 } 73 48 … … 81 56 } 82 57 58 void SVGFELightElement::registerAttributes() 59 { 60 auto& registry = attributeRegistry(); 61 if (!registry.isEmpty()) 62 return; 63 registry.registerAttribute<SVGNames::azimuthAttr, &SVGFELightElement::m_azimuth>(); 64 registry.registerAttribute<SVGNames::elevationAttr, &SVGFELightElement::m_elevation>(); 65 registry.registerAttribute<SVGNames::xAttr, &SVGFELightElement::m_x>(); 66 registry.registerAttribute<SVGNames::yAttr, &SVGFELightElement::m_y>(); 67 registry.registerAttribute<SVGNames::zAttr, &SVGFELightElement::m_z>(); 68 registry.registerAttribute<SVGNames::pointsAtXAttr, &SVGFELightElement::m_pointsAtX>(); 69 registry.registerAttribute<SVGNames::pointsAtYAttr, &SVGFELightElement::m_pointsAtY>(); 70 registry.registerAttribute<SVGNames::pointsAtZAttr, &SVGFELightElement::m_pointsAtZ>(); 71 registry.registerAttribute<SVGNames::specularExponentAttr, &SVGFELightElement::m_specularExponent>(); 72 registry.registerAttribute<SVGNames::limitingConeAngleAttr, &SVGFELightElement::m_limitingConeAngle>(); 73 } 74 83 75 void SVGFELightElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 84 76 { 85 77 if (name == SVGNames::azimuthAttr) { 86 setAzimuthBaseValue(value.toFloat());78 m_azimuth.setValue(value.toFloat()); 87 79 return; 88 80 } 89 81 90 82 if (name == SVGNames::elevationAttr) { 91 setElevationBaseValue(value.toFloat());83 m_elevation.setValue(value.toFloat()); 92 84 return; 93 85 } 94 86 95 87 if (name == SVGNames::xAttr) { 96 setXBaseValue(value.toFloat());88 m_x.setValue(value.toFloat()); 97 89 return; 98 90 } 99 91 100 92 if (name == SVGNames::yAttr) { 101 setYBaseValue(value.toFloat());93 m_y.setValue(value.toFloat()); 102 94 return; 103 95 } 104 96 105 97 if (name == SVGNames::zAttr) { 106 setZBaseValue(value.toFloat());98 m_z.setValue(value.toFloat()); 107 99 return; 108 100 } 109 101 110 102 if (name == SVGNames::pointsAtXAttr) { 111 setPointsAtXBaseValue(value.toFloat());103 m_pointsAtX.setValue(value.toFloat()); 112 104 return; 113 105 } 114 106 115 107 if (name == SVGNames::pointsAtYAttr) { 116 setPointsAtYBaseValue(value.toFloat());108 m_pointsAtY.setValue(value.toFloat()); 117 109 return; 118 110 } 119 111 120 112 if (name == SVGNames::pointsAtZAttr) { 121 setPointsAtZBaseValue(value.toFloat());113 m_pointsAtZ.setValue(value.toFloat()); 122 114 return; 123 115 } 124 116 125 117 if (name == SVGNames::specularExponentAttr) { 126 setSpecularExponentBaseValue(value.toFloat());118 m_specularExponent.setValue(value.toFloat()); 127 119 return; 128 120 } 129 121 130 122 if (name == SVGNames::limitingConeAngleAttr) { 131 setLimitingConeAngleBaseValue(value.toFloat());123 m_limitingConeAngle.setValue(value.toFloat()); 132 124 return; 133 125 } … … 138 130 void SVGFELightElement::svgAttributeChanged(const QualifiedName& attrName) 139 131 { 140 if (attrName == SVGNames::azimuthAttr || attrName == SVGNames::elevationAttr 141 || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::zAttr 142 || attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAttr || attrName == SVGNames::pointsAtZAttr 143 || attrName == SVGNames::specularExponentAttr || attrName == SVGNames::limitingConeAngleAttr) { 144 132 if (isKnownAttribute(attrName)) { 145 133 auto parent = makeRefPtr(parentElement()); 146 134 if (!parent) -
trunk/Source/WebCore/svg/SVGFELightElement.h
r229694 r234620 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 36 37 static SVGFELightElement* findLightElement(const SVGElement*); 37 38 39 float azimuth() const { return m_azimuth.currentValue(attributeOwnerProxy()); } 40 float elevation() const { return m_elevation.currentValue(attributeOwnerProxy()); } 41 float x() const { return m_x.currentValue(attributeOwnerProxy()); } 42 float y() const { return m_y.currentValue(attributeOwnerProxy()); } 43 float z() const { return m_z.currentValue(attributeOwnerProxy()); } 44 float pointsAtX() const { return m_pointsAtX.currentValue(attributeOwnerProxy()); } 45 float pointsAtY() const { return m_pointsAtY.currentValue(attributeOwnerProxy()); } 46 float pointsAtZ() const { return m_pointsAtZ.currentValue(attributeOwnerProxy()); } 47 float specularExponent() const { return m_specularExponent.currentValue(attributeOwnerProxy()); } 48 float limitingConeAngle() const { return m_limitingConeAngle.currentValue(attributeOwnerProxy()); } 49 50 RefPtr<SVGAnimatedNumber> azimuthAnimated() { return m_azimuth.animatedProperty(attributeOwnerProxy()); } 51 RefPtr<SVGAnimatedNumber> elevationAnimated() { return m_elevation.animatedProperty(attributeOwnerProxy()); } 52 RefPtr<SVGAnimatedNumber> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 53 RefPtr<SVGAnimatedNumber> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 54 RefPtr<SVGAnimatedNumber> zAnimated() { return m_z.animatedProperty(attributeOwnerProxy()); } 55 RefPtr<SVGAnimatedNumber> pointsAtXAnimated() { return m_pointsAtX.animatedProperty(attributeOwnerProxy()); } 56 RefPtr<SVGAnimatedNumber> pointsAtYAnimated() { return m_pointsAtY.animatedProperty(attributeOwnerProxy()); } 57 RefPtr<SVGAnimatedNumber> pointsAtZAnimated() { return m_pointsAtZ.animatedProperty(attributeOwnerProxy()); } 58 RefPtr<SVGAnimatedNumber> specularExponentAnimated() { return m_specularExponent.animatedProperty(attributeOwnerProxy()); } 59 RefPtr<SVGAnimatedNumber> limitingConeAngleAnimated() { return m_limitingConeAngle.animatedProperty(attributeOwnerProxy()); } 60 38 61 protected: 39 62 SVGFELightElement(const QualifiedName&, Document&); … … 42 65 43 66 private: 67 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFELightElement, SVGElement>; 68 static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 69 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 70 static void registerAttributes(); 71 72 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 44 73 void parseAttribute(const QualifiedName&, const AtomicString&) override; 45 74 void svgAttributeChanged(const QualifiedName&) override; 46 75 void childrenChanged(const ChildChange&) override; 47 76 48 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFELightElement) 49 DECLARE_ANIMATED_NUMBER(Azimuth, azimuth) 50 DECLARE_ANIMATED_NUMBER(Elevation, elevation) 51 DECLARE_ANIMATED_NUMBER(X, x) 52 DECLARE_ANIMATED_NUMBER(Y, y) 53 DECLARE_ANIMATED_NUMBER(Z, z) 54 DECLARE_ANIMATED_NUMBER(PointsAtX, pointsAtX) 55 DECLARE_ANIMATED_NUMBER(PointsAtY, pointsAtY) 56 DECLARE_ANIMATED_NUMBER(PointsAtZ, pointsAtZ) 57 DECLARE_ANIMATED_NUMBER(SpecularExponent, specularExponent) 58 DECLARE_ANIMATED_NUMBER(LimitingConeAngle, limitingConeAngle) 59 END_DECLARE_ANIMATED_PROPERTIES 77 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 78 SVGAnimatedNumberAttribute m_azimuth; 79 SVGAnimatedNumberAttribute m_elevation; 80 SVGAnimatedNumberAttribute m_x; 81 SVGAnimatedNumberAttribute m_y; 82 SVGAnimatedNumberAttribute m_z; 83 SVGAnimatedNumberAttribute m_pointsAtX; 84 SVGAnimatedNumberAttribute m_pointsAtY; 85 SVGAnimatedNumberAttribute m_pointsAtZ; 86 SVGAnimatedNumberAttribute m_specularExponent { 1 }; 87 SVGAnimatedNumberAttribute m_limitingConeAngle; 60 88 }; 61 89 -
trunk/Source/WebCore/svg/SVGFEMergeNodeElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 32 33 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEMergeNodeElement); 33 34 34 // Animated property definitions35 DEFINE_ANIMATED_STRING(SVGFEMergeNodeElement, SVGNames::inAttr, In1, in1)36 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMergeNodeElement)38 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)39 END_REGISTER_ANIMATED_PROPERTIES40 41 35 inline SVGFEMergeNodeElement::SVGFEMergeNodeElement(const QualifiedName& tagName, Document& document) 42 36 : SVGElement(tagName, document) 43 37 { 44 38 ASSERT(hasTagName(SVGNames::feMergeNodeTag)); 45 registerA nimatedPropertiesForSVGFEMergeNodeElement();39 registerAttributes(); 46 40 } 47 41 … … 51 45 } 52 46 47 void SVGFEMergeNodeElement::registerAttributes() 48 { 49 auto& registry = attributeRegistry(); 50 if (!registry.isEmpty()) 51 return; 52 registry.registerAttribute<SVGNames::inAttr, &SVGFEMergeNodeElement::m_in1>(); 53 } 54 53 55 void SVGFEMergeNodeElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 54 56 { 55 57 if (name == SVGNames::inAttr) { 56 setIn1BaseValue(value);58 m_in1.setValue(value); 57 59 return; 58 60 } -
trunk/Source/WebCore/svg/SVGFEMergeNodeElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 31 32 static Ref<SVGFEMergeNodeElement> create(const QualifiedName&, Document&); 32 33 34 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 35 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 36 33 37 private: 34 38 SVGFEMergeNodeElement(const QualifiedName&, Document&); 35 39 40 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEMergeNodeElement, SVGElement>; 41 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 42 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 43 static void registerAttributes(); 44 45 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 36 46 void parseAttribute(const QualifiedName&, const AtomicString&) final; 37 47 void svgAttributeChanged(const QualifiedName&) final; 48 38 49 bool rendererIsNeeded(const RenderStyle&) final { return false; } 39 50 40 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMergeNodeElement) 41 DECLARE_ANIMATED_STRING(In1, in1) 42 END_DECLARE_ANIMATED_PROPERTIES 51 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 52 SVGAnimatedStringAttribute m_in1; 43 53 }; 44 54 -
trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp
r229694 r234620 1 1 /* 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 31 32 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEMorphologyElement); 32 33 33 // Animated property definitions34 DEFINE_ANIMATED_STRING(SVGFEMorphologyElement, SVGNames::inAttr, In1, in1)35 DEFINE_ANIMATED_ENUMERATION(SVGFEMorphologyElement, SVGNames::operatorAttr, SVGOperator, svgOperator, MorphologyOperatorType)36 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusXIdentifier(), RadiusX, radiusX)37 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFEMorphologyElement, SVGNames::radiusAttr, radiusYIdentifier(), RadiusY, radiusY)38 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMorphologyElement)40 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)41 REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator)42 REGISTER_LOCAL_ANIMATED_PROPERTY(radiusX)43 REGISTER_LOCAL_ANIMATED_PROPERTY(radiusY)44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)45 END_REGISTER_ANIMATED_PROPERTIES46 47 34 inline SVGFEMorphologyElement::SVGFEMorphologyElement(const QualifiedName& tagName, Document& document) 48 35 : SVGFilterPrimitiveStandardAttributes(tagName, document) 49 , m_svgOperator(FEMORPHOLOGY_OPERATOR_ERODE)50 36 { 51 37 ASSERT(hasTagName(SVGNames::feMorphologyTag)); 52 registerA nimatedPropertiesForSVGFEMorphologyElement();38 registerAttributes(); 53 39 } 54 40 … … 72 58 void SVGFEMorphologyElement::setRadius(float x, float y) 73 59 { 74 setRadiusXBaseValue(x);75 setRadiusYBaseValue(y);60 m_radiusX.setValue(x); 61 m_radiusY.setValue(y); 76 62 invalidate(); 63 } 64 65 void SVGFEMorphologyElement::registerAttributes() 66 { 67 auto& registry = attributeRegistry(); 68 if (!registry.isEmpty()) 69 return; 70 registry.registerAttribute<SVGNames::inAttr, &SVGFEMorphologyElement::m_in1>(); 71 registry.registerAttribute<SVGNames::operatorAttr, MorphologyOperatorType, &SVGFEMorphologyElement::m_svgOperator>(); 72 registry.registerAttribute<SVGNames::radiusAttr, 73 &SVGFEMorphologyElement::radiusXIdentifier, &SVGFEMorphologyElement::m_radiusX, 74 &SVGFEMorphologyElement::radiusYIdentifier, &SVGFEMorphologyElement::m_radiusY>(); 77 75 } 78 76 … … 82 80 MorphologyOperatorType propertyValue = SVGPropertyTraits<MorphologyOperatorType>::fromString(value); 83 81 if (propertyValue > 0) 84 setSVGOperatorBaseValue(propertyValue);82 m_svgOperator.setValue(propertyValue); 85 83 return; 86 84 } 87 85 88 86 if (name == SVGNames::inAttr) { 89 setIn1BaseValue(value);87 m_in1.setValue(value); 90 88 return; 91 89 } … … 94 92 float x, y; 95 93 if (parseNumberOptionalNumber(value, x, y)) { 96 setRadiusXBaseValue(x);97 setRadiusYBaseValue(y);94 m_radiusX.setValue(x); 95 m_radiusY.setValue(y); 98 96 } 99 97 return; -
trunk/Source/WebCore/svg/SVGFEMorphologyElement.h
r233122 r234620 1 1 /* 2 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 63 64 void setRadius(float radiusX, float radiusY); 64 65 66 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 67 MorphologyOperatorType svgOperator() const { return m_svgOperator.currentValue(attributeOwnerProxy()); } 68 float radiusX() const { return m_radiusX.currentValue(attributeOwnerProxy()); } 69 float radiusY() const { return m_radiusY.currentValue(attributeOwnerProxy()); } 70 71 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 72 RefPtr<SVGAnimatedEnumeration> svgOperatorAnimated() { return m_svgOperator.animatedProperty(attributeOwnerProxy()); } 73 RefPtr<SVGAnimatedNumber> radiusXAnimated() { return m_radiusX.animatedProperty(attributeOwnerProxy()); } 74 RefPtr<SVGAnimatedNumber> radiusYAnimated() { return m_radiusY.animatedProperty(attributeOwnerProxy()); } 75 65 76 private: 66 77 SVGFEMorphologyElement(const QualifiedName&, Document&); 67 78 79 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEMorphologyElement, SVGFilterPrimitiveStandardAttributes>; 80 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 81 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 82 static void registerAttributes(); 83 84 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 68 85 void parseAttribute(const QualifiedName&, const AtomicString&) override; 86 void svgAttributeChanged(const QualifiedName&) override; 87 69 88 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 70 void svgAttributeChanged(const QualifiedName&) override;71 89 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 72 90 … … 74 92 static const AtomicString& radiusYIdentifier(); 75 93 76 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMorphologyElement) 77 DECLARE_ANIMATED_STRING(In1, in1) 78 DECLARE_ANIMATED_ENUMERATION(SVGOperator, svgOperator, MorphologyOperatorType) 79 DECLARE_ANIMATED_NUMBER(RadiusX, radiusX) 80 DECLARE_ANIMATED_NUMBER(RadiusY, radiusY) 81 END_DECLARE_ANIMATED_PROPERTIES 94 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 95 SVGAnimatedStringAttribute m_in1; 96 SVGAnimatedEnumerationAttribute<MorphologyOperatorType> m_svgOperator { FEMORPHOLOGY_OPERATOR_ERODE }; 97 SVGAnimatedNumberAttribute m_radiusX; 98 SVGAnimatedNumberAttribute m_radiusY; 82 99 }; 83 100 -
trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 32 33 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFEOffsetElement); 33 34 34 // Animated property definitions35 DEFINE_ANIMATED_STRING(SVGFEOffsetElement, SVGNames::inAttr, In1, in1)36 DEFINE_ANIMATED_NUMBER(SVGFEOffsetElement, SVGNames::dxAttr, Dx, dx)37 DEFINE_ANIMATED_NUMBER(SVGFEOffsetElement, SVGNames::dyAttr, Dy, dy)38 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEOffsetElement)40 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)41 REGISTER_LOCAL_ANIMATED_PROPERTY(dx)42 REGISTER_LOCAL_ANIMATED_PROPERTY(dy)43 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)44 END_REGISTER_ANIMATED_PROPERTIES45 46 35 inline SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document& document) 47 36 : SVGFilterPrimitiveStandardAttributes(tagName, document) 48 37 { 49 38 ASSERT(hasTagName(SVGNames::feOffsetTag)); 50 registerA nimatedPropertiesForSVGFEOffsetElement();39 registerAttributes(); 51 40 } 52 41 … … 56 45 } 57 46 47 void SVGFEOffsetElement::registerAttributes() 48 { 49 auto& registry = attributeRegistry(); 50 if (!registry.isEmpty()) 51 return; 52 registry.registerAttribute<SVGNames::inAttr, &SVGFEOffsetElement::m_in1>(); 53 registry.registerAttribute<SVGNames::dxAttr, &SVGFEOffsetElement::m_dx>(); 54 registry.registerAttribute<SVGNames::dyAttr, &SVGFEOffsetElement::m_dy>(); 55 } 56 58 57 void SVGFEOffsetElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 59 58 { 60 59 if (name == SVGNames::dxAttr) { 61 setDxBaseValue(value.toFloat());60 m_dx.setValue(value.toFloat()); 62 61 return; 63 62 } 64 63 65 64 if (name == SVGNames::dyAttr) { 66 setDyBaseValue(value.toFloat());65 m_dy.setValue(value.toFloat()); 67 66 return; 68 67 } 69 68 70 69 if (name == SVGNames::inAttr) { 71 setIn1BaseValue(value);70 m_in1.setValue(value); 72 71 return; 73 72 } … … 78 77 void SVGFEOffsetElement::svgAttributeChanged(const QualifiedName& attrName) 79 78 { 80 if ( attrName == SVGNames::inAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr) {79 if (isKnownAttribute(attrName)) { 81 80 InstanceInvalidationGuard guard(*this); 82 81 invalidate(); -
trunk/Source/WebCore/svg/SVGFEOffsetElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 31 32 static Ref<SVGFEOffsetElement> create(const QualifiedName&, Document&); 32 33 34 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 35 float dx() const { return m_dx.currentValue(attributeOwnerProxy()); } 36 float dy() const { return m_dy.currentValue(attributeOwnerProxy()); } 37 38 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 39 RefPtr<SVGAnimatedNumber> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); } 40 RefPtr<SVGAnimatedNumber> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); } 41 33 42 private: 34 43 SVGFEOffsetElement(const QualifiedName&, Document&); 35 44 45 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEOffsetElement, SVGFilterPrimitiveStandardAttributes>; 46 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 47 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 48 static void registerAttributes(); 49 50 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 36 51 void parseAttribute(const QualifiedName&, const AtomicString&) override; 37 52 void svgAttributeChanged(const QualifiedName&) override; 53 38 54 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 39 55 40 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEOffsetElement) 41 DECLARE_ANIMATED_STRING(In1, in1) 42 DECLARE_ANIMATED_NUMBER(Dx, dx) 43 DECLARE_ANIMATED_NUMBER(Dy, dy) 44 END_DECLARE_ANIMATED_PROPERTIES 56 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 57 SVGAnimatedStringAttribute m_in1; 58 SVGAnimatedNumberAttribute m_dx; 59 SVGAnimatedNumberAttribute m_dy; 45 60 }; 46 61 -
trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp
r231153 r234620 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 35 36 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFESpecularLightingElement); 36 37 37 // Animated property definitions38 DEFINE_ANIMATED_STRING(SVGFESpecularLightingElement, SVGNames::inAttr, In1, in1)39 DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::specularConstantAttr, SpecularConstant, specularConstant)40 DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::specularExponentAttr, SpecularExponent, specularExponent)41 DEFINE_ANIMATED_NUMBER(SVGFESpecularLightingElement, SVGNames::surfaceScaleAttr, SurfaceScale, surfaceScale)42 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthXIdentifier(), KernelUnitLengthX, kernelUnitLengthX)43 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFESpecularLightingElement, SVGNames::kernelUnitLengthAttr, kernelUnitLengthYIdentifier(), KernelUnitLengthY, kernelUnitLengthY)44 45 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFESpecularLightingElement)46 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)47 REGISTER_LOCAL_ANIMATED_PROPERTY(specularConstant)48 REGISTER_LOCAL_ANIMATED_PROPERTY(specularExponent)49 REGISTER_LOCAL_ANIMATED_PROPERTY(surfaceScale)50 REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthX)51 REGISTER_LOCAL_ANIMATED_PROPERTY(kernelUnitLengthY)52 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)53 END_REGISTER_ANIMATED_PROPERTIES54 55 38 inline SVGFESpecularLightingElement::SVGFESpecularLightingElement(const QualifiedName& tagName, Document& document) 56 39 : SVGFilterPrimitiveStandardAttributes(tagName, document) 57 , m_specularConstant(1)58 , m_specularExponent(1)59 , m_surfaceScale(1)60 40 { 61 41 ASSERT(hasTagName(SVGNames::feSpecularLightingTag)); 62 registerA nimatedPropertiesForSVGFESpecularLightingElement();42 registerAttributes(); 63 43 } 64 44 … … 80 60 } 81 61 62 void SVGFESpecularLightingElement::registerAttributes() 63 { 64 auto& registry = attributeRegistry(); 65 if (!registry.isEmpty()) 66 return; 67 registry.registerAttribute<SVGNames::inAttr, &SVGFESpecularLightingElement::m_in1>(); 68 registry.registerAttribute<SVGNames::specularConstantAttr, &SVGFESpecularLightingElement::m_specularConstant>(); 69 registry.registerAttribute<SVGNames::specularExponentAttr, &SVGFESpecularLightingElement::m_specularExponent>(); 70 registry.registerAttribute<SVGNames::surfaceScaleAttr, &SVGFESpecularLightingElement::m_surfaceScale>(); 71 registry.registerAttribute<SVGNames::kernelUnitLengthAttr, 72 &SVGFESpecularLightingElement::kernelUnitLengthXIdentifier, &SVGFESpecularLightingElement::m_kernelUnitLengthX, 73 &SVGFESpecularLightingElement::kernelUnitLengthYIdentifier, &SVGFESpecularLightingElement::m_kernelUnitLengthY>(); 74 } 75 82 76 void SVGFESpecularLightingElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 83 77 { 84 78 if (name == SVGNames::inAttr) { 85 setIn1BaseValue(value);79 m_in1.setValue(value); 86 80 return; 87 81 } 88 82 89 83 if (name == SVGNames::surfaceScaleAttr) { 90 setSurfaceScaleBaseValue(value.toFloat());84 m_surfaceScale.setValue(value.toFloat()); 91 85 return; 92 86 } 93 87 94 88 if (name == SVGNames::specularConstantAttr) { 95 setSpecularConstantBaseValue(value.toFloat());89 m_specularConstant.setValue(value.toFloat()); 96 90 return; 97 91 } 98 92 99 93 if (name == SVGNames::specularExponentAttr) { 100 setSpecularExponentBaseValue(value.toFloat());94 m_specularExponent.setValue(value.toFloat()); 101 95 return; 102 96 } … … 105 99 float x, y; 106 100 if (parseNumberOptionalNumber(value, x, y)) { 107 setKernelUnitLengthXBaseValue(x);108 setKernelUnitLengthYBaseValue(y);101 m_kernelUnitLengthX.setValue(x); 102 m_kernelUnitLengthY.setValue(y); 109 103 } 110 104 return; -
trunk/Source/WebCore/svg/SVGFESpecularLightingElement.h
r229694 r234620 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 35 36 void lightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&); 36 37 38 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 39 float specularConstant() const { return m_specularConstant.currentValue(attributeOwnerProxy()); } 40 float specularExponent() const { return m_specularExponent.currentValue(attributeOwnerProxy()); } 41 float surfaceScale() const { return m_surfaceScale.currentValue(attributeOwnerProxy()); } 42 float kernelUnitLengthX() const { return m_kernelUnitLengthX.currentValue(attributeOwnerProxy()); } 43 float kernelUnitLengthY() const { return m_kernelUnitLengthY.currentValue(attributeOwnerProxy()); } 44 45 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 46 RefPtr<SVGAnimatedNumber> specularConstantAnimated() { return m_specularConstant.animatedProperty(attributeOwnerProxy()); } 47 RefPtr<SVGAnimatedNumber> specularExponentAnimated() { return m_specularExponent.animatedProperty(attributeOwnerProxy()); } 48 RefPtr<SVGAnimatedNumber> surfaceScaleAnimated() { return m_surfaceScale.animatedProperty(attributeOwnerProxy()); } 49 RefPtr<SVGAnimatedNumber> kernelUnitLengthXAnimated() { return m_kernelUnitLengthX.animatedProperty(attributeOwnerProxy()); } 50 RefPtr<SVGAnimatedNumber> kernelUnitLengthYAnimated() { return m_kernelUnitLengthY.animatedProperty(attributeOwnerProxy()); } 51 37 52 private: 38 53 SVGFESpecularLightingElement(const QualifiedName&, Document&); 39 54 55 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFESpecularLightingElement, SVGFilterPrimitiveStandardAttributes>; 56 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 57 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 58 static void registerAttributes(); 59 60 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 40 61 void parseAttribute(const QualifiedName&, const AtomicString&) override; 62 void svgAttributeChanged(const QualifiedName&) override; 63 41 64 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override; 42 void svgAttributeChanged(const QualifiedName&) override;43 65 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 44 66 … … 46 68 static const AtomicString& kernelUnitLengthYIdentifier(); 47 69 48 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFESpecularLightingElement) 49 DECLARE_ANIMATED_STRING(In1, in1) 50 DECLARE_ANIMATED_NUMBER(SpecularConstant, specularConstant) 51 DECLARE_ANIMATED_NUMBER(SpecularExponent, specularExponent) 52 DECLARE_ANIMATED_NUMBER(SurfaceScale, surfaceScale) 53 DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX) 54 DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY) 55 END_DECLARE_ANIMATED_PROPERTIES 70 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 71 SVGAnimatedStringAttribute m_in1; 72 SVGAnimatedNumberAttribute m_specularConstant { 1 }; 73 SVGAnimatedNumberAttribute m_specularExponent { 1 }; 74 SVGAnimatedNumberAttribute m_surfaceScale { 1 }; 75 SVGAnimatedNumberAttribute m_kernelUnitLengthX; 76 SVGAnimatedNumberAttribute m_kernelUnitLengthY; 56 77 }; 57 78 -
trunk/Source/WebCore/svg/SVGFETileElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 33 34 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFETileElement); 34 35 35 // Animated property definitions36 DEFINE_ANIMATED_STRING(SVGFETileElement, SVGNames::inAttr, In1, in1)37 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETileElement)39 REGISTER_LOCAL_ANIMATED_PROPERTY(in1)40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)41 END_REGISTER_ANIMATED_PROPERTIES42 43 36 inline SVGFETileElement::SVGFETileElement(const QualifiedName& tagName, Document& document) 44 37 : SVGFilterPrimitiveStandardAttributes(tagName, document) 45 38 { 46 39 ASSERT(hasTagName(SVGNames::feTileTag)); 47 registerA nimatedPropertiesForSVGFETileElement();40 registerAttributes(); 48 41 } 49 42 … … 53 46 } 54 47 48 void SVGFETileElement::registerAttributes() 49 { 50 auto& registry = attributeRegistry(); 51 if (!registry.isEmpty()) 52 return; 53 registry.registerAttribute<SVGNames::inAttr, &SVGFETileElement::m_in1>(); 54 } 55 55 56 void SVGFETileElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 56 57 { 57 58 if (name == SVGNames::inAttr) { 58 setIn1BaseValue(value);59 m_in1.setValue(value); 59 60 return; 60 61 } -
trunk/Source/WebCore/svg/SVGFETileElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 30 31 static Ref<SVGFETileElement> create(const QualifiedName&, Document&); 31 32 33 String in1() const { return m_in1.currentValue(attributeOwnerProxy()); } 34 RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); } 35 32 36 private: 33 37 SVGFETileElement(const QualifiedName&, Document&); 34 38 39 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFETileElement, SVGFilterPrimitiveStandardAttributes>; 40 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 41 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 42 static void registerAttributes(); 43 44 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 35 45 void parseAttribute(const QualifiedName&, const AtomicString&) override; 36 46 void svgAttributeChanged(const QualifiedName&) override; 47 37 48 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 38 49 39 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFETileElement) 40 DECLARE_ANIMATED_STRING(In1, in1) 41 END_DECLARE_ANIMATED_PROPERTIES 50 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 51 SVGAnimatedStringAttribute m_in1; 42 52 }; 43 53 -
trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 30 31 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFETurbulenceElement); 31 32 32 // Animated property definitions33 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyXIdentifier(), BaseFrequencyX, baseFrequencyX)34 DEFINE_ANIMATED_NUMBER_MULTIPLE_WRAPPERS(SVGFETurbulenceElement, SVGNames::baseFrequencyAttr, baseFrequencyYIdentifier(), BaseFrequencyY, baseFrequencyY)35 DEFINE_ANIMATED_INTEGER(SVGFETurbulenceElement, SVGNames::numOctavesAttr, NumOctaves, numOctaves)36 DEFINE_ANIMATED_NUMBER(SVGFETurbulenceElement, SVGNames::seedAttr, Seed, seed)37 DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::stitchTilesAttr, StitchTiles, stitchTiles, SVGStitchOptions)38 DEFINE_ANIMATED_ENUMERATION(SVGFETurbulenceElement, SVGNames::typeAttr, Type, type, TurbulenceType)39 40 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETurbulenceElement)41 REGISTER_LOCAL_ANIMATED_PROPERTY(baseFrequencyX)42 REGISTER_LOCAL_ANIMATED_PROPERTY(baseFrequencyY)43 REGISTER_LOCAL_ANIMATED_PROPERTY(numOctaves)44 REGISTER_LOCAL_ANIMATED_PROPERTY(seed)45 REGISTER_LOCAL_ANIMATED_PROPERTY(stitchTiles)46 REGISTER_LOCAL_ANIMATED_PROPERTY(type)47 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)48 END_REGISTER_ANIMATED_PROPERTIES49 50 33 inline SVGFETurbulenceElement::SVGFETurbulenceElement(const QualifiedName& tagName, Document& document) 51 34 : SVGFilterPrimitiveStandardAttributes(tagName, document) 52 , m_numOctaves(1)53 , m_stitchTiles(SVG_STITCHTYPE_NOSTITCH)54 , m_type(TurbulenceType::Turbulence)55 35 { 56 36 ASSERT(hasTagName(SVGNames::feTurbulenceTag)); 57 registerA nimatedPropertiesForSVGFETurbulenceElement();37 registerAttributes(); 58 38 } 59 39 … … 75 55 } 76 56 57 void SVGFETurbulenceElement::registerAttributes() 58 { 59 auto& registry = attributeRegistry(); 60 if (!registry.isEmpty()) 61 return; 62 registry.registerAttribute<SVGNames::baseFrequencyAttr, 63 &SVGFETurbulenceElement::baseFrequencyXIdentifier, &SVGFETurbulenceElement::m_baseFrequencyX, 64 &SVGFETurbulenceElement::baseFrequencyYIdentifier, &SVGFETurbulenceElement::m_baseFrequencyY>(); 65 registry.registerAttribute<SVGNames::numOctavesAttr, &SVGFETurbulenceElement::m_numOctaves>(); 66 registry.registerAttribute<SVGNames::seedAttr, &SVGFETurbulenceElement::m_seed>(); 67 registry.registerAttribute<SVGNames::stitchTilesAttr, SVGStitchOptions, &SVGFETurbulenceElement::m_stitchTiles>(); 68 registry.registerAttribute<SVGNames::typeAttr, TurbulenceType, &SVGFETurbulenceElement::m_type>(); 69 } 70 77 71 void SVGFETurbulenceElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 78 72 { … … 80 74 TurbulenceType propertyValue = SVGPropertyTraits<TurbulenceType>::fromString(value); 81 75 if (propertyValue != TurbulenceType::Unknown) 82 setTypeBaseValue(propertyValue);76 m_type.setValue(propertyValue); 83 77 return; 84 78 } … … 87 81 SVGStitchOptions propertyValue = SVGPropertyTraits<SVGStitchOptions>::fromString(value); 88 82 if (propertyValue > 0) 89 setStitchTilesBaseValue(propertyValue);83 m_stitchTiles.setValue(propertyValue); 90 84 return; 91 85 } … … 94 88 float x, y; 95 89 if (parseNumberOptionalNumber(value, x, y)) { 96 setBaseFrequencyXBaseValue(x);97 setBaseFrequencyYBaseValue(y);90 m_baseFrequencyX.setValue(x); 91 m_baseFrequencyY.setValue(y); 98 92 } 99 93 return; … … 101 95 102 96 if (name == SVGNames::seedAttr) { 103 setSeedBaseValue(value.toFloat());97 m_seed.setValue(value.toFloat()); 104 98 return; 105 99 } 106 100 107 101 if (name == SVGNames::numOctavesAttr) { 108 setNumOctavesBaseValue(value.string().toUIntStrict());102 m_numOctaves.setValue(value.string().toUIntStrict()); 109 103 return; 110 104 } … … 125 119 return turbulence->setSeed(seed()); 126 120 if (attrName == SVGNames::numOctavesAttr) 127 return turbulence->setNumOctaves(numOctaves());121 return turbulence->setNumOctaves(numOctaves()); 128 122 129 123 ASSERT_NOT_REACHED(); … … 133 127 void SVGFETurbulenceElement::svgAttributeChanged(const QualifiedName& attrName) 134 128 { 135 if ( attrName == SVGNames::baseFrequencyAttr || attrName == SVGNames::numOctavesAttr || attrName == SVGNames::seedAttr || attrName == SVGNames::stitchTilesAttr || attrName == SVGNames::typeAttr) {129 if (isKnownAttribute(attrName)) { 136 130 InstanceInvalidationGuard guard(*this); 137 131 primitiveAttributeChanged(attrName); -
trunk/Source/WebCore/svg/SVGFETurbulenceElement.h
r233122 r234620 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 98 99 static Ref<SVGFETurbulenceElement> create(const QualifiedName&, Document&); 99 100 101 float baseFrequencyX() const { return m_baseFrequencyX.currentValue(attributeOwnerProxy()); } 102 float baseFrequencyY() const { return m_baseFrequencyY.currentValue(attributeOwnerProxy()); } 103 int numOctaves() const { return m_numOctaves.currentValue(attributeOwnerProxy()); } 104 float seed() const { return m_seed.currentValue(attributeOwnerProxy()); } 105 SVGStitchOptions stitchTiles() const { return m_stitchTiles.currentValue(attributeOwnerProxy()); } 106 TurbulenceType type() const { return m_type.currentValue(attributeOwnerProxy()); } 107 108 RefPtr<SVGAnimatedNumber> baseFrequencyXAnimated() { return m_baseFrequencyX.animatedProperty(attributeOwnerProxy()); } 109 RefPtr<SVGAnimatedNumber> baseFrequencyYAnimated() { return m_baseFrequencyY.animatedProperty(attributeOwnerProxy()); } 110 RefPtr<SVGAnimatedInteger> numOctavesAnimated() { return m_numOctaves.animatedProperty(attributeOwnerProxy()); } 111 RefPtr<SVGAnimatedNumber> seedAnimated() { return m_seed.animatedProperty(attributeOwnerProxy()); } 112 RefPtr<SVGAnimatedEnumeration> stitchTilesAnimated() { return m_stitchTiles.animatedProperty(attributeOwnerProxy()); } 113 RefPtr<SVGAnimatedEnumeration> typeAnimated() { return m_type.animatedProperty(attributeOwnerProxy()); } 114 100 115 private: 101 116 SVGFETurbulenceElement(const QualifiedName&, Document&); 102 117 118 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFETurbulenceElement, SVGFilterPrimitiveStandardAttributes>; 119 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 120 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 121 static void registerAttributes(); 122 123 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 103 124 void parseAttribute(const QualifiedName&, const AtomicString&) override; 125 void svgAttributeChanged(const QualifiedName&) override; 126 104 127 bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; 105 void svgAttributeChanged(const QualifiedName&) override;106 128 RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; 107 129 … … 109 131 static const AtomicString& baseFrequencyYIdentifier(); 110 132 111 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFETurbulenceElement) 112 DECLARE_ANIMATED_NUMBER(BaseFrequencyX, baseFrequencyX) 113 DECLARE_ANIMATED_NUMBER(BaseFrequencyY, baseFrequencyY) 114 DECLARE_ANIMATED_INTEGER(NumOctaves, numOctaves) 115 DECLARE_ANIMATED_NUMBER(Seed, seed) 116 DECLARE_ANIMATED_ENUMERATION(StitchTiles, stitchTiles, SVGStitchOptions) 117 DECLARE_ANIMATED_ENUMERATION(Type, type, TurbulenceType) 118 END_DECLARE_ANIMATED_PROPERTIES 133 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 134 SVGAnimatedNumberAttribute m_baseFrequencyX; 135 SVGAnimatedNumberAttribute m_baseFrequencyY; 136 SVGAnimatedIntegerAttribute m_numOctaves { 1 }; 137 SVGAnimatedNumberAttribute m_seed; 138 SVGAnimatedEnumerationAttribute<SVGStitchOptions> m_stitchTiles { SVG_STITCHTYPE_NOSTITCH }; 139 SVGAnimatedEnumerationAttribute<TurbulenceType> m_type { TurbulenceType::Turbulence }; 119 140 }; 120 141 -
trunk/Source/WebCore/svg/SVGFilterElement.cpp
r229694 r234620 6 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 7 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2018 Apple Inc. All rights reserved. 8 9 * 9 10 * This library is free software; you can redistribute it and/or … … 39 40 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFilterElement); 40 41 41 // Animated property definitions42 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::filterUnitsAttr, FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType)43 DEFINE_ANIMATED_ENUMERATION(SVGFilterElement, SVGNames::primitiveUnitsAttr, PrimitiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType)44 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::xAttr, X, x)45 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::yAttr, Y, y)46 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::widthAttr, Width, width)47 DEFINE_ANIMATED_LENGTH(SVGFilterElement, SVGNames::heightAttr, Height, height)48 DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, filterResXIdentifier(), FilterResX, filterResX)49 DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(SVGFilterElement, SVGNames::filterResAttr, filterResYIdentifier(), FilterResY, filterResY)50 DEFINE_ANIMATED_STRING(SVGFilterElement, XLinkNames::hrefAttr, Href, href)51 DEFINE_ANIMATED_BOOLEAN(SVGFilterElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)52 53 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterElement)54 REGISTER_LOCAL_ANIMATED_PROPERTY(filterUnits)55 REGISTER_LOCAL_ANIMATED_PROPERTY(primitiveUnits)56 REGISTER_LOCAL_ANIMATED_PROPERTY(x)57 REGISTER_LOCAL_ANIMATED_PROPERTY(y)58 REGISTER_LOCAL_ANIMATED_PROPERTY(width)59 REGISTER_LOCAL_ANIMATED_PROPERTY(height)60 REGISTER_LOCAL_ANIMATED_PROPERTY(filterResX)61 REGISTER_LOCAL_ANIMATED_PROPERTY(filterResY)62 REGISTER_LOCAL_ANIMATED_PROPERTY(href)63 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)64 END_REGISTER_ANIMATED_PROPERTIES65 66 42 inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document& document) 67 43 : SVGElement(tagName, document) 68 , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) 69 , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) 70 , m_x(LengthModeWidth, "-10%") 71 , m_y(LengthModeHeight, "-10%") 72 , m_width(LengthModeWidth, "120%") 73 , m_height(LengthModeHeight, "120%") 44 , SVGExternalResourcesRequired(this) 45 , SVGURIReference(this) 74 46 { 75 47 // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified. 76 48 // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified. 77 49 ASSERT(hasTagName(SVGNames::filterTag)); 78 registerA nimatedPropertiesForSVGFilterElement();50 registerAttributes(); 79 51 } 80 52 … … 98 70 void SVGFilterElement::setFilterRes(unsigned filterResX, unsigned filterResY) 99 71 { 100 setFilterResXBaseValue(filterResX);101 setFilterResYBaseValue(filterResY);72 m_filterResX.setValue(filterResX); 73 m_filterResY.setValue(filterResY); 102 74 103 75 if (RenderObject* object = renderer()) … … 105 77 } 106 78 107 bool SVGFilterElement::isSupportedAttribute(const QualifiedName& attrName) 108 { 109 static const auto supportedAttributes = makeNeverDestroyed([] { 110 HashSet<QualifiedName> set; 111 SVGURIReference::addSupportedAttributes(set); 112 SVGLangSpace::addSupportedAttributes(set); 113 SVGExternalResourcesRequired::addSupportedAttributes(set); 114 set.add({ 115 SVGNames::filterUnitsAttr.get(), 116 SVGNames::primitiveUnitsAttr.get(), 117 SVGNames::xAttr.get(), 118 SVGNames::yAttr.get(), 119 SVGNames::widthAttr.get(), 120 SVGNames::heightAttr.get(), 121 SVGNames::filterResAttr.get(), 122 }); 123 return set; 124 }()); 125 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 79 void SVGFilterElement::registerAttributes() 80 { 81 auto& registry = attributeRegistry(); 82 if (!registry.isEmpty()) 83 return; 84 registry.registerAttribute<SVGNames::filterUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_filterUnits>(); 85 registry.registerAttribute<SVGNames::primitiveUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_primitiveUnits>(); 86 registry.registerAttribute<SVGNames::xAttr, &SVGFilterElement::m_x>(); 87 registry.registerAttribute<SVGNames::yAttr, &SVGFilterElement::m_y>(); 88 registry.registerAttribute<SVGNames::widthAttr, &SVGFilterElement::m_width>(); 89 registry.registerAttribute<SVGNames::heightAttr, &SVGFilterElement::m_height>(); 90 registry.registerAttribute<SVGNames::filterResAttr, 91 &SVGFilterElement::filterResXIdentifier, &SVGFilterElement::m_filterResX, 92 &SVGFilterElement::filterResYIdentifier, &SVGFilterElement::m_filterResY>(); 126 93 } 127 94 … … 133 100 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 134 101 if (propertyValue > 0) 135 setFilterUnitsBaseValue(propertyValue);102 m_filterUnits.setValue(propertyValue); 136 103 } else if (name == SVGNames::primitiveUnitsAttr) { 137 104 SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 138 105 if (propertyValue > 0) 139 setPrimitiveUnitsBaseValue(propertyValue);106 m_primitiveUnits.setValue(propertyValue); 140 107 } else if (name == SVGNames::xAttr) 141 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));108 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 142 109 else if (name == SVGNames::yAttr) 143 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));110 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 144 111 else if (name == SVGNames::widthAttr) 145 setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));112 m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 146 113 else if (name == SVGNames::heightAttr) 147 setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));114 m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 148 115 else if (name == SVGNames::filterResAttr) { 149 116 float x, y; 150 117 if (parseNumberOptionalNumber(value, x, y)) { 151 setFilterResXBaseValue(x);152 setFilterResYBaseValue(y);118 m_filterResX.setValue(x); 119 m_filterResY.setValue(y); 153 120 } 154 121 } … … 163 130 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) 164 131 { 165 if (!isSupportedAttribute(attrName)) { 166 SVGElement::svgAttributeChanged(attrName); 167 return; 168 } 169 170 InstanceInvalidationGuard guard(*this); 171 172 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { 132 if (isAnimatedLengthAttribute(attrName)) { 133 InstanceInvalidationGuard guard(*this); 173 134 invalidateSVGPresentationAttributeStyle(); 174 135 return; 175 136 } 176 137 177 if (auto* renderer = this->renderer()) 178 renderer->setNeedsLayout(); 138 if (isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) { 139 if (auto* renderer = this->renderer()) 140 renderer->setNeedsLayout(); 141 return; 142 } 143 144 SVGElement::svgAttributeChanged(attrName); 145 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 179 146 } 180 147 -
trunk/Source/WebCore/svg/SVGFilterElement.h
r229694 r234620 4 4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 5 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) 2018 Apple Inc. All rights reserved. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 23 24 #pragma once 24 25 25 #include "SVGAnimatedBoolean.h"26 26 #include "SVGAnimatedEnumeration.h" 27 27 #include "SVGAnimatedInteger.h" … … 34 34 namespace WebCore { 35 35 36 class SVGFilterElement final : public SVGElement, public SVG URIReference, public SVGExternalResourcesRequired{36 class SVGFilterElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference { 37 37 WTF_MAKE_ISO_ALLOCATED(SVGFilterElement); 38 38 public: … … 41 41 void setFilterRes(unsigned filterResX, unsigned filterResY); 42 42 43 SVGUnitTypes::SVGUnitType filterUnits() const { return m_filterUnits.currentValue(attributeOwnerProxy()); } 44 SVGUnitTypes::SVGUnitType primitiveUnits() const { return m_primitiveUnits.currentValue(attributeOwnerProxy()); } 45 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 46 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 47 const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } 48 const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } 49 int filterResX() const { return m_filterResX.currentValue(attributeOwnerProxy()); } 50 int filterResY() const { return m_filterResY.currentValue(attributeOwnerProxy()); } 51 52 RefPtr<SVGAnimatedEnumeration> filterUnitsAnimated() { return m_filterUnits.animatedProperty(attributeOwnerProxy()); } 53 RefPtr<SVGAnimatedEnumeration> primitiveUnitsAnimated() { return m_primitiveUnits.animatedProperty(attributeOwnerProxy()); } 54 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 55 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 56 RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } 57 RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } 58 RefPtr<SVGAnimatedInteger> filterResXAnimated() { return m_filterResX.animatedProperty(attributeOwnerProxy()); } 59 RefPtr<SVGAnimatedInteger> filterResYAnimated() { return m_filterResY.animatedProperty(attributeOwnerProxy()); } 60 43 61 private: 44 62 SVGFilterElement(const QualifiedName&, Document&); 45 63 46 bool needsPendingResourceHandling() const final { return false; } 64 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFilterElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; 65 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 66 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 67 static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } 68 static void registerAttributes(); 47 69 48 static bool isSupportedAttribute(const QualifiedName&);70 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 49 71 void parseAttribute(const QualifiedName&, const AtomicString&) final; 50 72 void svgAttributeChanged(const QualifiedName&) final; 51 73 void childrenChanged(const ChildChange&) final; 74 75 bool needsPendingResourceHandling() const final { return false; } 52 76 53 77 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; … … 59 83 static const AtomicString& filterResYIdentifier(); 60 84 61 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFilterElement) 62 DECLARE_ANIMATED_ENUMERATION(FilterUnits, filterUnits, SVGUnitTypes::SVGUnitType) 63 DECLARE_ANIMATED_ENUMERATION(PrimitiveUnits, primitiveUnits, SVGUnitTypes::SVGUnitType) 64 DECLARE_ANIMATED_LENGTH(X, x) 65 DECLARE_ANIMATED_LENGTH(Y, y) 66 DECLARE_ANIMATED_LENGTH(Width, width) 67 DECLARE_ANIMATED_LENGTH(Height, height) 68 DECLARE_ANIMATED_INTEGER(FilterResX, filterResX) 69 DECLARE_ANIMATED_INTEGER(FilterResY, filterResY) 70 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 71 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 72 END_DECLARE_ANIMATED_PROPERTIES 85 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 86 SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_filterUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; 87 SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_primitiveUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; 88 SVGAnimatedLengthAttribute m_x { LengthModeWidth, "-10%" }; 89 SVGAnimatedLengthAttribute m_y { LengthModeHeight, "-10%" }; 90 SVGAnimatedLengthAttribute m_width { LengthModeWidth, "120%" }; 91 SVGAnimatedLengthAttribute m_height { LengthModeHeight, "120%" }; 92 SVGAnimatedIntegerAttribute m_filterResX; 93 SVGAnimatedIntegerAttribute m_filterResY; 73 94 }; 74 95 -
trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
r229694 r234620 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 25 26 #include "FilterEffect.h" 26 27 #include "RenderSVGResourceFilterPrimitive.h" 27 #include "SVGElement.h"28 28 #include "SVGFilterBuilder.h" 29 #include "SVGLengthValue.h"30 #include "SVGNames.h"31 #include "SVGUnitTypes.h"32 29 #include <wtf/IsoMallocInlines.h> 33 30 #include <wtf/NeverDestroyed.h> … … 37 34 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFilterPrimitiveStandardAttributes); 38 35 39 // Animated property definitions40 DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::xAttr, X, x)41 DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::yAttr, Y, y)42 DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::widthAttr, Width, width)43 DEFINE_ANIMATED_LENGTH(SVGFilterPrimitiveStandardAttributes, SVGNames::heightAttr, Height, height)44 DEFINE_ANIMATED_STRING(SVGFilterPrimitiveStandardAttributes, SVGNames::resultAttr, Result, result)45 46 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes)47 REGISTER_LOCAL_ANIMATED_PROPERTY(x)48 REGISTER_LOCAL_ANIMATED_PROPERTY(y)49 REGISTER_LOCAL_ANIMATED_PROPERTY(width)50 REGISTER_LOCAL_ANIMATED_PROPERTY(height)51 REGISTER_LOCAL_ANIMATED_PROPERTY(result)52 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)53 END_REGISTER_ANIMATED_PROPERTIES54 55 36 SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document) 56 37 : SVGElement(tagName, document) 57 , m_x(LengthModeWidth, "0%")58 , m_y(LengthModeHeight, "0%")59 , m_width(LengthModeWidth, "100%")60 , m_height(LengthModeHeight, "100%")61 38 { 62 // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified. 63 // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified. 64 registerAnimatedPropertiesForSVGFilterPrimitiveStandardAttributes(); 39 registerAttributes(); 65 40 } 66 41 67 bool SVGFilterPrimitiveStandardAttributes::isSupportedAttribute(const QualifiedName& attrName)42 void SVGFilterPrimitiveStandardAttributes::registerAttributes() 68 43 { 69 static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> {70 SVGNames::xAttr.get(),71 SVGNames::yAttr.get(),72 SVGNames::widthAttr.get(),73 SVGNames::heightAttr.get(),74 SVGNames::resultAttr.get(),75 });76 re turn supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);44 auto& registry = attributeRegistry(); 45 if (!registry.isEmpty()) 46 return; 47 registry.registerAttribute<SVGNames::xAttr, &SVGFilterPrimitiveStandardAttributes::m_x>(); 48 registry.registerAttribute<SVGNames::yAttr, &SVGFilterPrimitiveStandardAttributes::m_y>(); 49 registry.registerAttribute<SVGNames::widthAttr, &SVGFilterPrimitiveStandardAttributes::m_width>(); 50 registry.registerAttribute<SVGNames::heightAttr, &SVGFilterPrimitiveStandardAttributes::m_height>(); 51 registry.registerAttribute<SVGNames::resultAttr, &SVGFilterPrimitiveStandardAttributes::m_result>(); 77 52 } 78 53 … … 82 57 83 58 if (name == SVGNames::xAttr) 84 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));59 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 85 60 else if (name == SVGNames::yAttr) 86 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));61 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 87 62 else if (name == SVGNames::widthAttr) 88 setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));63 m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 89 64 else if (name == SVGNames::heightAttr) 90 setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));65 m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 91 66 else if (name == SVGNames::resultAttr) 92 setResultBaseValue(value);67 m_result.setValue(value); 93 68 94 69 reportAttributeParsingError(parseError, name, value); … … 106 81 void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedName& attrName) 107 82 { 108 if (!isSupportedAttribute(attrName)) { 109 SVGElement::svgAttributeChanged(attrName); 83 if (isKnownAttribute(attrName)) { 84 InstanceInvalidationGuard guard(*this); 85 invalidate(); 110 86 return; 111 87 } 112 88 113 InstanceInvalidationGuard guard(*this); 114 invalidate(); 89 SVGElement::svgAttributeChanged(attrName); 115 90 } 116 91 -
trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 26 27 #include "SVGAnimatedString.h" 27 28 #include "SVGElement.h" 29 #include "SVGNames.h" 28 30 #include <wtf/RefPtr.h> 29 31 … … 43 45 virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); 44 46 47 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFilterPrimitiveStandardAttributes, SVGElement>; 48 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 49 50 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 51 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 52 const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } 53 const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } 54 const String& result() const { return m_result.currentValue(attributeOwnerProxy()); } 55 56 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 57 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 58 RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } 59 RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } 60 RefPtr<SVGAnimatedString> resultAnimated() { return m_result.animatedProperty(attributeOwnerProxy()); } 61 45 62 protected: 46 63 SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document&); … … 54 71 55 72 private: 73 static void registerAttributes(); 74 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 75 56 76 bool isFilterEffect() const override { return true; } 57 77 … … 60 80 bool childShouldCreateRenderer(const Node&) const override { return false; } 61 81 62 static bool isSupportedAttribute(const QualifiedName&);82 const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } 63 83 64 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) 65 DECLARE_ANIMATED_LENGTH(X, x) 66 DECLARE_ANIMATED_LENGTH(Y, y) 67 DECLARE_ANIMATED_LENGTH(Width, width) 68 DECLARE_ANIMATED_LENGTH(Height, height) 69 DECLARE_ANIMATED_STRING(Result, result) 70 END_DECLARE_ANIMATED_PROPERTIES 84 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 85 86 // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified. 87 // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified. 88 SVGAnimatedLengthAttribute m_x { LengthModeWidth, "0%" }; 89 SVGAnimatedLengthAttribute m_y { LengthModeHeight, "0%" }; 90 SVGAnimatedLengthAttribute m_width { LengthModeWidth, "100%" }; 91 SVGAnimatedLengthAttribute m_height { LengthModeHeight, "100%" }; 92 SVGAnimatedStringAttribute m_result; 71 93 }; 72 94 -
trunk/Source/WebCore/svg/SVGFitToViewBox.cpp
r208581 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 26 27 #include "FloatRect.h" 27 28 #include "SVGDocumentExtensions.h" 29 #include "SVGElement.h" 28 30 #include "SVGNames.h" 29 31 #include "SVGParserUtilities.h" … … 33 35 namespace WebCore { 34 36 35 bool SVGFitToViewBox::parseViewBox(Document* doc, const String& s, FloatRect& viewBox) 37 SVGFitToViewBox::SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState animatedState) 38 : m_attributeOwnerProxy(*this, *contextElement, animatedState) 36 39 { 37 auto upconvertedCharacters = StringView(s).upconvertedCharacters(); 38 const UChar* characters = upconvertedCharacters; 39 return parseViewBox(doc, characters, characters + s.length(), viewBox, true); 40 registerAttributes(); 40 41 } 41 42 42 bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate) 43 void SVGFitToViewBox::registerAttributes() 44 { 45 auto& registry = attributeRegistry(); 46 if (!registry.isEmpty()) 47 return; 48 registry.registerAttribute<SVGNames::viewBoxAttr, &SVGFitToViewBox::m_viewBox>(); 49 registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGFitToViewBox::m_preserveAspectRatio>(); 50 } 51 52 void SVGFitToViewBox::setViewBox(const FloatRect& viewBox) 53 { 54 m_viewBox.setValue(viewBox); 55 m_isViewBoxValid = true; 56 } 57 58 void SVGFitToViewBox::resetViewBox() 59 { 60 m_viewBox.resetValue(); 61 m_isViewBoxValid = false; 62 } 63 64 void SVGFitToViewBox::reset() 65 { 66 resetViewBox(); 67 resetPreserveAspectRatio(); 68 } 69 70 bool SVGFitToViewBox::parseAttribute(const QualifiedName& name, const AtomicString& value) 71 { 72 if (name == SVGNames::viewBoxAttr) { 73 FloatRect viewBox; 74 if (!value.isNull() && parseViewBox(value, viewBox)) 75 setViewBox(viewBox); 76 else 77 resetViewBox(); 78 return true; 79 } 80 81 if (name == SVGNames::preserveAspectRatioAttr) { 82 SVGPreserveAspectRatioValue preserveAspectRatio; 83 preserveAspectRatio.parse(value); 84 setPreserveAspectRatio(preserveAspectRatio); 85 return true; 86 } 87 88 return false; 89 } 90 91 bool SVGFitToViewBox::parseViewBox(const AtomicString& value, FloatRect& viewBox) 92 { 93 auto upconvertedCharacters = StringView(value).upconvertedCharacters(); 94 const UChar* characters = upconvertedCharacters; 95 return parseViewBox(characters, characters + value.length(), viewBox); 96 } 97 98 bool SVGFitToViewBox::parseViewBox(const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate) 43 99 { 44 100 String str(c, end - c); … … 51 107 float height = 0.0f; 52 108 bool valid = parseNumber(c, end, x) && parseNumber(c, end, y) && parseNumber(c, end, width) && parseNumber(c, end, height, false); 53 if (!validate) { 54 viewBox = FloatRect(x, y, width, height); 55 return true; 56 } 57 if (!valid) { 58 doc->accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); 59 return false; 109 110 if (validate) { 111 Document& document = m_attributeOwnerProxy.element().document(); 112 113 if (!valid) { 114 document.accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); 115 return false; 116 } 117 118 // Check that width is positive. 119 if (width < 0.0) { 120 document.accessSVGExtensions().reportError("A negative value for ViewBox width is not allowed"); 121 return false; 122 } 123 124 // Check that height is positive. 125 if (height < 0.0) { 126 document.accessSVGExtensions().reportError("A negative value for ViewBox height is not allowed"); 127 return false; 128 } 129 130 // Nothing should come after the last, fourth number. 131 skipOptionalSVGSpaces(c, end); 132 if (c < end) { 133 document.accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); 134 return false; 135 } 60 136 } 61 137 62 if (width < 0.0) { // check that width is positive 63 doc->accessSVGExtensions().reportError("A negative value for ViewBox width is not allowed"); 64 return false; 65 } 66 if (height < 0.0) { // check that height is positive 67 doc->accessSVGExtensions().reportError("A negative value for ViewBox height is not allowed"); 68 return false; 69 } 70 skipOptionalSVGSpaces(c, end); 71 if (c < end) { // nothing should come after the last, fourth number 72 doc->accessSVGExtensions().reportWarning("Problem parsing viewBox=\"" + str + "\""); 73 return false; 74 } 75 76 viewBox = FloatRect(x, y, width, height); 138 viewBox = { x, y, width, height }; 77 139 return true; 78 140 } … … 86 148 } 87 149 88 bool SVGFitToViewBox::isKnownAttribute(const QualifiedName& attrName)89 {90 return attrName == SVGNames::viewBoxAttr || attrName == SVGNames::preserveAspectRatioAttr;91 150 } 92 93 void SVGFitToViewBox::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes)94 {95 supportedAttributes.add(SVGNames::viewBoxAttr);96 supportedAttributes.add(SVGNames::preserveAspectRatioAttr);97 }98 99 } -
trunk/Source/WebCore/svg/SVGFitToViewBox.h
r208668 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 23 24 #include "FloatRect.h" 24 25 #include "QualifiedName.h" 26 #include "SVGAttributeRegistry.h" 25 27 #include "SVGNames.h" 26 28 #include "SVGPreserveAspectRatio.h" … … 30 32 31 33 class AffineTransform; 32 class Document;33 34 34 35 class SVGFitToViewBox { 36 WTF_MAKE_NONCOPYABLE(SVGFitToViewBox); 35 37 public: 36 38 static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatioValue&, float viewWidth, float viewHeight); 37 39 38 static bool isKnownAttribute(const QualifiedName&);39 static void addSupportedAttributes(HashSet<QualifiedName>&);40 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFitToViewBox>; 41 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 40 42 41 template<class SVGElementTarget> 42 static bool parseAttribute(SVGElementTarget* target, const QualifiedName& name, const AtomicString& value) 43 { 44 ASSERT(target); 45 if (name == SVGNames::viewBoxAttr) { 46 FloatRect viewBox; 47 bool valueIsValid = !value.isNull() && parseViewBox(&target->document(), value, viewBox); 48 target->setViewBoxBaseValue(viewBox, valueIsValid); 49 return true; 50 } 43 const FloatRect& viewBox() const { return m_viewBox.currentValue(m_attributeOwnerProxy); } 44 const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(m_attributeOwnerProxy); } 51 45 52 if (name == SVGNames::preserveAspectRatioAttr) { 53 SVGPreserveAspectRatioValue preserveAspectRatio; 54 preserveAspectRatio.parse(value); 55 target->setPreserveAspectRatioBaseValue(preserveAspectRatio); 56 return true; 57 } 46 RefPtr<SVGAnimatedRect> viewBoxAnimated() { return m_viewBox.animatedProperty(m_attributeOwnerProxy); } 47 RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(m_attributeOwnerProxy); } 58 48 59 return false;60 }49 void setViewBox(const FloatRect&); 50 void resetViewBox(); 61 51 62 static bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); 52 void setPreserveAspectRatio(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio.setValue(preserveAspectRatio); } 53 void resetPreserveAspectRatio() { m_preserveAspectRatio.resetValue(); } 54 55 String viewBoxString() const { return m_viewBox.toString(); } 56 String preserveAspectRatioString() const { return m_preserveAspectRatio.toString(); } 57 58 bool hasValidViewBox() const { return m_isViewBoxValid; } 59 bool hasEmptyViewBox() const { return m_isViewBoxValid && viewBox().isEmpty(); } 60 61 protected: 62 SVGFitToViewBox(SVGElement* contextElement, AnimatedPropertyState = PropertyIsReadWrite); 63 64 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 65 66 void reset(); 67 bool parseAttribute(const QualifiedName&, const AtomicString&); 68 bool parseViewBox(const AtomicString& value, FloatRect& viewBox); 69 bool parseViewBox(const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); 63 70 64 71 private: 65 static bool parseViewBox(Document*, const String&, FloatRect&); 72 static void registerAttributes(); 73 74 AttributeOwnerProxy m_attributeOwnerProxy; 75 SVGAnimatedRectAttribute m_viewBox; 76 SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio; 77 bool m_isViewBoxValid { false }; 66 78 }; 67 79 -
trunk/Source/WebCore/svg/SVGFontElement.cpp
r229694 r234620 3 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 40 41 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFontElement); 41 42 42 // Animated property definitions43 DEFINE_ANIMATED_BOOLEAN(SVGFontElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)44 45 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFontElement)46 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)47 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)48 END_REGISTER_ANIMATED_PROPERTIES49 50 43 inline SVGFontElement::SVGFontElement(const QualifiedName& tagName, Document& document) 51 44 : SVGElement(tagName, document) 45 , SVGExternalResourcesRequired(this) 52 46 { 53 47 ASSERT(hasTagName(SVGNames::fontTag)); 54 registerAnimatedPropertiesForSVGFontElement();55 48 } 56 49 -
trunk/Source/WebCore/svg/SVGFontElement.h
r229694 r234620 3 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 53 54 bool rendererIsNeeded(const RenderStyle&) final { return false; } 54 55 55 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFontElement) 56 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 57 END_DECLARE_ANIMATED_PROPERTIES 56 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFontElement, SVGElement, SVGExternalResourcesRequired>; 57 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 58 59 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 58 60 }; 59 61 -
trunk/Source/WebCore/svg/SVGForeignObjectElement.cpp
r229694 r234620 1 1 /* 2 * Copyright (C) 2006 Apple Inc. All rights reserved.2 * Copyright (C) 2006-2018 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 4 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. … … 37 37 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGForeignObjectElement); 38 38 39 // Animated property definitions40 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::xAttr, X, x)41 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::yAttr, Y, y)42 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::widthAttr, Width, width)43 DEFINE_ANIMATED_LENGTH(SVGForeignObjectElement, SVGNames::heightAttr, Height, height)44 DEFINE_ANIMATED_STRING(SVGForeignObjectElement, XLinkNames::hrefAttr, Href, href)45 DEFINE_ANIMATED_BOOLEAN(SVGForeignObjectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)46 47 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement)48 REGISTER_LOCAL_ANIMATED_PROPERTY(x)49 REGISTER_LOCAL_ANIMATED_PROPERTY(y)50 REGISTER_LOCAL_ANIMATED_PROPERTY(width)51 REGISTER_LOCAL_ANIMATED_PROPERTY(height)52 REGISTER_LOCAL_ANIMATED_PROPERTY(href)53 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)54 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)55 END_REGISTER_ANIMATED_PROPERTIES56 57 39 inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document& document) 58 40 : SVGGraphicsElement(tagName, document) 59 , m_x(LengthModeWidth) 60 , m_y(LengthModeHeight) 61 , m_width(LengthModeWidth) 62 , m_height(LengthModeHeight) 41 , SVGExternalResourcesRequired(this) 63 42 { 64 43 ASSERT(hasTagName(SVGNames::foreignObjectTag)); 65 registerA nimatedPropertiesForSVGForeignObjectElement();44 registerAttributes(); 66 45 } 67 46 … … 71 50 } 72 51 73 bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName)52 void SVGForeignObjectElement::registerAttributes() 74 53 { 75 static const auto supportedAttributes = makeNeverDestroyed([] { 76 HashSet<QualifiedName> set; 77 SVGLangSpace::addSupportedAttributes(set); 78 SVGExternalResourcesRequired::addSupportedAttributes(set); 79 set.add({ SVGNames::xAttr.get(), SVGNames::yAttr.get(), SVGNames::widthAttr.get(), SVGNames::heightAttr.get() }); 80 return set; 81 }()); 82 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 54 auto& registry = attributeRegistry(); 55 if (!registry.isEmpty()) 56 return; 57 registry.registerAttribute<SVGNames::xAttr, &SVGForeignObjectElement::m_x>(); 58 registry.registerAttribute<SVGNames::yAttr, &SVGForeignObjectElement::m_y>(); 59 registry.registerAttribute<SVGNames::widthAttr, &SVGForeignObjectElement::m_width>(); 60 registry.registerAttribute<SVGNames::heightAttr, &SVGForeignObjectElement::m_height>(); 83 61 } 84 62 … … 88 66 89 67 if (name == SVGNames::xAttr) 90 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));68 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 91 69 else if (name == SVGNames::yAttr) 92 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));70 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 93 71 else if (name == SVGNames::widthAttr) 94 setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));72 m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 95 73 else if (name == SVGNames::heightAttr) 96 setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));74 m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 97 75 98 76 reportAttributeParsingError(parseError, name, value); … … 104 82 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) 105 83 { 106 if (!isSupportedAttribute(attrName)) { 107 SVGGraphicsElement::svgAttributeChanged(attrName); 108 return; 109 } 110 111 InstanceInvalidationGuard guard(*this); 112 113 if (attrName == SVGNames::widthAttr 114 || attrName == SVGNames::heightAttr) { 84 if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { 115 85 invalidateSVGPresentationAttributeStyle(); 116 86 return; 117 87 } 118 88 119 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) 89 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) { 120 90 updateRelativeLengthsInformation(); 91 if (auto renderer = this->renderer()) 92 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 93 return; 94 } 121 95 122 if (auto renderer = this->renderer())123 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);96 SVGGraphicsElement::svgAttributeChanged(attrName); 97 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 124 98 } 125 99 -
trunk/Source/WebCore/svg/SVGForeignObjectElement.h
r229694 r234620 1 1 /* 2 * Copyright (C) 2006 Apple Inc. All rights reserved.2 * Copyright (C) 2006-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 34 34 static Ref<SVGForeignObjectElement> create(const QualifiedName&, Document&); 35 35 36 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 37 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 38 const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } 39 const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } 40 41 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 42 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 43 RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } 44 RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } 45 36 46 private: 37 47 SVGForeignObjectElement(const QualifiedName&, Document&); 38 48 39 bool isValid() const final { return SVGTests::isValid(); } 40 static bool isSupportedAttribute(const QualifiedName&); 49 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGForeignObjectElement, SVGGraphicsElement, SVGExternalResourcesRequired>; 50 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 51 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 52 static void registerAttributes(); 53 54 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 41 55 void parseAttribute(const QualifiedName&, const AtomicString&) final; 42 56 void svgAttributeChanged(const QualifiedName&) final; … … 46 60 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 47 61 62 bool isValid() const final { return SVGTests::isValid(); } 48 63 bool selfHasRelativeLengths() const final { return true; } 49 64 50 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGForeignObjectElement) 51 DECLARE_ANIMATED_LENGTH(X, x) 52 DECLARE_ANIMATED_LENGTH(Y, y) 53 DECLARE_ANIMATED_LENGTH(Width, width) 54 DECLARE_ANIMATED_LENGTH(Height, height) 55 DECLARE_ANIMATED_STRING(Href, href) 56 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 57 END_DECLARE_ANIMATED_PROPERTIES 65 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 66 SVGAnimatedLengthAttribute m_x { LengthModeWidth }; 67 SVGAnimatedLengthAttribute m_y { LengthModeHeight }; 68 SVGAnimatedLengthAttribute m_width { LengthModeWidth }; 69 SVGAnimatedLengthAttribute m_height { LengthModeHeight }; 58 70 }; 59 71 -
trunk/Source/WebCore/svg/SVGGElement.cpp
r232178 r234620 2 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 33 34 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGElement); 34 35 35 // Animated property definitions36 DEFINE_ANIMATED_BOOLEAN(SVGGElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)37 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGElement)39 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)41 END_REGISTER_ANIMATED_PROPERTIES42 43 36 SVGGElement::SVGGElement(const QualifiedName& tagName, Document& document) 44 37 : SVGGraphicsElement(tagName, document) 38 , SVGExternalResourcesRequired(this) 45 39 { 46 40 ASSERT(hasTagName(SVGNames::gTag)); 47 registerAnimatedPropertiesForSVGGElement();48 41 } 49 42 … … 58 51 } 59 52 60 bool SVGGElement::isSupportedAttribute(const QualifiedName& attrName)61 {62 static const auto supportedAttributes = makeNeverDestroyed([] {63 HashSet<QualifiedName> set;64 SVGLangSpace::addSupportedAttributes(set);65 SVGExternalResourcesRequired::addSupportedAttributes(set);66 return set;67 }());68 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);69 }70 71 53 void SVGGElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 72 54 { … … 77 59 void SVGGElement::svgAttributeChanged(const QualifiedName& attrName) 78 60 { 79 if (!isSupportedAttribute(attrName)) { 80 SVGGraphicsElement::svgAttributeChanged(attrName); 81 return; 82 } 83 84 InstanceInvalidationGuard guard(*this); 85 86 if (auto renderer = this->renderer()) 87 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 61 SVGGraphicsElement::svgAttributeChanged(attrName); 62 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 88 63 } 89 64 -
trunk/Source/WebCore/svg/SVGGElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 38 39 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 39 40 40 bool isValid() const final { return SVGTests::isValid(); }41 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGElement, SVGGraphicsElement, SVGExternalResourcesRequired>; 41 42 42 static bool isSupportedAttribute(const QualifiedName&);43 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 43 44 void parseAttribute(const QualifiedName&, const AtomicString&) final; 44 45 void svgAttributeChanged(const QualifiedName&) final; 45 46 47 bool isValid() const final { return SVGTests::isValid(); } 46 48 bool rendererIsNeeded(const RenderStyle&) final; 47 49 48 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGElement) 49 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 50 END_DECLARE_ANIMATED_PROPERTIES 50 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 51 51 }; 52 52 -
trunk/Source/WebCore/svg/SVGGeometryElement.cpp
r231955 r234620 25 25 26 26 #include "DOMPoint.h" 27 #include "RenderSVGPath.h"28 #include "RenderSVGResource.h"29 27 #include "SVGDocumentExtensions.h" 30 #include "SVGMPathElement.h"31 #include "SVGNames.h"32 28 #include "SVGPathUtilities.h" 33 29 #include "SVGPoint.h" 34 30 #include <wtf/IsoMallocInlines.h> 35 #include <wtf/NeverDestroyed.h>36 31 37 32 namespace WebCore { … … 39 34 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGeometryElement); 40 35 41 // Animated property definitions42 DEFINE_ANIMATED_NUMBER(SVGGeometryElement, SVGNames::pathLengthAttr, PathLength, pathLength)43 44 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGeometryElement)45 REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength)46 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)47 END_REGISTER_ANIMATED_PROPERTIES48 49 36 SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& document) 50 37 : SVGGraphicsElement(tagName, document) 51 38 { 52 registerA nimatedPropertiesForSVGGeometryElement();39 registerAttributes(); 53 40 } 54 41 … … 101 88 } 102 89 103 bool SVGGeometryElement::isSupportedAttribute(const QualifiedName& attrName)90 void SVGGeometryElement::registerAttributes() 104 91 { 105 static const auto supportedAttributes = makeNeverDestroyed([] { 106 HashSet<QualifiedName> set; 107 SVGLangSpace::addSupportedAttributes(set); 108 SVGExternalResourcesRequired::addSupportedAttributes(set); 109 set.add({ SVGNames::pathLengthAttr.get() }); 110 return set; 111 }()); 112 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 92 auto& registry = attributeRegistry(); 93 if (!registry.isEmpty()) 94 return; 95 registry.registerAttribute<SVGNames::pathLengthAttr, &SVGGeometryElement::m_pathLength>(); 113 96 } 114 97 … … 116 99 { 117 100 if (name == SVGNames::pathLengthAttr) { 118 setPathLengthBaseValue(value.toFloat());119 if ( pathLengthBaseValue() < 0)101 m_pathLength.setValue(value.toFloat()); 102 if (m_pathLength.value() < 0) 120 103 document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed"); 121 104 return; … … 127 110 void SVGGeometryElement::svgAttributeChanged(const QualifiedName& attrName) 128 111 { 129 if (!isSupportedAttribute(attrName)) { 130 SVGGraphicsElement::svgAttributeChanged(attrName); 112 if (attrName == SVGNames::pathLengthAttr) { 113 InstanceInvalidationGuard guard(*this); 114 if (auto* renderer = this->renderer()) 115 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 131 116 return; 132 117 } 133 118 134 InstanceInvalidationGuard guard(*this); 135 136 ASSERT_NOT_REACHED(); 119 SVGGraphicsElement::svgAttributeChanged(attrName); 137 120 } 138 121 -
trunk/Source/WebCore/svg/SVGGeometryElement.h
r231955 r234620 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2018 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 23 24 24 25 #include "Path.h" 25 #include "SVGAnimatedBoolean.h"26 26 #include "SVGAnimatedNumber.h" 27 #include "SVGExternalResourcesRequired.h"28 27 #include "SVGGraphicsElement.h" 29 28 #include "SVGNames.h" … … 44 43 bool isPointInStroke(DOMPointInit&&); 45 44 45 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGeometryElement, SVGGraphicsElement>; 46 static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 47 48 auto pathLengthAnimated() { return m_pathLength.animatedProperty(attributeOwnerProxy()); } 49 46 50 protected: 47 51 SVGGeometryElement(const QualifiedName&, Document&); 48 52 49 static bool isSupportedAttribute(const QualifiedName&);50 53 void parseAttribute(const QualifiedName&, const AtomicString&) override; 51 54 void svgAttributeChanged(const QualifiedName&) override; 52 55 53 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGeometryElement) 54 DECLARE_ANIMATED_NUMBER(PathLength, pathLength) 55 END_DECLARE_ANIMATED_PROPERTIES 56 private: 57 const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } 58 59 static void registerAttributes(); 60 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 61 62 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 63 SVGAnimatedNumberAttribute m_pathLength; 56 64 }; 57 65 -
trunk/Source/WebCore/svg/SVGGlyphRefElement.cpp
r229694 r234620 1 1 /* 2 2 * Copyright (C) 2011 Leo Yang <leoyang@webkit.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 34 35 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGlyphRefElement); 35 36 36 // Animated property definitions37 DEFINE_ANIMATED_STRING(SVGGlyphRefElement, XLinkNames::hrefAttr, Href, href)38 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGlyphRefElement)40 REGISTER_LOCAL_ANIMATED_PROPERTY(href)41 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)42 END_REGISTER_ANIMATED_PROPERTIES43 44 37 inline SVGGlyphRefElement::SVGGlyphRefElement(const QualifiedName& tagName, Document& document) 45 38 : SVGElement(tagName, document) 39 , SVGURIReference(this) 46 40 { 47 41 ASSERT(hasTagName(SVGNames::glyphRefTag)); 48 registerAnimatedPropertiesForSVGGlyphRefElement();49 42 } 50 43 -
trunk/Source/WebCore/svg/SVGGlyphRefElement.h
r229694 r234620 1 1 /* 2 2 * Copyright (C) 2011 Leo Yang <leoyang@webkit.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 46 47 SVGGlyphRefElement(const QualifiedName&, Document&); 47 48 49 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGlyphRefElement, SVGElement, SVGURIReference>; 50 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 48 51 void parseAttribute(const QualifiedName&, const AtomicString&) final; 52 49 53 bool rendererIsNeeded(const RenderStyle&) final { return false; } 50 51 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGlyphRefElement)52 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)53 END_DECLARE_ANIMATED_PROPERTIES54 54 55 55 float m_x { 0 }; … … 57 57 float m_dx { 0 }; 58 58 float m_dy { 0 }; 59 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 59 60 }; 60 61 -
trunk/Source/WebCore/svg/SVGGradientElement.cpp
r230829 r234620 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 40 41 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGradientElement); 41 42 42 // Animated property definitions43 DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::spreadMethodAttr, SpreadMethod, spreadMethod, SVGSpreadMethodType)44 DEFINE_ANIMATED_ENUMERATION(SVGGradientElement, SVGNames::gradientUnitsAttr, GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType)45 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGradientElement, SVGNames::gradientTransformAttr, GradientTransform, gradientTransform)46 DEFINE_ANIMATED_STRING(SVGGradientElement, XLinkNames::hrefAttr, Href, href)47 DEFINE_ANIMATED_BOOLEAN(SVGGradientElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)48 49 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGradientElement)50 REGISTER_LOCAL_ANIMATED_PROPERTY(spreadMethod)51 REGISTER_LOCAL_ANIMATED_PROPERTY(gradientUnits)52 REGISTER_LOCAL_ANIMATED_PROPERTY(gradientTransform)53 REGISTER_LOCAL_ANIMATED_PROPERTY(href)54 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)55 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)56 END_REGISTER_ANIMATED_PROPERTIES57 58 43 SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document& document) 59 44 : SVGElement(tagName, document) 60 , m_spreadMethod(SVGSpreadMethodPad)61 , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)45 , SVGExternalResourcesRequired(this) 46 , SVGURIReference(this) 62 47 { 63 registerA nimatedPropertiesForSVGGradientElement();48 registerAttributes(); 64 49 } 65 50 66 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName)51 void SVGGradientElement::registerAttributes() 67 52 { 68 static const auto supportedAttributes = makeNeverDestroyed([] { 69 HashSet<QualifiedName> set; 70 SVGURIReference::addSupportedAttributes(set); 71 SVGExternalResourcesRequired::addSupportedAttributes(set); 72 set.add({ SVGNames::gradientUnitsAttr.get(), SVGNames::gradientTransformAttr.get(), SVGNames::spreadMethodAttr.get() }); 73 return set; 74 }()); 75 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 53 auto& registry = attributeRegistry(); 54 if (!registry.isEmpty()) 55 return; 56 registry.registerAttribute<SVGNames::spreadMethodAttr, SVGSpreadMethodType, &SVGGradientElement::m_spreadMethod>(); 57 registry.registerAttribute<SVGNames::gradientUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGGradientElement::m_gradientUnits>(); 58 registry.registerAttribute<SVGNames::gradientTransformAttr, &SVGGradientElement::m_gradientTransform>(); 76 59 } 77 60 … … 81 64 auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 82 65 if (propertyValue > 0) 83 setGradientUnitsBaseValue(propertyValue);66 m_gradientUnits.setValue(propertyValue); 84 67 return; 85 68 } … … 88 71 SVGTransformListValues newList; 89 72 newList.parse(value); 90 detachAnimatedGradientTransformListWrappers(newList.size());91 setGradientTransformBaseValue(newList);73 m_gradientTransform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 74 m_gradientTransform.setValue(WTFMove(newList)); 92 75 return; 93 76 } … … 96 79 auto propertyValue = SVGPropertyTraits<SVGSpreadMethodType>::fromString(value); 97 80 if (propertyValue > 0) 98 setSpreadMethodBaseValue(propertyValue);81 m_spreadMethod.setValue(propertyValue); 99 82 return; 100 83 } … … 107 90 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) 108 91 { 109 if (!isSupportedAttribute(attrName)) { 110 SVGElement::svgAttributeChanged(attrName); 92 if (isKnownAttribute(attrName)) { 93 InstanceInvalidationGuard guard(*this); 94 if (RenderObject* object = renderer()) 95 object->setNeedsLayout(); 111 96 return; 112 97 } 113 98 114 InstanceInvalidationGuard guard(*this); 115 116 if (RenderObject* object = renderer()) 117 object->setNeedsLayout(); 99 SVGElement::svgAttributeChanged(attrName); 118 100 } 119 101 -
trunk/Source/WebCore/svg/SVGGradientElement.h
r233122 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 73 74 }; 74 75 75 class SVGGradientElement : public SVGElement, public SVG URIReference, public SVGExternalResourcesRequired{76 class SVGGradientElement : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference { 76 77 WTF_MAKE_ISO_ALLOCATED(SVGGradientElement); 77 78 public: … … 84 85 85 86 Vector<Gradient::ColorStop> buildStops(); 86 87 88 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGradientElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; 89 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 90 91 SVGSpreadMethodType spreadMethod() const { return m_spreadMethod.currentValue(attributeOwnerProxy()); } 92 SVGUnitTypes::SVGUnitType gradientUnits() const { return m_gradientUnits.currentValue(attributeOwnerProxy()); } 93 const SVGTransformListValues& gradientTransform() const { return m_gradientTransform.currentValue(attributeOwnerProxy()); } 94 95 RefPtr<SVGAnimatedEnumeration> spreadMethodAnimated() { return m_spreadMethod.animatedProperty(attributeOwnerProxy()); } 96 RefPtr<SVGAnimatedEnumeration> gradientUnitsAnimated() { return m_gradientUnits.animatedProperty(attributeOwnerProxy()); } 97 RefPtr<SVGAnimatedTransformList> gradientTransformAnimated() { return m_gradientTransform.animatedProperty(attributeOwnerProxy()); } 98 87 99 protected: 88 100 SVGGradientElement(const QualifiedName&, Document&); 89 101 90 static bool is SupportedAttribute(const QualifiedName&);102 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 91 103 void parseAttribute(const QualifiedName&, const AtomicString&) override; 92 104 void svgAttributeChanged(const QualifiedName&) override; … … 94 106 private: 95 107 bool needsPendingResourceHandling() const override { return false; } 96 97 108 void childrenChanged(const ChildChange&) override; 98 109 99 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGradientElement)100 DECLARE_ANIMATED_ENUMERATION(SpreadMethod, spreadMethod, SVGSpreadMethodType)101 DECLARE_ANIMATED_ENUMERATION(GradientUnits, gradientUnits, SVGUnitTypes::SVGUnitType) 102 DECLARE_ANIMATED_TRANSFORM_LIST(GradientTransform, gradientTransform)103 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)104 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)105 END_DECLARE_ANIMATED_PROPERTIES110 const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } 111 static void registerAttributes(); 112 113 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 114 SVGAnimatedEnumerationAttribute<SVGSpreadMethodType> m_spreadMethod { SVGSpreadMethodPad }; 115 SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_gradientUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; 116 SVGAnimatedTransformListAttribute m_gradientTransform; 106 117 }; 107 118 -
trunk/Source/WebCore/svg/SVGGraphicsElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 37 38 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGraphicsElement); 38 39 39 // Animated property definitions40 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGraphicsElement, SVGNames::transformAttr, Transform, transform)41 42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGraphicsElement)43 REGISTER_LOCAL_ANIMATED_PROPERTY(transform)44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)46 END_REGISTER_ANIMATED_PROPERTIES47 48 40 SVGGraphicsElement::SVGGraphicsElement(const QualifiedName& tagName, Document& document) 49 41 : SVGElement(tagName, document) 42 , SVGTests(this) 50 43 , m_shouldIsolateBlending(false) 51 44 { 52 registerA nimatedPropertiesForSVGGraphicsElement();45 registerAttributes(); 53 46 } 54 47 … … 128 121 } 129 122 130 bool SVGGraphicsElement::isSupportedAttribute(const QualifiedName& attrName)123 void SVGGraphicsElement::registerAttributes() 131 124 { 132 static const auto supportedAttributes = makeNeverDestroyed([] { 133 HashSet<QualifiedName> set; 134 SVGTests::addSupportedAttributes(set); 135 set.add(SVGNames::transformAttr); 136 return set; 137 }()); 138 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 125 auto& registry = attributeRegistry(); 126 if (!registry.isEmpty()) 127 return; 128 registry.registerAttribute<SVGNames::transformAttr, &SVGGraphicsElement::m_transform>(); 139 129 } 140 130 … … 144 134 SVGTransformListValues newList; 145 135 newList.parse(value); 146 detachAnimatedTransformListWrappers(newList.size());147 setTransformBaseValue(newList);136 m_transform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 137 m_transform.setValue(newList); 148 138 return; 149 139 } … … 155 145 void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) 156 146 { 157 if (!isSupportedAttribute(attrName)) { 158 SVGElement::svgAttributeChanged(attrName); 159 return; 147 if (isKnownAttribute(attrName)) { 148 InstanceInvalidationGuard guard(*this); 149 150 auto renderer = this->renderer(); 151 if (!renderer) 152 return; 153 154 if (attrName == SVGNames::transformAttr) { 155 renderer->setNeedsTransformUpdate(); 156 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 157 return; 158 } 160 159 } 161 160 162 InstanceInvalidationGuard guard(*this); 163 164 if (SVGTests::handleAttributeChange(this, attrName)) 165 return; 166 167 auto renderer = this->renderer(); 168 if (!renderer) 169 return; 170 171 if (attrName == SVGNames::transformAttr) { 172 renderer->setNeedsTransformUpdate(); 173 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 174 return; 175 } 176 177 ASSERT_NOT_REACHED(); 161 SVGElement::svgAttributeChanged(attrName); 162 SVGTests::svgAttributeChanged(attrName); 178 163 } 179 164 … … 211 196 } 212 197 213 Ref<SVGStringList> SVGGraphicsElement::requiredFeatures()214 {215 return SVGTests::requiredFeatures(*this);216 198 } 217 218 Ref<SVGStringList> SVGGraphicsElement::requiredExtensions()219 {220 return SVGTests::requiredExtensions(*this);221 }222 223 Ref<SVGStringList> SVGGraphicsElement::systemLanguage()224 {225 return SVGTests::systemLanguage(*this);226 }227 228 } -
trunk/Source/WebCore/svg/SVGGraphicsElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 63 64 size_t approximateMemoryCost() const override { return sizeof(*this); } 64 65 65 // SVGTests 66 Ref<SVGStringList> requiredFeatures(); 67 Ref<SVGStringList> requiredExtensions(); 68 Ref<SVGStringList> systemLanguage(); 66 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGGraphicsElement, SVGElement, SVGTests>; 67 static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 68 69 const auto& transform() const { return m_transform.currentValue(attributeOwnerProxy()); } 70 auto transformAnimated() { return m_transform.animatedProperty(attributeOwnerProxy()); } 69 71 70 72 protected: … … 76 78 void svgAttributeChanged(const QualifiedName&) override; 77 79 78 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGraphicsElement)79 DECLARE_ANIMATED_TRANSFORM_LIST(Transform, transform)80 END_DECLARE_ANIMATED_PROPERTIES81 82 80 private: 83 81 bool isSVGGraphicsElement() const override { return true; } 84 82 85 static bool isSupportedAttribute(const QualifiedName&);83 const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } 86 84 87 // SVGTests 88 void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } 89 void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } 90 void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } 85 static void registerAttributes(); 86 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 91 87 92 88 // Used by <animateMotion> … … 95 91 // Used to isolate blend operations caused by masking. 96 92 bool m_shouldIsolateBlending; 93 94 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 95 SVGAnimatedTransformListAttribute m_transform; 97 96 }; 98 97 -
trunk/Source/WebCore/svg/SVGImageElement.cpp
r229694 r234620 4 4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 5 5 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 6 * Copyright (C) 2018 Apple Inc. All rights reserved. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 37 38 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGImageElement); 38 39 39 // Animated property definitions40 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::xAttr, X, x)41 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::yAttr, Y, y)42 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::widthAttr, Width, width)43 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::heightAttr, Height, height)44 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGImageElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)45 DEFINE_ANIMATED_STRING(SVGImageElement, XLinkNames::hrefAttr, Href, href)46 DEFINE_ANIMATED_BOOLEAN(SVGImageElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)47 48 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGImageElement)49 REGISTER_LOCAL_ANIMATED_PROPERTY(x)50 REGISTER_LOCAL_ANIMATED_PROPERTY(y)51 REGISTER_LOCAL_ANIMATED_PROPERTY(width)52 REGISTER_LOCAL_ANIMATED_PROPERTY(height)53 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)54 REGISTER_LOCAL_ANIMATED_PROPERTY(href)55 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)56 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)57 END_REGISTER_ANIMATED_PROPERTIES58 59 40 inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& document) 60 41 : SVGGraphicsElement(tagName, document) 61 , m_x(LengthModeWidth) 62 , m_y(LengthModeHeight) 63 , m_width(LengthModeWidth) 64 , m_height(LengthModeHeight) 42 , SVGExternalResourcesRequired(this) 43 , SVGURIReference(this) 65 44 , m_imageLoader(*this) 66 45 { 67 registerA nimatedPropertiesForSVGImageElement();46 registerAttributes(); 68 47 } 69 48 … … 82 61 } 83 62 84 bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName)63 void SVGImageElement::registerAttributes() 85 64 { 86 static const auto supportedAttributes = makeNeverDestroyed([] { 87 HashSet<QualifiedName> set; 88 SVGLangSpace::addSupportedAttributes(set); 89 SVGExternalResourcesRequired::addSupportedAttributes(set); 90 SVGURIReference::addSupportedAttributes(set); 91 set.add({ SVGNames::xAttr.get(), SVGNames::yAttr.get(), SVGNames::widthAttr.get(), SVGNames::heightAttr.get(), SVGNames::preserveAspectRatioAttr.get() }); 92 return set; 93 }()); 94 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 65 auto& registry = attributeRegistry(); 66 if (!registry.isEmpty()) 67 return; 68 registry.registerAttribute<SVGNames::xAttr, &SVGImageElement::m_x>(); 69 registry.registerAttribute<SVGNames::yAttr, &SVGImageElement::m_y>(); 70 registry.registerAttribute<SVGNames::widthAttr, &SVGImageElement::m_width>(); 71 registry.registerAttribute<SVGNames::heightAttr, &SVGImageElement::m_height>(); 72 registry.registerAttribute<SVGNames::preserveAspectRatioAttr, &SVGImageElement::m_preserveAspectRatio>(); 95 73 } 96 74 … … 100 78 SVGPreserveAspectRatioValue preserveAspectRatio; 101 79 preserveAspectRatio.parse(value); 102 setPreserveAspectRatioBaseValue(preserveAspectRatio);80 m_preserveAspectRatio.setValue(preserveAspectRatio); 103 81 return; 104 82 } … … 107 85 108 86 if (name == SVGNames::xAttr) 109 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));87 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 110 88 else if (name == SVGNames::yAttr) 111 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));89 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 112 90 else if (name == SVGNames::widthAttr) 113 setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));91 m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 114 92 else if (name == SVGNames::heightAttr) 115 setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));93 m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 116 94 117 95 reportAttributeParsingError(parseError, name, value); … … 124 102 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) 125 103 { 126 if (!isSupportedAttribute(attrName)) { 127 SVGGraphicsElement::svgAttributeChanged(attrName); 104 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) { 105 InstanceInvalidationGuard guard(*this); 106 updateRelativeLengthsInformation(); 107 108 if (auto* renderer = this->renderer()) { 109 if (downcast<RenderSVGImage>(*renderer).updateImageViewport()) 110 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 111 } 128 112 return; 129 113 } 130 114 131 InstanceInvalidationGuard guard(*this); 132 133 if (attrName == SVGNames::widthAttr 134 || attrName == SVGNames::heightAttr) { 115 if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { 116 InstanceInvalidationGuard guard(*this); 135 117 invalidateSVGPresentationAttributeStyle(); 136 118 return; 137 119 } 138 120 139 bool isLengthAttribute = attrName == SVGNames::xAttr 140 || attrName == SVGNames::yAttr 141 || attrName == SVGNames::widthAttr 142 || attrName == SVGNames::heightAttr; 143 144 if (isLengthAttribute) 145 updateRelativeLengthsInformation(); 121 if (attrName == SVGNames::preserveAspectRatioAttr) { 122 InstanceInvalidationGuard guard(*this); 123 if (auto* renderer = this->renderer()) 124 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 125 return; 126 } 146 127 147 128 if (SVGURIReference::isKnownAttribute(attrName)) { … … 150 131 } 151 132 152 auto* renderer = this->renderer(); 153 if (!renderer) 154 return; 155 156 if (isLengthAttribute) { 157 if (downcast<RenderSVGImage>(*renderer).updateImageViewport()) 158 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 159 return; 160 } 161 162 if (attrName == SVGNames::preserveAspectRatioAttr 163 || SVGLangSpace::isKnownAttribute(attrName) 164 || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { 165 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 166 return; 167 } 168 169 ASSERT_NOT_REACHED(); 133 SVGGraphicsElement::svgAttributeChanged(attrName); 134 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 170 135 } 171 136 … … 177 142 bool SVGImageElement::haveLoadedRequiredResources() 178 143 { 179 return !externalResourcesRequired BaseValue() || !m_imageLoader.hasPendingActivity();144 return !externalResourcesRequired() || !m_imageLoader.hasPendingActivity(); 180 145 } 181 146 -
trunk/Source/WebCore/svg/SVGImageElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 21 22 #pragma once 22 23 23 #include "SVGAnimatedBoolean.h"24 24 #include "SVGAnimatedLength.h" 25 25 #include "SVGAnimatedPreserveAspectRatio.h" … … 39 39 const AtomicString& imageSourceURL() const final; 40 40 41 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 42 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 43 const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } 44 const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } 45 const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio.currentValue(attributeOwnerProxy()); } 46 47 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 48 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 49 RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } 50 RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } 51 RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated() { return m_preserveAspectRatio.animatedProperty(attributeOwnerProxy()); } 52 41 53 private: 42 54 SVGImageElement(const QualifiedName&, Document&); 43 55 44 bool isValid() const final { return SVGTests::isValid(); } 56 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGImageElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>; 57 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 58 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 59 static void registerAttributes(); 45 60 46 static bool isSupportedAttribute(const QualifiedName&);61 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 47 62 void parseAttribute(const QualifiedName&, const AtomicString&) final; 48 63 void svgAttributeChanged(const QualifiedName&) final; … … 50 65 void didAttachRenderers() final; 51 66 InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; 52 53 67 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 54 68 55 69 void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; 56 57 70 bool haveLoadedRequiredResources() final; 58 71 72 bool isValid() const final { return SVGTests::isValid(); } 59 73 bool selfHasRelativeLengths() const final { return true; } 60 74 void didMoveToNewDocument(Document& oldDocument, Document& newDocument) final; 61 75 62 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement) 63 DECLARE_ANIMATED_LENGTH(X, x) 64 DECLARE_ANIMATED_LENGTH(Y, y) 65 DECLARE_ANIMATED_LENGTH(Width, width) 66 DECLARE_ANIMATED_LENGTH(Height, height) 67 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) 68 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 69 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 70 END_DECLARE_ANIMATED_PROPERTIES 71 76 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 77 SVGAnimatedLengthAttribute m_x { LengthModeWidth }; 78 SVGAnimatedLengthAttribute m_y { LengthModeHeight }; 79 SVGAnimatedLengthAttribute m_width { LengthModeWidth }; 80 SVGAnimatedLengthAttribute m_height { LengthModeHeight }; 81 SVGAnimatedPreserveAspectRatioAttribute m_preserveAspectRatio; 72 82 SVGImageLoader m_imageLoader; 73 83 }; -
trunk/Source/WebCore/svg/SVGImageLoader.cpp
r223728 r234620 42 42 element().dispatchEvent(Event::create(eventNames().errorEvent, false, false)); 43 43 else { 44 if (downcast<SVGImageElement>(element()).externalResourcesRequired BaseValue())44 if (downcast<SVGImageElement>(element()).externalResourcesRequired()) 45 45 downcast<SVGImageElement>(ImageLoader::element()).sendSVGLoadEventIfPossible(true); 46 46 } -
trunk/Source/WebCore/svg/SVGLangSpace.cpp
r219595 r234620 2 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGLangSpace.h" 23 24 25 #include "RenderSVGResource.h" 26 #include "RenderSVGShape.h" 27 #include "SVGElement.h" 24 28 #include "XMLNames.h" 25 29 #include <wtf/NeverDestroyed.h> … … 27 31 namespace WebCore { 28 32 29 void SVGLangSpace::setXmllang(const AtomicString& xmlLang) 33 SVGLangSpace::SVGLangSpace(SVGElement* contextElement) 34 : m_contextElement(*contextElement) 30 35 { 31 m_lang = xmlLang;36 registerAttributes(); 32 37 } 33 38 34 const AtomicString& SVGLangSpace::xmlspace() const 39 void SVGLangSpace::registerAttributes() 35 40 { 36 if (!m_space) { 37 static NeverDestroyed<const AtomicString> defaultString("default", AtomicString::ConstructFromLiteral); 41 auto& registry = attributeRegistry(); 42 if (!registry.isEmpty()) 43 return; 44 registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::langAttr, &SVGLangSpace::m_lang>()); 45 registry.registerAttribute(SVGStringAttributeAccessor::singleton<XMLNames::spaceAttr, &SVGLangSpace::m_space>()); 46 } 47 48 const String& SVGLangSpace::xmlspace() const 49 { 50 if (!m_space.value()) { 51 static NeverDestroyed<String> defaultString("default"); 38 52 return defaultString; 39 53 } 40 41 return m_space; 42 } 43 44 void SVGLangSpace::setXmlspace(const AtomicString& xmlSpace) 45 { 46 m_space = xmlSpace; 54 return m_space.value(); 47 55 } 48 56 … … 55 63 } 56 64 57 bool SVGLangSpace::isKnownAttribute(const QualifiedName& attrName)65 void SVGLangSpace::svgAttributeChanged(const QualifiedName& attrName) 58 66 { 59 return attrName.matches(XMLNames::langAttr) || attrName.matches(XMLNames::spaceAttr);60 } 67 if (!isKnownAttribute(attrName)) 68 return; 61 69 62 static void addWithAndWithoutXMLPrefix(HashSet<QualifiedName>& set, const QualifiedName& attributeName) 63 { 64 ASSERT(attributeName.prefix().isNull()); 65 set.add(attributeName); 66 set.add({ xmlAtom(), attributeName.localName(), attributeName.namespaceURI() }); 67 } 68 69 void SVGLangSpace::addSupportedAttributes(HashSet<QualifiedName>& set) 70 { 71 addWithAndWithoutXMLPrefix(set, XMLNames::langAttr); 72 addWithAndWithoutXMLPrefix(set, XMLNames::spaceAttr); 70 if (auto* renderer = downcast<RenderSVGShape>(m_contextElement.renderer())) { 71 SVGElement::InstanceInvalidationGuard guard(m_contextElement); 72 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 73 } 73 74 } 74 75 -
trunk/Source/WebCore/svg/SVGLangSpace.h
r208668 r234620 2 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 22 23 23 24 #include "QualifiedName.h" 25 #include "SVGAttributeOwnerProxyImpl.h" 24 26 #include <wtf/HashSet.h> 25 27 26 28 namespace WebCore { 27 29 30 class SVGElement; 31 28 32 class SVGLangSpace { 29 33 public: 30 const AtomicString& xmllang() const { return m_lang; }31 void setXmllang(const AtomicString& xmlLang) ;34 const String& xmllang() const { return m_lang.value(); } 35 void setXmllang(const AtomicString& xmlLang) { m_lang.setValue(xmlLang); } 32 36 33 const AtomicString& xmlspace() const;34 void setXmlspace(const AtomicString& xmlSpace) ;37 const String& xmlspace() const; 38 void setXmlspace(const AtomicString& xmlSpace) { m_space.setValue(xmlSpace); } 35 39 36 40 void parseAttribute(const QualifiedName&, const AtomicString&); 37 41 38 static bool isKnownAttribute(const QualifiedName&); 39 static void addSupportedAttributes(HashSet<QualifiedName>&); 42 void svgAttributeChanged(const QualifiedName&); 43 44 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLangSpace>; 45 using AttributeRegistry = SVGAttributeRegistry<SVGLangSpace>; 46 static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 47 static bool isKnownAttribute(const QualifiedName& attributeName) { return attributeRegistry().isKnownAttribute(attributeName); } 48 49 protected: 50 SVGLangSpace(SVGElement* contextElement); 40 51 41 52 private: 42 AtomicString m_lang; 43 AtomicString m_space; 53 using SVGStringAttribute = SVGPropertyAttribute<String>; 54 using SVGStringAttributeAccessor = SVGPropertyAttributeAccessor<SVGLangSpace, SVGStringAttribute>; 55 static void registerAttributes(); 56 57 SVGElement& m_contextElement; 58 SVGStringAttribute m_lang; 59 SVGStringAttribute m_space; 44 60 }; 45 61 -
trunk/Source/WebCore/svg/SVGLineElement.cpp
r231955 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGLineElement.h" 23 24 24 #include "FloatPoint.h"25 #include "RenderSVGPath.h"26 25 #include "RenderSVGResource.h" 27 26 #include "SVGLengthValue.h" 28 #include "SVGNames.h"29 27 #include <wtf/IsoMallocInlines.h> 30 #include <wtf/NeverDestroyed.h>31 28 32 29 namespace WebCore { … … 34 31 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGLineElement); 35 32 36 // Animated property definitions37 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x1Attr, X1, x1)38 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y1Attr, Y1, y1)39 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::x2Attr, X2, x2)40 DEFINE_ANIMATED_LENGTH(SVGLineElement, SVGNames::y2Attr, Y2, y2)41 DEFINE_ANIMATED_BOOLEAN(SVGLineElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)42 43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLineElement)44 REGISTER_LOCAL_ANIMATED_PROPERTY(x1)45 REGISTER_LOCAL_ANIMATED_PROPERTY(y1)46 REGISTER_LOCAL_ANIMATED_PROPERTY(x2)47 REGISTER_LOCAL_ANIMATED_PROPERTY(y2)48 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)49 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)50 END_REGISTER_ANIMATED_PROPERTIES51 52 33 inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document& document) 53 34 : SVGGeometryElement(tagName, document) 54 , m_x1(LengthModeWidth) 55 , m_y1(LengthModeHeight) 56 , m_x2(LengthModeWidth) 57 , m_y2(LengthModeHeight) 35 , SVGExternalResourcesRequired(this) 58 36 { 59 37 ASSERT(hasTagName(SVGNames::lineTag)); 60 registerA nimatedPropertiesForSVGLineElement();38 registerAttributes(); 61 39 } 62 40 … … 66 44 } 67 45 68 bool SVGLineElement::isSupportedAttribute(const QualifiedName& attrName)46 void SVGLineElement::registerAttributes() 69 47 { 70 static const auto supportedAttributes = makeNeverDestroyed([] { 71 HashSet<QualifiedName> set; 72 SVGLangSpace::addSupportedAttributes(set); 73 SVGExternalResourcesRequired::addSupportedAttributes(set); 74 set.add({ SVGNames::x1Attr.get(), SVGNames::x2Attr.get(), SVGNames::y1Attr.get(), SVGNames::y2Attr.get() }); 75 return set; 76 }()); 77 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 48 auto& registry = attributeRegistry(); 49 if (!registry.isEmpty()) 50 return; 51 registry.registerAttribute<SVGNames::x1Attr, &SVGLineElement::m_x1>(); 52 registry.registerAttribute<SVGNames::y1Attr, &SVGLineElement::m_y1>(); 53 registry.registerAttribute<SVGNames::x2Attr, &SVGLineElement::m_x2>(); 54 registry.registerAttribute<SVGNames::y2Attr, &SVGLineElement::m_y2>(); 78 55 } 79 56 … … 83 60 84 61 if (name == SVGNames::x1Attr) 85 setX1BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));62 m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 86 63 else if (name == SVGNames::y1Attr) 87 setY1BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));64 m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 88 65 else if (name == SVGNames::x2Attr) 89 setX2BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));66 m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 90 67 else if (name == SVGNames::y2Attr) 91 setY2BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));68 m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 92 69 93 70 reportAttributeParsingError(parseError, name, value); 94 71 95 SVGG raphicsElement::parseAttribute(name, value);72 SVGGeometryElement::parseAttribute(name, value); 96 73 SVGExternalResourcesRequired::parseAttribute(name, value); 97 74 } … … 99 76 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) 100 77 { 101 if (!isSupportedAttribute(attrName)) { 102 SVGGraphicsElement::svgAttributeChanged(attrName); 78 if (isKnownAttribute(attrName)) { 79 InstanceInvalidationGuard guard(*this); 80 updateRelativeLengthsInformation(); 81 82 if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) { 83 renderer->setNeedsShapeUpdate(); 84 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 85 } 103 86 return; 104 87 } 105 88 106 InstanceInvalidationGuard guard(*this); 107 108 bool isLengthAttribute = attrName == SVGNames::x1Attr 109 || attrName == SVGNames::y1Attr 110 || attrName == SVGNames::x2Attr 111 || attrName == SVGNames::y2Attr; 112 113 if (isLengthAttribute) 114 updateRelativeLengthsInformation(); 115 116 auto* renderer = downcast<RenderSVGShape>(this->renderer()); 117 if (!renderer) 118 return; 119 120 if (isLengthAttribute) { 121 renderer->setNeedsShapeUpdate(); 122 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 123 return; 124 } 125 126 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { 127 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 128 return; 129 } 130 131 ASSERT_NOT_REACHED(); 89 SVGGeometryElement::svgAttributeChanged(attrName); 90 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 132 91 } 133 92 -
trunk/Source/WebCore/svg/SVGLineElement.h
r231955 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 21 22 #pragma once 22 23 23 #include "SVGAnimatedBoolean.h"24 24 #include "SVGAnimatedLength.h" 25 25 #include "SVGExternalResourcesRequired.h" 26 26 #include "SVGGeometryElement.h" 27 #include "SVGNames.h" 27 28 28 29 namespace WebCore { … … 33 34 static Ref<SVGLineElement> create(const QualifiedName&, Document&); 34 35 36 const SVGLengthValue& x1() const { return m_x1.currentValue(attributeOwnerProxy()); } 37 const SVGLengthValue& y1() const { return m_y1.currentValue(attributeOwnerProxy()); } 38 const SVGLengthValue& x2() const { return m_x2.currentValue(attributeOwnerProxy()); } 39 const SVGLengthValue& y2() const { return m_y2.currentValue(attributeOwnerProxy()); } 40 41 RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(attributeOwnerProxy()); } 42 RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(attributeOwnerProxy()); } 43 RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(attributeOwnerProxy()); } 44 RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(attributeOwnerProxy()); } 45 35 46 private: 36 47 SVGLineElement(const QualifiedName&, Document&); 37 38 bool isValid() const final { return SVGTests::isValid(); }39 48 40 static bool isSupportedAttribute(const QualifiedName&); 49 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLineElement, SVGGeometryElement, SVGExternalResourcesRequired>; 50 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 51 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 52 static void registerAttributes(); 53 54 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 41 55 void parseAttribute(const QualifiedName&, const AtomicString&) final; 42 56 void svgAttributeChanged(const QualifiedName&) final; 43 57 58 bool isValid() const final { return SVGTests::isValid(); } 44 59 bool supportsMarkers() const final { return true; } 45 46 60 bool selfHasRelativeLengths() const final; 47 61 48 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGLineElement) 49 DECLARE_ANIMATED_LENGTH(X1, x1) 50 DECLARE_ANIMATED_LENGTH(Y1, y1) 51 DECLARE_ANIMATED_LENGTH(X2, x2) 52 DECLARE_ANIMATED_LENGTH(Y2, y2) 53 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 54 END_DECLARE_ANIMATED_PROPERTIES 62 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 63 SVGAnimatedLengthAttribute m_x1 { LengthModeWidth }; 64 SVGAnimatedLengthAttribute m_y1 { LengthModeHeight }; 65 SVGAnimatedLengthAttribute m_x2 { LengthModeWidth }; 66 SVGAnimatedLengthAttribute m_y2 { LengthModeHeight }; 55 67 }; 56 68 -
trunk/Source/WebCore/svg/SVGLinearGradientElement.cpp
r229694 r234620 5 5 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) 2018 Apple Inc. All rights reserved. 7 8 * 8 9 * This library is free software; you can redistribute it and/or … … 39 40 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGLinearGradientElement); 40 41 41 // Animated property definitions42 DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x1Attr, X1, x1)43 DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y1Attr, Y1, y1)44 DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::x2Attr, X2, x2)45 DEFINE_ANIMATED_LENGTH(SVGLinearGradientElement, SVGNames::y2Attr, Y2, y2)46 47 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLinearGradientElement)48 REGISTER_LOCAL_ANIMATED_PROPERTY(x1)49 REGISTER_LOCAL_ANIMATED_PROPERTY(y1)50 REGISTER_LOCAL_ANIMATED_PROPERTY(x2)51 REGISTER_LOCAL_ANIMATED_PROPERTY(y2)52 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGradientElement)53 END_REGISTER_ANIMATED_PROPERTIES54 55 42 inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document& document) 56 43 : SVGGradientElement(tagName, document) 57 , m_x1(LengthModeWidth)58 , m_y1(LengthModeHeight)59 , m_x2(LengthModeWidth, "100%")60 , m_y2(LengthModeHeight)61 44 { 62 45 // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified. 63 46 ASSERT(hasTagName(SVGNames::linearGradientTag)); 64 registerA nimatedPropertiesForSVGLinearGradientElement();47 registerAttributes(); 65 48 } 66 49 … … 70 53 } 71 54 72 bool SVGLinearGradientElement::isSupportedAttribute(const QualifiedName& attrName)55 void SVGLinearGradientElement::registerAttributes() 73 56 { 74 static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> { 75 SVGNames::x1Attr, SVGNames::x2Attr, SVGNames::y1Attr, SVGNames::y2Attr 76 }); 77 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 57 auto& registry = attributeRegistry(); 58 if (!registry.isEmpty()) 59 return; 60 registry.registerAttribute<SVGNames::x1Attr, &SVGLinearGradientElement::m_x1>(); 61 registry.registerAttribute<SVGNames::y1Attr, &SVGLinearGradientElement::m_y1>(); 62 registry.registerAttribute<SVGNames::x2Attr, &SVGLinearGradientElement::m_x2>(); 63 registry.registerAttribute<SVGNames::y2Attr, &SVGLinearGradientElement::m_y2>(); 78 64 } 79 65 … … 83 69 84 70 if (name == SVGNames::x1Attr) 85 setX1BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));71 m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 86 72 else if (name == SVGNames::y1Attr) 87 setY1BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));73 m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 88 74 else if (name == SVGNames::x2Attr) 89 setX2BaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));75 m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 90 76 else if (name == SVGNames::y2Attr) 91 setY2BaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));77 m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 92 78 93 79 reportAttributeParsingError(parseError, name, value); … … 98 84 void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName) 99 85 { 100 if (!isSupportedAttribute(attrName)) { 101 SVGGradientElement::svgAttributeChanged(attrName); 86 if (isKnownAttribute(attrName)) { 87 InstanceInvalidationGuard guard(*this); 88 updateRelativeLengthsInformation(); 89 if (RenderObject* object = renderer()) 90 object->setNeedsLayout(); 102 91 return; 103 92 } 104 93 105 InstanceInvalidationGuard guard(*this); 106 107 updateRelativeLengthsInformation(); 108 109 if (RenderObject* object = renderer()) 110 object->setNeedsLayout(); 94 SVGGradientElement::svgAttributeChanged(attrName); 111 95 } 112 96 -
trunk/Source/WebCore/svg/SVGLinearGradientElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 36 37 bool collectGradientAttributes(LinearGradientAttributes&); 37 38 39 const SVGLengthValue& x1() const { return m_x1.currentValue(attributeOwnerProxy()); } 40 const SVGLengthValue& y1() const { return m_y1.currentValue(attributeOwnerProxy()); } 41 const SVGLengthValue& x2() const { return m_x2.currentValue(attributeOwnerProxy()); } 42 const SVGLengthValue& y2() const { return m_y2.currentValue(attributeOwnerProxy()); } 43 44 RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(attributeOwnerProxy()); } 45 RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(attributeOwnerProxy()); } 46 RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(attributeOwnerProxy()); } 47 RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(attributeOwnerProxy()); } 48 38 49 private: 39 50 SVGLinearGradientElement(const QualifiedName&, Document&); 40 51 41 static bool isSupportedAttribute(const QualifiedName&); 52 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLinearGradientElement, SVGGradientElement>; 53 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 54 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 55 static void registerAttributes(); 56 57 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 42 58 void parseAttribute(const QualifiedName&, const AtomicString&) override; 43 59 void svgAttributeChanged(const QualifiedName&) override; … … 47 63 bool selfHasRelativeLengths() const override; 48 64 49 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGLinearGradientElement) 50 DECLARE_ANIMATED_LENGTH(X1, x1) 51 DECLARE_ANIMATED_LENGTH(Y1, y1) 52 DECLARE_ANIMATED_LENGTH(X2, x2) 53 DECLARE_ANIMATED_LENGTH(Y2, y2) 54 END_DECLARE_ANIMATED_PROPERTIES 65 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 66 SVGAnimatedLengthAttribute m_x1 { LengthModeWidth }; 67 SVGAnimatedLengthAttribute m_y1 { LengthModeHeight }; 68 SVGAnimatedLengthAttribute m_x2 { LengthModeWidth, "100%" }; 69 SVGAnimatedLengthAttribute m_y2 { LengthModeHeight }; 55 70 }; 56 71 -
trunk/Source/WebCore/svg/SVGMPathElement.cpp
r229694 r234620 1 1 /* 2 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 32 33 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGMPathElement); 33 34 34 // Animated property definitions35 DEFINE_ANIMATED_STRING(SVGMPathElement, XLinkNames::hrefAttr, Href, href)36 DEFINE_ANIMATED_BOOLEAN(SVGMPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)37 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement)39 REGISTER_LOCAL_ANIMATED_PROPERTY(href)40 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)41 END_REGISTER_ANIMATED_PROPERTIES42 43 35 inline SVGMPathElement::SVGMPathElement(const QualifiedName& tagName, Document& document) 44 36 : SVGElement(tagName, document) 37 , SVGExternalResourcesRequired(this) 38 , SVGURIReference(this) 45 39 { 46 40 ASSERT(hasTagName(SVGNames::mpathTag)); 47 registerAnimatedPropertiesForSVGMPathElement();48 41 } 49 42 … … 126 119 127 120 SVGElement::svgAttributeChanged(attrName); 121 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 128 122 } 129 123 -
trunk/Source/WebCore/svg/SVGMPathElement.h
r229694 r234620 1 1 /* 2 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 31 32 class SVGPathElement; 32 33 33 class SVGMPathElement final : public SVGElement, public SVG URIReference, public SVGExternalResourcesRequired{34 class SVGMPathElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference { 34 35 WTF_MAKE_ISO_ALLOCATED(SVGMPathElement); 35 36 public: … … 45 46 SVGMPathElement(const QualifiedName&, Document&); 46 47 48 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMPathElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; 49 50 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 51 void parseAttribute(const QualifiedName&, const AtomicString&) final; 52 void svgAttributeChanged(const QualifiedName&) final; 53 47 54 void buildPendingResource() final; 48 55 void clearResourceReferences(); 49 56 InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; 50 57 void removedFromAncestor(RemovalType, ContainerNode&) final; 51 52 void parseAttribute(const QualifiedName&, const AtomicString&) final;53 void svgAttributeChanged(const QualifiedName&) final;54 58 55 59 bool rendererIsNeeded(const RenderStyle&) final { return false; } … … 58 62 void notifyParentOfPathChange(ContainerNode*); 59 63 60 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMPathElement) 61 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 62 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 63 END_DECLARE_ANIMATED_PROPERTIES 64 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 64 65 }; 65 66 -
trunk/Source/WebCore/svg/SVGMarkerElement.cpp
r229694 r234620 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 33 34 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGMarkerElement); 34 35 35 // Define custom animated property 'orientType'.36 const SVGPropertyInfo* SVGMarkerElement::orientTypePropertyInfo()37 {38 static const SVGPropertyInfo* s_propertyInfo = 0;39 if (!s_propertyInfo) {40 s_propertyInfo = new SVGPropertyInfo(AnimatedEnumeration,41 PropertyIsReadWrite,42 SVGNames::orientAttr,43 orientTypeIdentifier(),44 &SVGMarkerElement::synchronizeOrientType,45 &SVGMarkerElement::lookupOrCreateOrientTypeWrapper);46 }47 return s_propertyInfo;48 }49 50 // Animated property definitions51 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::refXAttr, RefX, refX)52 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::refYAttr, RefY, refY)53 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerWidthAttr, MarkerWidth, markerWidth)54 DEFINE_ANIMATED_LENGTH(SVGMarkerElement, SVGNames::markerHeightAttr, MarkerHeight, markerHeight)55 DEFINE_ANIMATED_ENUMERATION(SVGMarkerElement, SVGNames::markerUnitsAttr, MarkerUnits, markerUnits, SVGMarkerUnitsType)56 DEFINE_ANIMATED_ANGLE_AND_ENUMERATION(SVGMarkerElement, SVGNames::orientAttr, orientAngleIdentifier(), OrientAngle, orientAngle)57 DEFINE_ANIMATED_BOOLEAN(SVGMarkerElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)58 DEFINE_ANIMATED_RECT(SVGMarkerElement, SVGNames::viewBoxAttr, ViewBox, viewBox)59 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGMarkerElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)60 61 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMarkerElement)62 REGISTER_LOCAL_ANIMATED_PROPERTY(refX)63 REGISTER_LOCAL_ANIMATED_PROPERTY(refY)64 REGISTER_LOCAL_ANIMATED_PROPERTY(markerWidth)65 REGISTER_LOCAL_ANIMATED_PROPERTY(markerHeight)66 REGISTER_LOCAL_ANIMATED_PROPERTY(markerUnits)67 REGISTER_LOCAL_ANIMATED_PROPERTY(orientAngle)68 REGISTER_LOCAL_ANIMATED_PROPERTY(orientType)69 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)70 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)71 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)72 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)73 END_REGISTER_ANIMATED_PROPERTIES74 75 36 inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document& document) 76 37 : SVGElement(tagName, document) 77 , m_refX(LengthModeWidth) 78 , m_refY(LengthModeHeight) 79 , m_markerWidth(LengthModeWidth, "3") 80 , m_markerHeight(LengthModeHeight, "3") 81 , m_markerUnits(SVGMarkerUnitsStrokeWidth) 82 , m_orientType(SVGMarkerOrientAngle) 38 , SVGExternalResourcesRequired(this) 39 , SVGFitToViewBox(this) 83 40 { 84 41 // Spec: If the markerWidth/markerHeight attribute is not specified, the effect is as if a value of "3" were specified. 85 42 ASSERT(hasTagName(SVGNames::markerTag)); 86 registerA nimatedPropertiesForSVGMarkerElement();43 registerAttributes(); 87 44 } 88 45 … … 109 66 } 110 67 111 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName)68 void SVGMarkerElement::registerAttributes() 112 69 { 113 static const auto supportedAttributes = makeNeverDestroyed([] { 114 HashSet<QualifiedName> set; 115 SVGLangSpace::addSupportedAttributes(set); 116 SVGExternalResourcesRequired::addSupportedAttributes(set); 117 SVGFitToViewBox::addSupportedAttributes(set); 118 set.add({ 119 SVGNames::markerUnitsAttr.get(), 120 SVGNames::refXAttr.get(), 121 SVGNames::refYAttr.get(), 122 SVGNames::markerWidthAttr.get(), 123 SVGNames::markerHeightAttr.get(), 124 SVGNames::orientAttr.get(), 125 }); 126 return set; 127 }()); 128 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 70 auto& registry = attributeRegistry(); 71 if (!registry.isEmpty()) 72 return; 73 registry.registerAttribute<SVGNames::refXAttr, &SVGMarkerElement::m_refX>(); 74 registry.registerAttribute<SVGNames::refYAttr, &SVGMarkerElement::m_refY>(); 75 registry.registerAttribute<SVGNames::markerWidthAttr, &SVGMarkerElement::m_markerWidth>(); 76 registry.registerAttribute<SVGNames::markerHeightAttr, &SVGMarkerElement::m_markerHeight>(); 77 registry.registerAttribute<SVGNames::markerUnitsAttr, SVGMarkerUnitsType, &SVGMarkerElement::m_markerUnits>(); 78 registry.registerAttribute(SVGAnimatedCustomAngleAttributeAccessor::singleton<SVGNames::orientAttr, 79 &SVGMarkerElement::orientAngleIdentifier, &SVGMarkerElement::m_orientAngle, 80 &SVGMarkerElement::orientTypeIdentifier, &SVGMarkerElement::m_orientType>()); 129 81 } 130 82 … … 134 86 auto propertyValue = SVGPropertyTraits<SVGMarkerUnitsType>::fromString(value); 135 87 if (propertyValue > 0) 136 setMarkerUnitsBaseValue(propertyValue);88 m_markerUnits.setValue(propertyValue); 137 89 return; 138 90 } … … 142 94 auto orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(value, angle); 143 95 if (orientType > 0) 144 setOrientTypeBaseValue(orientType);96 m_orientType.setValue(orientType); 145 97 if (orientType == SVGMarkerOrientAngle) 146 setOrientAngleBaseValue(angle);98 m_orientAngle.setValue(angle); 147 99 return; 148 100 } … … 151 103 152 104 if (name == SVGNames::refXAttr) 153 setRefXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));105 m_refX.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 154 106 else if (name == SVGNames::refYAttr) 155 setRefYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));107 m_refY.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 156 108 else if (name == SVGNames::markerWidthAttr) 157 setMarkerWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));109 m_markerWidth.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 158 110 else if (name == SVGNames::markerHeightAttr) 159 setMarkerHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));111 m_markerHeight.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 160 112 161 113 reportAttributeParsingError(parseError, name, value); … … 163 115 SVGElement::parseAttribute(name, value); 164 116 SVGExternalResourcesRequired::parseAttribute(name, value); 165 SVGFitToViewBox::parseAttribute( this,name, value);117 SVGFitToViewBox::parseAttribute(name, value); 166 118 } 167 119 168 120 void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) 169 121 { 170 if (!isSupportedAttribute(attrName)) { 171 SVGElement::svgAttributeChanged(attrName); 122 if (isKnownAttribute(attrName)) { 123 InstanceInvalidationGuard guard(*this); 124 if (isAnimatedLengthAttribute(attrName)) 125 updateRelativeLengthsInformation(); 126 if (RenderObject* object = renderer()) 127 object->setNeedsLayout(); 128 return; 129 } 130 131 if (SVGFitToViewBox::isKnownAttribute(attrName)) { 132 if (RenderObject* object = renderer()) 133 object->setNeedsLayout(); 172 134 return; 173 135 } 174 136 175 InstanceInvalidationGuard guard(*this); 176 177 if (attrName == SVGNames::refXAttr 178 || attrName == SVGNames::refYAttr 179 || attrName == SVGNames::markerWidthAttr 180 || attrName == SVGNames::markerHeightAttr) 181 updateRelativeLengthsInformation(); 182 183 if (RenderObject* object = renderer()) 184 object->setNeedsLayout(); 137 SVGElement::svgAttributeChanged(attrName); 138 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 185 139 } 186 140 … … 198 152 void SVGMarkerElement::setOrient(SVGMarkerOrientType orientType, const SVGAngleValue& angle) 199 153 { 200 setOrientTypeBaseValue(orientType);201 setOrientAngleBaseValue(angle);154 m_orientType.setValue(orientType); 155 m_orientAngle.setValue(angle); 202 156 203 157 // Mark orientAttr dirty - the next XML DOM access of that attribute kicks in synchronization. 204 m_orientAngle.s houldSynchronize = true;205 m_orientType.s houldSynchronize = true;158 m_orientAngle.setShouldSynchronize(true); 159 m_orientType.setShouldSynchronize(true); 206 160 invalidateSVGAttributes(); 207 svgAttributeChanged( orientAnglePropertyInfo()->attributeName);161 svgAttributeChanged(SVGNames::orientAttr); 208 162 } 209 163 … … 231 185 } 232 186 233 void SVGMarkerElement::synchronizeOrientType(SVGElement* contextElement)234 {235 ASSERT(contextElement);236 SVGMarkerElement& ownerType = downcast<SVGMarkerElement>(*contextElement);237 if (!ownerType.m_orientType.shouldSynchronize)238 return;239 240 static NeverDestroyed<AtomicString> autoString("auto", AtomicString::ConstructFromLiteral);241 static NeverDestroyed<AtomicString> autoStartReverseString("auto-start-reverse", AtomicString::ConstructFromLiteral);242 243 // If orient is not auto or auto-start-reverse, the previous call to synchronizeOrientAngle already set the orientAttr to the right angle.244 if (ownerType.m_orientType.value == SVGMarkerOrientAuto) {245 ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoString);246 return;247 }248 249 if (ownerType.m_orientType.value == SVGMarkerOrientAutoStartReverse)250 ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoStartReverseString);251 187 } 252 253 Ref<SVGAnimatedProperty> SVGMarkerElement::lookupOrCreateOrientTypeWrapper(SVGElement* contextElement)254 {255 ASSERT(contextElement);256 SVGMarkerElement& ownerType = downcast<SVGMarkerElement>(*contextElement);257 return SVGAnimatedProperty::lookupOrCreateWrapper<SVGMarkerElement, SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>, SVGMarkerOrientType>258 (&ownerType, orientTypePropertyInfo(), ownerType.m_orientType.value);259 }260 261 SVGMarkerOrientType& SVGMarkerElement::orientType() const262 {263 if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, SVGAnimatedEnumeration>(this, orientTypePropertyInfo())) {264 if (wrapper->isAnimating()) {265 ASSERT(wrapper->currentAnimatedValue() < SVGMarkerOrientMax);266 return reinterpret_cast<SVGMarkerOrientType&>(wrapper->currentAnimatedValue());267 }268 }269 return m_orientType.value;270 }271 272 Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated()273 {274 m_orientType.shouldSynchronize = true;275 return static_reference_cast<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>>(lookupOrCreateOrientTypeWrapper(this));276 }277 278 } -
trunk/Source/WebCore/svg/SVGMarkerElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 58 59 void setOrientToAngle(SVGAngle&); 59 60 60 static const SVGPropertyInfo* orientTypePropertyInfo(); 61 const SVGLengthValue& refX() const { return m_refX.currentValue(attributeOwnerProxy()); } 62 const SVGLengthValue& refY() const { return m_refY.currentValue(attributeOwnerProxy()); } 63 const SVGLengthValue& markerWidth() const { return m_markerWidth.currentValue(attributeOwnerProxy()); } 64 const SVGLengthValue& markerHeight() const { return m_markerHeight.currentValue(attributeOwnerProxy()); } 65 SVGMarkerUnitsType markerUnits() const { return m_markerUnits.currentValue(attributeOwnerProxy()); } 66 const SVGAngleValue& orientAngle() const { return m_orientAngle.currentValue(attributeOwnerProxy()); } 67 SVGMarkerOrientType orientType() const { return m_orientType.currentValue(attributeOwnerProxy()); } 68 69 RefPtr<SVGAnimatedLength> refXAnimated() { return m_refX.animatedProperty(attributeOwnerProxy()); } 70 RefPtr<SVGAnimatedLength> refYAnimated() { return m_refY.animatedProperty(attributeOwnerProxy()); } 71 RefPtr<SVGAnimatedLength> markerWidthAnimated() { return m_markerWidth.animatedProperty(attributeOwnerProxy()); } 72 RefPtr<SVGAnimatedLength> markerHeightAnimated() { return m_markerHeight.animatedProperty(attributeOwnerProxy()); } 73 RefPtr<SVGAnimatedEnumeration> markerUnitsAnimated() { return m_markerUnits.animatedProperty(attributeOwnerProxy()); } 74 RefPtr<SVGAnimatedAngle> orientAngleAnimated() { return m_orientAngle.animatedProperty(attributeOwnerProxy()); } 75 RefPtr<SVGAnimatedEnumeration> orientTypeAnimated() { return m_orientType.animatedProperty(attributeOwnerProxy()); } 61 76 62 77 private: 63 78 SVGMarkerElement(const QualifiedName&, Document&); 64 79 65 bool needsPendingResourceHandling() const override { return false; } 80 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>; 81 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 82 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 83 static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } 84 static void registerAttributes(); 66 85 67 static bool isSupportedAttribute(const QualifiedName&);86 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 68 87 void parseAttribute(const QualifiedName&, const AtomicString&) override; 69 88 void svgAttributeChanged(const QualifiedName&) override; … … 73 92 bool rendererIsNeeded(const RenderStyle&) override { return true; } 74 93 94 bool needsPendingResourceHandling() const override { return false; } 95 75 96 bool selfHasRelativeLengths() const override; 76 97 77 98 void setOrient(SVGMarkerOrientType, const SVGAngleValue&); 78 99 79 void synchronizeOrientType();80 81 100 static const AtomicString& orientTypeIdentifier(); 82 101 static const AtomicString& orientAngleIdentifier(); 83 84 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMarkerElement)85 DECLARE_ANIMATED_LENGTH(RefX, refX)86 DECLARE_ANIMATED_LENGTH(RefY, refY)87 DECLARE_ANIMATED_LENGTH(MarkerWidth, markerWidth)88 DECLARE_ANIMATED_LENGTH(MarkerHeight, markerHeight)89 DECLARE_ANIMATED_ENUMERATION(MarkerUnits, markerUnits, SVGMarkerUnitsType)90 DECLARE_ANIMATED_ANGLE(OrientAngle, orientAngle)91 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)92 DECLARE_ANIMATED_RECT(ViewBox, viewBox)93 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)94 END_DECLARE_ANIMATED_PROPERTIES95 96 public:97 // Custom 'orientType' property.98 static void synchronizeOrientType(SVGElement* contextElement);99 static Ref<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);100 SVGMarkerOrientType& orientType() const;101 SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }102 void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }103 Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();104 102 105 private: 106 mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType; 103 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 104 105 class SVGAnimatedCustomOrientTypeAttribute : public SVGAnimatedEnumerationAttribute<SVGMarkerOrientType> { 106 public: 107 using Base = SVGAnimatedEnumerationAttribute<SVGMarkerOrientType>; 108 109 SVGAnimatedCustomOrientTypeAttribute(SVGMarkerOrientType baseValue) 110 : Base(baseValue) 111 { 112 } 113 void synchronize(Element& element, const QualifiedName& attributeName) 114 { 115 static const NeverDestroyed<String> autoString = MAKE_STATIC_STRING_IMPL("auto"); 116 static const NeverDestroyed<String> autoStartReverseString = MAKE_STATIC_STRING_IMPL("auto-start-reverse"); 117 118 if (!shouldSynchronize()) 119 return; 120 if (value() == SVGMarkerOrientAuto) 121 element.setSynchronizedLazyAttribute(attributeName, autoString.get()); 122 else if (value() == SVGMarkerOrientAutoStartReverse) 123 element.setSynchronizedLazyAttribute(attributeName, autoStartReverseString.get()); 124 } 125 }; 126 127 using SVGAnimatedCustomAngleAttributeAccessor = SVGAnimatedPairAttributeAccessor<SVGMarkerElement, SVGAnimatedAngleAttribute, AnimatedAngle, SVGAnimatedCustomOrientTypeAttribute, AnimatedEnumeration>; 128 129 SVGAnimatedLengthAttribute m_refX { LengthModeWidth }; 130 SVGAnimatedLengthAttribute m_refY { LengthModeHeight }; 131 SVGAnimatedLengthAttribute m_markerWidth { LengthModeWidth, "3" }; 132 SVGAnimatedLengthAttribute m_markerHeight { LengthModeHeight, "3" }; 133 SVGAnimatedEnumerationAttribute<SVGMarkerUnitsType> m_markerUnits { SVGMarkerUnitsStrokeWidth }; 134 SVGAnimatedAngleAttribute m_orientAngle; 135 SVGAnimatedCustomOrientTypeAttribute m_orientType { SVGMarkerOrientAngle }; 107 136 }; 108 137 -
trunk/Source/WebCore/svg/SVGMaskElement.cpp
r229694 r234620 6 6 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 7 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2018 Apple Inc. All rights reserved. 8 9 * 9 10 * This library is free software; you can redistribute it and/or … … 39 40 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGMaskElement); 40 41 41 // Animated property definitions42 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskUnitsAttr, MaskUnits, maskUnits, SVGUnitTypes::SVGUnitType)43 DEFINE_ANIMATED_ENUMERATION(SVGMaskElement, SVGNames::maskContentUnitsAttr, MaskContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType)44 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::xAttr, X, x)45 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::yAttr, Y, y)46 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::widthAttr, Width, width)47 DEFINE_ANIMATED_LENGTH(SVGMaskElement, SVGNames::heightAttr, Height, height)48 DEFINE_ANIMATED_BOOLEAN(SVGMaskElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)49 50 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMaskElement)51 REGISTER_LOCAL_ANIMATED_PROPERTY(maskUnits)52 REGISTER_LOCAL_ANIMATED_PROPERTY(maskContentUnits)53 REGISTER_LOCAL_ANIMATED_PROPERTY(x)54 REGISTER_LOCAL_ANIMATED_PROPERTY(y)55 REGISTER_LOCAL_ANIMATED_PROPERTY(width)56 REGISTER_LOCAL_ANIMATED_PROPERTY(height)57 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)58 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)59 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)60 END_REGISTER_ANIMATED_PROPERTIES61 62 42 inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document& document) 63 43 : SVGElement(tagName, document) 64 , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) 65 , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) 66 , m_x(LengthModeWidth, "-10%") 67 , m_y(LengthModeHeight, "-10%") 68 , m_width(LengthModeWidth, "120%") 69 , m_height(LengthModeHeight, "120%") 44 , SVGExternalResourcesRequired(this) 45 , SVGTests(this) 70 46 { 71 47 // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified. 72 48 // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified. 73 49 ASSERT(hasTagName(SVGNames::maskTag)); 74 registerA nimatedPropertiesForSVGMaskElement();50 registerAttributes(); 75 51 } 76 52 … … 80 56 } 81 57 82 bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName)58 void SVGMaskElement::registerAttributes() 83 59 { 84 static const auto supportedAttributes = makeNeverDestroyed([] { 85 HashSet<QualifiedName> set; 86 SVGTests::addSupportedAttributes(set); 87 SVGLangSpace::addSupportedAttributes(set); 88 SVGExternalResourcesRequired::addSupportedAttributes(set); 89 set.add({ 90 SVGNames::maskUnitsAttr.get(), 91 SVGNames::maskContentUnitsAttr.get(), 92 SVGNames::refYAttr.get(), 93 SVGNames::xAttr.get(), 94 SVGNames::yAttr.get(), 95 SVGNames::widthAttr.get(), 96 SVGNames::heightAttr.get(), 97 }); 98 return set; 99 }()); 100 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 60 auto& registry = attributeRegistry(); 61 if (!registry.isEmpty()) 62 return; 63 registry.registerAttribute<SVGNames::xAttr, &SVGMaskElement::m_x>(); 64 registry.registerAttribute<SVGNames::yAttr, &SVGMaskElement::m_y>(); 65 registry.registerAttribute<SVGNames::widthAttr, &SVGMaskElement::m_width>(); 66 registry.registerAttribute<SVGNames::heightAttr, &SVGMaskElement::m_height>(); 67 registry.registerAttribute<SVGNames::maskUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskUnits>(); 68 registry.registerAttribute<SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskContentUnits>(); 101 69 } 102 70 … … 106 74 auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 107 75 if (propertyValue > 0) 108 setMaskUnitsBaseValue(propertyValue);76 m_maskUnits.setValue(propertyValue); 109 77 return; 110 78 } … … 112 80 auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 113 81 if (propertyValue > 0) 114 setMaskContentUnitsBaseValue(propertyValue);82 m_maskContentUnits.setValue(propertyValue); 115 83 return; 116 84 } … … 119 87 120 88 if (name == SVGNames::xAttr) 121 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));89 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 122 90 else if (name == SVGNames::yAttr) 123 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));91 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 124 92 else if (name == SVGNames::widthAttr) 125 setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));93 m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 126 94 else if (name == SVGNames::heightAttr) 127 setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));95 m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 128 96 129 97 reportAttributeParsingError(parseError, name, value); … … 136 104 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) 137 105 { 138 if (!isSupportedAttribute(attrName)) { 139 SVGElement::svgAttributeChanged(attrName); 140 return; 141 } 142 143 InstanceInvalidationGuard guard(*this); 144 145 if (attrName == SVGNames::xAttr 146 || attrName == SVGNames::yAttr 147 || attrName == SVGNames::widthAttr 148 || attrName == SVGNames::heightAttr) { 106 if (isAnimatedLengthAttribute(attrName)) { 107 InstanceInvalidationGuard guard(*this); 149 108 invalidateSVGPresentationAttributeStyle(); 150 109 return; 151 110 } 152 111 153 if (RenderObject* object = renderer()) 154 object->setNeedsLayout(); 112 if (isKnownAttribute(attrName)) { 113 if (auto* renderer = this->renderer()) 114 renderer->setNeedsLayout(); 115 return; 116 } 117 118 SVGElement::svgAttributeChanged(attrName); 119 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 155 120 } 156 121 … … 171 136 } 172 137 173 Ref<SVGStringList> SVGMaskElement::requiredFeatures()174 {175 return SVGTests::requiredFeatures(*this);176 138 } 177 178 Ref<SVGStringList> SVGMaskElement::requiredExtensions()179 {180 return SVGTests::requiredExtensions(*this);181 }182 183 Ref<SVGStringList> SVGMaskElement::systemLanguage()184 {185 return SVGTests::systemLanguage(*this);186 }187 188 } -
trunk/Source/WebCore/svg/SVGMaskElement.h
r229694 r234620 1 1 /* 2 2 * Copyright (C) 2005 Alexander Kellett <lypanov@kde.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 31 32 namespace WebCore { 32 33 33 class SVGMaskElement final : public SVGElement, public SVG Tests, public SVGExternalResourcesRequired{34 class SVGMaskElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGTests { 34 35 WTF_MAKE_ISO_ALLOCATED(SVGMaskElement); 35 36 public: 36 37 static Ref<SVGMaskElement> create(const QualifiedName&, Document&); 37 38 38 // SVGTests 39 Ref<SVGStringList> requiredFeatures(); 40 Ref<SVGStringList> requiredExtensions(); 41 Ref<SVGStringList> systemLanguage(); 39 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 40 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 41 const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } 42 const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } 43 SVGUnitTypes::SVGUnitType maskUnits() const { return m_maskUnits.currentValue(attributeOwnerProxy()); } 44 SVGUnitTypes::SVGUnitType maskContentUnits() const { return m_maskContentUnits.currentValue(attributeOwnerProxy()); } 45 46 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 47 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 48 RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } 49 RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } 50 RefPtr<SVGAnimatedEnumeration> maskUnitsAnimated() { return m_maskUnits.animatedProperty(attributeOwnerProxy()); } 51 RefPtr<SVGAnimatedEnumeration> maskContentUnitsAnimated() { return m_maskContentUnits.animatedProperty(attributeOwnerProxy()); } 42 52 43 53 private: 44 54 SVGMaskElement(const QualifiedName&, Document&); 45 55 46 bool isValid() const final { return SVGTests::isValid(); } 47 bool needsPendingResourceHandling() const final { return false; } 56 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMaskElement, SVGElement, SVGExternalResourcesRequired, SVGTests>; 57 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 58 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 59 static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } 60 static void registerAttributes(); 48 61 49 static bool isSupportedAttribute(const QualifiedName&);62 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 50 63 void parseAttribute(const QualifiedName&, const AtomicString&) final; 51 64 void svgAttributeChanged(const QualifiedName&) final; … … 54 67 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 55 68 69 bool isValid() const final { return SVGTests::isValid(); } 70 bool needsPendingResourceHandling() const final { return false; } 56 71 bool selfHasRelativeLengths() const final { return true; } 57 72 58 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMaskElement) 59 DECLARE_ANIMATED_ENUMERATION(MaskUnits, maskUnits, SVGUnitTypes::SVGUnitType) 60 DECLARE_ANIMATED_ENUMERATION(MaskContentUnits, maskContentUnits, SVGUnitTypes::SVGUnitType) 61 DECLARE_ANIMATED_LENGTH(X, x) 62 DECLARE_ANIMATED_LENGTH(Y, y) 63 DECLARE_ANIMATED_LENGTH(Width, width) 64 DECLARE_ANIMATED_LENGTH(Height, height) 65 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 66 END_DECLARE_ANIMATED_PROPERTIES 67 68 // SVGTests 69 void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } 70 void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } 71 void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } 73 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 74 SVGAnimatedLengthAttribute m_x { LengthModeWidth, "-10%" }; 75 SVGAnimatedLengthAttribute m_y { LengthModeHeight, "-10%" }; 76 SVGAnimatedLengthAttribute m_width { LengthModeWidth, "120%" }; 77 SVGAnimatedLengthAttribute m_height { LengthModeHeight, "120%" }; 78 SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; 79 SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_maskContentUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; 72 80 }; 73 81 -
trunk/Source/WebCore/svg/SVGPathElement.cpp
r230829 r234620 57 57 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPathElement); 58 58 59 // Define custom animated property 'd'.60 const SVGPropertyInfo* SVGPathElement::dPropertyInfo()61 {62 static const SVGPropertyInfo* s_propertyInfo = nullptr;63 if (!s_propertyInfo) {64 s_propertyInfo = new SVGPropertyInfo(AnimatedPath,65 PropertyIsReadWrite,66 SVGNames::dAttr,67 SVGNames::dAttr->localName(),68 &SVGPathElement::synchronizeD,69 &SVGPathElement::lookupOrCreateDWrapper);70 }71 return s_propertyInfo;72 }73 74 // Animated property definitions75 DEFINE_ANIMATED_NUMBER(SVGPathElement, SVGNames::pathLengthAttr, PathLength, pathLength)76 DEFINE_ANIMATED_BOOLEAN(SVGPathElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)77 78 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPathElement)79 REGISTER_LOCAL_ANIMATED_PROPERTY(d)80 REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength)81 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)82 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)83 END_REGISTER_ANIMATED_PROPERTIES84 85 59 inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& document) 86 60 : SVGGeometryElement(tagName, document) 87 , m_pathSegList(PathSegUnalteredRole) 88 , m_isAnimValObserved(false) 61 , SVGExternalResourcesRequired(this) 89 62 { 90 63 ASSERT(hasTagName(SVGNames::pathTag)); 91 registerA nimatedPropertiesForSVGPathElement();64 registerAttributes(); 92 65 } 93 66 … … 213 186 } 214 187 215 bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) 216 { 217 static const auto supportedAttributes = makeNeverDestroyed([] { 218 HashSet<QualifiedName> set; 219 SVGLangSpace::addSupportedAttributes(set); 220 SVGExternalResourcesRequired::addSupportedAttributes(set); 221 set.add({ SVGNames::dAttr.get(), SVGNames::pathLengthAttr.get() }); 222 return set; 223 }()); 224 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 188 void SVGPathElement::registerAttributes() 189 { 190 auto& registry = attributeRegistry(); 191 if (!registry.isEmpty()) 192 return; 193 registry.registerAttribute(SVGAnimatedCustomPathSegListAttributeAccessor::singleton<SVGNames::dAttr, &SVGPathElement::m_pathSegList>()); 225 194 } 226 195 … … 234 203 } 235 204 236 if (name == SVGNames::pathLengthAttr) {237 setPathLengthBaseValue(value.toFloat());238 if (pathLengthBaseValue() < 0)239 document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed");240 return;241 }242 243 205 SVGGeometryElement::parseAttribute(name, value); 244 206 SVGExternalResourcesRequired::parseAttribute(name, value); … … 247 209 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) 248 210 { 249 if ( !isSupportedAttribute(attrName)) {250 SVGGeometryElement::svgAttributeChanged(attrName);251 return; 252 }253 254 InstanceInvalidationGuard guard(*this);255 256 RenderSVGPath* renderer = downcast<RenderSVGPath>(this->renderer());257 258 if (attrName == SVGNames::dAttr) {259 if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo())->isAnimating()) { 260 SVGPathSegListValues newList(PathSegUnalteredRole);261 buildSVGPathSegListValuesFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing);262 m_pathSegList.value = WTFMove(newList);211 if (isKnownAttribute(attrName)) { 212 InstanceInvalidationGuard guard(*this); 213 214 RenderSVGPath* renderer = downcast<RenderSVGPath>(this->renderer()); 215 if (attrName == SVGNames::dAttr) { 216 if (m_pathSegList.shouldSynchronize() && !lookupAnimatedProperty(m_pathSegList)->isAnimating()) { 217 SVGPathSegListValues newList(PathSegUnalteredRole); 218 buildSVGPathSegListValuesFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing); 219 m_pathSegList.setValue(WTFMove(newList)); 220 } 221 222 if (renderer) 223 renderer->setNeedsShapeUpdate(); 224 invalidateMPathDependencies(); 263 225 } 264 226 265 227 if (renderer) 266 renderer->setNeedsShapeUpdate(); 267 268 invalidateMPathDependencies(); 269 } 270 271 if (renderer) 272 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 228 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 229 return; 230 } 231 232 SVGGeometryElement::svgAttributeChanged(attrName); 233 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 273 234 } 274 235 … … 300 261 const SVGPathByteStream& SVGPathElement::pathByteStream() const 301 262 { 302 auto property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo());263 auto property = lookupAnimatedProperty(m_pathSegList); 303 264 if (!property || !property->isAnimating()) 304 265 return m_pathByteStream; 305 266 306 SVGPathByteStream* animatedPathByteStream = static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property.get())->animatedPathByteStream(); 307 if (!animatedPathByteStream) 308 return m_pathByteStream; 309 310 return *animatedPathByteStream; 267 if (auto* animatedPathByteStream = static_cast<SVGAnimatedPathSegListPropertyTearOff*>(property.get())->animatedPathByteStream()) 268 return *animatedPathByteStream; 269 270 return m_pathByteStream; 311 271 } 312 272 … … 324 284 } 325 285 326 Ref<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper(SVGElement* contextElement) 327 { 328 ASSERT(contextElement); 329 SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement); 330 331 if (auto property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(&ownerType, dPropertyInfo())) 332 return *property; 333 334 if (ownerType.m_pathSegList.value.isEmpty()) 335 buildSVGPathSegListValuesFromByteStream(ownerType.m_pathByteStream, ownerType, ownerType.m_pathSegList.value, UnalteredParsing); 336 337 return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegListValues>(&ownerType, dPropertyInfo(), ownerType.m_pathSegList.value); 338 } 339 340 void SVGPathElement::synchronizeD(SVGElement* contextElement) 341 { 342 ASSERT(contextElement); 343 SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement); 344 if (!ownerType.m_pathSegList.shouldSynchronize) 345 return; 346 ownerType.m_pathSegList.synchronize(&ownerType, dPropertyInfo()->attributeName, ownerType.m_pathSegList.value.valueAsString()); 286 RefPtr<SVGAnimatedProperty> SVGPathElement::lookupOrCreateDWrapper() 287 { 288 return m_pathSegList.animatedProperty(attributeOwnerProxy()); 347 289 } 348 290 … … 351 293 // m_pathSegList.shouldSynchronize is set to true when the 'd' wrapper for m_pathSegList 352 294 // is created and cached. We need to reset it back to false when this wrapper is deleted 353 // so we can be sure if shouldSynchronize is true, SVGA nimatedProperty::lookupWrapper()295 // so we can be sure if shouldSynchronize is true, SVGAttributeAccessor::lookupAnimatedProperty() 354 296 // will return a valid cached 'd' wrapper for the m_pathSegList. 355 m_pathSegList.s houldSynchronize = false;297 m_pathSegList.setShouldSynchronize(false); 356 298 } 357 299 358 300 Ref<SVGPathSegList> SVGPathElement::pathSegList() 359 301 { 360 m_pathSegList.shouldSynchronize = true; 361 return static_reference_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->baseVal(); 302 return static_pointer_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper())->baseVal(); 362 303 } 363 304 … … 370 311 Ref<SVGPathSegList> SVGPathElement::animatedPathSegList() 371 312 { 372 m_pathSegList.shouldSynchronize = true;373 313 m_isAnimValObserved = true; 374 return static_ reference_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper(this))->animVal();314 return static_pointer_cast<SVGAnimatedPathSegListPropertyTearOff>(lookupOrCreateDWrapper())->animVal(); 375 315 } 376 316 … … 395 335 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! 396 336 break; 397 case PathSegUnalteredRole: 337 case PathSegUnalteredRole: { 338 auto& pathSegList = m_pathSegList.value(false); 398 339 if (listModification == ListModificationAppend) { 399 ASSERT(! m_pathSegList.value.isEmpty());400 appendSVGPathByteStreamFromSVGPathSeg( m_pathSegList.value.last().copyRef(), m_pathByteStream, UnalteredParsing);340 ASSERT(!pathSegList.isEmpty()); 341 appendSVGPathByteStreamFromSVGPathSeg(pathSegList.last().copyRef(), m_pathByteStream, UnalteredParsing); 401 342 } else 402 buildSVGPathByteStreamFromSVGPathSegListValues( m_pathSegList.value, m_pathByteStream, UnalteredParsing);343 buildSVGPathByteStreamFromSVGPathSegListValues(pathSegList, m_pathByteStream, UnalteredParsing); 403 344 m_cachedPath = std::nullopt; 404 345 break; 346 } 405 347 case PathSegUndefinedRole: 406 348 return; -
trunk/Source/WebCore/svg/SVGPathElement.h
r232613 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 24 25 #include "SVGAnimatedBoolean.h" 25 26 #include "SVGAnimatedNumber.h" 27 #include "SVGAnimatedPath.h" 26 28 #include "SVGExternalResourcesRequired.h" 27 29 #include "SVGGeometryElement.h" … … 96 98 FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) final; 97 99 98 static const SVGPropertyInfo* dPropertyInfo();99 100 100 bool isAnimValObserved() const { return m_isAnimValObserved; } 101 101 … … 104 104 size_t approximateMemoryCost() const final; 105 105 106 const SVGPathSegListValues& pathSegList() const { return m_pathSegList.currentValue(attributeOwnerProxy()); } 107 RefPtr<SVGAnimatedPathSegList> pathSegListAnimated() { return m_pathSegList.animatedProperty(attributeOwnerProxy()); } 108 106 109 private: 107 110 SVGPathElement(const QualifiedName&, Document&); 108 111 109 bool isValid() const final { return SVGTests::isValid(); } 112 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPathElement, SVGGeometryElement, SVGExternalResourcesRequired>; 113 static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 114 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 115 static void registerAttributes(); 110 116 111 static bool isSupportedAttribute(const QualifiedName&);117 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 112 118 void parseAttribute(const QualifiedName&, const AtomicString&) final; 113 119 void svgAttributeChanged(const QualifiedName&) final; 120 121 bool isValid() const final { return SVGTests::isValid(); } 114 122 bool supportsMarkers() const final { return true; } 115 116 // Custom 'd' property 117 static void synchronizeD(SVGElement* contextElement); 118 static Ref<SVGAnimatedProperty> lookupOrCreateDWrapper(SVGElement* contextElement); 119 120 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPathElement) 121 DECLARE_ANIMATED_NUMBER(PathLength, pathLength) 122 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 123 END_DECLARE_ANIMATED_PROPERTIES 123 RefPtr<SVGAnimatedProperty> lookupOrCreateDWrapper(); 124 124 125 125 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; … … 133 133 SVGPathByteStream m_pathByteStream; 134 134 mutable std::optional<Path> m_cachedPath; 135 mutable SVGSynchronizableAnimatedProperty<SVGPathSegListValues> m_pathSegList; 136 bool m_isAnimValObserved; 135 bool m_isAnimValObserved { false }; 136 137 class SVGAnimatedCustomPathSegListAttribute : public SVGAnimatedPathSegListAttribute { 138 public: 139 SVGAnimatedCustomPathSegListAttribute(SVGPathElement& element) 140 : SVGAnimatedPathSegListAttribute(PathSegUnalteredRole) 141 , m_element(element) 142 { 143 } 144 145 SVGPathSegListValues& value(bool shouldBuildSegListValues = true) 146 { 147 if (shouldBuildSegListValues && m_property.isEmpty()) 148 buildSVGPathSegListValuesFromByteStream(m_element.m_pathByteStream, m_element, m_property, UnalteredParsing); 149 return m_property; 150 } 151 152 private: 153 SVGPathElement& m_element; 154 }; 155 156 using SVGAnimatedCustomPathSegListAttributeAccessor = SVGAnimatedAttributeAccessor<SVGPathElement, SVGAnimatedCustomPathSegListAttribute, AnimatedPath>; 157 158 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 159 SVGAnimatedCustomPathSegListAttribute m_pathSegList { *this }; 137 160 }; 138 161 -
trunk/Source/WebCore/svg/SVGPathSegListValues.h
r229830 r234620 78 78 template<> struct SVGPropertyTraits<SVGPathSegListValues> { 79 79 static SVGPathSegListValues initialValue() { return SVGPathSegListValues(PathSegUndefinedRole); } 80 static String toString(const SVGPathSegListValues& list) { return list.valueAsString(); } 80 81 81 82 using ListItemType = RefPtr<SVGPathSeg>; -
trunk/Source/WebCore/svg/SVGPathSegWithContext.h
r232613 r234620 20 20 #pragma once 21 21 22 #include "SVG AnimatedPathSegListPropertyTearOff.h"22 #include "SVGPathElement.h" 23 23 24 24 namespace WebCore { … … 41 41 return nullptr; 42 42 case PathSegUnalteredRole: 43 return SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(m_element.get(), SVGPathElement::dPropertyInfo());43 return m_element->pathSegListAnimated(); 44 44 case PathSegNormalizedRole: 45 45 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! -
trunk/Source/WebCore/svg/SVGPatternElement.cpp
r229694 r234620 4 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 5 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 6 * Copyright (C) 2018 Apple Inc. All rights reserved. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 46 47 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPatternElement); 47 48 48 // Animated property definitions49 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::xAttr, X, x)50 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::yAttr, Y, y)51 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::widthAttr, Width, width)52 DEFINE_ANIMATED_LENGTH(SVGPatternElement, SVGNames::heightAttr, Height, height)53 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternUnitsAttr, PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType)54 DEFINE_ANIMATED_ENUMERATION(SVGPatternElement, SVGNames::patternContentUnitsAttr, PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType)55 DEFINE_ANIMATED_TRANSFORM_LIST(SVGPatternElement, SVGNames::patternTransformAttr, PatternTransform, patternTransform)56 DEFINE_ANIMATED_STRING(SVGPatternElement, XLinkNames::hrefAttr, Href, href)57 DEFINE_ANIMATED_BOOLEAN(SVGPatternElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)58 DEFINE_ANIMATED_RECT(SVGPatternElement, SVGNames::viewBoxAttr, ViewBox, viewBox)59 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGPatternElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)60 61 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement)62 REGISTER_LOCAL_ANIMATED_PROPERTY(x)63 REGISTER_LOCAL_ANIMATED_PROPERTY(y)64 REGISTER_LOCAL_ANIMATED_PROPERTY(width)65 REGISTER_LOCAL_ANIMATED_PROPERTY(height)66 REGISTER_LOCAL_ANIMATED_PROPERTY(patternUnits)67 REGISTER_LOCAL_ANIMATED_PROPERTY(patternContentUnits)68 REGISTER_LOCAL_ANIMATED_PROPERTY(patternTransform)69 REGISTER_LOCAL_ANIMATED_PROPERTY(href)70 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)71 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)72 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)73 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)74 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)75 END_REGISTER_ANIMATED_PROPERTIES76 77 49 inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document& document) 78 50 : SVGElement(tagName, document) 79 , m_x(LengthModeWidth) 80 , m_y(LengthModeHeight) 81 , m_width(LengthModeWidth) 82 , m_height(LengthModeHeight) 83 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) 84 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) 51 , SVGExternalResourcesRequired(this) 52 , SVGFitToViewBox(this) 53 , SVGTests(this) 54 , SVGURIReference(this) 85 55 { 86 56 ASSERT(hasTagName(SVGNames::patternTag)); 87 registerA nimatedPropertiesForSVGPatternElement();57 registerAttributes(); 88 58 } 89 59 … … 93 63 } 94 64 95 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName)65 void SVGPatternElement::registerAttributes() 96 66 { 97 static const auto supportedAttributes = makeNeverDestroyed([] { 98 HashSet<QualifiedName> set; 99 SVGURIReference::addSupportedAttributes(set); 100 SVGTests::addSupportedAttributes(set); 101 SVGLangSpace::addSupportedAttributes(set); 102 SVGExternalResourcesRequired::addSupportedAttributes(set); 103 SVGFitToViewBox::addSupportedAttributes(set); 104 set.add({ 105 SVGNames::patternUnitsAttr.get(), SVGNames::patternContentUnitsAttr.get(), SVGNames::patternTransformAttr.get(), 106 SVGNames::xAttr.get(), SVGNames::yAttr.get(), SVGNames::widthAttr.get(), SVGNames::heightAttr.get(), 107 }); 108 return set; 109 }()); 110 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 67 auto& registry = attributeRegistry(); 68 if (!registry.isEmpty()) 69 return; 70 registry.registerAttribute<SVGNames::xAttr, &SVGPatternElement::m_x>(); 71 registry.registerAttribute<SVGNames::yAttr, &SVGPatternElement::m_y>(); 72 registry.registerAttribute<SVGNames::widthAttr, &SVGPatternElement::m_width>(); 73 registry.registerAttribute<SVGNames::heightAttr, &SVGPatternElement::m_height>(); 74 registry.registerAttribute<SVGNames::patternUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternUnits>(); 75 registry.registerAttribute<SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternContentUnits>(); 76 registry.registerAttribute<SVGNames::patternTransformAttr, &SVGPatternElement::m_patternTransform>(); 111 77 } 112 78 … … 116 82 auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 117 83 if (propertyValue > 0) 118 setPatternUnitsBaseValue(propertyValue);84 m_patternUnits.setValue(propertyValue); 119 85 return; 120 86 } … … 122 88 auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); 123 89 if (propertyValue > 0) 124 setPatternContentUnitsBaseValue(propertyValue);90 m_patternContentUnits.setValue(propertyValue); 125 91 return; 126 92 } … … 128 94 SVGTransformListValues newList; 129 95 newList.parse(value); 130 detachAnimatedPatternTransformListWrappers(newList.size());131 setPatternTransformBaseValue(newList);96 m_patternTransform.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 97 m_patternTransform.setValue(WTFMove(newList)); 132 98 return; 133 99 } … … 136 102 137 103 if (name == SVGNames::xAttr) 138 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));104 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 139 105 else if (name == SVGNames::yAttr) 140 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));106 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 141 107 else if (name == SVGNames::widthAttr) 142 setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));108 m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 143 109 else if (name == SVGNames::heightAttr) 144 setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));110 m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 145 111 146 112 reportAttributeParsingError(parseError, name, value); … … 150 116 SVGTests::parseAttribute(name, value); 151 117 SVGExternalResourcesRequired::parseAttribute(name, value); 152 SVGFitToViewBox::parseAttribute( this,name, value);118 SVGFitToViewBox::parseAttribute(name, value); 153 119 } 154 120 155 121 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) 156 122 { 157 if (!isSupportedAttribute(attrName)) { 158 SVGElement::svgAttributeChanged(attrName); 159 return; 160 } 161 162 InstanceInvalidationGuard guard(*this); 163 164 if (attrName == SVGNames::xAttr 165 || attrName == SVGNames::yAttr 166 || attrName == SVGNames::widthAttr 167 || attrName == SVGNames::heightAttr) { 123 if (isAnimatedLengthAttribute(attrName)) { 124 InstanceInvalidationGuard guard(*this); 168 125 invalidateSVGPresentationAttributeStyle(); 169 126 return; 170 127 } 171 128 172 if (RenderObject* object = renderer()) 173 object->setNeedsLayout(); 129 if (isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) { 130 if (RenderObject* object = renderer()) 131 object->setNeedsLayout(); 132 return; 133 } 134 135 SVGElement::svgAttributeChanged(attrName); 136 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 174 137 } 175 138 … … 204 167 attributes.setHeight(height()); 205 168 206 if (!attributes.hasViewBox() && hasAttribute(SVGNames::viewBoxAttr) && viewBoxIsValid())169 if (!attributes.hasViewBox() && hasAttribute(SVGNames::viewBoxAttr) && hasValidViewBox()) 207 170 attributes.setViewBox(viewBox()); 208 171 … … 233 196 } 234 197 235 Ref<SVGStringList> SVGPatternElement::requiredFeatures()236 {237 return SVGTests::requiredFeatures(*this);238 198 } 239 240 Ref<SVGStringList> SVGPatternElement::requiredExtensions()241 {242 return SVGTests::requiredExtensions(*this);243 }244 245 Ref<SVGStringList> SVGPatternElement::systemLanguage()246 {247 return SVGTests::systemLanguage(*this);248 }249 250 } -
trunk/Source/WebCore/svg/SVGPatternElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 39 40 struct PatternAttributes; 40 41 41 class SVGPatternElement final : public SVGElement, public SVG URIReference, public SVGTests, public SVGExternalResourcesRequired, public SVGFitToViewBox{42 class SVGPatternElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGFitToViewBox, public SVGTests, public SVGURIReference { 42 43 WTF_MAKE_ISO_ALLOCATED(SVGPatternElement); 43 44 public: … … 48 49 AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const final; 49 50 50 // SVGTests 51 Ref<SVGStringList> requiredFeatures(); 52 Ref<SVGStringList> requiredExtensions(); 53 Ref<SVGStringList> systemLanguage(); 51 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 52 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 53 const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } 54 const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } 55 SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits.currentValue(attributeOwnerProxy()); } 56 SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternContentUnits.currentValue(attributeOwnerProxy()); } 57 const SVGTransformListValues& patternTransform() const { return m_patternTransform.currentValue(attributeOwnerProxy()); } 58 59 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 60 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 61 RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } 62 RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } 63 RefPtr<SVGAnimatedEnumeration> patternUnitsAnimated() { return m_patternUnits.animatedProperty(attributeOwnerProxy()); } 64 RefPtr<SVGAnimatedEnumeration> patternContentUnitsAnimated() { return m_patternContentUnits.animatedProperty(attributeOwnerProxy()); } 65 RefPtr<SVGAnimatedTransformList> patternTransformAnimated() { return m_patternTransform.animatedProperty(attributeOwnerProxy()); } 54 66 55 67 private: 56 68 SVGPatternElement(const QualifiedName&, Document&); 57 58 bool isValid() const final { return SVGTests::isValid(); }59 bool needsPendingResourceHandling() const final { return false; }60 69 61 static bool isSupportedAttribute(const QualifiedName&); 70 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPatternElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGTests, SVGURIReference>; 71 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 72 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 73 static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); } 74 static void registerAttributes(); 75 76 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 62 77 void parseAttribute(const QualifiedName&, const AtomicString&) final; 63 78 void svgAttributeChanged(const QualifiedName&) final; … … 66 81 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 67 82 83 bool isValid() const final { return SVGTests::isValid(); } 84 bool needsPendingResourceHandling() const final { return false; } 68 85 bool selfHasRelativeLengths() const final { return true; } 69 86 70 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPatternElement) 71 DECLARE_ANIMATED_LENGTH(X, x) 72 DECLARE_ANIMATED_LENGTH(Y, y) 73 DECLARE_ANIMATED_LENGTH(Width, width) 74 DECLARE_ANIMATED_LENGTH(Height, height) 75 DECLARE_ANIMATED_ENUMERATION(PatternUnits, patternUnits, SVGUnitTypes::SVGUnitType) 76 DECLARE_ANIMATED_ENUMERATION(PatternContentUnits, patternContentUnits, SVGUnitTypes::SVGUnitType) 77 DECLARE_ANIMATED_TRANSFORM_LIST(PatternTransform, patternTransform) 78 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 79 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 80 DECLARE_ANIMATED_RECT(ViewBox, viewBox) 81 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) 82 END_DECLARE_ANIMATED_PROPERTIES 83 84 // SVGTests 85 void synchronizeRequiredFeatures() final { SVGTests::synchronizeRequiredFeatures(*this); } 86 void synchronizeRequiredExtensions() final { SVGTests::synchronizeRequiredExtensions(*this); } 87 void synchronizeSystemLanguage() final { SVGTests::synchronizeSystemLanguage(*this); } 87 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 88 SVGAnimatedLengthAttribute m_x { LengthModeWidth }; 89 SVGAnimatedLengthAttribute m_y { LengthModeHeight }; 90 SVGAnimatedLengthAttribute m_width { LengthModeWidth }; 91 SVGAnimatedLengthAttribute m_height { LengthModeHeight }; 92 SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternUnits { SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX }; 93 SVGAnimatedEnumerationAttribute<SVGUnitTypes::SVGUnitType> m_patternContentUnits { SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE }; 94 SVGAnimatedTransformListAttribute m_patternTransform; 88 95 }; 89 96 -
trunk/Source/WebCore/svg/SVGPointListValues.h
r229417 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 45 46 } 46 47 static std::optional<SVGPointListValues> parse(const QualifiedName&, const String&) { ASSERT_NOT_REACHED(); return { }; } 47 static String toString(const SVGPointListValues& ) { ASSERT_NOT_REACHED(); return emptyString(); }48 static String toString(const SVGPointListValues& list) { return list.valueAsString(); } 48 49 49 50 using ListItemType = FloatPoint; -
trunk/Source/WebCore/svg/SVGPolyElement.cpp
r231955 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 25 26 #include "RenderSVGPath.h" 26 27 #include "RenderSVGResource.h" 27 #include "SVGAnimatedPointList.h"28 28 #include "SVGDocumentExtensions.h" 29 #include "SVGNames.h"30 29 #include "SVGParserUtilities.h" 31 #include "SVGPoint.h"32 #include "SVGPointList.h"33 30 #include <wtf/IsoMallocInlines.h> 34 31 … … 37 34 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGPolyElement); 38 35 39 // Define custom animated property 'points'. 40 const SVGPropertyInfo* SVGPolyElement::pointsPropertyInfo() 36 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) 37 : SVGGeometryElement(tagName, document) 38 , SVGExternalResourcesRequired(this) 41 39 { 42 static const SVGPropertyInfo* s_propertyInfo = nullptr; 43 if (!s_propertyInfo) { 44 s_propertyInfo = new SVGPropertyInfo(AnimatedPoints, 45 PropertyIsReadWrite, 46 SVGNames::pointsAttr, 47 SVGNames::pointsAttr->localName(), 48 &SVGPolyElement::synchronizePoints, 49 &SVGPolyElement::lookupOrCreatePointsWrapper); 50 } 51 return s_propertyInfo; 40 registerAttributes(); 52 41 } 53 42 54 // Animated property definitions 55 DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) 56 57 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) 58 REGISTER_LOCAL_ANIMATED_PROPERTY(points) 59 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 60 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement) 61 END_REGISTER_ANIMATED_PROPERTIES 62 63 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) 64 : SVGGeometryElement(tagName, document) 43 void SVGPolyElement::registerAttributes() 65 44 { 66 registerAnimatedPropertiesForSVGPolyElement(); 45 auto& registry = attributeRegistry(); 46 if (!registry.isEmpty()) 47 return; 48 registry.registerAttribute<SVGNames::pointsAttr, &SVGPolyElement::m_points>(); 67 49 } 68 50 … … 74 56 document().accessSVGExtensions().reportError("Problem parsing points=\"" + value + "\""); 75 57 76 if (auto wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()))77 static_pointer_cast<SVGAnimatedPointList>(wrapper)->detachListWrappers(newList.size());58 if (auto wrapper = static_pointer_cast<SVGAnimatedPointList>(lookupAnimatedProperty(m_points))) 59 wrapper->detachListWrappers(newList.size()); 78 60 79 m_points. value = WTFMove(newList);61 m_points.setValue(WTFMove(newList)); 80 62 return; 81 63 } 82 64 83 SVGG raphicsElement::parseAttribute(name, value);65 SVGGeometryElement::parseAttribute(name, value); 84 66 SVGExternalResourcesRequired::parseAttribute(name, value); 85 67 } … … 96 78 } 97 79 98 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { 99 if (auto* renderer = downcast<RenderSVGPath>(this->renderer())) { 100 InstanceInvalidationGuard guard(*this); 101 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 102 } 103 return; 104 } 105 106 SVGGraphicsElement::svgAttributeChanged(attrName); 107 } 108 109 void SVGPolyElement::synchronizePoints(SVGElement* contextElement) 110 { 111 ASSERT(contextElement); 112 SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement); 113 if (!ownerType.m_points.shouldSynchronize) 114 return; 115 ownerType.m_points.synchronize(&ownerType, pointsPropertyInfo()->attributeName, ownerType.m_points.value.valueAsString()); 116 } 117 118 Ref<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement) 119 { 120 ASSERT(contextElement); 121 SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement); 122 return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPolyElement, SVGAnimatedPointList, SVGPointListValues>(&ownerType, pointsPropertyInfo(), ownerType.m_points.value); 80 SVGGeometryElement::svgAttributeChanged(attrName); 81 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 123 82 } 124 83 125 84 Ref<SVGPointList> SVGPolyElement::points() 126 85 { 127 m_points.s houldSynchronize = true;128 return static_ reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal();86 m_points.setShouldSynchronize(true); 87 return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->baseVal(); 129 88 } 130 89 131 90 Ref<SVGPointList> SVGPolyElement::animatedPoints() 132 91 { 133 m_points.s houldSynchronize = true;134 return static_ reference_cast<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal();92 m_points.setShouldSynchronize(true); 93 return static_pointer_cast<SVGAnimatedPointList>(lookupOrCreateAnimatedProperty(m_points))->animVal(); 135 94 } 136 95 -
trunk/Source/WebCore/svg/SVGPolyElement.h
r231955 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 21 22 #pragma once 22 23 23 #include "SVGAnimated Boolean.h"24 #include "SVGAnimatedPointList.h" 24 25 #include "SVGExternalResourcesRequired.h" 25 26 #include "SVGGeometryElement.h" 26 27 #include "SVGNames.h" 27 #include "SVGPointListValues.h"28 28 29 29 namespace WebCore { … … 35 35 Ref<SVGPointList> animatedPoints(); 36 36 37 SVGPointListValues& pointList() const { return m_points.value; } 38 39 static const SVGPropertyInfo* pointsPropertyInfo(); 37 const SVGPointListValues& pointList() const { return m_points.value(); } 40 38 41 39 size_t approximateMemoryCost() const override; … … 45 43 46 44 private: 47 bool isValid() const override { return SVGTests::isValid(); } 45 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGPolyElement, SVGGeometryElement, SVGExternalResourcesRequired>; 46 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 47 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 48 static void registerAttributes(); 48 49 50 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 49 51 void parseAttribute(const QualifiedName&, const AtomicString&) override; 50 52 void svgAttributeChanged(const QualifiedName&) override; 51 53 54 bool isValid() const override { return SVGTests::isValid(); } 52 55 bool supportsMarkers() const override { return true; } 53 56 54 // Custom 'points' property 55 static void synchronizePoints(SVGElement* contextElement); 56 static Ref<SVGAnimatedProperty> lookupOrCreatePointsWrapper(SVGElement* contextElement); 57 58 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPolyElement) 59 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 60 END_DECLARE_ANIMATED_PROPERTIES 61 62 protected: 63 mutable SVGSynchronizableAnimatedProperty<SVGPointListValues> m_points; 57 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 58 SVGAnimatedPointListAttribute m_points; 64 59 }; 65 60 -
trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp
r228721 r234620 181 181 } 182 182 183 void SVGPreserveAspectRatioValue::transformRect(FloatRect& destRect, FloatRect& srcRect) 183 void SVGPreserveAspectRatioValue::transformRect(FloatRect& destRect, FloatRect& srcRect) const 184 184 { 185 185 if (m_align == SVG_PRESERVEASPECTRATIO_NONE) -
trunk/Source/WebCore/svg/SVGPreserveAspectRatioValue.h
r229417 r234620 61 61 unsigned short meetOrSlice() const { return m_meetOrSlice; } 62 62 63 void transformRect(FloatRect& destRect, FloatRect& srcRect) ;63 void transformRect(FloatRect& destRect, FloatRect& srcRect) const; 64 64 65 65 AffineTransform getCTM(float logicalX, float logicalY, float logicalWidth, float logicalHeight, float physicalWidth, float physicalHeight) const; -
trunk/Source/WebCore/svg/SVGRadialGradientElement.cpp
r229694 r234620 5 5 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) 2018 Apple Inc. All rights reserved. 7 8 * 8 9 * This library is free software; you can redistribute it and/or … … 39 40 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGRadialGradientElement); 40 41 41 // Animated property definitions42 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::cxAttr, Cx, cx)43 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::cyAttr, Cy, cy)44 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::rAttr, R, r)45 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::fxAttr, Fx, fx)46 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::fyAttr, Fy, fy)47 DEFINE_ANIMATED_LENGTH(SVGRadialGradientElement, SVGNames::frAttr, Fr, fr)48 49 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRadialGradientElement)50 REGISTER_LOCAL_ANIMATED_PROPERTY(cx)51 REGISTER_LOCAL_ANIMATED_PROPERTY(cy)52 REGISTER_LOCAL_ANIMATED_PROPERTY(r)53 REGISTER_LOCAL_ANIMATED_PROPERTY(fx)54 REGISTER_LOCAL_ANIMATED_PROPERTY(fy)55 REGISTER_LOCAL_ANIMATED_PROPERTY(fr)56 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGradientElement)57 END_REGISTER_ANIMATED_PROPERTIES58 59 42 inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document& document) 60 43 : SVGGradientElement(tagName, document) 61 , m_cx(LengthModeWidth, "50%")62 , m_cy(LengthModeHeight, "50%")63 , m_r(LengthModeOther, "50%")64 , m_fx(LengthModeWidth)65 , m_fy(LengthModeHeight)66 , m_fr(LengthModeOther, "0%")67 44 { 68 45 // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified. 69 46 ASSERT(hasTagName(SVGNames::radialGradientTag)); 70 registerA nimatedPropertiesForSVGRadialGradientElement();47 registerAttributes(); 71 48 } 72 49 … … 76 53 } 77 54 78 bool SVGRadialGradientElement::isSupportedAttribute(const QualifiedName& attrName) 79 { 80 static const auto supportedAttributes = makeNeverDestroyed(HashSet<QualifiedName> { 81 SVGNames::cxAttr.get(), SVGNames::cyAttr.get(), SVGNames::fxAttr.get(), SVGNames::fyAttr.get(), SVGNames::rAttr.get(), SVGNames::frAttr.get(), 82 }); 83 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 55 void SVGRadialGradientElement::registerAttributes() 56 { 57 auto& registry = attributeRegistry(); 58 if (!registry.isEmpty()) 59 return; 60 registry.registerAttribute<SVGNames::cxAttr, &SVGRadialGradientElement::m_cx>(); 61 registry.registerAttribute<SVGNames::cyAttr, &SVGRadialGradientElement::m_cy>(); 62 registry.registerAttribute<SVGNames::rAttr, &SVGRadialGradientElement::m_r>(); 63 registry.registerAttribute<SVGNames::fxAttr, &SVGRadialGradientElement::m_fx>(); 64 registry.registerAttribute<SVGNames::fyAttr, &SVGRadialGradientElement::m_fy>(); 65 registry.registerAttribute<SVGNames::frAttr, &SVGRadialGradientElement::m_fr>(); 84 66 } 85 67 … … 89 71 90 72 if (name == SVGNames::cxAttr) 91 setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));73 m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 92 74 else if (name == SVGNames::cyAttr) 93 setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));75 m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 94 76 else if (name == SVGNames::rAttr) 95 setRBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));77 m_r.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); 96 78 else if (name == SVGNames::fxAttr) 97 setFxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));79 m_fx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 98 80 else if (name == SVGNames::fyAttr) 99 setFyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));81 m_fy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 100 82 else if (name == SVGNames::frAttr) 101 setFrBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));83 m_fr.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); 102 84 103 85 reportAttributeParsingError(parseError, name, value); … … 108 90 void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName) 109 91 { 110 if (!isSupportedAttribute(attrName)) { 111 SVGGradientElement::svgAttributeChanged(attrName); 92 if (isKnownAttribute(attrName)) { 93 InstanceInvalidationGuard guard(*this); 94 updateRelativeLengthsInformation(); 95 if (RenderObject* object = renderer()) 96 object->setNeedsLayout(); 112 97 return; 113 98 } 114 99 115 InstanceInvalidationGuard guard(*this); 116 117 updateRelativeLengthsInformation(); 118 119 if (RenderObject* object = renderer()) 120 object->setNeedsLayout(); 100 SVGGradientElement::svgAttributeChanged(attrName); 121 101 } 122 102 -
trunk/Source/WebCore/svg/SVGRadialGradientElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 36 37 bool collectGradientAttributes(RadialGradientAttributes&); 37 38 39 const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); } 40 const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); } 41 const SVGLengthValue& r() const { return m_r.currentValue(attributeOwnerProxy()); } 42 const SVGLengthValue& fx() const { return m_fx.currentValue(attributeOwnerProxy()); } 43 const SVGLengthValue& fy() const { return m_fy.currentValue(attributeOwnerProxy()); } 44 const SVGLengthValue& fr() const { return m_fr.currentValue(attributeOwnerProxy()); } 45 46 RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); } 47 RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); } 48 RefPtr<SVGAnimatedLength> rAnimated() { return m_r.animatedProperty(attributeOwnerProxy()); } 49 RefPtr<SVGAnimatedLength> fxAnimated() { return m_fx.animatedProperty(attributeOwnerProxy()); } 50 RefPtr<SVGAnimatedLength> fyAnimated() { return m_fy.animatedProperty(attributeOwnerProxy()); } 51 RefPtr<SVGAnimatedLength> frAnimated() { return m_fr.animatedProperty(attributeOwnerProxy()); } 52 38 53 private: 39 54 SVGRadialGradientElement(const QualifiedName&, Document&); 40 55 41 static bool isSupportedAttribute(const QualifiedName&); 56 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRadialGradientElement, SVGGradientElement>; 57 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 58 static void registerAttributes(); 59 60 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 42 61 void parseAttribute(const QualifiedName&, const AtomicString&) override; 43 62 void svgAttributeChanged(const QualifiedName&) override; … … 47 66 bool selfHasRelativeLengths() const override; 48 67 49 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGRadialGradientElement) 50 DECLARE_ANIMATED_LENGTH(Cx, cx) 51 DECLARE_ANIMATED_LENGTH(Cy, cy) 52 DECLARE_ANIMATED_LENGTH(R, r) 53 DECLARE_ANIMATED_LENGTH(Fx, fx) 54 DECLARE_ANIMATED_LENGTH(Fy, fy) 55 DECLARE_ANIMATED_LENGTH(Fr, fr) 56 END_DECLARE_ANIMATED_PROPERTIES 68 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 69 SVGAnimatedLengthAttribute m_cx { LengthModeWidth, "50%" }; 70 SVGAnimatedLengthAttribute m_cy { LengthModeHeight, "50%" }; 71 SVGAnimatedLengthAttribute m_r { LengthModeOther, "50%" }; 72 SVGAnimatedLengthAttribute m_fx { LengthModeWidth }; 73 SVGAnimatedLengthAttribute m_fy { LengthModeHeight }; 74 SVGAnimatedLengthAttribute m_fr { LengthModeOther, "0%" }; 57 75 }; 58 76 -
trunk/Source/WebCore/svg/SVGRectElement.cpp
r231955 r234620 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 23 24 #include "SVGRectElement.h" 24 25 25 #include "RenderSVGPath.h"26 26 #include "RenderSVGRect.h" 27 27 #include "RenderSVGResource.h" 28 #include "SVGLengthValue.h"29 #include "SVGNames.h"30 28 #include <wtf/IsoMallocInlines.h> 31 29 … … 34 32 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGRectElement); 35 33 36 // Animated property definitions37 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::xAttr, X, x)38 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::yAttr, Y, y)39 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::widthAttr, Width, width)40 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::heightAttr, Height, height)41 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::rxAttr, Rx, rx)42 DEFINE_ANIMATED_LENGTH(SVGRectElement, SVGNames::ryAttr, Ry, ry)43 DEFINE_ANIMATED_BOOLEAN(SVGRectElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)44 45 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRectElement)46 REGISTER_LOCAL_ANIMATED_PROPERTY(x)47 REGISTER_LOCAL_ANIMATED_PROPERTY(y)48 REGISTER_LOCAL_ANIMATED_PROPERTY(width)49 REGISTER_LOCAL_ANIMATED_PROPERTY(height)50 REGISTER_LOCAL_ANIMATED_PROPERTY(rx)51 REGISTER_LOCAL_ANIMATED_PROPERTY(ry)52 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)53 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)54 END_REGISTER_ANIMATED_PROPERTIES55 56 34 inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document& document) 57 35 : SVGGeometryElement(tagName, document) 58 , m_x(LengthModeWidth) 59 , m_y(LengthModeHeight) 60 , m_width(LengthModeWidth) 61 , m_height(LengthModeHeight) 62 , m_rx(LengthModeWidth) 63 , m_ry(LengthModeHeight) 36 , SVGExternalResourcesRequired(this) 64 37 { 65 38 ASSERT(hasTagName(SVGNames::rectTag)); 66 registerA nimatedPropertiesForSVGRectElement();39 registerAttributes(); 67 40 } 68 41 … … 72 45 } 73 46 47 void SVGRectElement::registerAttributes() 48 { 49 auto& registry = attributeRegistry(); 50 if (!registry.isEmpty()) 51 return; 52 registry.registerAttribute<SVGNames::xAttr, &SVGRectElement::m_x>(); 53 registry.registerAttribute<SVGNames::yAttr, &SVGRectElement::m_y>(); 54 registry.registerAttribute<SVGNames::widthAttr, &SVGRectElement::m_width>(); 55 registry.registerAttribute<SVGNames::heightAttr, &SVGRectElement::m_height>(); 56 registry.registerAttribute<SVGNames::rxAttr, &SVGRectElement::m_rx>(); 57 registry.registerAttribute<SVGNames::ryAttr, &SVGRectElement::m_ry>(); 58 } 59 74 60 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 75 61 { … … 77 63 78 64 if (name == SVGNames::xAttr) 79 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));65 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 80 66 else if (name == SVGNames::yAttr) 81 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));67 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 82 68 else if (name == SVGNames::rxAttr) 83 setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));69 m_rx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 84 70 else if (name == SVGNames::ryAttr) 85 setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));71 m_ry.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 86 72 else if (name == SVGNames::widthAttr) 87 setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));73 m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 88 74 else if (name == SVGNames::heightAttr) 89 setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));75 m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 90 76 91 77 reportAttributeParsingError(parseError, name, value); 92 78 93 SVGG raphicsElement::parseAttribute(name, value);79 SVGGeometryElement::parseAttribute(name, value); 94 80 SVGExternalResourcesRequired::parseAttribute(name, value); 95 81 } … … 97 83 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) 98 84 { 99 if ( attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) {85 if (isKnownAttribute(attrName)) { 100 86 InstanceInvalidationGuard guard(*this); 101 87 invalidateSVGPresentationAttributeStyle(); … … 103 89 } 104 90 105 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { 106 if (auto* renderer = downcast<RenderSVGShape>(this->renderer())) { 107 InstanceInvalidationGuard guard(*this); 108 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 109 } 110 return; 111 } 112 113 SVGGraphicsElement::svgAttributeChanged(attrName); 91 SVGGeometryElement::svgAttributeChanged(attrName); 92 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 114 93 } 115 94 -
trunk/Source/WebCore/svg/SVGRectElement.h
r231955 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 34 35 static Ref<SVGRectElement> create(const QualifiedName&, Document&); 35 36 37 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 38 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 39 const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } 40 const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } 41 const SVGLengthValue& rx() const { return m_rx.currentValue(attributeOwnerProxy()); } 42 const SVGLengthValue& ry() const { return m_ry.currentValue(attributeOwnerProxy()); } 43 44 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 45 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 46 RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } 47 RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } 48 RefPtr<SVGAnimatedLength> rxAnimated() { return m_rx.animatedProperty(attributeOwnerProxy()); } 49 RefPtr<SVGAnimatedLength> ryAnimated() { return m_ry.animatedProperty(attributeOwnerProxy()); } 50 36 51 private: 37 52 SVGRectElement(const QualifiedName&, Document&); 38 39 bool isValid() const final { return SVGTests::isValid(); }40 53 54 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRectElement, SVGGeometryElement, SVGExternalResourcesRequired>; 55 static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 56 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 57 static void registerAttributes(); 58 59 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 41 60 void parseAttribute(const QualifiedName&, const AtomicString&) final; 42 61 void svgAttributeChanged(const QualifiedName&) final; 43 62 63 bool isValid() const final { return SVGTests::isValid(); } 44 64 bool selfHasRelativeLengths() const final { return true; } 45 65 46 66 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 47 67 48 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGRectElement) 49 DECLARE_ANIMATED_LENGTH(X, x) 50 DECLARE_ANIMATED_LENGTH(Y, y) 51 DECLARE_ANIMATED_LENGTH(Width, width) 52 DECLARE_ANIMATED_LENGTH(Height, height) 53 DECLARE_ANIMATED_LENGTH(Rx, rx) 54 DECLARE_ANIMATED_LENGTH(Ry, ry) 55 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 56 END_DECLARE_ANIMATED_PROPERTIES 68 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 69 SVGAnimatedLengthAttribute m_x { LengthModeWidth }; 70 SVGAnimatedLengthAttribute m_y { LengthModeHeight }; 71 SVGAnimatedLengthAttribute m_width { LengthModeWidth }; 72 SVGAnimatedLengthAttribute m_height { LengthModeHeight }; 73 SVGAnimatedLengthAttribute m_rx { LengthModeWidth }; 74 SVGAnimatedLengthAttribute m_ry { LengthModeHeight}; 57 75 }; 58 76 -
trunk/Source/WebCore/svg/SVGSVGElement.cpp
r233122 r234620 2 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> 4 * Copyright (C) 2007-201 7Apple Inc. All rights reserved.4 * Copyright (C) 2007-2018 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 6 6 * … … 53 53 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGSVGElement); 54 54 55 // Animated property definitions56 DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::xAttr, X, x)57 DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::yAttr, Y, y)58 DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::widthAttr, Width, width)59 DEFINE_ANIMATED_LENGTH(SVGSVGElement, SVGNames::heightAttr, Height, height)60 DEFINE_ANIMATED_BOOLEAN(SVGSVGElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)61 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSVGElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)62 DEFINE_ANIMATED_RECT(SVGSVGElement, SVGNames::viewBoxAttr, ViewBox, viewBox)63 64 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSVGElement)65 REGISTER_LOCAL_ANIMATED_PROPERTY(x)66 REGISTER_LOCAL_ANIMATED_PROPERTY(y)67 REGISTER_LOCAL_ANIMATED_PROPERTY(width)68 REGISTER_LOCAL_ANIMATED_PROPERTY(height)69 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)70 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)71 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)72 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)73 END_REGISTER_ANIMATED_PROPERTIES74 75 55 inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& document) 76 56 : SVGGraphicsElement(tagName, document) 77 , m_x(LengthModeWidth) 78 , m_y(LengthModeHeight) 79 , m_width(LengthModeWidth, "100%"_s) 80 , m_height(LengthModeHeight, "100%"_s) 57 , SVGExternalResourcesRequired(this) 58 , SVGFitToViewBox(this) 81 59 , m_timeContainer(SMILTimeContainer::create(*this)) 82 60 { 83 61 ASSERT(hasTagName(SVGNames::svgTag)); 84 registerA nimatedPropertiesForSVGSVGElement();62 registerAttributes(); 85 63 document.registerForDocumentSuspensionCallbacks(this); 86 64 } … … 215 193 } 216 194 195 void SVGSVGElement::registerAttributes() 196 { 197 auto& registry = attributeRegistry(); 198 if (!registry.isEmpty()) 199 return; 200 registry.registerAttribute<SVGNames::xAttr, &SVGSVGElement::m_x>(); 201 registry.registerAttribute<SVGNames::yAttr, &SVGSVGElement::m_y>(); 202 registry.registerAttribute<SVGNames::widthAttr, &SVGSVGElement::m_width>(); 203 registry.registerAttribute<SVGNames::heightAttr, &SVGSVGElement::m_height>(); 204 } 205 217 206 void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 218 207 { … … 253 242 254 243 if (name == SVGNames::xAttr) 255 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));244 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 256 245 else if (name == SVGNames::yAttr) 257 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));246 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 258 247 else if (name == SVGNames::widthAttr) { 259 248 auto length = SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths); … … 263 252 length = SVGLengthValue(LengthModeWidth, "100%"_s); 264 253 } 265 setWidthBaseValue(length);254 m_width.setValue(length); 266 255 } else if (name == SVGNames::heightAttr) { 267 256 auto length = SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths); … … 271 260 length = SVGLengthValue(LengthModeHeight, "100%"_s); 272 261 } 273 setHeightBaseValue(length);262 m_height.setValue(length); 274 263 } 275 264 276 265 reportAttributeParsingError(parseError, name, value); 277 266 267 SVGGraphicsElement::parseAttribute(name, value); 278 268 SVGExternalResourcesRequired::parseAttribute(name, value); 279 SVGFitToViewBox::parseAttribute(this, name, value); 280 SVGZoomAndPan::parseAttribute(*this, name, value); 281 SVGGraphicsElement::parseAttribute(name, value); 269 SVGFitToViewBox::parseAttribute(name, value); 270 SVGZoomAndPan::parseAttribute(name, value); 282 271 } 283 272 284 273 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) 285 274 { 286 bool updateRelativeLengthsOrViewBox = false;287 if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) {275 if (isKnownAttribute(attrName)) { 276 InstanceInvalidationGuard guard(*this); 288 277 invalidateSVGPresentationAttributeStyle(); 289 updateRelativeLengthsOrViewBox = true; 290 } 291 292 if (SVGFitToViewBox::isKnownAttribute(attrName)) { 293 updateRelativeLengthsOrViewBox = true; 294 if (auto* renderer = this->renderer()) 295 renderer->setNeedsTransformUpdate(); 296 } 297 298 InstanceInvalidationGuard guard(*this); 299 300 if (updateRelativeLengthsOrViewBox 301 || SVGLangSpace::isKnownAttribute(attrName) 302 || SVGExternalResourcesRequired::isKnownAttribute(attrName) 303 || SVGZoomAndPan::isKnownAttribute(attrName)) { 278 304 279 if (auto renderer = this->renderer()) 305 280 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 306 281 return; 307 282 } 283 284 if (SVGFitToViewBox::isKnownAttribute(attrName)) { 285 if (auto* renderer = this->renderer()) { 286 renderer->setNeedsTransformUpdate(); 287 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 288 } 289 return; 290 } 308 291 309 292 SVGGraphicsElement::svgAttributeChanged(attrName); 293 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 310 294 } 311 295 … … 635 619 636 620 AffineTransform transform = SVGFitToViewBox::viewBoxToViewTransform(currentViewBoxRect(), m_viewSpec->preserveAspectRatio(), viewWidth, viewHeight); 637 m_viewSpec->transform BaseValue().concatenate(transform);621 m_viewSpec->transformValue().concatenate(transform); 638 622 return transform; 639 623 } … … 717 701 if (auto* rootElement = findRootAnchor(m_currentViewFragmentIdentifier)) { 718 702 SVGViewSpec& view = rootElement->currentView(); 719 view.setViewBox BaseValue(viewBox());720 view.setPreserveAspectRatio BaseValue(preserveAspectRatioBaseValue());721 view.setZoomAndPan BaseValue(zoomAndPan());703 view.setViewBox(viewBox()); 704 view.setPreserveAspectRatio(preserveAspectRatio()); 705 view.setZoomAndPan(zoomAndPan()); 722 706 m_currentViewFragmentIdentifier = { }; 723 707 } … … 735 719 736 720 if (viewElement.hasAttribute(SVGNames::viewBoxAttr)) 737 view.setViewBox BaseValue(viewElement.viewBox());721 view.setViewBox(viewElement.viewBox()); 738 722 else 739 view.setViewBox BaseValue(viewBox());723 view.setViewBox(viewBox()); 740 724 741 725 if (viewElement.hasAttribute(SVGNames::preserveAspectRatioAttr)) 742 view.setPreserveAspectRatio BaseValue(viewElement.preserveAspectRatioBaseValue());726 view.setPreserveAspectRatio(viewElement.preserveAspectRatio()); 743 727 else 744 view.setPreserveAspectRatio BaseValue(preserveAspectRatioBaseValue());728 view.setPreserveAspectRatio(preserveAspectRatio()); 745 729 746 730 if (viewElement.hasAttribute(SVGNames::zoomAndPanAttr)) 747 view.setZoomAndPan BaseValue(viewElement.zoomAndPan());731 view.setZoomAndPan(viewElement.zoomAndPan()); 748 732 else 749 view.setZoomAndPan BaseValue(zoomAndPan());733 view.setZoomAndPan(zoomAndPan()); 750 734 } 751 735 -
trunk/Source/WebCore/svg/SVGSVGElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> 4 * Copyright (C) 2015 Apple Inc. All rights reserved.4 * Copyright (C) 2015-2018 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 45 45 class SVGSVGElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGFitToViewBox, public SVGZoomAndPan { 46 46 WTF_MAKE_ISO_ALLOCATED(SVGSVGElement); 47 48 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement)49 DECLARE_ANIMATED_LENGTH(X, x)50 DECLARE_ANIMATED_LENGTH(Y, y)51 DECLARE_ANIMATED_LENGTH(Width, width)52 DECLARE_ANIMATED_LENGTH(Height, height)53 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)54 DECLARE_ANIMATED_RECT(ViewBox, viewBox)55 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)56 END_DECLARE_ANIMATED_PROPERTIES57 58 47 public: // DOM 59 48 const AtomicString& contentScriptType() const; … … 70 59 float screenPixelToMillimeterY() const; 71 60 72 bool useCurrentView() const ;61 bool useCurrentView() const { return m_useCurrentView; } 73 62 SVGViewSpec& currentView(); 74 63 … … 77 66 78 67 Ref<SVGPoint> currentTranslate(); 79 FloatPoint currentTranslateValue() ;68 FloatPoint currentTranslateValue() { return m_currentTranslate; } 80 69 81 70 unsigned suspendRedraw(unsigned maxWaitMilliseconds); … … 109 98 Element* getElementById(const AtomicString&); 110 99 111 SVGZoomAndPanType zoomAndPan() const;112 void setZoomAndPan(unsigned short);113 114 100 public: 115 101 static Ref<SVGSVGElement> create(const QualifiedName&, Document&); … … 121 107 using SVGGraphicsElement::deref; 122 108 123 SMILTimeContainer& timeContainer() ;109 SMILTimeContainer& timeContainer() { return m_timeContainer.get(); } 124 110 125 111 void setCurrentTranslate(const FloatPoint&); // Used to pan. … … 134 120 FloatRect currentViewBoxRect() const; 135 121 136 bool hasEmptyViewBox() const;137 122 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; 123 124 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 125 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 126 const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } 127 const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } 128 129 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 130 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 131 RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } 132 RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } 138 133 139 134 private: … … 141 136 virtual ~SVGSVGElement(); 142 137 138 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSVGElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan>; 139 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 140 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 141 static void registerAttributes(); 142 143 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 144 void parseAttribute(const QualifiedName&, const AtomicString&) override; 145 void svgAttributeChanged(const QualifiedName&) override; 146 bool selfHasRelativeLengths() const override; 143 147 bool isValid() const override; 144 void didMoveToNewDocument(Document& oldDocument, Document& newDocument) override; 145 void parseAttribute(const QualifiedName&, const AtomicString&) override; 148 146 149 bool rendererIsNeeded(const RenderStyle&) override; 147 150 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; 148 151 InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; 149 152 void removedFromAncestor(RemovalType, ContainerNode&) override; 150 void svgAttributeChanged(const QualifiedName&) override;151 bool selfHasRelativeLengths() const override;152 153 void prepareForDocumentSuspension() override; 153 154 void resumeFromDocumentSuspension() override; 155 void didMoveToNewDocument(Document& oldDocument, Document& newDocument) override; 156 154 157 AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override; 155 156 158 RefPtr<Frame> frameForCurrentScale() const; 157 159 void inheritViewAttributes(const SVGViewElement&); … … 163 165 164 166 bool m_useCurrentView { false }; 165 SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };166 167 Ref<SMILTimeContainer> m_timeContainer; 167 168 FloatPoint m_currentTranslate; 168 169 RefPtr<SVGViewSpec> m_viewSpec; 169 170 String m_currentViewFragmentIdentifier; 171 172 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 173 SVGAnimatedLengthAttribute m_x { LengthModeWidth }; 174 SVGAnimatedLengthAttribute m_y { LengthModeHeight}; 175 SVGAnimatedLengthAttribute m_width { LengthModeWidth, "100%"_s }; 176 SVGAnimatedLengthAttribute m_height { LengthModeHeight, "100%"_s }; 170 177 }; 171 178 172 inline bool SVGSVGElement::useCurrentView() const173 {174 return m_useCurrentView;175 }176 177 inline FloatPoint SVGSVGElement::currentTranslateValue()178 {179 return m_currentTranslate;180 }181 182 inline SVGZoomAndPanType SVGSVGElement::zoomAndPan() const183 {184 return m_zoomAndPan;185 }186 187 inline void SVGSVGElement::setZoomAndPan(unsigned short zoomAndPan)188 {189 m_zoomAndPan = parseFromNumber(zoomAndPan);190 }191 192 inline SMILTimeContainer& SVGSVGElement::timeContainer()193 {194 return m_timeContainer.get();195 }196 197 inline bool SVGSVGElement::hasEmptyViewBox() const198 {199 return viewBoxIsValid() && viewBox().isEmpty();200 }201 202 179 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGScriptElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 25 26 #include "Event.h" 26 27 #include "SVGAnimatedStaticPropertyTearOff.h" 27 #include "XLinkNames.h"28 28 #include <wtf/IsoMallocInlines.h> 29 29 … … 32 32 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGScriptElement); 33 33 34 // Animated property definitions35 DEFINE_ANIMATED_STRING(SVGScriptElement, XLinkNames::hrefAttr, Href, href)36 DEFINE_ANIMATED_BOOLEAN(SVGScriptElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)37 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement)39 REGISTER_LOCAL_ANIMATED_PROPERTY(href)40 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)41 END_REGISTER_ANIMATED_PROPERTIES42 43 34 inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document& document, bool wasInsertedByParser, bool alreadyStarted) 44 35 : SVGElement(tagName, document) 36 , SVGExternalResourcesRequired(this) 37 , SVGURIReference(this) 45 38 , ScriptElement(*this, wasInsertedByParser, alreadyStarted) 46 39 , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired) 47 40 { 48 41 ASSERT(hasTagName(SVGNames::scriptTag)); 49 registerAnimatedPropertiesForSVGScriptElement();50 42 } 51 43 … … 71 63 } 72 64 73 SVGExternalResourcesRequired::handleAttributeChange(this, attrName);74 65 SVGElement::svgAttributeChanged(attrName); 66 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 75 67 } 76 68 … … 79 71 SVGElement::insertedIntoAncestor(insertionType, parentOfInsertedTree); 80 72 if (insertionType.connectedToDocument) 81 SVGExternalResourcesRequired::insertedIntoDocument( this);73 SVGExternalResourcesRequired::insertedIntoDocument(); 82 74 return ScriptElement::insertedIntoAncestor(insertionType, parentOfInsertedTree); 83 75 } … … 94 86 } 95 87 96 bool SVGScriptElement::isURLAttribute(const Attribute& attribute) const97 {98 return attribute.name() == sourceAttributeValue();99 }100 101 88 void SVGScriptElement::finishParsingChildren() 102 89 { … … 111 98 addSubresourceURL(urls, document().completeURL(href())); 112 99 } 113 114 String SVGScriptElement::sourceAttributeValue() const115 {116 return href();117 }118 119 String SVGScriptElement::charsetAttributeValue() const120 {121 return String();122 }123 124 String SVGScriptElement::typeAttributeValue() const125 {126 return getAttribute(SVGNames::typeAttr).string();127 }128 129 String SVGScriptElement::languageAttributeValue() const130 {131 return String();132 }133 134 String SVGScriptElement::forAttributeValue() const135 {136 return String();137 }138 139 String SVGScriptElement::eventAttributeValue() const140 {141 return String();142 }143 144 bool SVGScriptElement::hasAsyncAttribute() const145 {146 return false;147 }148 149 bool SVGScriptElement::hasDeferAttribute() const150 {151 return false;152 }153 154 bool SVGScriptElement::hasNoModuleAttribute() const155 {156 return false;157 }158 159 bool SVGScriptElement::hasSourceAttribute() const160 {161 return hasAttribute(XLinkNames::hrefAttr);162 }163 164 100 Ref<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren(Document& targetDocument) 165 101 { … … 167 103 } 168 104 169 #ifndef NDEBUG170 bool SVGScriptElement::filterOutAnimatableAttribute(const QualifiedName& name) const171 {172 return name == SVGNames::typeAttr;173 105 } 174 #endif175 176 } -
trunk/Source/WebCore/svg/SVGScriptElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2008-201 7Apple Inc. All rights reserved.4 * Copyright (C) 2008-2018 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 28 28 #include "SVGURIReference.h" 29 29 #include "ScriptElement.h" 30 #include "XLinkNames.h" 30 31 31 32 namespace WebCore { 32 33 33 class SVGScriptElement final : public SVGElement, public SVG URIReference, public SVGExternalResourcesRequired, public ScriptElement {34 class SVGScriptElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference, public ScriptElement { 34 35 WTF_MAKE_ISO_ALLOCATED(SVGScriptElement); 35 36 public: … … 42 43 SVGScriptElement(const QualifiedName&, Document&, bool wasInsertedByParser, bool alreadyStarted); 43 44 45 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGScriptElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>; 46 47 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 44 48 void parseAttribute(const QualifiedName&, const AtomicString&) final; 49 void svgAttributeChanged(const QualifiedName&) final; 50 45 51 InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; 46 52 void didFinishInsertingNode() final; 47 53 void childrenChanged(const ChildChange&) final; 48 54 49 void svgAttributeChanged(const QualifiedName&) final; 50 bool isURLAttribute(const Attribute&) const final; 55 bool isURLAttribute(const Attribute& attribute) const final { return attribute.name() == sourceAttributeValue(); } 51 56 void finishParsingChildren() final; 52 53 57 void addSubresourceAttributeURLs(ListHashSet<URL>&) const final; 54 58 55 59 bool haveLoadedRequiredResources() final { return SVGExternalResourcesRequired::haveLoadedRequiredResources(); } 56 60 57 String sourceAttributeValue() const final ;58 String charsetAttributeValue() const final ;59 String typeAttributeValue() const final ;60 String languageAttributeValue() const final ;61 String forAttributeValue() const final ;62 String eventAttributeValue() const final ;63 bool hasAsyncAttribute() const final ;64 bool hasDeferAttribute() const final ;65 bool hasNoModuleAttribute() const final ;66 bool hasSourceAttribute() const final ;61 String sourceAttributeValue() const final { return href(); } 62 String charsetAttributeValue() const final { return String(); } 63 String typeAttributeValue() const final { return getAttribute(SVGNames::typeAttr).string(); } 64 String languageAttributeValue() const final { return String(); } 65 String forAttributeValue() const final { return String(); } 66 String eventAttributeValue() const final { return String(); } 67 bool hasAsyncAttribute() const final { return false; } 68 bool hasDeferAttribute() const final { return false; } 69 bool hasNoModuleAttribute() const final { return false; } 70 bool hasSourceAttribute() const final { return hasAttribute(XLinkNames::hrefAttr); } 67 71 68 void dispatchLoadEvent() final { SVGExternalResourcesRequired::dispatchLoadEvent( this); }72 void dispatchLoadEvent() final { SVGExternalResourcesRequired::dispatchLoadEvent(); } 69 73 70 74 Ref<Element> cloneElementWithoutAttributesAndChildren(Document&) final; … … 78 82 79 83 #ifndef NDEBUG 80 bool filterOutAnimatableAttribute(const QualifiedName& ) const final;84 bool filterOutAnimatableAttribute(const QualifiedName& name) const final { return name == SVGNames::typeAttr; } 81 85 #endif 82 86 83 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGScriptElement) 84 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 85 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 86 END_DECLARE_ANIMATED_PROPERTIES 87 87 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 88 88 Timer m_svgLoadEventTimer; 89 89 }; -
trunk/Source/WebCore/svg/SVGStopElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 33 34 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGStopElement); 34 35 35 // Animated property definitions36 DEFINE_ANIMATED_NUMBER(SVGStopElement, SVGNames::offsetAttr, Offset, offset)37 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGStopElement)39 REGISTER_LOCAL_ANIMATED_PROPERTY(offset)40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)41 END_REGISTER_ANIMATED_PROPERTIES42 43 36 inline SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document& document) 44 37 : SVGElement(tagName, document) 45 , m_offset(0)46 38 { 47 39 ASSERT(hasTagName(SVGNames::stopTag)); 48 registerA nimatedPropertiesForSVGStopElement();40 registerAttributes(); 49 41 } 50 42 … … 54 46 } 55 47 48 void SVGStopElement::registerAttributes() 49 { 50 auto& registry = attributeRegistry(); 51 if (!registry.isEmpty()) 52 return; 53 registry.registerAttribute<SVGNames::offsetAttr, &SVGStopElement::m_offset>(); 54 } 55 56 56 void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 57 57 { 58 58 if (name == SVGNames::offsetAttr) { 59 59 if (value.endsWith('%')) 60 setOffsetBaseValue(value.string().left(value.length() - 1).toFloat() / 100.0f);60 m_offset.setValue(value.string().left(value.length() - 1).toFloat() / 100.0f); 61 61 else 62 setOffsetBaseValue(value.toFloat());62 m_offset.setValue(value.toFloat()); 63 63 return; 64 64 } -
trunk/Source/WebCore/svg/SVGStopElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 33 34 Color stopColorIncludingOpacity() const; 34 35 36 float offset() { return m_offset.currentValue(attributeOwnerProxy()); } 37 RefPtr<SVGAnimatedNumber> offsetAnimated() { return m_offset.animatedProperty(attributeOwnerProxy()); } 38 35 39 private: 36 40 SVGStopElement(const QualifiedName&, Document&); 37 41 42 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGStopElement, SVGElement>; 43 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 44 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 45 static void registerAttributes(); 46 47 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 38 48 void parseAttribute(const QualifiedName&, const AtomicString&) final; 39 49 void svgAttributeChanged(const QualifiedName&) final; … … 44 54 bool rendererIsNeeded(const RenderStyle&) final; 45 55 46 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGStopElement) 47 DECLARE_ANIMATED_NUMBER(Offset, offset) 48 END_DECLARE_ANIMATED_PROPERTIES 56 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 57 SVGAnimatedNumberAttribute m_offset { 0 }; 49 58 }; 50 59 -
trunk/Source/WebCore/svg/SVGStringListValues.h
r208863 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 22 23 23 24 #include "QualifiedName.h" 25 #include "SVGAttributeAccessor.h" 24 26 #include "SVGPropertyTraits.h" 27 25 28 #include <wtf/Vector.h> 26 29 … … 29 32 class SVGElement; 30 33 class SVGStringList; 34 class SVGStringListValues; 31 35 32 36 template<typename T> 33 37 class SVGPropertyTearOff; 38 39 using SVGStringListValuesAttribute = SVGPropertyAttribute<SVGStringListValues>; 40 41 template<typename OwnerType> 42 using SVGStringListValuesAttributeAccessor = SVGPropertyAttributeAccessor<OwnerType, SVGStringListValuesAttribute>; 34 43 35 44 class SVGStringListValues final : public Vector<String> { … … 53 62 54 63 template<> struct SVGPropertyTraits<SVGStringListValues> { 64 static String toString(const SVGStringListValues& list) { return list.valueAsString(); } 65 55 66 using ListItemType = String; 56 67 using ListItemTearOff = SVGPropertyTearOff<String>; -
trunk/Source/WebCore/svg/SVGSwitchElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 31 32 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGSwitchElement); 32 33 33 // Animated property definitions34 DEFINE_ANIMATED_BOOLEAN(SVGSwitchElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)35 36 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSwitchElement)37 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)38 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)39 END_REGISTER_ANIMATED_PROPERTIES40 41 34 inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document& document) 42 35 : SVGGraphicsElement(tagName, document) 36 , SVGExternalResourcesRequired(this) 43 37 { 44 38 ASSERT(hasTagName(SVGNames::switchTag)); 45 registerAnimatedPropertiesForSVGSwitchElement();46 39 } 47 40 -
trunk/Source/WebCore/svg/SVGSwitchElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 34 35 private: 35 36 SVGSwitchElement(const QualifiedName&, Document&); 36 37 38 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSwitchElement, SVGGraphicsElement, SVGExternalResourcesRequired>; 39 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 40 37 41 bool isValid() const final { return SVGTests::isValid(); } 38 42 … … 40 44 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; 41 45 42 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSwitchElement) 43 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 44 END_DECLARE_ANIMATED_PROPERTIES 46 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 45 47 }; 46 48 -
trunk/Source/WebCore/svg/SVGSymbolElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 31 32 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGSymbolElement); 32 33 33 // Animated property definitions34 DEFINE_ANIMATED_BOOLEAN(SVGSymbolElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)35 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGSymbolElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)36 DEFINE_ANIMATED_RECT(SVGSymbolElement, SVGNames::viewBoxAttr, ViewBox, viewBox)37 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement)39 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)40 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)41 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)42 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)43 END_REGISTER_ANIMATED_PROPERTIES44 45 34 inline SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document& document) 46 35 : SVGElement(tagName, document) 36 , SVGExternalResourcesRequired(this) 37 , SVGFitToViewBox(this) 47 38 { 48 39 ASSERT(hasTagName(SVGNames::symbolTag)); 49 registerAnimatedPropertiesForSVGSymbolElement();50 40 } 51 41 … … 59 49 SVGElement::parseAttribute(name, value); 60 50 SVGExternalResourcesRequired::parseAttribute(name, value); 61 SVGFitToViewBox::parseAttribute( this,name, value);51 SVGFitToViewBox::parseAttribute(name, value); 62 52 } 63 53 64 54 void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName) 65 55 { 66 if (attrName == SVGNames::viewBoxAttr) {67 InstanceInvalidationGuard guard(*this);68 updateRelativeLengthsInformation();69 return;70 }71 72 56 SVGElement::svgAttributeChanged(attrName); 57 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 73 58 } 74 59 -
trunk/Source/WebCore/svg/SVGSymbolElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 38 39 SVGSymbolElement(const QualifiedName&, Document&); 39 40 41 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSymbolElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>; 42 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 43 40 44 void parseAttribute(const QualifiedName&, const AtomicString&) override; 41 45 void svgAttributeChanged(const QualifiedName&) override; … … 44 48 bool selfHasRelativeLengths() const override; 45 49 46 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSymbolElement) 47 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 48 DECLARE_ANIMATED_RECT(ViewBox, viewBox) 49 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) 50 END_DECLARE_ANIMATED_PROPERTIES 50 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 51 51 }; 52 52 -
trunk/Source/WebCore/svg/SVGTRefElement.cpp
r233366 r234620 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 43 44 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTRefElement); 44 45 45 // Animated property definitions46 DEFINE_ANIMATED_STRING(SVGTRefElement, XLinkNames::hrefAttr, Href, href)47 48 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTRefElement)49 REGISTER_LOCAL_ANIMATED_PROPERTY(href)50 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextPositioningElement)51 END_REGISTER_ANIMATED_PROPERTIES52 53 46 Ref<SVGTRefElement> SVGTRefElement::create(const QualifiedName& tagName, Document& document) 54 47 { … … 132 125 inline SVGTRefElement::SVGTRefElement(const QualifiedName& tagName, Document& document) 133 126 : SVGTextPositioningElement(tagName, document) 127 , SVGURIReference(this) 134 128 , m_targetListener(SVGTRefTargetEventListener::create(*this)) 135 129 { 136 130 ASSERT(hasTagName(SVGNames::trefTag)); 137 registerAnimatedPropertiesForSVGTRefElement();138 131 } 139 132 -
trunk/Source/WebCore/svg/SVGTRefElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 39 40 virtual ~SVGTRefElement(); 40 41 42 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTRefElement, SVGTextPositioningElement, SVGURIReference>; 43 44 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 41 45 void parseAttribute(const QualifiedName&, const AtomicString&) override; 42 46 void svgAttributeChanged(const QualifiedName&) override; … … 51 55 52 56 void clearTarget() override; 53 54 57 void updateReferencedText(Element*); 55 56 58 void detachTarget(); 57 58 59 void buildPendingResource() override; 59 60 60 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTRefElement) 61 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 62 END_DECLARE_ANIMATED_PROPERTIES 63 61 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 64 62 Ref<SVGTRefTargetEventListener> m_targetListener; 65 63 }; -
trunk/Source/WebCore/svg/SVGTests.cpp
r225117 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2015-201 6Apple Inc. All right reserved.4 * Copyright (C) 2015-2018 Apple Inc. All right reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 25 25 #include "DOMImplementation.h" 26 26 #include "HTMLNames.h" 27 #include "SVGAttributeOwnerProxy.h" 27 28 #include "SVGElement.h" 28 29 #include "SVGNames.h" … … 107 108 } 108 109 109 SVGTests::SVGTests() 110 : m_requiredFeatures(requiredFeaturesAttr) 111 , m_requiredExtensions(requiredExtensionsAttr) 112 , m_systemLanguage(systemLanguageAttr) 113 { 114 } 115 116 static SVGPropertyInfo createSVGTestPropertyInfo(const QualifiedName& attributeName, SVGPropertyInfo::SynchronizeProperty synchronizeFunction) 117 { 118 return { AnimatedUnknown, PropertyIsReadWrite, attributeName, attributeName.localName(), synchronizeFunction, nullptr }; 119 } 120 121 static SVGAttributeToPropertyMap createSVGTextAttributeToPropertyMap() 122 { 123 typedef NeverDestroyed<const SVGPropertyInfo> Info; 124 125 SVGAttributeToPropertyMap map; 126 127 static Info requiredFeatures = createSVGTestPropertyInfo(requiredFeaturesAttr, SVGElement::synchronizeRequiredFeatures); 128 map.addProperty(requiredFeatures.get()); 129 130 static Info requiredExtensions = createSVGTestPropertyInfo(requiredExtensionsAttr, SVGElement::synchronizeRequiredExtensions); 131 map.addProperty(requiredExtensions.get()); 132 133 static Info systemLanguage = createSVGTestPropertyInfo(systemLanguageAttr, SVGElement::synchronizeSystemLanguage); 134 map.addProperty(systemLanguage.get()); 135 136 return map; 137 } 138 139 const SVGAttributeToPropertyMap& SVGTests::attributeToPropertyMap() 140 { 141 static NeverDestroyed<SVGAttributeToPropertyMap> map = createSVGTextAttributeToPropertyMap(); 142 return map; 110 SVGTests::SVGTests(SVGElement* contextElement) 111 : m_contextElement(*contextElement) 112 { 113 registerAttributes(); 114 } 115 116 void SVGTests::registerAttributes() 117 { 118 auto& registry = attributeRegistry(); 119 if (!registry.isEmpty()) 120 return; 121 registry.registerAttribute<SVGNames::requiredFeaturesAttr, &SVGTests::m_requiredFeatures>(); 122 registry.registerAttribute<SVGNames::requiredExtensionsAttr, &SVGTests::m_requiredExtensions>(); 123 registry.registerAttribute<SVGNames::systemLanguageAttr, &SVGTests::m_systemLanguage>(); 124 } 125 126 SVGTests::AttributeRegistry& SVGTests::attributeRegistry() 127 { 128 return AttributeOwnerProxy::attributeRegistry(); 129 } 130 131 bool SVGTests::isKnownAttribute(const QualifiedName& attributeName) 132 { 133 return AttributeOwnerProxy::isKnownAttribute(attributeName); 143 134 } 144 135 … … 155 146 bool SVGTests::isValid() const 156 147 { 157 for (auto& feature : m_requiredFeatures.value ) {148 for (auto& feature : m_requiredFeatures.value()) { 158 149 if (feature.isEmpty() || !supportedSVGFeatures().contains(feature)) 159 150 return false; 160 151 } 161 for (auto& language : m_systemLanguage.value ) {152 for (auto& language : m_systemLanguage.value()) { 162 153 if (language != defaultLanguage().substring(0, 2)) 163 154 return false; 164 155 } 165 for (auto& extension : m_requiredExtensions.value ) {156 for (auto& extension : m_requiredExtensions.value()) { 166 157 if (!hasExtension(extension)) 167 158 return false; … … 173 164 { 174 165 if (attributeName == requiredFeaturesAttr) 175 m_requiredFeatures.value .reset(value);166 m_requiredFeatures.value().reset(value); 176 167 if (attributeName == requiredExtensionsAttr) 177 m_requiredExtensions.value .reset(value);168 m_requiredExtensions.value().reset(value); 178 169 if (attributeName == systemLanguageAttr) 179 m_systemLanguage.value.reset(value); 180 } 181 182 bool SVGTests::isKnownAttribute(const QualifiedName& attributeName) 183 { 184 return attributeName == requiredFeaturesAttr 185 || attributeName == requiredExtensionsAttr 186 || attributeName == systemLanguageAttr; 187 } 188 189 bool SVGTests::handleAttributeChange(SVGElement* targetElement, const QualifiedName& attributeName) 190 { 191 ASSERT(targetElement); 192 if (!isKnownAttribute(attributeName)) 193 return false; 194 if (!targetElement->isConnected()) 195 return true; 196 targetElement->invalidateStyleAndRenderersForSubtree(); 197 return true; 170 m_systemLanguage.value().reset(value); 171 } 172 173 void SVGTests::svgAttributeChanged(const QualifiedName& attrName) 174 { 175 if (!isKnownAttribute(attrName)) 176 return; 177 178 if (!m_contextElement.isConnected()) 179 return; 180 m_contextElement.invalidateStyleAndRenderersForSubtree(); 198 181 } 199 182 … … 205 188 } 206 189 207 void SVGTests::synchronizeAttribute(SVGElement& contextElement, SVGSynchronizableAnimatedProperty<SVGStringListValues>& property, const QualifiedName& attributeName) 208 { 209 if (!property.shouldSynchronize) 210 return; 211 m_requiredFeatures.synchronize(&contextElement, attributeName, property.value.valueAsString()); 212 } 213 214 void SVGTests::synchronizeRequiredFeatures(SVGElement& contextElement) 215 { 216 synchronizeAttribute(contextElement, m_requiredFeatures, requiredFeaturesAttr); 217 } 218 219 void SVGTests::synchronizeRequiredExtensions(SVGElement& contextElement) 220 { 221 synchronizeAttribute(contextElement, m_requiredExtensions, requiredExtensionsAttr); 222 } 223 224 void SVGTests::synchronizeSystemLanguage(SVGElement& contextElement) 225 { 226 synchronizeAttribute(contextElement, m_systemLanguage, systemLanguageAttr); 227 } 228 229 Ref<SVGStringList> SVGTests::requiredFeatures(SVGElement& contextElement) 230 { 231 m_requiredFeatures.shouldSynchronize = true; 232 return SVGStringList::create(contextElement, m_requiredFeatures.value); 233 } 234 235 Ref<SVGStringList> SVGTests::requiredExtensions(SVGElement& contextElement) 236 { 237 m_requiredExtensions.shouldSynchronize = true; 238 return SVGStringList::create(contextElement, m_requiredExtensions.value); 239 } 240 241 Ref<SVGStringList> SVGTests::systemLanguage(SVGElement& contextElement) 242 { 243 m_systemLanguage.shouldSynchronize = true; 244 return SVGStringList::create(contextElement, m_systemLanguage.value); 190 Ref<SVGStringList> SVGTests::requiredFeatures() 191 { 192 m_requiredFeatures.setShouldSynchronize(true); 193 return SVGStringList::create(m_contextElement, m_requiredFeatures.value()); 194 } 195 196 Ref<SVGStringList> SVGTests::requiredExtensions() 197 { 198 m_requiredExtensions.setShouldSynchronize(true); 199 return SVGStringList::create(m_contextElement, m_requiredExtensions.value()); 200 } 201 202 Ref<SVGStringList> SVGTests::systemLanguage() 203 { 204 m_systemLanguage.setShouldSynchronize(true); 205 return SVGStringList::create(m_contextElement, m_systemLanguage.value()); 245 206 } 246 207 -
trunk/Source/WebCore/svg/SVGTests.h
r208863 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2010 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 21 22 #pragma once 22 23 23 #include "SVGA nimatedPropertyMacros.h"24 #include "SVGAttribute.h" 24 25 #include "SVGStringListValues.h" 25 26 … … 29 30 class SVGStringList; 30 31 32 template<typename OwnerType, typename... BaseTypes> 33 class SVGAttributeRegistry; 34 35 template<typename OwnerType, typename... BaseTypes> 36 class SVGAttributeOwnerProxyImpl; 37 31 38 class SVGTests { 39 WTF_MAKE_NONCOPYABLE(SVGTests); 32 40 public: 33 41 static bool hasExtension(const String&); 34 42 bool isValid() const; 35 43 44 using AttributeRegistry = SVGAttributeRegistry<SVGTests>; 45 static AttributeRegistry& attributeRegistry(); 46 static bool isKnownAttribute(const QualifiedName& attributeName); 47 36 48 void parseAttribute(const QualifiedName&, const AtomicString&); 49 void svgAttributeChanged(const QualifiedName&); 37 50 38 static bool isKnownAttribute(const QualifiedName&);39 51 static void addSupportedAttributes(HashSet<QualifiedName>&); 40 41 static bool handleAttributeChange(SVGElement*, const QualifiedName&);42 43 static const SVGAttributeToPropertyMap& attributeToPropertyMap();44 52 45 53 WEBCORE_EXPORT static bool hasFeatureForLegacyBindings(const String& feature, const String& version); 46 54 55 // These methods are called from DOM through the super classes. 56 Ref<SVGStringList> requiredFeatures(); 57 Ref<SVGStringList> requiredExtensions(); 58 Ref<SVGStringList> systemLanguage(); 59 47 60 protected: 48 SVGTests(); 49 50 Ref<SVGStringList> requiredFeatures(SVGElement&); 51 Ref<SVGStringList> requiredExtensions(SVGElement&); 52 Ref<SVGStringList> systemLanguage(SVGElement&); 53 54 void synchronizeRequiredFeatures(SVGElement&); 55 void synchronizeRequiredExtensions(SVGElement&); 56 void synchronizeSystemLanguage(SVGElement&); 61 SVGTests(SVGElement* contextElement); 57 62 58 63 private: 59 void synchronizeAttribute(SVGElement& contextElement, SVGSynchronizableAnimatedProperty<SVGStringListValues>&, const QualifiedName& attributeName); 64 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTests>; 65 static void registerAttributes(); 60 66 61 SVGSynchronizableAnimatedProperty<SVGStringListValues> m_requiredFeatures; 62 SVGSynchronizableAnimatedProperty<SVGStringListValues> m_requiredExtensions; 63 SVGSynchronizableAnimatedProperty<SVGStringListValues> m_systemLanguage; 67 SVGElement& m_contextElement; 68 SVGStringListValuesAttribute m_requiredFeatures { SVGNames::requiredFeaturesAttr }; 69 SVGStringListValuesAttribute m_requiredExtensions { SVGNames::requiredExtensionsAttr }; 70 SVGStringListValuesAttribute m_systemLanguage { SVGNames::systemLanguageAttr }; 64 71 }; 65 72 -
trunk/Source/WebCore/svg/SVGTextContentElement.cpp
r231266 r234620 2 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 43 44 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextContentElement); 44 45 45 // Define custom animated property 'textLength'.46 const SVGPropertyInfo* SVGTextContentElement::textLengthPropertyInfo()47 {48 static const SVGPropertyInfo* s_propertyInfo = nullptr;49 if (!s_propertyInfo) {50 s_propertyInfo = new SVGPropertyInfo(AnimatedLength,51 PropertyIsReadWrite,52 SVGNames::textLengthAttr,53 SVGNames::textLengthAttr->localName(),54 &SVGTextContentElement::synchronizeTextLength,55 &SVGTextContentElement::lookupOrCreateTextLengthWrapper);56 }57 return s_propertyInfo;58 }59 60 // Animated property definitions61 DEFINE_ANIMATED_ENUMERATION(SVGTextContentElement, SVGNames::lengthAdjustAttr, LengthAdjust, lengthAdjust, SVGLengthAdjustType)62 DEFINE_ANIMATED_BOOLEAN(SVGTextContentElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)63 64 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextContentElement)65 REGISTER_LOCAL_ANIMATED_PROPERTY(textLength)66 REGISTER_LOCAL_ANIMATED_PROPERTY(lengthAdjust)67 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)68 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)69 END_REGISTER_ANIMATED_PROPERTIES70 71 46 SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Document& document) 72 47 : SVGGraphicsElement(tagName, document) 73 , m_textLength(LengthModeOther) 74 , m_specifiedTextLength(LengthModeOther) 75 , m_lengthAdjust(SVGLengthAdjustSpacing) 76 { 77 registerAnimatedPropertiesForSVGTextContentElement(); 78 } 79 80 void SVGTextContentElement::synchronizeTextLength(SVGElement* contextElement) 81 { 82 ASSERT(contextElement); 83 SVGTextContentElement& ownerType = downcast<SVGTextContentElement>(*contextElement); 84 if (!ownerType.m_textLength.shouldSynchronize) 85 return; 86 AtomicString value(SVGPropertyTraits<SVGLengthValue>::toString(ownerType.m_specifiedTextLength)); 87 ownerType.m_textLength.synchronize(&ownerType, textLengthPropertyInfo()->attributeName, value); 88 } 89 90 Ref<SVGAnimatedProperty> SVGTextContentElement::lookupOrCreateTextLengthWrapper(SVGElement* contextElement) 91 { 92 ASSERT(contextElement); 93 SVGTextContentElement& ownerType = downcast<SVGTextContentElement>(*contextElement); 94 return SVGAnimatedProperty::lookupOrCreateWrapper<SVGTextContentElement, SVGAnimatedLength, SVGLengthValue> 95 (&ownerType, textLengthPropertyInfo(), ownerType.m_textLength.value); 96 } 97 98 Ref<SVGAnimatedLength> SVGTextContentElement::textLengthAnimated() 99 { 100 static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther); 101 if (m_specifiedTextLength == defaultTextLength) 102 m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength()); 103 104 m_textLength.shouldSynchronize = true; 105 return static_reference_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this)); 48 , SVGExternalResourcesRequired(this) 49 { 50 registerAttributes(); 106 51 } 107 52 … … 192 137 193 138 return { }; 194 }195 196 bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName)197 {198 static const auto supportedAttributes = makeNeverDestroyed([] {199 HashSet<QualifiedName> set;200 SVGLangSpace::addSupportedAttributes(set);201 SVGExternalResourcesRequired::addSupportedAttributes(set);202 set.add({ SVGNames::lengthAdjustAttr.get(), SVGNames::textLengthAttr.get() });203 return set;204 }());205 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);206 139 } 207 140 … … 226 159 } 227 160 161 void SVGTextContentElement::registerAttributes() 162 { 163 auto& registry = attributeRegistry(); 164 if (!registry.isEmpty()) 165 return; 166 registry.registerAttribute(SVGAnimatedCustomLengthAttributeAccessor::singleton<SVGNames::textLengthAttr, &SVGTextContentElement::m_textLength>()); 167 registry.registerAttribute<SVGNames::lengthAdjustAttr, SVGLengthAdjustType, &SVGTextContentElement::m_lengthAdjust>(); 168 } 169 228 170 void SVGTextContentElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 229 171 { … … 233 175 auto propertyValue = SVGPropertyTraits<SVGLengthAdjustType>::fromString(value); 234 176 if (propertyValue > 0) 235 setLengthAdjustBaseValue(propertyValue);177 m_lengthAdjust.setValue(propertyValue); 236 178 } else if (name == SVGNames::textLengthAttr) 237 m_textLength. value = SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths);179 m_textLength.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); 238 180 239 181 reportAttributeParsingError(parseError, name, value); … … 245 187 void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) 246 188 { 247 if (!isSupportedAttribute(attrName)) { 248 SVGGraphicsElement::svgAttributeChanged(attrName); 189 if (isKnownAttribute(attrName)) { 190 if (attrName == SVGNames::textLengthAttr) 191 m_specifiedTextLength = m_textLength.value(); 192 193 if (auto renderer = this->renderer()) { 194 InstanceInvalidationGuard guard(*this); 195 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 196 } 249 197 return; 250 198 } 251 199 252 if (attrName == SVGNames::textLengthAttr) 253 m_specifiedTextLength = m_textLength.value; 254 255 if (auto renderer = this->renderer()) { 256 InstanceInvalidationGuard guard(*this); 257 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 258 } 200 SVGGraphicsElement::svgAttributeChanged(attrName); 201 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 259 202 } 260 203 -
trunk/Source/WebCore/svg/SVGTextContentElement.h
r233122 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 85 86 86 87 static SVGTextContentElement* elementFromRenderer(RenderObject*); 88 const SVGLengthValue& specifiedTextLength() { return m_specifiedTextLength; } 87 89 88 // textLength is not declared using the standard DECLARE_ANIMATED_LENGTH macro 89 // as its getter needs special handling (return getComputedTextLength(), instead of m_textLength). 90 SVGLengthValue& specifiedTextLength() { return m_specifiedTextLength; } 91 Ref<SVGAnimatedLength> textLengthAnimated(); 92 static const SVGPropertyInfo* textLengthPropertyInfo(); 90 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>; 91 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 92 93 const SVGLengthValue& textLength() const { return m_textLength.currentValue(attributeOwnerProxy()); } 94 SVGLengthAdjustType lengthAdjust() const { return m_lengthAdjust.currentValue(attributeOwnerProxy()); } 95 96 RefPtr<SVGAnimatedLength> textLengthAnimated() { return m_textLength.animatedProperty(attributeOwnerProxy()); } 97 RefPtr<SVGAnimatedEnumeration> lengthAdjustAnimated() { return m_lengthAdjust.animatedProperty(attributeOwnerProxy()); } 93 98 94 99 protected: … … 106 111 private: 107 112 bool isTextContent() const final { return true; } 113 const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } 108 114 109 static bool isSupportedAttribute(const QualifiedName&); 115 static void registerAttributes(); 116 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 110 117 111 // Custom 'textLength' property 112 static void synchronizeTextLength(SVGElement* contextElement); 113 static Ref<SVGAnimatedProperty> lookupOrCreateTextLengthWrapper(SVGElement* contextElement); 114 mutable SVGSynchronizableAnimatedProperty<SVGLengthValue> m_textLength; 115 SVGLengthValue m_specifiedTextLength; 116 117 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextContentElement) 118 DECLARE_ANIMATED_ENUMERATION(LengthAdjust, lengthAdjust, SVGLengthAdjustType) 119 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 120 END_DECLARE_ANIMATED_PROPERTIES 118 class SVGAnimatedCustomLengthAttribute : public SVGAnimatedLengthAttribute { 119 public: 120 using SVGAnimatedLengthAttribute::operator=; 121 122 SVGAnimatedCustomLengthAttribute(SVGTextContentElement& element, SVGLengthMode lengthMode) 123 : SVGAnimatedLengthAttribute(lengthMode) 124 , m_element(element) 125 { 126 } 127 128 void synchronize(Element&, const QualifiedName& attributeName) 129 { 130 if (!shouldSynchronize()) 131 return; 132 String string(SVGPropertyTraits<SVGLengthValue>::toString(m_element.m_specifiedTextLength)); 133 static_cast<Element&>(m_element).setSynchronizedLazyAttribute(attributeName, string); 134 } 135 136 RefPtr<SVGAnimatedLength> animatedProperty(const SVGAttributeOwnerProxy& attributeOwnerProxy) 137 { 138 static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther); 139 if (m_element.m_specifiedTextLength == defaultTextLength) 140 m_element.m_textLength.value().newValueSpecifiedUnits(LengthTypeNumber, m_element.getComputedTextLength()); 141 142 setShouldSynchronize(true); 143 return static_reference_cast<SVGAnimatedLength>(attributeOwnerProxy.lookupOrCreateAnimatedProperty(*this).releaseNonNull()); 144 } 145 146 private: 147 SVGTextContentElement& m_element; 148 }; 149 150 using SVGAnimatedCustomLengthAttributeAccessor = SVGAnimatedAttributeAccessor<SVGTextContentElement, SVGAnimatedCustomLengthAttribute, AnimatedLength>; 151 152 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 153 SVGAnimatedCustomLengthAttribute m_textLength { *this, LengthModeOther }; 154 SVGAnimatedEnumerationAttribute<SVGLengthAdjustType> m_lengthAdjust { SVGLengthAdjustSpacing }; 155 SVGLengthValue m_specifiedTextLength { LengthModeOther }; 121 156 }; 122 157 -
trunk/Source/WebCore/svg/SVGTextPathElement.cpp
r229694 r234620 2 2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 34 35 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextPathElement); 35 36 36 // Animated property definitions37 DEFINE_ANIMATED_LENGTH(SVGTextPathElement, SVGNames::startOffsetAttr, StartOffset, startOffset)38 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::methodAttr, Method, method, SVGTextPathMethodType)39 DEFINE_ANIMATED_ENUMERATION(SVGTextPathElement, SVGNames::spacingAttr, Spacing, spacing, SVGTextPathSpacingType)40 DEFINE_ANIMATED_STRING(SVGTextPathElement, XLinkNames::hrefAttr, Href, href)41 42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPathElement)43 REGISTER_LOCAL_ANIMATED_PROPERTY(startOffset)44 REGISTER_LOCAL_ANIMATED_PROPERTY(method)45 REGISTER_LOCAL_ANIMATED_PROPERTY(spacing)46 REGISTER_LOCAL_ANIMATED_PROPERTY(href)47 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement)48 END_REGISTER_ANIMATED_PROPERTIES49 50 37 inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document& document) 51 38 : SVGTextContentElement(tagName, document) 52 , m_startOffset(LengthModeOther) 53 , m_method(SVGTextPathMethodAlign) 54 , m_spacing(SVGTextPathSpacingExact) 39 , SVGURIReference(this) 55 40 { 56 41 ASSERT(hasTagName(SVGNames::textPathTag)); 57 registerA nimatedPropertiesForSVGTextPathElement();42 registerAttributes(); 58 43 } 59 44 … … 73 58 } 74 59 75 bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName)60 void SVGTextPathElement::registerAttributes() 76 61 { 77 static const auto supportedAttributes = makeNeverDestroyed([] { 78 HashSet<QualifiedName> set; 79 SVGURIReference::addSupportedAttributes(set); 80 set.add({ SVGNames::startOffsetAttr.get(), SVGNames::methodAttr.get(), SVGNames::spacingAttr.get() }); 81 return set; 82 }()); 83 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); 62 auto& registry = attributeRegistry(); 63 if (!registry.isEmpty()) 64 return; 65 registry.registerAttribute<SVGNames::startOffsetAttr, &SVGTextPathElement::m_startOffset>(); 66 registry.registerAttribute<SVGNames::methodAttr, SVGTextPathMethodType, &SVGTextPathElement::m_method>(); 67 registry.registerAttribute<SVGNames::spacingAttr, SVGTextPathSpacingType, &SVGTextPathElement::m_spacing>(); 84 68 } 85 69 … … 89 73 90 74 if (name == SVGNames::startOffsetAttr) 91 setStartOffsetBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError));75 m_startOffset.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError)); 92 76 else if (name == SVGNames::methodAttr) { 93 77 SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value); 94 78 if (propertyValue > 0) 95 setMethodBaseValue(propertyValue);79 m_method.setValue(propertyValue); 96 80 } else if (name == SVGNames::spacingAttr) { 97 81 SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpacingType>::fromString(value); 98 82 if (propertyValue > 0) 99 setSpacingBaseValue(propertyValue);83 m_spacing.setValue(propertyValue); 100 84 } 101 85 … … 108 92 void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName) 109 93 { 110 if (!isSupportedAttribute(attrName)) { 111 SVGTextContentElement::svgAttributeChanged(attrName); 94 if (isKnownAttribute(attrName)) { 95 InstanceInvalidationGuard guard(*this); 96 97 if (attrName == SVGNames::startOffsetAttr) 98 updateRelativeLengthsInformation(); 99 100 if (auto renderer = this->renderer()) 101 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 112 102 return; 113 103 } 114 115 InstanceInvalidationGuard guard(*this);116 104 117 105 if (SVGURIReference::isKnownAttribute(attrName)) { … … 120 108 } 121 109 122 if (attrName == SVGNames::startOffsetAttr) 123 updateRelativeLengthsInformation(); 124 125 if (auto renderer = this->renderer()) 126 RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); 110 SVGTextContentElement::svgAttributeChanged(attrName); 127 111 } 128 112 -
trunk/Source/WebCore/svg/SVGTextPathElement.h
r233122 r234620 1 1 /* 2 2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 111 112 static Ref<SVGTextPathElement> create(const QualifiedName&, Document&); 112 113 114 const SVGLengthValue& startOffset() const { return m_startOffset.currentValue(attributeOwnerProxy()); } 115 SVGTextPathMethodType method() const { return m_method.currentValue(attributeOwnerProxy()); } 116 SVGTextPathSpacingType spacing() const { return m_spacing.currentValue(attributeOwnerProxy()); } 117 118 RefPtr<SVGAnimatedLength> startOffsetAnimated() { return m_startOffset.animatedProperty(attributeOwnerProxy()); } 119 RefPtr<SVGAnimatedEnumeration> methodAnimated() { return m_method.animatedProperty(attributeOwnerProxy()); } 120 RefPtr<SVGAnimatedEnumeration> spacingAnimated() { return m_spacing.animatedProperty(attributeOwnerProxy()); } 121 113 122 protected: 114 123 void didFinishInsertingNode() override; … … 116 125 private: 117 126 SVGTextPathElement(const QualifiedName&, Document&); 118 119 127 virtual ~SVGTextPathElement(); 120 128 121 void clearResourceReferences(); 129 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPathElement, SVGTextContentElement, SVGURIReference>; 130 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 131 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 132 static void registerAttributes(); 122 133 123 void buildPendingResource() override; 124 InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; 125 void removedFromAncestor(RemovalType, ContainerNode&) override; 126 127 static bool isSupportedAttribute(const QualifiedName&); 134 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 128 135 void parseAttribute(const QualifiedName&, const AtomicString&) override; 129 136 void svgAttributeChanged(const QualifiedName&) override; … … 133 140 bool rendererIsNeeded(const RenderStyle&) override; 134 141 142 void clearResourceReferences(); 143 void buildPendingResource() override; 144 InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; 145 void removedFromAncestor(RemovalType, ContainerNode&) override; 146 135 147 bool selfHasRelativeLengths() const override; 136 137 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPathElement) 138 DECLARE_ANIMATED_LENGTH(StartOffset, startOffset) 139 DECLARE_ANIMATED_ENUMERATION(Method, method, SVGTextPathMethodType) 140 DECLARE_ANIMATED_ENUMERATION(Spacing, spacing, SVGTextPathSpacingType) 141 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href) 142 END_DECLARE_ANIMATED_PROPERTIES 148 149 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 150 SVGAnimatedLengthAttribute m_startOffset { LengthModeOther }; 151 SVGAnimatedEnumerationAttribute<SVGTextPathMethodType> m_method { SVGTextPathMethodAlign }; 152 SVGAnimatedEnumerationAttribute<SVGTextPathSpacingType> m_spacing { SVGTextPathSpacingExact }; 143 153 }; 144 154 -
trunk/Source/WebCore/svg/SVGTextPositioningElement.cpp
r229694 r234620 3 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2018 Apple Inc. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 39 40 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextPositioningElement); 40 41 41 // Animated property definitions42 DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::xAttr, X, x)43 DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::yAttr, Y, y)44 DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::dxAttr, Dx, dx)45 DEFINE_ANIMATED_LENGTH_LIST(SVGTextPositioningElement, SVGNames::dyAttr, Dy, dy)46 DEFINE_ANIMATED_NUMBER_LIST(SVGTextPositioningElement, SVGNames::rotateAttr, Rotate, rotate)47 48 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPositioningElement)49 REGISTER_LOCAL_ANIMATED_PROPERTY(x)50 REGISTER_LOCAL_ANIMATED_PROPERTY(y)51 REGISTER_LOCAL_ANIMATED_PROPERTY(dx)52 REGISTER_LOCAL_ANIMATED_PROPERTY(dy)53 REGISTER_LOCAL_ANIMATED_PROPERTY(rotate)54 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement)55 END_REGISTER_ANIMATED_PROPERTIES56 57 42 SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document& document) 58 43 : SVGTextContentElement(tagName, document) 59 44 { 60 registerAnimatedPropertiesForSVGTextPositioningElement(); 45 registerAttributes(); 46 } 47 48 void SVGTextPositioningElement::registerAttributes() 49 { 50 auto& registry = attributeRegistry(); 51 if (!registry.isEmpty()) 52 return; 53 registry.registerAttribute<SVGNames::xAttr, &SVGTextPositioningElement::m_x>(); 54 registry.registerAttribute<SVGNames::yAttr, &SVGTextPositioningElement::m_y>(); 55 registry.registerAttribute<SVGNames::dxAttr, &SVGTextPositioningElement::m_dx>(); 56 registry.registerAttribute<SVGNames::dyAttr, &SVGTextPositioningElement::m_dy>(); 57 registry.registerAttribute<SVGNames::rotateAttr, &SVGTextPositioningElement::m_rotate>(); 61 58 } 62 59 … … 66 63 SVGLengthListValues newList; 67 64 newList.parse(value, LengthModeWidth); 68 detachAnimatedXListWrappers(newList.size());69 setXBaseValue(newList);65 m_x.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 66 m_x.setValue(WTFMove(newList)); 70 67 return; 71 68 } … … 74 71 SVGLengthListValues newList; 75 72 newList.parse(value, LengthModeHeight); 76 detachAnimatedYListWrappers(newList.size());77 setYBaseValue(newList);73 m_y.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 74 m_y.setValue(WTFMove(newList)); 78 75 return; 79 76 } … … 82 79 SVGLengthListValues newList; 83 80 newList.parse(value, LengthModeWidth); 84 detachAnimatedDxListWrappers(newList.size());85 setDxBaseValue(newList);81 m_dx.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 82 m_dx.setValue(WTFMove(newList)); 86 83 return; 87 84 } … … 90 87 SVGLengthListValues newList; 91 88 newList.parse(value, LengthModeHeight); 92 detachAnimatedDyListWrappers(newList.size());93 setDyBaseValue(newList);89 m_dy.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 90 m_dy.setValue(WTFMove(newList)); 94 91 return; 95 92 } … … 98 95 SVGNumberListValues newList; 99 96 newList.parse(value); 100 detachAnimatedRotateListWrappers(newList.size());101 setRotateBaseValue(newList);97 m_rotate.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size()); 98 m_rotate.setValue(WTFMove(newList)); 102 99 return; 103 100 } … … 122 119 void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrName) 123 120 { 124 if ( attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::dxAttr || attrName == SVGNames::dyAttr || attrName == SVGNames::rotateAttr) {121 if (isKnownAttribute(attrName)) { 125 122 InstanceInvalidationGuard guard(*this); 126 123 -
trunk/Source/WebCore/svg/SVGTextPositioningElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 32 33 static SVGTextPositioningElement* elementFromRenderer(RenderBoxModelObject&); 33 34 35 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPositioningElement, SVGTextContentElement>; 36 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 37 38 const SVGLengthListValues& x() const { return m_x.currentValue(attributeOwnerProxy()); } 39 const SVGLengthListValues& y() const { return m_y.currentValue(attributeOwnerProxy()); } 40 const SVGLengthListValues& dx() const { return m_dx.currentValue(attributeOwnerProxy()); } 41 const SVGLengthListValues& dy() const { return m_dy.currentValue(attributeOwnerProxy()); } 42 const SVGNumberListValues& rotate() const { return m_rotate.currentValue(attributeOwnerProxy()); } 43 44 RefPtr<SVGAnimatedLengthList> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 45 RefPtr<SVGAnimatedLengthList> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 46 RefPtr<SVGAnimatedLengthList> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); } 47 RefPtr<SVGAnimatedLengthList> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); } 48 RefPtr<SVGAnimatedNumberList> rotateAnimated() { return m_rotate.animatedProperty(attributeOwnerProxy()); } 49 34 50 protected: 35 51 SVGTextPositioningElement(const QualifiedName&, Document&); … … 42 58 void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) final; 43 59 44 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPositioningElement) 45 DECLARE_ANIMATED_LENGTH_LIST(X, x) 46 DECLARE_ANIMATED_LENGTH_LIST(Y, y) 47 DECLARE_ANIMATED_LENGTH_LIST(Dx, dx) 48 DECLARE_ANIMATED_LENGTH_LIST(Dy, dy) 49 DECLARE_ANIMATED_NUMBER_LIST(Rotate, rotate) 50 END_DECLARE_ANIMATED_PROPERTIES 60 const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; } 61 62 static void registerAttributes(); 63 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 64 65 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 66 SVGAnimatedLengthListAttribute m_x; 67 SVGAnimatedLengthListAttribute m_y; 68 SVGAnimatedLengthListAttribute m_dx; 69 SVGAnimatedLengthListAttribute m_dy; 70 SVGAnimatedNumberListAttribute m_rotate; 51 71 }; 52 72 -
trunk/Source/WebCore/svg/SVGURIReference.cpp
r204247 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 24 25 #include "Document.h" 25 26 #include "Element.h" 27 #include "SVGAttributeOwnerProxy.h" 26 28 #include "URL.h" 27 29 #include "XLinkNames.h" … … 29 31 namespace WebCore { 30 32 33 SVGURIReference::SVGURIReference(SVGElement* contextElement) 34 : m_attributeOwnerProxy(std::make_unique<AttributeOwnerProxy>(*this, *contextElement)) 35 { 36 registerAttributes(); 37 } 38 39 void SVGURIReference::registerAttributes() 40 { 41 auto& registry = attributeRegistry(); 42 if (!registry.isEmpty()) 43 return; 44 registry.registerAttribute<XLinkNames::hrefAttr, &SVGURIReference::m_href>(); 45 } 46 47 SVGURIReference::AttributeRegistry& SVGURIReference::attributeRegistry() 48 { 49 return AttributeOwnerProxy::attributeRegistry(); 50 } 51 52 bool SVGURIReference::isKnownAttribute(const QualifiedName& attributeName) 53 { 54 return AttributeOwnerProxy::isKnownAttribute(attributeName); 55 } 56 31 57 void SVGURIReference::parseAttribute(const QualifiedName& name, const AtomicString& value) 32 58 { 33 59 if (name.matches(XLinkNames::hrefAttr)) 34 setHrefBaseValue(value);60 m_href.setValue(value); 35 61 } 36 62 37 bool SVGURIReference::isKnownAttribute(const QualifiedName& attrName) 63 const String& SVGURIReference::href() const 38 64 { 39 return attrName.matches(XLinkNames::hrefAttr); 65 return m_href.currentValue(*m_attributeOwnerProxy); 66 } 67 68 RefPtr<SVGAnimatedString> SVGURIReference::hrefAnimated() 69 { 70 return m_href.animatedProperty(*m_attributeOwnerProxy); 40 71 } 41 72 … … 99 130 } 100 131 101 void SVGURIReference::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes)102 {103 supportedAttributes.add(XLinkNames::hrefAttr);104 132 } 105 106 } -
trunk/Source/WebCore/svg/SVGURIReference.h
r223728 r234620 2 2 * Copyright (C) 2004, 2005, 2008, 2009 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 23 24 #include "Document.h" 24 25 #include "QualifiedName.h" 26 #include "SVGAnimatedString.h" 25 27 26 28 namespace WebCore { 27 29 30 template<typename OwnerType, typename... BaseTypes> 31 class SVGAttributeRegistry; 32 33 template<typename OwnerType, typename... BaseTypes> 34 class SVGAttributeOwnerProxyImpl; 35 28 36 class SVGURIReference { 37 WTF_MAKE_NONCOPYABLE(SVGURIReference); 29 38 public: 30 39 virtual ~SVGURIReference() = default; 31 40 32 41 void parseAttribute(const QualifiedName&, const AtomicString&); 33 static bool isKnownAttribute(const QualifiedName&);34 static void addSupportedAttributes(HashSet<QualifiedName>&);35 42 36 43 static String fragmentIdentifierFromIRIString(const String&, const Document&); … … 49 56 } 50 57 58 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGURIReference>; 59 using AttributeRegistry = SVGAttributeRegistry<SVGURIReference>; 60 static AttributeRegistry& attributeRegistry(); 61 62 const String& href() const; 63 RefPtr<SVGAnimatedString> hrefAnimated(); 64 51 65 protected: 52 virtual String& hrefBaseValue() const = 0; 53 virtual void setHrefBaseValue(const String&, const bool validValue = true) = 0; 66 SVGURIReference(SVGElement* contextElement); 67 68 static bool isKnownAttribute(const QualifiedName& attributeName); 69 70 private: 71 static void registerAttributes(); 72 73 std::unique_ptr<AttributeOwnerProxy> m_attributeOwnerProxy; 74 SVGAnimatedStringAttribute m_href; 54 75 }; 55 76 -
trunk/Source/WebCore/svg/SVGUseElement.cpp
r233366 r234620 6 6 * Copyright (C) 2012 University of Szeged 7 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 8 * Copyright (C) 2015-201 7Apple Inc. All rights reserved.8 * Copyright (C) 2015-2018 Apple Inc. All rights reserved. 9 9 * 10 10 * This library is free software; you can redistribute it and/or … … 47 47 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGUseElement); 48 48 49 DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::xAttr, X, x)50 DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::yAttr, Y, y)51 DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::widthAttr, Width, width)52 DEFINE_ANIMATED_LENGTH(SVGUseElement, SVGNames::heightAttr, Height, height)53 DEFINE_ANIMATED_STRING(SVGUseElement, XLinkNames::hrefAttr, Href, href)54 DEFINE_ANIMATED_BOOLEAN(SVGUseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)55 56 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGUseElement)57 REGISTER_LOCAL_ANIMATED_PROPERTY(x)58 REGISTER_LOCAL_ANIMATED_PROPERTY(y)59 REGISTER_LOCAL_ANIMATED_PROPERTY(width)60 REGISTER_LOCAL_ANIMATED_PROPERTY(height)61 REGISTER_LOCAL_ANIMATED_PROPERTY(href)62 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)63 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)64 END_REGISTER_ANIMATED_PROPERTIES65 66 49 inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& document) 67 50 : SVGGraphicsElement(tagName, document) 68 , m_x(LengthModeWidth) 69 , m_y(LengthModeHeight) 70 , m_width(LengthModeWidth) 71 , m_height(LengthModeHeight) 51 , SVGExternalResourcesRequired(this) 52 , SVGURIReference(this) 72 53 , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired) 73 54 { 74 55 ASSERT(hasCustomStyleResolveCallbacks()); 75 56 ASSERT(hasTagName(SVGNames::useTag)); 76 registerA nimatedPropertiesForSVGUseElement();57 registerAttributes(); 77 58 } 78 59 … … 88 69 } 89 70 71 void SVGUseElement::registerAttributes() 72 { 73 auto& registry = attributeRegistry(); 74 if (!registry.isEmpty()) 75 return; 76 registry.registerAttribute<SVGNames::xAttr, &SVGUseElement::m_x>(); 77 registry.registerAttribute<SVGNames::yAttr, &SVGUseElement::m_y>(); 78 registry.registerAttribute<SVGNames::widthAttr, &SVGUseElement::m_width>(); 79 registry.registerAttribute<SVGNames::heightAttr, &SVGUseElement::m_height>(); 80 } 81 90 82 void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 91 83 { … … 93 85 94 86 if (name == SVGNames::xAttr) 95 setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));87 m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); 96 88 else if (name == SVGNames::yAttr) 97 setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));89 m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); 98 90 else if (name == SVGNames::widthAttr) 99 setWidthBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));91 m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); 100 92 else if (name == SVGNames::heightAttr) 101 setHeightBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));93 m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); 102 94 103 95 reportAttributeParsingError(parseError, name, value); … … 114 106 if (m_shadowTreeNeedsUpdate) 115 107 document().addSVGUseElement(*this); 116 SVGExternalResourcesRequired::insertedIntoDocument( this);108 SVGExternalResourcesRequired::insertedIntoDocument(); 117 109 invalidateShadowTree(); 118 110 // FIXME: Move back the call to updateExternalDocument() here once notifyFinished is made always async. … … 157 149 // will be transferred to the generated 'svg'. If attributes width and/or height are not specified, 158 150 // the generated 'svg' element will use values of 100% for these attributes. 159 shadowElement.setAttribute(SVGNames::widthAttr, (widthIsValid() && width().valueInSpecifiedUnits()) ? AtomicString(width().valueAsString()) : "100%");160 shadowElement.setAttribute(SVGNames::heightAttr, (heightIsValid() && height().valueInSpecifiedUnits()) ? AtomicString(height().valueAsString()) : "100%");151 shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? AtomicString(width().valueAsString()) : "100%"); 152 shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? AtomicString(height().valueAsString()) : "100%"); 161 153 } else if (is<SVGSVGElement>(shadowElement)) { 162 154 // Spec (<use> on <svg>): If attributes width and/or height are provided on the 'use' element, then these 163 155 // values will override the corresponding attributes on the 'svg' in the generated tree. 164 156 auto correspondingElement = makeRefPtr(shadowElement.correspondingElement()); 165 shadowElement.setAttribute(SVGNames::widthAttr, (widthIsValid() && width().valueInSpecifiedUnits()) ? AtomicString(width().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom()));166 shadowElement.setAttribute(SVGNames::heightAttr, (heightIsValid() && height().valueInSpecifiedUnits()) ? AtomicString(height().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom()));157 shadowElement.setAttribute(SVGNames::widthAttr, width().valueInSpecifiedUnits() ? AtomicString(width().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::widthAttr) : nullAtom())); 158 shadowElement.setAttribute(SVGNames::heightAttr, height().valueInSpecifiedUnits() ? AtomicString(height().valueAsString()) : (correspondingElement ? correspondingElement->getAttribute(SVGNames::heightAttr) : nullAtom())); 167 159 } 168 160 } … … 172 164 InstanceInvalidationGuard guard(*this); 173 165 174 if ( attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {166 if (isKnownAttribute(attrName)) { 175 167 updateRelativeLengthsInformation(); 176 168 if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) { … … 184 176 } 185 177 186 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName))187 return;188 189 178 if (SVGURIReference::isKnownAttribute(attrName)) { 190 179 updateExternalDocument(); … … 193 182 } 194 183 195 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {184 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) 196 185 invalidateShadowTree(); 197 return;198 }199 186 200 187 SVGGraphicsElement::svgAttributeChanged(attrName); 188 SVGExternalResourcesRequired::svgAttributeChanged(attrName); 201 189 } 202 190 … … 573 561 dispatchEvent(Event::create(eventNames().errorEvent, false, false)); 574 562 else if (!resource.wasCanceled()) 575 SVGExternalResourcesRequired::dispatchLoadEvent( this);563 SVGExternalResourcesRequired::dispatchLoadEvent(); 576 564 } 577 565 -
trunk/Source/WebCore/svg/SVGUseElement.h
r233324 r234620 2 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2015 Apple Inc. All rights reserved.4 * Copyright (C) 2015-2018 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 37 37 class SVGUseElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGURIReference, private CachedSVGDocumentClient { 38 38 WTF_MAKE_ISO_ALLOCATED(SVGUseElement); 39 40 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGUseElement)41 DECLARE_ANIMATED_LENGTH(X, x)42 DECLARE_ANIMATED_LENGTH(Y, y)43 DECLARE_ANIMATED_LENGTH(Width, width)44 DECLARE_ANIMATED_LENGTH(Height, height)45 DECLARE_ANIMATED_STRING_OVERRIDE(Href, href)46 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)47 END_DECLARE_ANIMATED_PROPERTIES48 49 39 public: 50 40 static Ref<SVGUseElement> create(const QualifiedName&, Document&); … … 57 47 RenderElement* rendererClipChild() const; 58 48 49 const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); } 50 const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); } 51 const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); } 52 const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); } 53 54 RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); } 55 RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); } 56 RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); } 57 RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); } 58 59 59 private: 60 60 SVGUseElement(const QualifiedName&, Document&); … … 65 65 void removedFromAncestor(RemovalType, ContainerNode&) override; 66 66 void buildPendingResource() override; 67 68 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGUseElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>; 69 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 70 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 71 static void registerAttributes(); 72 73 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 67 74 void parseAttribute(const QualifiedName&, const AtomicString&) override; 68 75 void svgAttributeChanged(const QualifiedName&) override; 76 69 77 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; 70 78 Path toClipPath() override; … … 93 101 void invalidateDependentShadowTrees(); 94 102 103 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 104 SVGAnimatedLengthAttribute m_x { LengthModeWidth }; 105 SVGAnimatedLengthAttribute m_y { LengthModeHeight }; 106 SVGAnimatedLengthAttribute m_width { LengthModeWidth }; 107 SVGAnimatedLengthAttribute m_height { LengthModeHeight }; 108 95 109 bool m_haveFiredLoadEvent { false }; 96 110 bool m_shadowTreeNeedsUpdate { true }; -
trunk/Source/WebCore/svg/SVGValue.h
r229417 r234620 36 36 #include "SVGPointListValues.h" 37 37 #include "SVGPreserveAspectRatioValue.h" 38 #include "SVGPropertyInfo.h"39 38 #include "SVGPropertyTraits.h" 40 39 #include "SVGTransformListValues.h" -
trunk/Source/WebCore/svg/SVGViewElement.cpp
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 30 31 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGViewElement); 31 32 32 // Animated property definitions33 DEFINE_ANIMATED_BOOLEAN(SVGViewElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)34 DEFINE_ANIMATED_RECT(SVGViewElement, SVGNames::viewBoxAttr, ViewBox, viewBox)35 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGViewElement, SVGNames::preserveAspectRatioAttr, PreserveAspectRatio, preserveAspectRatio)36 37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement)38 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)39 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)40 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)41 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)42 END_REGISTER_ANIMATED_PROPERTIES43 44 33 inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document& document) 45 34 : SVGElement(tagName, document) 46 , m_zoomAndPan(SVGZoomAndPanMagnify) 35 , SVGExternalResourcesRequired(this) 36 , SVGFitToViewBox(this) 47 37 , m_viewTarget(SVGNames::viewTargetAttr) 48 38 { 49 39 ASSERT(hasTagName(SVGNames::viewTag)); 50 registerAnimatedPropertiesForSVGViewElement();51 40 } 52 41 … … 66 55 m_viewTarget.reset(value); 67 56 57 SVGElement::parseAttribute(name, value); 68 58 SVGExternalResourcesRequired::parseAttribute(name, value); 69 SVGFitToViewBox::parseAttribute(this, name, value); 70 SVGZoomAndPan::parseAttribute(*this, name, value); 71 SVGElement::parseAttribute(name, value); 59 SVGFitToViewBox::parseAttribute(name, value); 60 SVGZoomAndPan::parseAttribute(name, value); 72 61 } 73 62 -
trunk/Source/WebCore/svg/SVGViewElement.h
r229694 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 21 22 #pragma once 22 23 23 #include "SVGAnimatedBoolean.h"24 #include "SVGAnimatedPreserveAspectRatio.h"25 #include "SVGAnimatedRect.h"26 24 #include "SVGElement.h" 27 25 #include "SVGExternalResourcesRequired.h" 28 26 #include "SVGFitToViewBox.h" 29 #include "SVGStringListValues.h"30 27 #include "SVGZoomAndPan.h" 31 28 … … 43 40 44 41 Ref<SVGStringList> viewTarget(); 45 SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }46 void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); }47 42 48 43 private: … … 50 45 51 46 // FIXME: svgAttributeChanged missing. 47 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGViewElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan>; 48 const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; } 52 49 void parseAttribute(const QualifiedName&, const AtomicString&) final; 53 50 54 51 bool rendererIsNeeded(const RenderStyle&) final { return false; } 55 52 56 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGViewElement) 57 DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired) 58 DECLARE_ANIMATED_RECT(ViewBox, viewBox) 59 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) 60 END_DECLARE_ANIMATED_PROPERTIES 61 62 SVGZoomAndPanType m_zoomAndPan; 53 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 63 54 SVGStringListValues m_viewTarget; 64 55 }; -
trunk/Source/WebCore/svg/SVGViewSpec.cpp
r219856 r234620 1 1 /* 2 2 * Copyright (C) 2007, 2010 Rob Buis <buis@kde.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 32 33 namespace WebCore { 33 34 34 // Define custom animated property 'viewBox'. 35 const SVGPropertyInfo* SVGViewSpec::viewBoxPropertyInfo() 35 SVGViewSpec::SVGViewSpec(SVGElement& contextElement) 36 : SVGFitToViewBox(&contextElement, PropertyIsReadOnly) 37 , m_contextElement(&contextElement) 38 , m_attributeOwnerProxy(*this, contextElement) 36 39 { 37 static const SVGPropertyInfo* s_propertyInfo = nullptr; 38 if (!s_propertyInfo) { 39 s_propertyInfo = new SVGPropertyInfo(AnimatedRect, 40 PropertyIsReadOnly, 41 SVGNames::viewBoxAttr, 42 viewBoxIdentifier(), 43 0, 44 0); 45 } 46 return s_propertyInfo; 40 registerAttributes(); 47 41 } 48 42 49 // Define custom animated property 'preserveAspectRatio'. 50 const SVGPropertyInfo* SVGViewSpec::preserveAspectRatioPropertyInfo() 43 void SVGViewSpec::registerAttributes() 51 44 { 52 static const SVGPropertyInfo* s_propertyInfo = nullptr; 53 if (!s_propertyInfo) { 54 s_propertyInfo = new SVGPropertyInfo(AnimatedPreserveAspectRatio, 55 PropertyIsReadOnly, 56 SVGNames::preserveAspectRatioAttr, 57 preserveAspectRatioIdentifier(), 58 0, 59 0); 60 } 61 return s_propertyInfo; 62 } 63 64 65 // Define custom non-animated property 'transform'. 66 const SVGPropertyInfo* SVGViewSpec::transformPropertyInfo() 67 { 68 static const SVGPropertyInfo* s_propertyInfo = nullptr; 69 if (!s_propertyInfo) { 70 s_propertyInfo = new SVGPropertyInfo(AnimatedTransformList, 71 PropertyIsReadOnly, 72 SVGNames::transformAttr, 73 transformIdentifier(), 74 0, 75 0); 76 } 77 return s_propertyInfo; 78 } 79 80 SVGViewSpec::SVGViewSpec(SVGElement& contextElement) 81 : m_contextElement(&contextElement) 82 { 83 } 84 85 const AtomicString& SVGViewSpec::viewBoxIdentifier() 86 { 87 static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecViewBoxAttribute", AtomicString::ConstructFromLiteral); 88 return s_identifier; 89 } 90 91 const AtomicString& SVGViewSpec::preserveAspectRatioIdentifier() 92 { 93 static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecPreserveAspectRatioAttribute", AtomicString::ConstructFromLiteral); 94 return s_identifier; 95 } 96 97 const AtomicString& SVGViewSpec::transformIdentifier() 98 { 99 static NeverDestroyed<AtomicString> s_identifier("SVGViewSpecTransformAttribute", AtomicString::ConstructFromLiteral); 100 return s_identifier; 101 } 102 103 ExceptionOr<void> SVGViewSpec::setZoomAndPan(unsigned short) 104 { 105 // SVGViewSpec and all of its content is read-only. 106 return Exception { NoModificationAllowedError }; 107 } 108 109 String SVGViewSpec::transformString() const 110 { 111 return SVGPropertyTraits<SVGTransformListValues>::toString(m_transform); 112 } 113 114 String SVGViewSpec::viewBoxString() const 115 { 116 return SVGPropertyTraits<FloatRect>::toString(m_viewBox); 117 } 118 119 String SVGViewSpec::preserveAspectRatioString() const 120 { 121 return SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString(m_preserveAspectRatio); 45 auto& registry = attributeRegistry(); 46 if (!registry.isEmpty()) 47 return; 48 registry.registerAttribute<SVGNames::transformAttr, &SVGViewSpec::m_transform>(); 122 49 } 123 50 … … 137 64 return nullptr; 138 65 // Return the animVal here, as its readonly by default - which is exactly what we want here. 139 return static_reference_cast<SVGAnimatedTransformList>(lookupOrCreateTransformWrapper(this))->animVal(); 140 } 141 142 RefPtr<SVGAnimatedRect> SVGViewSpec::viewBoxAnimated() 143 { 144 if (!m_contextElement) 145 return nullptr; 146 return static_reference_cast<SVGAnimatedRect>(lookupOrCreateViewBoxWrapper(this)); 147 } 148 149 RefPtr<SVGAnimatedPreserveAspectRatio> SVGViewSpec::preserveAspectRatioAnimated() 150 { 151 if (!m_contextElement) 152 return nullptr; 153 return static_reference_cast<SVGAnimatedPreserveAspectRatio>(lookupOrCreatePreserveAspectRatioWrapper(this)); 154 } 155 156 Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateViewBoxWrapper(SVGViewSpec* ownerType) 157 { 158 ASSERT(ownerType); 159 ASSERT(ownerType->m_contextElement); 160 return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, FloatRect>(ownerType->m_contextElement, viewBoxPropertyInfo(), ownerType->m_viewBox); 161 } 162 163 Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* ownerType) 164 { 165 ASSERT(ownerType); 166 ASSERT(ownerType->m_contextElement); 167 return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatioValue>(ownerType->m_contextElement, preserveAspectRatioPropertyInfo(), ownerType->m_preserveAspectRatio); 168 } 169 170 Ref<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateTransformWrapper(SVGViewSpec* ownerType) 171 { 172 ASSERT(ownerType); 173 ASSERT(ownerType->m_contextElement); 174 return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedTransformList, SVGTransformListValues>(ownerType->m_contextElement, transformPropertyInfo(), ownerType->m_transform); 66 return m_transform.animatedProperty(m_attributeOwnerProxy)->animVal(); 175 67 } 176 68 177 69 void SVGViewSpec::reset() 178 70 { 179 m_zoomAndPan = SVGZoomAndPanMagnify;180 m_transform.clear();181 m_viewBox = { };182 m_preserveAspectRatio = { };183 71 m_viewTargetString = emptyString(); 72 m_transform.resetValue(); 73 SVGFitToViewBox::reset(); 74 SVGZoomAndPan::reset(); 184 75 } 185 76 … … 214 105 currViewSpec++; 215 106 FloatRect viewBox; 216 if (!SVGFitToViewBox::parseViewBox( &m_contextElement->document(),currViewSpec, end, viewBox, false))107 if (!SVGFitToViewBox::parseViewBox(currViewSpec, end, viewBox, false)) 217 108 return false; 218 setViewBox BaseValue(viewBox);109 setViewBox(viewBox); 219 110 if (currViewSpec >= end || *currViewSpec != ')') 220 111 return false; … … 238 129 return false; 239 130 currViewSpec++; 240 if (! parse(currViewSpec, end, m_zoomAndPan))131 if (!SVGZoomAndPan::parseZoomAndPan(currViewSpec, end)) 241 132 return false; 242 133 if (currViewSpec >= end || *currViewSpec != ')') … … 252 143 if (!preserveAspectRatio.parse(currViewSpec, end, false)) 253 144 return false; 254 setPreserveAspectRatio BaseValue(preserveAspectRatio);145 setPreserveAspectRatio(preserveAspectRatio); 255 146 if (currViewSpec >= end || *currViewSpec != ')') 256 147 return false; … … 262 153 return false; 263 154 currViewSpec++; 264 SVGTransformable::parseTransformAttribute(m_transform , currViewSpec, end, SVGTransformable::DoNotClearList);155 SVGTransformable::parseTransformAttribute(m_transform.value(), currViewSpec, end, SVGTransformable::DoNotClearList); 265 156 if (currViewSpec >= end || *currViewSpec != ')') 266 157 return false; -
trunk/Source/WebCore/svg/SVGViewSpec.h
r208863 r234620 1 1 /* 2 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 31 32 class SVGTransformList; 32 33 33 class SVGViewSpec final : public RefCounted<SVGViewSpec>, public SVG ZoomAndPan, public SVGFitToViewBox{34 class SVGViewSpec final : public RefCounted<SVGViewSpec>, public SVGFitToViewBox, public SVGZoomAndPan { 34 35 public: 35 36 static Ref<SVGViewSpec> create(SVGElement& contextElement) … … 40 41 bool parseViewSpec(const String&); 41 42 void reset(); 43 void resetContextElement() { m_contextElement = nullptr; } 42 44 43 45 SVGElement* viewTarget() const; 44 45 String transformString() const;46 String viewBoxString() const;47 String preserveAspectRatioString() const;48 46 const String& viewTargetString() const { return m_viewTargetString; } 49 47 50 SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } 51 ExceptionOr<void> setZoomAndPan(unsigned short); 52 void setZoomAndPanBaseValue(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); } 53 54 void resetContextElement() { m_contextElement = nullptr; } 55 56 // Custom non-animated 'transform' property. 48 String transformString() const { return m_transform.toString(); } 57 49 RefPtr<SVGTransformList> transform(); 58 SVGTransformListValues transformBaseValue() const { return m_transform; } 59 60 // Custom animated 'viewBox' property. 61 RefPtr<SVGAnimatedRect> viewBoxAnimated(); 62 FloatRect& viewBox() { return m_viewBox; } 63 void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; } 64 65 // Custom animated 'preserveAspectRatio' property. 66 RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated(); 67 SVGPreserveAspectRatioValue& preserveAspectRatio() { return m_preserveAspectRatio; } 68 void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; } 50 SVGTransformListValues transformValue() const { return m_transform.value(); } 69 51 70 52 private: 71 53 explicit SVGViewSpec(SVGElement&); 72 54 73 static const SVGPropertyInfo* transformPropertyInfo(); 74 static const SVGPropertyInfo* viewBoxPropertyInfo(); 75 static const SVGPropertyInfo* preserveAspectRatioPropertyInfo(); 55 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGViewSpec, SVGFitToViewBox, SVGZoomAndPan>; 56 static void registerAttributes(); 76 57 77 static const AtomicString& transformIdentifier(); 78 static const AtomicString& viewBoxIdentifier(); 79 static const AtomicString& preserveAspectRatioIdentifier(); 80 81 static Ref<SVGAnimatedProperty> lookupOrCreateTransformWrapper(SVGViewSpec* contextElement); 82 static Ref<SVGAnimatedProperty> lookupOrCreateViewBoxWrapper(SVGViewSpec* contextElement); 83 static Ref<SVGAnimatedProperty> lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* contextElement); 58 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 59 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 84 60 85 61 SVGElement* m_contextElement; 86 SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };87 SVGTransformListValues m_transform;88 FloatRect m_viewBox;89 SVGPreserveAspectRatioValue m_preserveAspectRatio;90 62 String m_viewTargetString; 63 AttributeOwnerProxy m_attributeOwnerProxy; 64 SVGAnimatedTransformListAttribute m_transform; 91 65 }; 92 66 -
trunk/Source/WebCore/svg/SVGViewSpec.idl
r222429 r234620 1 1 /* 2 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 36 37 readonly attribute DOMString transformString; 37 38 readonly attribute DOMString viewTargetString; 38 39 // SVGZoomAndPan40 attribute unsigned short zoomAndPan;41 39 }; 42 40 43 41 SVGViewSpec implements SVGFitToViewBox; 42 SVGViewSpec implements SVGZoomAndPan; -
trunk/Source/WebCore/svg/SVGZoomAndPan.cpp
r179982 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGZoomAndPan.h" 23 24 24 #include "SVGParserUtilities.h"25 26 25 namespace WebCore { 27 26 28 bool SVGZoomAndPan::parse(const UChar*& start, const UChar* end, SVGZoomAndPanType& zoomAndPan) 27 SVGZoomAndPan::SVGZoomAndPan() 28 { 29 registerAttributes(); 30 } 31 32 void SVGZoomAndPan::registerAttributes() 33 { 34 auto& registry = attributeRegistry(); 35 if (!registry.isEmpty()) 36 return; 37 registry.registerAttribute<SVGNames::zoomAndPanAttr, &SVGZoomAndPan::m_zoomAndPan>(); 38 } 39 40 bool SVGZoomAndPan::parseZoomAndPan(const UChar*& start, const UChar* end) 29 41 { 30 42 static const UChar disable[] = { 'd', 'i', 's', 'a', 'b', 'l', 'e' }; 31 43 if (skipString(start, end, disable, WTF_ARRAY_LENGTH(disable))) { 32 zoomAndPan = SVGZoomAndPanDisable;44 m_zoomAndPan.setValue(SVGZoomAndPanDisable); 33 45 return true; 34 46 } 47 35 48 static const UChar magnify[] = { 'm', 'a', 'g', 'n', 'i', 'f', 'y' }; 36 49 if (skipString(start, end, magnify, WTF_ARRAY_LENGTH(magnify))) { 37 zoomAndPan = SVGZoomAndPanMagnify;50 m_zoomAndPan.setValue(SVGZoomAndPanMagnify); 38 51 return true; 39 52 } 53 40 54 return false; 41 55 } 42 56 43 SVGZoomAndPanType SVGZoomAndPan::parseAttributeValue(const AtomicString& value)57 void SVGZoomAndPan::parseAttribute(const QualifiedName& attributeName, const AtomicString& value) 44 58 { 45 if (value == "disable") 46 return SVGZoomAndPanDisable; 47 if (value == "magnify") 48 return SVGZoomAndPanMagnify; 49 return SVGZoomAndPanUnknown; 59 if (attributeName != SVGNames::zoomAndPanAttr) 60 return; 61 m_zoomAndPan.setValue(SVGPropertyTraits<SVGZoomAndPanType>::fromString(value)); 50 62 } 51 63 -
trunk/Source/WebCore/svg/SVGZoomAndPan.h
r208668 r234620 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 23 24 #include "QualifiedName.h" 24 25 #include "SVGNames.h" 26 #include "SVGZoomAndPanType.h" 25 27 26 28 namespace WebCore { 27 29 28 enum SVGZoomAndPanType { SVGZoomAndPanUnknown, SVGZoomAndPanDisable, SVGZoomAndPanMagnify };29 30 30 class SVGZoomAndPan { 31 WTF_MAKE_NONCOPYABLE(SVGZoomAndPan); 31 32 public: 32 33 // Forward declare enumerations in the W3C naming scheme, for IDL generation. … … 37 38 }; 38 39 39 static bool isKnownAttribute(const QualifiedName&); 40 SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan.value(); } 41 void setZoomAndPan(SVGZoomAndPanType zoomAndPan) { m_zoomAndPan.setValue(zoomAndPan); } 42 ExceptionOr<void> setZoomAndPan(unsigned) { return Exception { NoModificationAllowedError }; } 43 void reset() { m_zoomAndPan.setValue(SVGZoomAndPanMagnify); } 40 44 41 static SVGZoomAndPanType parseFromNumber(unsigned short); 45 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGZoomAndPan>; 46 static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); } 42 47 43 static bool parse(const UChar*& start, const UChar* end, SVGZoomAndPanType&); 44 template<class DerivedClass> static void parseAttribute(DerivedClass&, const QualifiedName&, const AtomicString& value); 48 void parseAttribute(const QualifiedName&, const AtomicString&); 49 50 protected: 51 SVGZoomAndPan(); 52 53 static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); } 54 bool parseZoomAndPan(const UChar*&, const UChar*); 45 55 46 56 private: 47 static SVGZoomAndPanType parseAttributeValue(const AtomicString&); 57 static void registerAttributes(); 58 59 SVGPropertyAttribute<SVGZoomAndPanType> m_zoomAndPan; 48 60 }; 49 61 50 inline bool SVGZoomAndPan::isKnownAttribute(const QualifiedName& name)51 {52 return name == SVGNames::zoomAndPanAttr;53 }54 55 inline SVGZoomAndPanType SVGZoomAndPan::parseFromNumber(unsigned short number)56 {57 if (number > SVGZoomAndPanMagnify)58 return SVGZoomAndPanUnknown;59 return static_cast<SVGZoomAndPanType>(number);60 }61 62 template<class DerivedClass> void SVGZoomAndPan::parseAttribute(DerivedClass& element, const QualifiedName& name, const AtomicString& value)63 {64 if (name == SVGNames::zoomAndPanAttr)65 element.setZoomAndPan(parseAttributeValue(value));66 }67 68 62 } // namespace WebCore -
trunk/Source/WebCore/svg/SVGZoomAndPanType.h
r234619 r234620 26 26 #pragma once 27 27 28 #include "Color.h" 29 #include "FloatRect.h" 30 #include "SVGAngleValue.h" 31 #include "SVGLengthListValues.h" 32 #include "SVGLengthValue.h" 33 #include "SVGMarkerTypes.h" 34 #include "SVGNumberListValues.h" 35 #include "SVGPathByteStream.h" 36 #include "SVGPointListValues.h" 37 #include "SVGPreserveAspectRatioValue.h" 38 #include "SVGPropertyInfo.h" 28 #include "SVGAttributeAccessor.h" 39 29 #include "SVGPropertyTraits.h" 40 #include "SVGTransformListValues.h"41 42 #include <wtf/Variant.h>43 30 44 31 namespace WebCore { 45 32 46 using SVGValueVariant = Variant< 47 std::pair<SVGAngleValue, unsigned>*, 48 bool*, 49 Color*, 50 unsigned*, 51 int*, 52 std::pair<int, int>*, 53 SVGLengthValue*, 54 SVGLengthListValues*, 55 float*, 56 SVGNumberListValues*, 57 std::pair<float, float>*, 58 SVGPathByteStream*, 59 SVGPointListValues*, 60 SVGPreserveAspectRatioValue*, 61 FloatRect*, 62 String*, 63 SVGTransformListValues* 64 >; 33 enum SVGZoomAndPanType { 34 SVGZoomAndPanUnknown, 35 SVGZoomAndPanDisable, 36 SVGZoomAndPanMagnify 37 }; 65 38 66 } // namespace WebCore 39 using SVGZoomAndPanTypeAttribute = SVGPropertyAttribute<SVGZoomAndPanType>; 40 41 template<typename OwnerType> 42 using SVGZoomAndPanTypeAttributeAccessor = SVGPropertyAttributeAccessor<OwnerType, SVGZoomAndPanTypeAttribute>; 43 44 template<> 45 struct SVGPropertyTraits<SVGZoomAndPanType> { 46 static SVGZoomAndPanType initialValue() { return SVGZoomAndPanMagnify; } 47 static String toString(SVGZoomAndPanType) { return emptyString(); } 48 static SVGZoomAndPanType fromString(const String& value) 49 { 50 if (value == "disable") 51 return SVGZoomAndPanDisable; 52 if (value == "magnify") 53 return SVGZoomAndPanMagnify; 54 return SVGZoomAndPanUnknown; 55 } 56 }; 57 58 } -
trunk/Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h
r219831 r234620 28 28 class SVGAnimatedEnumerationPropertyTearOff final : public SVGAnimatedStaticPropertyTearOff<unsigned> { 29 29 public: 30 using ContentType = EnumType; 31 30 32 const unsigned& baseVal() final 31 33 { -
trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.cpp
r234619 r234620 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "SVGAnimatedPathSegListPropertyTearOff.h" 27 28 28 #include "Color.h" 29 #include "FloatRect.h" 30 #include "SVGAngleValue.h" 31 #include "SVGLengthListValues.h" 32 #include "SVGLengthValue.h" 33 #include "SVGMarkerTypes.h" 34 #include "SVGNumberListValues.h" 35 #include "SVGPathByteStream.h" 36 #include "SVGPointListValues.h" 37 #include "SVGPreserveAspectRatioValue.h" 38 #include "SVGPropertyInfo.h" 39 #include "SVGPropertyTraits.h" 40 #include "SVGTransformListValues.h" 41 42 #include <wtf/Variant.h> 29 #include "SVGPathElement.h" 43 30 44 31 namespace WebCore { 45 32 46 using SVGValueVariant = Variant< 47 std::pair<SVGAngleValue, unsigned>*, 48 bool*, 49 Color*, 50 unsigned*, 51 int*, 52 std::pair<int, int>*, 53 SVGLengthValue*, 54 SVGLengthListValues*, 55 float*, 56 SVGNumberListValues*, 57 std::pair<float, float>*, 58 SVGPathByteStream*, 59 SVGPointListValues*, 60 SVGPreserveAspectRatioValue*, 61 FloatRect*, 62 String*, 63 SVGTransformListValues* 64 >; 33 SVGAnimatedPathSegListPropertyTearOff::SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegListValues& values) 34 : Base(contextElement, attributeName, animatedPropertyType, values) 35 { 36 ASSERT(contextElement); 37 ASSERT(is<SVGPathElement>(contextElement)); 38 } 65 39 66 } // namespace WebCore 40 SVGAnimatedPathSegListPropertyTearOff::~SVGAnimatedPathSegListPropertyTearOff() 41 { 42 downcast<SVGPathElement>(contextElement())->animatedPropertyWillBeDeleted(); 43 } 44 45 void SVGAnimatedPathSegListPropertyTearOff::animValDidChange() 46 { 47 ASSERT(m_animatedPathByteStream); 48 auto pathElement = makeRefPtr(downcast<SVGPathElement>(contextElement())); 49 50 // If the animVal is observed from JS, we have to update it on each animation step. 51 // This is an expensive operation and only done if someone actually observes the animatedPathSegList() while an animation is running. 52 if (pathElement->isAnimValObserved()) { 53 auto& animatedList = currentAnimatedValue(); 54 animatedList.clear(); 55 buildSVGPathSegListValuesFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing); 56 } 57 58 Base::animValDidChange(); 59 } 60 61 } -
trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h
r232613 r234620 1 1 /* 2 2 * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved. 3 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 22 23 #include "SVGAnimatedListPropertyTearOff.h" 23 24 #include "SVGPathByteStream.h" 24 #include "SVGPathElement.h"25 25 #include "SVGPathSegList.h" 26 26 #include "SVGPathUtilities.h" … … 88 88 } 89 89 90 void animValDidChange() 91 { 92 ASSERT(m_animatedPathByteStream); 93 auto pathElement = makeRefPtr(downcast<SVGPathElement>(contextElement())); 94 95 // If the animVal is observed from JS, we have to update it on each animation step. 96 // This is an expensive operation and only done, if someone actually observes the animatedPathSegList() while an animation is running. 97 if (pathElement->isAnimValObserved()) { 98 auto& animatedList = currentAnimatedValue(); 99 animatedList.clear(); 100 buildSVGPathSegListValuesFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing); 101 } 102 103 Base::animValDidChange(); 104 } 90 void animValDidChange(); 105 91 106 92 SVGPathByteStream* animatedPathByteStream() const { return m_animatedPathByteStream; } 107 93 108 94 private: 109 SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegListValues& values) 110 : Base(contextElement, attributeName, animatedPropertyType, values) 111 , m_animatedPathByteStream(nullptr) 112 { 113 ASSERT(contextElement); 114 ASSERT(is<SVGPathElement>(contextElement)); 115 } 95 SVGAnimatedPathSegListPropertyTearOff(SVGElement*, const QualifiedName&, AnimatedPropertyType, SVGPathSegListValues&); 96 virtual ~SVGAnimatedPathSegListPropertyTearOff(); 116 97 117 virtual ~SVGAnimatedPathSegListPropertyTearOff() 118 { 119 downcast<SVGPathElement>(contextElement())->animatedPropertyWillBeDeleted(); 120 } 121 122 SVGPathByteStream* m_animatedPathByteStream; 98 SVGPathByteStream* m_animatedPathByteStream { nullptr }; 123 99 }; 124 100 -
trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp
r197967 r234620 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 4 * Copyright (C) 2016 Apple Inc. All rights reserved.4 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 31 31 , m_attributeName(attributeName) 32 32 , m_animatedPropertyType(animatedPropertyType) 33 , m_isReadOnly(false)34 33 { 35 34 } … … 37 36 SVGAnimatedProperty::~SVGAnimatedProperty() 38 37 { 38 // Assure that animationEnded() was called, if animationStarted() was called before. 39 ASSERT(!isAnimating()); 40 39 41 // Remove wrapper from cache. 40 for (auto& cache : *animatedPropertyCache()) {42 for (auto& cache : animatedPropertyCache()) { 41 43 if (cache.value == this) { 42 animatedPropertyCache() ->remove(cache.key);43 break;44 animatedPropertyCache().remove(cache.key); 45 return; 44 46 } 45 47 } 46 48 47 // Assure that animationEnded() was called, if animationStarted() was called before. 48 ASSERT(!isAnimating()); 49 RELEASE_ASSERT_NOT_REACHED(); 49 50 } 50 51 … … 59 60 } 60 61 61 SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache()62 {63 static Cache* s_cache = new Cache;64 return s_cache;65 }66 67 62 } // namespace WebCore -
trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.h
r226993 r234620 2 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 4 * Copyright (C) 2016 Apple Inc. All rights reserved.4 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 22 22 #pragma once 23 23 24 #include "QualifiedName.h" 24 25 #include "SVGAnimatedPropertyDescription.h" 25 #include "SVG PropertyInfo.h"26 #include "SVGAnimatedPropertyType.h" 26 27 #include <wtf/RefCounted.h> 27 28 … … 33 34 class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty> { 34 35 public: 36 virtual ~SVGAnimatedProperty(); 37 virtual bool isAnimating() const { return false; } 38 virtual bool isAnimatedListTearOff() const { return false; } 39 35 40 SVGElement* contextElement() const { return m_contextElement.get(); } 36 41 const QualifiedName& attributeName() const { return m_attributeName; } … … 41 46 void commitChange(); 42 47 43 virtual bool isAnimating() const { return false; } 44 virtual bool isAnimatedListTearOff() const { return false; } 48 template<typename TearOffType, typename PropertyType, AnimatedPropertyType animatedType> 49 static RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(SVGElement& element, const QualifiedName& attributeName, const AtomicString& identifier, PropertyType& property, AnimatedPropertyState animatedState) 50 { 51 SVGAnimatedPropertyDescription key(&element, identifier); 45 52 46 // Caching facilities. 47 typedef HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> Cache; 53 auto result = animatedPropertyCache().add(key, nullptr); 54 if (!result.isNewEntry) 55 return result.iterator->value; 48 56 49 virtual ~SVGAnimatedProperty(); 50 51 template<typename OwnerType, typename TearOffType, typename PropertyType> 52 static Ref<TearOffType> lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType& property) 53 { 54 ASSERT(info); 55 SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); 56 57 auto result = animatedPropertyCache()->add(key, nullptr); 58 if (!result.isNewEntry) 59 return static_cast<TearOffType&>(*result.iterator->value); 60 61 Ref<SVGAnimatedProperty> wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property); 62 if (info->animatedPropertyState == PropertyIsReadOnly) 57 auto wrapper = TearOffType::create(&element, attributeName, animatedType, property); 58 if (animatedState == PropertyIsReadOnly) 63 59 wrapper->setIsReadOnly(); 64 60 65 // Cache the raw pointer but return a Ref <>. This will break the cyclic reference61 // Cache the raw pointer but return a RefPtr<>. This will break the cyclic reference 66 62 // between SVGAnimatedProperty and SVGElement once the property pointer is not needed. 67 63 result.iterator->value = wrapper.ptr(); 68 return static_reference_cast< TearOffType>(wrapper);64 return static_reference_cast<SVGAnimatedProperty>(wrapper); 69 65 } 70 66 71 template<typename OwnerType, typename TearOffType> 72 static RefPtr<TearOffType> lookupWrapper(OwnerType* element, const SVGPropertyInfo* info) 67 static RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGElement& element, const AtomicString& identifier) 73 68 { 74 ASSERT(info); 75 SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); 76 return static_cast<TearOffType*>(animatedPropertyCache()->get(key)); 77 } 78 79 template<typename OwnerType, typename TearOffType> 80 static RefPtr<TearOffType> lookupWrapper(const OwnerType* element, const SVGPropertyInfo* info) 81 { 82 return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(element), info); 69 SVGAnimatedPropertyDescription key(const_cast<SVGElement*>(&element), identifier); 70 return animatedPropertyCache().get(key); 83 71 } 84 72 … … 87 75 88 76 private: 89 static Cache* animatedPropertyCache(); 77 // Caching facilities. 78 using Cache = HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits>; 79 static Cache& animatedPropertyCache() 80 { 81 static NeverDestroyed<Cache> cache; 82 return cache; 83 } 90 84 91 85 RefPtr<SVGElement> m_contextElement; … … 94 88 95 89 protected: 96 bool m_isReadOnly ;90 bool m_isReadOnly { false }; 97 91 }; 98 92 -
trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyType.h
r234619 r234620 1 1 /* 2 * Copyright (C) 20 06 Apple Inc.All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 25 26 interface SVGAElement : SVGGraphicsElement { 27 [ImplementedAs=svgTarget] readonly attribute SVGAnimatedString target; 26 #pragma once 27 28 namespace WebCore { 29 30 enum AnimatedPropertyState { 31 PropertyIsReadWrite, 32 PropertyIsReadOnly 28 33 }; 29 34 30 SVGAElement implements SVGExternalResourcesRequired; 31 SVGAElement implements SVGURIReference; 35 enum AnimatedPropertyType { 36 AnimatedPropertyTypeMin = 0, 37 AnimatedAngle = AnimatedPropertyTypeMin, 38 AnimatedBoolean, 39 AnimatedColor, 40 AnimatedEnumeration, 41 AnimatedInteger, 42 AnimatedIntegerOptionalInteger, 43 AnimatedLength, 44 AnimatedLengthList, 45 AnimatedNumber, 46 AnimatedNumberList, 47 AnimatedNumberOptionalNumber, 48 AnimatedPath, 49 AnimatedPoints, 50 AnimatedPreserveAspectRatio, 51 AnimatedRect, 52 AnimatedString, 53 AnimatedTransformList, 54 AnimatedPropertyTypeMax, 55 AnimatedUnknown = AnimatedPropertyTypeMax 56 }; 57 58 } -
trunk/Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h
r234619 r234620 26 26 #pragma once 27 27 28 #include "Color.h" 29 #include "FloatRect.h" 30 #include "SVGAngleValue.h" 31 #include "SVGLengthListValues.h" 32 #include "SVGLengthValue.h" 33 #include "SVGMarkerTypes.h" 34 #include "SVGNumberListValues.h" 35 #include "SVGPathByteStream.h" 36 #include "SVGPointListValues.h" 37 #include "SVGPreserveAspectRatioValue.h" 38 #include "SVGPropertyInfo.h" 39 #include "SVGPropertyTraits.h" 40 #include "SVGTransformListValues.h" 41 42 #include <wtf/Variant.h> 28 #include "SVGAnimatedPropertyType.h" 43 29 44 30 namespace WebCore { 45 31 46 using SVGValueVariant = Variant< 47 std::pair<SVGAngleValue, unsigned>*, 48 bool*, 49 Color*, 50 unsigned*, 51 int*, 52 std::pair<int, int>*, 53 SVGLengthValue*, 54 SVGLengthListValues*, 55 float*, 56 SVGNumberListValues*, 57 std::pair<float, float>*, 58 SVGPathByteStream*, 59 SVGPointListValues*, 60 SVGPreserveAspectRatioValue*, 61 FloatRect*, 62 String*, 63 SVGTransformListValues* 64 >; 32 class SVGAnimatedProperty; 33 class SVGAttribute; 34 class SVGElement; 65 35 66 } // namespace WebCore 36 class SVGAttributeOwnerProxy { 37 public: 38 SVGAttributeOwnerProxy(SVGElement& element) 39 : m_element(element) 40 { 41 } 42 43 virtual ~SVGAttributeOwnerProxy() = default; 44 45 SVGElement& element() const { return m_element; } 46 47 virtual void synchronizeAttributes() const = 0; 48 virtual void synchronizeAttribute(const QualifiedName&) const = 0; 49 50 virtual Vector<AnimatedPropertyType> animatedTypes(const QualifiedName&) const = 0; 51 52 virtual RefPtr<SVGAnimatedProperty> lookupOrCreateAnimatedProperty(const SVGAttribute&) const = 0; 53 virtual RefPtr<SVGAnimatedProperty> lookupAnimatedProperty(const SVGAttribute&) const = 0; 54 virtual Vector<RefPtr<SVGAnimatedProperty>> lookupOrCreateAnimatedProperties(const QualifiedName&) const = 0; 55 56 protected: 57 SVGElement& m_element; 58 }; 59 60 }
Note:
See TracChangeset
for help on using the changeset viewer.