Source/WebCore/ChangeLog

 12017-02-21 Said Abou-Hallawa <sabouhallawa@apple.com>
 2
 3 Make SVGAnimatedType holds RefCounted objects instead of holding a union of raw pointers
 4 https://bugs.webkit.org/show_bug.cgi?id=168586
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 This is a step towards changing the raw pointers which is held by
 9 SVGAnimatedType and the SVGAnimatedPropertyTearOff object to be RefCounted
 10 pointers.
 11
 12 This patch changes SVGAnimatedType which holds a union of raw pointers to
 13 hold RefCounted Variant objects. It makes the SVGAnimatedType holds a pair
 14 SVGAnimatedValue. The SVGAnimatedValue is a RefCounted Variant which holds
 15 a single data type. SVGAnimatedType can hold one or two SVGAnimatedValues.
 16 The data pair have to be stored in separate objects not in the same Variant
 17 because they are held by two different SVGAnimatedPropertyTearOff objects.
 18
 19 The plan is to change the property raw pointer in SVGAnimatedPropertyTearOff
 20 to be be a SVGAnimatedValue which is a RefCounted pointer initiated in
 21 SVGAnimatedType.
 22
 23 * WebCore.xcodeproj/project.pbxproj: Add SVGMarkerTypes.h and SVGAnimatedValue.h
 24 and delete SVGRectTraits.h from the project. Make ParserUtilities.h private because
 25 it is included in SVGPropertyTraits.h.
 26
 27 * svg/SVGAnimateElementBase.cpp:
 28 (WebCore::SVGAnimateElementBase::resetAnimatedType): Replace the call to
 29 SVGAnimatedType::setValueAsString() by SVGAnimatedType::parse().
 30 (WebCore::SVGAnimateElementBase::applyResultsToTarget): Replace the call
 31 to SVGAnimatedType::valueAsString() by SVGAnimatedType::toString().
 32
 33 * svg/SVGAnimatedAngle.cpp:
 34 (WebCore::SVGAnimatedAngleAnimator::constructFromString):Use
 35 SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>>::fromString() to get
 36 the angle value form a string.
 37 (WebCore::SVGAnimatedAngleAnimator::startAnimValAnimation): Don't construct
 38 an SVGAnimatedType from the return of constructFromBaseValues() since it now
 39 returns an SVGAnimatedType.
 40 (WebCore::SVGAnimatedAngleAnimator::resetAnimValToBaseVal): Don't pass a getter
 41 to resetFromBaseValues since the ContentType of the TearOff object can be used
 42 to get the property from the SVGAnimatedType.
 43 (WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes): Replace the call to
 44 SVGAnimatedType::angleAndEnumeration() by SVGAnimatedType::properties<>().
 45 (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue): Ditto.
 46
 47 * svg/SVGAnimatedBoolean.cpp:
 48 (WebCore::SVGAnimatedBooleanAnimator::constructFromString):
 49 (WebCore::SVGAnimatedBooleanAnimator::startAnimValAnimation):
 50 (WebCore::SVGAnimatedBooleanAnimator::resetAnimValToBaseVal):
 51 (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
 52 Ditto.
 53
 54 * svg/SVGAnimatedColor.cpp:
 55 (WebCore::SVGAnimatedColorAnimator::constructFromString):
 56 (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
 57 (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
 58 Ditto.
 59
 60 * svg/SVGAnimatedEnumeration.cpp:
 61 (WebCore::SVGAnimatedEnumerationAnimator::constructFromString):
 62 (WebCore::SVGAnimatedEnumerationAnimator::startAnimValAnimation):
 63 (WebCore::SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal):
 64 (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
 65 Ditto.
 66
 67 * svg/SVGAnimatedInteger.cpp:
 68 (WebCore::SVGAnimatedIntegerAnimator::constructFromString):
 69 (WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
 70 (WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
 71 (WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes):
 72 (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
 73 Ditto.
 74
 75 * svg/SVGAnimatedIntegerOptionalInteger.cpp:
 76 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
 77 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
 78 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
 79 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes):
 80 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
 81 Ditto.
 82
 83 * svg/SVGAnimatedLength.cpp:
 84 (WebCore::SVGAnimatedLengthAnimator::constructFromString):
 85 (WebCore::SVGAnimatedLengthAnimator::startAnimValAnimation):
 86 (WebCore::SVGAnimatedLengthAnimator::resetAnimValToBaseVal):
 87 (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
 88 (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
 89 Ditto.
 90
 91 * svg/SVGAnimatedLengthList.cpp:
 92 (WebCore::SVGAnimatedLengthListAnimator::constructFromString):
 93 (WebCore::SVGAnimatedLengthListAnimator::startAnimValAnimation):
 94 (WebCore::SVGAnimatedLengthListAnimator::resetAnimValToBaseVal):
 95 (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
 96 (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
 97 Ditto.
 98
 99 * svg/SVGAnimatedNumber.cpp:
 100 (WebCore::SVGAnimatedNumberAnimator::constructFromString):
 101 (WebCore::SVGAnimatedNumberAnimator::startAnimValAnimation):
 102 (WebCore::SVGAnimatedNumberAnimator::resetAnimValToBaseVal):
 103 (WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes):
 104 (WebCore::parseNumberFromString):
 105 (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
 106 Ditto.
 107
 108 * svg/SVGAnimatedNumberList.cpp:
 109 (WebCore::SVGAnimatedNumberListAnimator::constructFromString):
 110 (WebCore::SVGAnimatedNumberListAnimator::startAnimValAnimation):
 111 (WebCore::SVGAnimatedNumberListAnimator::resetAnimValToBaseVal):
 112 (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
 113 (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
 114 Ditto.
 115
 116 * svg/SVGAnimatedNumberOptionalNumber.cpp:
 117 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString):
 118 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation):
 119 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal):
 120 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes):
 121 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
 122 Ditto.
 123
 124 * svg/SVGAnimatedPath.cpp:
 125 (WebCore::SVGAnimatedPathAnimator::constructFromString):
 126 (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation):
 127 (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
 128 (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
 129 (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
 130 Ditto.
 131
 132 * svg/SVGAnimatedPointList.cpp:
 133 (WebCore::SVGAnimatedPointListAnimator::constructFromString):
 134 (WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation):
 135 (WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal):
 136 (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
 137 (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
 138 Ditto.
 139
 140 * svg/SVGAnimatedPreserveAspectRatio.cpp:
 141 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
 142 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation):
 143 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal):
 144 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
 145 Ditto.
 146
 147 * svg/SVGAnimatedRect.cpp:
 148 (WebCore::SVGAnimatedRectAnimator::constructFromString):
 149 (WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
 150 (WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
 151 (WebCore::SVGAnimatedRectAnimator::addAnimatedTypes):
 152 (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
 153 Ditto.
 154
 155 * svg/SVGAnimatedString.cpp:
 156 (WebCore::SVGAnimatedStringAnimator::constructFromString):
 157 (WebCore::SVGAnimatedStringAnimator::startAnimValAnimation):
 158 (WebCore::SVGAnimatedStringAnimator::resetAnimValToBaseVal):
 159 (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
 160 Ditto.
 161
 162 * svg/SVGAnimatedTransformList.cpp:
 163 (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
 164 (WebCore::SVGAnimatedTransformListAnimator::startAnimValAnimation):
 165 (WebCore::SVGAnimatedTransformListAnimator::resetAnimValToBaseVal):
 166 (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
 167 (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
 168 (WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
 169 Ditto.
 170
 171 * svg/SVGAnimatedType.cpp:
 172 (WebCore::SVGAnimatedType::type): The type of the SVGAnimatedType can be
 173 deduced from the type of the SVGAnimatedValues.
 174 (WebCore::SVGAnimatedType::toString): Rename valueAsString() to toString().
 175 (WebCore::SVGAnimatedType::parse): Rename setValueAsString() to parse().
 176 (WebCore::SVGAnimatedType::SVGAnimatedType): Deleted.
 177 (WebCore::SVGAnimatedType::~SVGAnimatedType): Deleted.
 178 (WebCore::SVGAnimatedType::createAngleAndEnumeration): Deleted.
 179 (WebCore::SVGAnimatedType::createBoolean): Deleted.
 180 (WebCore::SVGAnimatedType::createColor): Deleted.
 181 (WebCore::SVGAnimatedType::createEnumeration): Deleted.
 182 (WebCore::SVGAnimatedType::createInteger): Deleted.
 183 (WebCore::SVGAnimatedType::createIntegerOptionalInteger): Deleted.
 184 (WebCore::SVGAnimatedType::createLength): Deleted.
 185 (WebCore::SVGAnimatedType::createLengthList): Deleted.
 186 (WebCore::SVGAnimatedType::createNumber): Deleted.
 187 (WebCore::SVGAnimatedType::createNumberList): Deleted.
 188 (WebCore::SVGAnimatedType::createNumberOptionalNumber): Deleted.
 189 (WebCore::SVGAnimatedType::createPath): Deleted.
 190 (WebCore::SVGAnimatedType::createPointList): Deleted.
 191 (WebCore::SVGAnimatedType::createPreserveAspectRatio): Deleted.
 192 (WebCore::SVGAnimatedType::createRect): Deleted.
 193 (WebCore::SVGAnimatedType::createString): Deleted.
 194 (WebCore::SVGAnimatedType::createTransformList): Deleted.
 195 (WebCore::SVGAnimatedType::valueAsString): Deleted.
 196 (WebCore::SVGAnimatedType::setValueAsString): Deleted.
 197
 198 * svg/SVGAnimatedType.h:
 199 (WebCore::SVGAnimatedType::SVGAnimatedType): Template constructors to construct a SVGAnimatedType.
 200 (WebCore::SVGAnimatedType::create): Template functions to create a SVGAnimatedType.
 201 (WebCore::SVGAnimatedType::property): Template functions to return the stored property.
 202 (WebCore::SVGAnimatedType::properties): Template functions to return the stored pair properties.
 203 (WebCore::SVGAnimatedType::type): Deleted.
 204 (WebCore::SVGAnimatedType::angleAndEnumeration): Deleted.
 205 (WebCore::SVGAnimatedType::boolean): Deleted.
 206 (WebCore::SVGAnimatedType::color): Deleted.
 207 (WebCore::SVGAnimatedType::enumeration): Deleted.
 208 (WebCore::SVGAnimatedType::integer): Deleted.
 209 (WebCore::SVGAnimatedType::integerOptionalInteger): Deleted.
 210 (WebCore::SVGAnimatedType::length): Deleted.
 211 (WebCore::SVGAnimatedType::lengthList): Deleted.
 212 (WebCore::SVGAnimatedType::number): Deleted.
 213 (WebCore::SVGAnimatedType::numberList): Deleted.
 214 (WebCore::SVGAnimatedType::numberOptionalNumber): Deleted.
 215 (WebCore::SVGAnimatedType::path): Deleted.
 216 (WebCore::SVGAnimatedType::pointList): Deleted.
 217 (WebCore::SVGAnimatedType::preserveAspectRatio): Deleted.
 218 (WebCore::SVGAnimatedType::rect): Deleted.
 219 (WebCore::SVGAnimatedType::string): Deleted.
 220 (WebCore::SVGAnimatedType::transformList): Deleted.
 221
 222 * svg/SVGAnimatedTypeAnimator.h:
 223 (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue): Create a RefPtr<SVGAnimatedValue> from
 224 the currentBaseValue and use this pointer to create an std::unique_ptr<SVGAnimatedType>.
 225 (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue): No need for the SVGAnimatedType getter
 226 because the ContentType of the TearOff object can be used to get the property from the SVGAnimatedType.
 227 (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues): Create two RefPtr<SVGAnimatedValue>
 228 from the currentBaseValues and use these pair pointers to create an std::unique_ptr<SVGAnimatedType>.
 229 (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): No need for the SVGAnimatedType getter
 230 because the ContentType of the TearOff object can be used to get the properties from the SVGAnimatedType.
 231 (WebCore::SVGAnimatedTypeAnimator::executeAction): Rename the argument name.
 232
 233 * svg/SVGAnimatedValue.h: Added.
 234 (WebCore::SVGAnimatedValue::create): Template functions to create an SVGAnimatedValue.
 235 (WebCore::SVGAnimatedValue::is): A template function to return the data type of an SVGAnimatedValue.
 236 (WebCore::SVGAnimatedValue::property): Template functions to return the data of an SVGAnimatedValue.
 237 (WebCore::SVGAnimatedValue::toString): A template function to return value an SVGAnimatedValue as an String.
 238 (WebCore::SVGAnimatedValue::parse): A template function to change value an SVGAnimatedValue.
 239 (WebCore::SVGAnimatedValue::SVGAnimatedValue): Template constructors to construct an SVGAnimatedValue.
 240
 241 * svg/SVGLengthListValues.h:
 242 (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString):
 243 (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse):
 244 Add functions to SVGPropertyTraits<SVGLengthListValues>.
 245
 246 * svg/SVGLengthValue.h:
 247 (WebCore::SVGPropertyTraits<SVGLengthValue>::parse):
 248 (WebCore::SVGPropertyTraits<SVGLengthValue>::toString):
 249 Add functions to SVGPropertyTraits<SVGLengthValue>.
 250
 251 * svg/SVGMarkerElement.h:
 252 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
 253 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
 254 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
 255 (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
 256 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
 257 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
 258 * svg/SVGMarkerTypes.h: Added.
 259 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
 260 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
 261 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
 262 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
 263 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
 264 (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
 265 Move these SVGPropertyTraits to a separate file because we want to add a new
 266 SVGPropertyTraits for the pair <SVGAngleValue, unsigned>.
 267
 268 * svg/SVGNumberListValues.h:
 269 (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString):
 270 (WebCore::SVGPropertyTraits<SVGNumberListValues>::toString):
 271 Add functions to SVGPropertyTraits<SVGNumberListValues>.
 272
 273 * svg/SVGPathByteStream.h:
 274 (WebCore::SVGPathByteStream::SVGPathByteStream):
 275 (WebCore::SVGPathByteStream::operator=):
 276 Add copy and move semantics.
 277
 278 (WebCore::SVGPathByteStream::operator==):
 279 (WebCore::SVGPathByteStream::operator!=):
 280 (WebCore::SVGPathByteStream::copy):
 281 (WebCore::SVGPathByteStream::append):
 282 (WebCore::SVGPathByteStream::clear):
 283 (WebCore::SVGPathByteStream::isEmpty):
 284 Minor clean-up.
 285
 286 (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue):
 287 (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString):
 288 Add functions to SVGPropertyTraits<SVGPathByteStream>.
 289
 290 * svg/SVGPathUtilities.cpp:
 291 (WebCore::addToSVGPathByteStream): Use SVGPathByteStream move semantics.
 292
 293 * svg/SVGPointListValues.h:
 294 (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString):
 295 Add functions to SVGPropertyTraits<SVGPointListValues>.
 296
 297 * svg/SVGPreserveAspectRatioValue.cpp:
 298 (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue):
 299 Add a constructor which takes a string to be used by
 300 SVGPropertyTraits<SVGPreserveAspectRatioValue>.
 301
 302 * svg/SVGPreserveAspectRatioValue.h:
 303 (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString):
 304 Add functions to SVGPropertyTraits<SVGPreserveAspectRatioValue>.
 305
 306 * svg/SVGRect.h:
 307 * svg/SVGRectTraits.h: Removed.
 308 Move SVGPropertyTraits<FloatRect> from SVGRectTraits.h to SVGPropertyTraits.h
 309 since it includes the SVGPropertyTraits for the non SVG types.
 310
 311 * svg/SVGTransformListValues.h:
 312 (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString):
 313 Add functions to SVGPropertyTraits<SVGTransformListValues>.
 314
 315 * svg/properties/SVGPropertyTraits.h:
 316 (WebCore::SVGPropertyTraits<bool>::fromString):
 317 (WebCore::SVGPropertyTraits<Color>::initialValue):
 318 (WebCore::SVGPropertyTraits<Color>::fromString):
 319 (WebCore::SVGPropertyTraits<Color>::parse):
 320 (WebCore::SVGPropertyTraits<Color>::toString):
 321 (WebCore::SVGPropertyTraits<int>::fromString):
 322 (WebCore::SVGPropertyTraits<float>::fromString):
 323 (WebCore::SVGPropertyTraits<float>::parse):
 324 (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
 325 (WebCore::SVGPropertyTraits<FloatRect>::fromString):
 326 (WebCore::SVGPropertyTraits<FloatRect>::parse):
 327 (WebCore::SVGPropertyTraits<FloatRect>::toString):
 328 (WebCore::SVGPropertyTraits<String>::fromString):
 329 (WebCore::SVGPropertyTraits<String>::parse):
 330 (WebCore::SVGPropertyTraits<String>::toString):
 331 Add functions to the SVGPropertyTraits for non SVG types.
 332
13332017-02-21 Chris Dumez <cdumez@apple.com>
2334
3335 REGRESSION (203941): iAd Producer: Clicking buttons in Preview does not work
212773

Source/WebCore/WebCore.xcodeproj/project.pbxproj

23222322 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
23232323 555B87EC1CAAF0AB00349425 /* ImageDecoderCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */; };
23242324 555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */; };
 2325 5575056D1E53B30C008DE30A /* SVGMarkerTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5575056C1E53B30C008DE30A /* SVGMarkerTypes.h */; };
23252326 5576A5641D88A70800CCC04C /* ImageFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5576A5621D88A70800CCC04C /* ImageFrame.cpp */; };
23262327 5576A5651D88A70800CCC04C /* ImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 5576A5631D88A70800CCC04C /* ImageFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
23272328 5597F8261D91C3130066BC21 /* ImageFrameCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5597F8241D91C3130066BC21 /* ImageFrameCache.cpp */; };
23282329 5597F8271D91C3130066BC21 /* ImageFrameCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5597F8251D91C3130066BC21 /* ImageFrameCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
23292330 55A336F71D8209F40022C4C7 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; };
23302331 55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
 2332 55E44AE11E4BFBC50092457B /* SVGAnimatedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 55E44AE01E4BFBC50092457B /* SVGAnimatedValue.h */; };
23312333 570440531E5278B200356601 /* CryptoAlgorithmAES_CFB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5712526A1E52527C008FF369 /* CryptoAlgorithmAES_CFB.cpp */; };
23322334 570440581E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */; };
23332335 5704405A1E53936200356601 /* JSAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 570440591E53936200356601 /* JSAesCbcCfbParams.h */; };

29712973 7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */; };
29722974 7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; };
29732975 7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
2974  7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */; };
29752976 7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
29762977 7CE58D541DD7D6E200128552 /* SVGLengthValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */; };
29772978 7CE58D571DD7D96D00128552 /* SVGTransformValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE58D551DD7D96D00128552 /* SVGTransformValue.cpp */; };

47664767 B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B80D00BF200071B782 /* SVGMPathElement.h */; };
47674768 B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278BB0D00BF200071B782 /* SVGNumberList.h */; settings = {ATTRIBUTES = (Private, ); }; };
47684769 B2227A560D00BF220071B782 /* SVGParserUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278C00D00BF200071B782 /* SVGParserUtilities.cpp */; };
4769  B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C10D00BF200071B782 /* SVGParserUtilities.h */; };
 4770 B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C10D00BF200071B782 /* SVGParserUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
47704771 B2227A580D00BF220071B782 /* SVGPathElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278C20D00BF200071B782 /* SVGPathElement.cpp */; };
47714772 B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C30D00BF200071B782 /* SVGPathElement.h */; };
47724773 B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C50D00BF200071B782 /* SVGPathSeg.h */; };

54355436 BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D6E2509AF943500F59759 /* ScrollView.h */; settings = {ATTRIBUTES = (Private, ); }; };
54365437 BC74DA371013F3F7007987AD /* RGBColor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC74DA351013F3F7007987AD /* RGBColor.h */; settings = {ATTRIBUTES = (Private, ); }; };
54375438 BC74DA381013F3F7007987AD /* RGBColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC74DA361013F3F7007987AD /* RGBColor.cpp */; };
5438  BC76AC130DD7AD5C00415F34 /* ParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = BC76AC110DD7AD5C00415F34 /* ParserUtilities.h */; };
 5439 BC76AC130DD7AD5C00415F34 /* ParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = BC76AC110DD7AD5C00415F34 /* ParserUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
54395440 BC772B3C0C4EA91E0083285F /* CSSHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = BC772B360C4EA91E0083285F /* CSSHelper.h */; settings = {ATTRIBUTES = (Private, ); }; };
54405441 BC772C460C4EB2C60083285F /* XMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC772C440C4EB2C60083285F /* XMLHttpRequest.cpp */; };
54415442 BC772C470C4EB2C60083285F /* XMLHttpRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BC772C450C4EB2C60083285F /* XMLHttpRequest.h */; };

96849685 550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
96859686 555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDecoderCG.cpp; sourceTree = "<group>"; };
96869687 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDecoderCG.h; sourceTree = "<group>"; };
 9688 5575056C1E53B30C008DE30A /* SVGMarkerTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerTypes.h; sourceTree = "<group>"; };
96879689 5576A5621D88A70800CCC04C /* ImageFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrame.cpp; sourceTree = "<group>"; };
96889690 5576A5631D88A70800CCC04C /* ImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFrame.h; sourceTree = "<group>"; };
96899691 5597F8241D91C3130066BC21 /* ImageFrameCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrameCache.cpp; sourceTree = "<group>"; };

96919693 55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };
96929694 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBackingStore.h; sourceTree = "<group>"; };
96939695 55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; };
 9696 55E44AE01E4BFBC50092457B /* SVGAnimatedValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedValue.h; sourceTree = "<group>"; };
96949697 570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; };
96959698 570440591E53936200356601 /* JSAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcCfbParams.h; sourceTree = "<group>"; };
96969699 5704405B1E53937900356601 /* JSAesCbcCfbParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesCbcCfbParams.cpp; sourceTree = "<group>"; };

1062110624 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderAttachment.cpp; sourceTree = "<group>"; };
1062210625 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderAttachment.h; sourceTree = "<group>"; };
1062310626 7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = "<group>"; };
10624  7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectTraits.h; sourceTree = "<group>"; };
1062510627 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = "<group>"; };
1062610628 7CE58D511DD7B09300128552 /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = "<group>"; };
1062710629 7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthValue.cpp; sourceTree = "<group>"; };

2149121493 439D334013A6911C00C20F4F /* SVGAnimatedType.h */,
2149221494 836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */,
2149321495 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */,
 21496 55E44AE01E4BFBC50092457B /* SVGAnimatedValue.h */,
2149421497 B22277F90D00BF1F0071B782 /* SVGAnimateElement.cpp */,
2149521498 B22277FA0D00BF1F0071B782 /* SVGAnimateElement.h */,
2149621499 B22277FB0D00BF1F0071B782 /* SVGAnimateElement.idl */,

2182921832 B22279070D00BF210071B782 /* SVGRectElement.cpp */,
2183021833 B22279080D00BF210071B782 /* SVGRectElement.h */,
2183121834 B22279090D00BF210071B782 /* SVGRectElement.idl */,
21832  7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */,
2183321835 B222790A0D00BF210071B782 /* SVGRenderingIntent.h */,
2183421836 B222790B0D00BF210071B782 /* SVGRenderingIntent.idl */,
2183521837 B222790C0D00BF210071B782 /* SVGScriptElement.cpp */,

2192121923 B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */,
2192221924 B2E4EC960D00C22B00432643 /* SVGZoomEvent.idl */,
2192321925 B28C6A260D00C44800334AA4 /* xlinkattrs.in */,
 21926 5575056C1E53B30C008DE30A /* SVGMarkerTypes.h */,
2192421927 );
2192521928 path = svg;
2192621929 sourceTree = "<group>";

2555725560 A584FE2618637DAB00843B10 /* CommandLineAPIModuleSource.h in Headers */,
2555825561 6550B6A2099DF0270090D781 /* Comment.h in Headers */,
2555925562 E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */,
 25563 5575056D1E53B30C008DE30A /* SVGMarkerTypes.h in Headers */,
2556025564 0F60F32B1DFBB10700416D6C /* CommonVM.h in Headers */,
2556125565 7C93F34A1AA6BA5E00A98BAB /* CompiledContentExtension.h in Headers */,
2556225566 C2F4E78C1E45C3EF006D7105 /* ComplexTextController.h in Headers */,

2841728421 B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */,
2841828422 08EDE19F12A50B8E00B95797 /* SVGRect.h in Headers */,
2841928423 B2227A9E0D00BF220071B782 /* SVGRectElement.h in Headers */,
28420  7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */,
2842128424 197B180C1506353200E4ADA8 /* SVGRenderingContext.h in Headers */,
2842228425 B2227AA00D00BF220071B782 /* SVGRenderingIntent.h in Headers */,
2842328426 BC2274790E8366E200E7F975 /* SVGRenderStyle.h in Headers */,

2863228635 BCA2B061105047600043BD1C /* UserScript.h in Headers */,
2863328636 BCA2B08B10505BCD0043BD1C /* UserScriptTypes.h in Headers */,
2863428637 BC8BF151105813BF00A40A07 /* UserStyleSheet.h in Headers */,
 28638 55E44AE11E4BFBC50092457B /* SVGAnimatedValue.h in Headers */,
2863528639 BC8BF15A1058141800A40A07 /* UserStyleSheetTypes.h in Headers */,
2863628640 BCDF317C11F8D683003C5BF8 /* UserTypingGestureIndicator.h in Headers */,
2863728641 1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */,
212773

Source/WebCore/svg/SVGAnimateElementBase.cpp

@@void SVGAnimateElementBase::resetAnimate
229229 if (!m_animatedType)
230230 m_animatedType = animator->constructFromString(baseValue);
231231 else
232  m_animatedType->setValueAsString(attributeName, baseValue);
 232 m_animatedType->parse(attributeName, baseValue);
233233}
234234
235235static inline void applyCSSPropertyToTarget(SVGElement& targetElement, CSSPropertyID id, const String& value)

@@void SVGAnimateElementBase::applyResults
349349 if (m_animatedProperties.isEmpty()) {
350350 // CSS properties animation code-path.
351351 // Convert the result of the animation to a String and apply it as CSS property on the target & all instances.
352  applyCSSPropertyToTargetAndInstances(*targetElement, attributeName, m_animatedType->valueAsString());
 352 applyCSSPropertyToTargetAndInstances(*targetElement, attributeName, m_animatedType->toString());
353353 return;
354354 }
355355
356356 // We do update the style and the animation property independent of each other.
357357 ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attributeName);
358358 if (shouldApply == ApplyXMLandCSSAnimation)
359  applyCSSPropertyToTargetAndInstances(*targetElement, attributeName, m_animatedType->valueAsString());
 359 applyCSSPropertyToTargetAndInstances(*targetElement, attributeName, m_animatedType->toString());
360360
361361 // SVG DOM animVal animation code-path.
362362 // At this point the SVG DOM values are already changed, unlike for CSS.
212773

Source/WebCore/svg/SVGAnimatedAngle.cpp

@@SVGAnimatedAngleAnimator::SVGAnimatedAng
3232
3333std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::constructFromString(const String& string)
3434{
35  auto animatedType = SVGAnimatedType::createAngleAndEnumeration(std::make_unique<std::pair<SVGAngleValue, unsigned>>());
36  auto& animatedPair = animatedType->angleAndEnumeration();
37 
38  SVGAngleValue angle;
39  SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(string, angle);
40  if (orientType > 0)
41  animatedPair.second = orientType;
42  if (orientType == SVGMarkerOrientAngle)
43  animatedPair.first = angle;
44 
45  return animatedType;
 35 return SVGAnimatedType::create(SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>>::fromString(string));
4636}
4737
4838std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4939{
50  return SVGAnimatedType::createAngleAndEnumeration(constructFromBaseValues<SVGAnimatedAngle, SVGAnimatedEnumeration>(animatedTypes));
 40 return constructFromBaseValues<SVGAnimatedAngle, SVGAnimatedEnumeration>(animatedTypes);
5141}
5242
5343void SVGAnimatedAngleAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedAngleAnimator::stopAnimV
5747
5848void SVGAnimatedAngleAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5949{
60  resetFromBaseValues<SVGAnimatedAngle, SVGAnimatedEnumeration>(animatedTypes, type, &SVGAnimatedType::angleAndEnumeration);
 50 resetFromBaseValues<SVGAnimatedAngle, SVGAnimatedEnumeration>(animatedTypes, type);
6151}
6252
6353void SVGAnimatedAngleAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedAngleAnimator::addAnimat
7565 ASSERT(from->type() == AnimatedAngle);
7666 ASSERT(from->type() == to->type());
7767
78  const auto& fromAngleAndEnumeration = from->angleAndEnumeration();
79  auto& toAngleAndEnumeration = to->angleAndEnumeration();
 68 const auto fromAngleAndEnumeration = from->properties<SVGAngleValue, unsigned>();
 69 auto toAngleAndEnumeration = to->properties<SVGAngleValue, unsigned>();
8070 // Only respect by animations, if from and by are both specified in angles (and not eg. 'auto').
8171 if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second || fromAngleAndEnumeration.second != SVGMarkerOrientAngle)
8272 return;

@@void SVGAnimatedAngleAnimator::calculate
9080 ASSERT(m_animationElement);
9181 ASSERT(m_contextElement);
9282
93  const auto& fromAngleAndEnumeration = m_animationElement->animationMode() == ToAnimation ? animated->angleAndEnumeration() : from->angleAndEnumeration();
94  auto& toAngleAndEnumeration = to->angleAndEnumeration();
95  auto& toAtEndOfDurationAngleAndEnumeration = toAtEndOfDuration->angleAndEnumeration();
96  auto& animatedAngleAndEnumeration = animated->angleAndEnumeration();
 83 const auto fromAngleAndEnumeration = m_animationElement->animationMode() == ToAnimation ? animated->properties<SVGAngleValue, unsigned>() : from->properties<SVGAngleValue, unsigned>();
 84 auto toAngleAndEnumeration = to->properties<SVGAngleValue, unsigned>();
 85 auto toAtEndOfDurationAngleAndEnumeration = toAtEndOfDuration->properties<SVGAngleValue, unsigned>();
 86 auto animatedAngleAndEnumeration = animated->properties<SVGAngleValue, unsigned>();
9787
9888 if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second) {
9989 // Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
212773

Source/WebCore/svg/SVGAnimatedBoolean.cpp

@@SVGAnimatedBooleanAnimator::SVGAnimatedB
3131
3232std::unique_ptr<SVGAnimatedType> SVGAnimatedBooleanAnimator::constructFromString(const String& string)
3333{
34  auto animatedType = SVGAnimatedType::createBoolean(std::make_unique<bool>());
35  animatedType->boolean() = (string == "true"); // wat?
36  return animatedType;
 34 return SVGAnimatedType::create(SVGPropertyTraits<bool>::fromString(string));
3735}
3836
3937std::unique_ptr<SVGAnimatedType> SVGAnimatedBooleanAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4038{
41  return SVGAnimatedType::createBoolean(constructFromBaseValue<SVGAnimatedBoolean>(animatedTypes));
 39 return constructFromBaseValue<SVGAnimatedBoolean>(animatedTypes);
4240}
4341
4442void SVGAnimatedBooleanAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedBooleanAnimator::stopAni
4846
4947void SVGAnimatedBooleanAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5048{
51  resetFromBaseValue<SVGAnimatedBoolean>(animatedTypes, type, &SVGAnimatedType::boolean);
 49 resetFromBaseValue<SVGAnimatedBoolean>(animatedTypes, type);
5250}
5351
5452void SVGAnimatedBooleanAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedBooleanAnimator::calcula
7169 ASSERT(m_animationElement);
7270 ASSERT(m_contextElement);
7371
74  bool fromBoolean = m_animationElement->animationMode() == ToAnimation ? animated->boolean() : from->boolean();
75  bool toBoolean = to->boolean();
76  bool& animatedBoolean = animated->boolean();
 72 bool fromBoolean = m_animationElement->animationMode() == ToAnimation ? animated->property<bool>() : from->property<bool>();
 73 bool toBoolean = to->property<bool>();
 74 bool& animatedBoolean = animated->property<bool>();
7775
7876 m_animationElement->animateDiscreteType<bool>(percentage, fromBoolean, toBoolean, animatedBoolean);
7977}
212773

Source/WebCore/svg/SVGAnimatedColor.cpp

@@SVGAnimatedColorAnimator::SVGAnimatedCol
3333
3434std::unique_ptr<SVGAnimatedType> SVGAnimatedColorAnimator::constructFromString(const String& string)
3535{
36  return SVGAnimatedType::createColor(std::make_unique<Color>(CSSParser::parseColor(string.stripWhiteSpace())));
 36 return SVGAnimatedType::create(SVGPropertyTraits<Color>::fromString(string));
3737}
3838
3939void SVGAnimatedColorAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)

@@void SVGAnimatedColorAnimator::addAnimat
4444 ASSERT(to->type() == AnimatedColor);
4545
4646 // Ignores any alpha and sets alpha on result to 100% opaque.
47  auto& fromColor = from->color();
48  auto& toColor = to->color();
 47 auto& fromColor = from->property<Color>();
 48 auto& toColor = to->property<Color>();
4949 toColor = { roundAndClampColorChannel(toColor.red() + fromColor.red()),
5050 roundAndClampColorChannel(toColor.green() + fromColor.green()),
5151 roundAndClampColorChannel(toColor.blue() + fromColor.blue()) };

@@void SVGAnimatedColorAnimator::calculate
6969 ASSERT(m_animationElement);
7070 ASSERT(m_contextElement);
7171
72  Color fromColor = m_animationElement->animationMode() == ToAnimation ? animated->color() : from->color();
73  Color toColor = to->color();
 72 Color fromColor = m_animationElement->animationMode() == ToAnimation ? animated->property<Color>() : from->property<Color>();
 73 Color toColor = to->property<Color>();
7474
7575 // Apply CSS inheritance rules.
7676 m_animationElement->adjustForInheritance<Color>(parseColorFromString, m_animationElement->fromPropertyValueType(), fromColor, m_contextElement);

@@void SVGAnimatedColorAnimator::calculate
8282 if (m_animationElement->toPropertyValueType() == CurrentColorValue)
8383 toColor = currentColor(*m_contextElement);
8484
85  auto& toAtEndOfDurationColor = toAtEndOfDuration->color();
86  auto& animatedColor = animated->color();
 85 auto& toAtEndOfDurationColor = toAtEndOfDuration->property<Color>();
 86 auto& animatedColor = animated->property<Color>();
8787
8888 // FIXME: ExtendedColor - this will need to handle blending between colors in different color spaces,
8989 // as well as work with non [0-255] Colors.
212773

Source/WebCore/svg/SVGAnimatedEnumeration.cpp

@@SVGAnimatedEnumerationAnimator::SVGAnima
109109std::unique_ptr<SVGAnimatedType> SVGAnimatedEnumerationAnimator::constructFromString(const String& string)
110110{
111111 ASSERT(m_animationElement);
112  auto animatedType = SVGAnimatedType::createEnumeration(std::make_unique<unsigned>());
113  animatedType->enumeration() = enumerationValueForTargetAttribute(m_animationElement->targetElement(), m_animationElement->attributeName(), string);
114  return animatedType;
 112 return SVGAnimatedType::create(enumerationValueForTargetAttribute(m_animationElement->targetElement(), m_animationElement->attributeName(), string));
115113}
116114
117115std::unique_ptr<SVGAnimatedType> SVGAnimatedEnumerationAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
118116{
119  return SVGAnimatedType::createEnumeration(constructFromBaseValue<SVGAnimatedEnumeration>(animatedTypes));
 117 return constructFromBaseValue<SVGAnimatedEnumeration>(animatedTypes);
120118}
121119
122120void SVGAnimatedEnumerationAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedEnumerationAnimator::sto
126124
127125void SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
128126{
129  resetFromBaseValue<SVGAnimatedEnumeration>(animatedTypes, type, &SVGAnimatedType::enumeration);
 127 resetFromBaseValue<SVGAnimatedEnumeration>(animatedTypes, type);
130128}
131129
132130void SVGAnimatedEnumerationAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedEnumerationAnimator::cal
149147 ASSERT(m_animationElement);
150148 ASSERT(m_contextElement);
151149
152  unsigned fromEnumeration = m_animationElement->animationMode() == ToAnimation ? animated->enumeration() : from->enumeration();
153  unsigned toEnumeration = to->enumeration();
154  unsigned& animatedEnumeration = animated->enumeration();
 150 unsigned fromEnumeration = m_animationElement->animationMode() == ToAnimation ? animated->property<unsigned>() : from->property<unsigned>();
 151 unsigned toEnumeration = to->property<unsigned>();
 152 unsigned& animatedEnumeration = animated->property<unsigned>();
155153
156154 m_animationElement->animateDiscreteType<unsigned>(percentage, fromEnumeration, toEnumeration, animatedEnumeration);
157155}
212773

Source/WebCore/svg/SVGAnimatedInteger.cpp

@@SVGAnimatedIntegerAnimator::SVGAnimatedI
3333
3434std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerAnimator::constructFromString(const String& string)
3535{
36  auto animatedType = SVGAnimatedType::createInteger(std::make_unique<int>());
37  animatedType->integer() = string.toIntStrict();
38  return animatedType;
 36 return SVGAnimatedType::create(SVGPropertyTraits<int>::fromString(string));
3937}
4038
4139std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4240{
43  return SVGAnimatedType::createInteger(constructFromBaseValue<SVGAnimatedInteger>(animatedTypes));
 41 return constructFromBaseValue<SVGAnimatedInteger>(animatedTypes);
4442}
4543
4644void SVGAnimatedIntegerAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedIntegerAnimator::stopAni
5048
5149void SVGAnimatedIntegerAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5250{
53  resetFromBaseValue<SVGAnimatedInteger>(animatedTypes, type, &SVGAnimatedType::integer);
 51 resetFromBaseValue<SVGAnimatedInteger>(animatedTypes, type);
5452}
5553
5654void SVGAnimatedIntegerAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedIntegerAnimator::addAnim
6866 ASSERT(from->type() == AnimatedInteger);
6967 ASSERT(from->type() == to->type());
7068
71  to->integer() += from->integer();
 69 to->property<int>() += from->property<int>();
7270}
7371
7472void SVGAnimatedIntegerAnimator::calculateAnimatedInteger(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, int fromInteger, int toInteger, int toAtEndOfDurationInteger, int& animatedInteger)

@@void SVGAnimatedIntegerAnimator::calcula
8381 ASSERT(m_animationElement);
8482 ASSERT(m_contextElement);
8583
86  int fromInteger = m_animationElement->animationMode() == ToAnimation ? animated->integer() : from->integer();
87  int toInteger = to->integer();
88  int toAtEndOfDurationInteger = toAtEndOfDuration->integer();
89  int& animatedInteger = animated->integer();
 84 int fromInteger = m_animationElement->animationMode() == ToAnimation ? animated->property<int>() : from->property<int>();
 85 int toInteger = to->property<int>();
 86 int toAtEndOfDurationInteger = toAtEndOfDuration->property<int>();
 87 int& animatedInteger = animated->property<int>();
9088
9189 calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromInteger, toInteger, toAtEndOfDurationInteger, animatedInteger);
9290}
212773

Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp

@@SVGAnimatedIntegerOptionalIntegerAnimato
3333
3434std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString(const String& string)
3535{
36  auto animatedType = SVGAnimatedType::createIntegerOptionalInteger(std::make_unique<std::pair<int, int>>());
37  std::pair<int, int>& animatedInteger = animatedType->integerOptionalInteger();
38  float firstNumber = 0;
39  float secondNumber = 0;
40  if (!parseNumberOptionalNumber(string, firstNumber, secondNumber)) {
41  animatedInteger.first = 0;
42  animatedInteger.second = 0;
43  } else {
44  animatedInteger.first = static_cast<int>(roundf(firstNumber));
45  animatedInteger.second = static_cast<int>(roundf(secondNumber));
46  }
47  return animatedType;
 36 return SVGAnimatedType::create(SVGPropertyTraits<std::pair<int, int>>::fromString(string));
4837}
4938
5039std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
5140{
52  return SVGAnimatedType::createIntegerOptionalInteger(constructFromBaseValues<SVGAnimatedInteger, SVGAnimatedInteger>(animatedTypes));
 41 return constructFromBaseValues<SVGAnimatedInteger, SVGAnimatedInteger>(animatedTypes);
5342}
5443
5544void SVGAnimatedIntegerOptionalIntegerAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedIntegerOptionalIntegerAn
5948
6049void SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
6150{
62  resetFromBaseValues<SVGAnimatedInteger, SVGAnimatedInteger>(animatedTypes, type, &SVGAnimatedType::integerOptionalInteger);
 51 resetFromBaseValues<SVGAnimatedInteger, SVGAnimatedInteger>(animatedTypes, type);
6352}
6453
6554void SVGAnimatedIntegerOptionalIntegerAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedIntegerOptionalIntegerAn
7766 ASSERT(from->type() == AnimatedIntegerOptionalInteger);
7867 ASSERT(from->type() == to->type());
7968
80  const std::pair<int, int>& fromIntegerPair = from->integerOptionalInteger();
81  std::pair<int, int>& toIntegerPair = to->integerOptionalInteger();
 69 const std::pair<int&, int&> fromIntegerPair = from->properties<int, int>();
 70 std::pair<int&, int&> toIntegerPair = to->properties<int, int>();
8271
8372 toIntegerPair.first += fromIntegerPair.first;
8473 toIntegerPair.second += fromIntegerPair.second;

@@void SVGAnimatedIntegerOptionalIntegerAn
8978 ASSERT(m_animationElement);
9079 ASSERT(m_contextElement);
9180
92  const std::pair<int, int>& fromIntegerPair = m_animationElement->animationMode() == ToAnimation ? animated->integerOptionalInteger() : from->integerOptionalInteger();
93  const std::pair<int, int>& toIntegerPair = to->integerOptionalInteger();
94  const std::pair<int, int>& toAtEndOfDurationIntegerPair = toAtEndOfDuration->integerOptionalInteger();
95  std::pair<int, int>& animatedIntegerPair = animated->integerOptionalInteger();
 81 const std::pair<int&, int&> fromIntegerPair = m_animationElement->animationMode() == ToAnimation ? animated->properties<int, int>() : from->properties<int, int>();
 82 const std::pair<int&, int&> toIntegerPair = to->properties<int, int>();
 83 const std::pair<int&, int&> toAtEndOfDurationIntegerPair = toAtEndOfDuration->properties<int, int>();
 84 std::pair<int&, int&> animatedIntegerPair = animated->properties<int, int>();
9685
9786 SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.first, toIntegerPair.first, toAtEndOfDurationIntegerPair.first, animatedIntegerPair.first);
9887 SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.second, toIntegerPair.second, toAtEndOfDurationIntegerPair.second, animatedIntegerPair.second);
212773

Source/WebCore/svg/SVGAnimatedLength.cpp

@@SVGAnimatedLengthAnimator::SVGAnimatedLe
3434
3535std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string)
3636{
37  return SVGAnimatedType::createLength(std::make_unique<SVGLengthValue>(m_lengthMode, string));
 37 return SVGAnimatedType::create(SVGLengthValue(m_lengthMode, string));
3838}
3939
4040std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4141{
42  return SVGAnimatedType::createLength(constructFromBaseValue<SVGAnimatedLength>(animatedTypes));
 42 return constructFromBaseValue<SVGAnimatedLength>(animatedTypes);
4343}
4444
4545void SVGAnimatedLengthAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedLengthAnimator::stopAnim
4949
5050void SVGAnimatedLengthAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5151{
52  resetFromBaseValue<SVGAnimatedLength>(animatedTypes, type, &SVGAnimatedType::length);
 52 resetFromBaseValue<SVGAnimatedLength>(animatedTypes, type);
5353}
5454
5555void SVGAnimatedLengthAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedLengthAnimator::addAnima
6868 ASSERT(from->type() == to->type());
6969
7070 SVGLengthContext lengthContext(m_contextElement);
71  const auto& fromLength = from->length();
72  auto& toLength = to->length();
 71 const auto& fromLength = from->property<SVGLengthValue>();
 72 auto& toLength = to->property<SVGLengthValue>();
7373
7474 toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext);
7575}

@@void SVGAnimatedLengthAnimator::calculat
8686 ASSERT(m_animationElement);
8787 ASSERT(m_contextElement);
8888
89  auto fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->length() : from->length();
90  auto toSVGLength = to->length();
91  const auto& toAtEndOfDurationSVGLength = toAtEndOfDuration->length();
92  auto& animatedSVGLength = animated->length();
 89 auto fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->property<SVGLengthValue>() : from->property<SVGLengthValue>();
 90 auto toSVGLength = to->property<SVGLengthValue>();
 91 const auto& toAtEndOfDurationSVGLength = toAtEndOfDuration->property<SVGLengthValue>();
 92 auto& animatedSVGLength = animated->property<SVGLengthValue>();
9393
9494 // Apply CSS inheritance rules.
9595 m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
212773

Source/WebCore/svg/SVGAnimatedLengthList.cpp

@@SVGAnimatedLengthListAnimator::SVGAnimat
3333
3434std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::constructFromString(const String& string)
3535{
36  auto animatedType = SVGAnimatedType::createLengthList(std::make_unique<SVGLengthListValues>());
37  animatedType->lengthList().parse(string, m_lengthMode);
38  return animatedType;
 36 return SVGAnimatedType::create(SVGPropertyTraits<SVGLengthListValues>::fromString(string, m_lengthMode));
3937}
4038
4139std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4240{
43  return SVGAnimatedType::createLengthList(constructFromBaseValue<SVGAnimatedLengthList>(animatedTypes));
 41 return constructFromBaseValue<SVGAnimatedLengthList>(animatedTypes);
4442}
4543
4644void SVGAnimatedLengthListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedLengthListAnimator::stop
5048
5149void SVGAnimatedLengthListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5250{
53  resetFromBaseValue<SVGAnimatedLengthList>(animatedTypes, type, &SVGAnimatedType::lengthList);
 51 resetFromBaseValue<SVGAnimatedLengthList>(animatedTypes, type);
5452}
5553
5654void SVGAnimatedLengthListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedLengthListAnimator::addA
6866 ASSERT(from->type() == AnimatedLengthList);
6967 ASSERT(from->type() == to->type());
7068
71  const auto& fromLengthList = from->lengthList();
72  auto& toLengthList = to->lengthList();
 69 const auto& fromLengthList = from->property<SVGLengthListValues>();
 70 auto& toLengthList = to->property<SVGLengthListValues>();
7371
7472 unsigned fromLengthListSize = fromLengthList.size();
7573 if (!fromLengthListSize || fromLengthListSize != toLengthList.size())

@@void SVGAnimatedLengthListAnimator::calc
9290 ASSERT(m_animationElement);
9391 ASSERT(m_contextElement);
9492
95  auto fromLengthList = m_animationElement->animationMode() == ToAnimation ? animated->lengthList() : from->lengthList();
96  auto toLengthList = to->lengthList();
97  const auto& toAtEndOfDurationLengthList = toAtEndOfDuration->lengthList();
98  auto& animatedLengthList = animated->lengthList();
 93 auto fromLengthList = m_animationElement->animationMode() == ToAnimation ? animated->property<SVGLengthListValues>() : from->property<SVGLengthListValues>();
 94 auto toLengthList = to->property<SVGLengthListValues>();
 95 const auto& toAtEndOfDurationLengthList = toAtEndOfDuration->property<SVGLengthListValues>();
 96 auto& animatedLengthList = animated->property<SVGLengthListValues>();
9997
10098 // Apply CSS inheritance rules.
10199 m_animationElement->adjustForInheritance<SVGLengthListValues>(parseLengthListFromString, m_animationElement->fromPropertyValueType(), fromLengthList, m_contextElement);
212773

Source/WebCore/svg/SVGAnimatedNumber.cpp

@@SVGAnimatedNumberAnimator::SVGAnimatedNu
3232
3333std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberAnimator::constructFromString(const String& string)
3434{
35  auto animatedType = SVGAnimatedType::createNumber(std::make_unique<float>());
36  float& animatedNumber = animatedType->number();
37  if (!parseNumberFromString(string, animatedNumber))
38  animatedNumber = 0;
39  return animatedType;
 35 return SVGAnimatedType::create(SVGPropertyTraits<float>::fromString(string));
4036}
4137
4238std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4339{
44  return SVGAnimatedType::createNumber(constructFromBaseValue<SVGAnimatedNumber>(animatedTypes));
 40 return constructFromBaseValue<SVGAnimatedNumber>(animatedTypes);
4541}
4642
4743void SVGAnimatedNumberAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedNumberAnimator::stopAnim
5147
5248void SVGAnimatedNumberAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5349{
54  resetFromBaseValue<SVGAnimatedNumber>(animatedTypes, type, &SVGAnimatedType::number);
 50 resetFromBaseValue<SVGAnimatedNumber>(animatedTypes, type);
5551}
5652
5753void SVGAnimatedNumberAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedNumberAnimator::addAnima
6965 ASSERT(from->type() == AnimatedNumber);
7066 ASSERT(from->type() == to->type());
7167
72  to->number() += from->number();
 68 to->property<float>() += from->property<float>();
7369}
7470
7571static float parseNumberFromString(SVGAnimationElement*, const String& string)
7672{
77  float number = 0;
78  parseNumberFromString(string, number);
79  return number;
 73 return SVGPropertyTraits<float>::fromString(string);
8074}
8175
8276void SVGAnimatedNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)

@@void SVGAnimatedNumberAnimator::calculat
8478 ASSERT(m_animationElement);
8579 ASSERT(m_contextElement);
8680
87  float fromNumber = m_animationElement->animationMode() == ToAnimation ? animated->number() : from->number();
88  float toNumber = to->number();
89  float toAtEndOfDurationNumber = toAtEndOfDuration->number();
90  float& animatedNumber = animated->number();
 81 float fromNumber = m_animationElement->animationMode() == ToAnimation ? animated->property<float>() : from->property<float>();
 82 float toNumber = to->property<float>();
 83 float toAtEndOfDurationNumber = toAtEndOfDuration->property<float>();
 84 float& animatedNumber = animated->property<float>();
9185
9286 // Apply CSS inheritance rules.
9387 m_animationElement->adjustForInheritance<float>(parseNumberFromString, m_animationElement->fromPropertyValueType(), fromNumber, m_contextElement);
212773

Source/WebCore/svg/SVGAnimatedNumberList.cpp

@@SVGAnimatedNumberListAnimator::SVGAnimat
3232
3333std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::constructFromString(const String& string)
3434{
35  auto animatedType = SVGAnimatedType::createNumberList(std::make_unique<SVGNumberListValues>());
36  animatedType->numberList().parse(string);
37  return animatedType;
 35 return SVGAnimatedType::create(SVGPropertyTraits<SVGNumberListValues>::fromString(string));
3836}
3937
4038std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4139{
42  return SVGAnimatedType::createNumberList(constructFromBaseValue<SVGAnimatedNumberList>(animatedTypes));
 40 return constructFromBaseValue<SVGAnimatedNumberList>(animatedTypes);
4341}
4442
4543void SVGAnimatedNumberListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedNumberListAnimator::stop
4947
5048void SVGAnimatedNumberListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5149{
52  resetFromBaseValue<SVGAnimatedNumberList>(animatedTypes, type, &SVGAnimatedType::numberList);
 50 resetFromBaseValue<SVGAnimatedNumberList>(animatedTypes, type);
5351}
5452
5553void SVGAnimatedNumberListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedNumberListAnimator::addA
6765 ASSERT(from->type() == AnimatedNumberList);
6866 ASSERT(from->type() == to->type());
6967
70  const auto& fromNumberList = from->numberList();
71  auto& toNumberList = to->numberList();
 68 const auto& fromNumberList = from->property<SVGNumberListValues>();
 69 auto& toNumberList = to->property<SVGNumberListValues>();
7270
7371 unsigned fromNumberListSize = fromNumberList.size();
7472 if (!fromNumberListSize || fromNumberListSize != toNumberList.size())

@@void SVGAnimatedNumberListAnimator::calc
8280{
8381 ASSERT(m_animationElement);
8482
85  const auto& fromNumberList = m_animationElement->animationMode() == ToAnimation ? animated->numberList() : from->numberList();
86  const auto& toNumberList = to->numberList();
87  const auto& toAtEndOfDurationNumberList = toAtEndOfDuration->numberList();
88  auto& animatedNumberList = animated->numberList();
 83 const auto& fromNumberList = m_animationElement->animationMode() == ToAnimation ? animated->property<SVGNumberListValues>() : from->property<SVGNumberListValues>();
 84 const auto& toNumberList = to->property<SVGNumberListValues>();
 85 const auto& toAtEndOfDurationNumberList = toAtEndOfDuration->property<SVGNumberListValues>();
 86 auto& animatedNumberList = animated->property<SVGNumberListValues>();
8987 if (!m_animationElement->adjustFromToListValues<SVGNumberListValues>(fromNumberList, toNumberList, animatedNumberList, percentage))
9088 return;
9189
212773

Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp

@@SVGAnimatedNumberOptionalNumberAnimator:
3333
3434std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberOptionalNumberAnimator::constructFromString(const String& string)
3535{
36  auto animatedType = SVGAnimatedType::createNumberOptionalNumber(std::make_unique<std::pair<float, float>>());
37  std::pair<float, float>& animatedNumber = animatedType->numberOptionalNumber();
38  if (!parseNumberOptionalNumber(string, animatedNumber.first, animatedNumber.second)) {
39  animatedNumber.first = 0;
40  animatedNumber.second = 0;
41  }
42  return animatedType;
 36 return SVGAnimatedType::create(SVGPropertyTraits<std::pair<float, float>>::fromString(string));
4337}
4438
4539std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4640{
47  return SVGAnimatedType::createNumberOptionalNumber(constructFromBaseValues<SVGAnimatedNumber, SVGAnimatedNumber>(animatedTypes));
 41 return constructFromBaseValues<SVGAnimatedNumber, SVGAnimatedNumber>(animatedTypes);
4842}
4943
5044void SVGAnimatedNumberOptionalNumberAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedNumberOptionalNumberAnim
5448
5549void SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5650{
57  resetFromBaseValues<SVGAnimatedNumber, SVGAnimatedNumber>(animatedTypes, type, &SVGAnimatedType::numberOptionalNumber);
 51 resetFromBaseValues<SVGAnimatedNumber, SVGAnimatedNumber>(animatedTypes, type);
5852}
5953
6054void SVGAnimatedNumberOptionalNumberAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedNumberOptionalNumberAnim
7266 ASSERT(from->type() == AnimatedNumberOptionalNumber);
7367 ASSERT(from->type() == to->type());
7468
75  const std::pair<float, float>& fromNumberPair = from->numberOptionalNumber();
76  std::pair<float, float>& toNumberPair = to->numberOptionalNumber();
 69 const std::pair<float&, float&> fromNumberPair = from->properties<float, float>();
 70 std::pair<float&, float&> toNumberPair = to->properties<float, float>();
7771
7872 toNumberPair.first += fromNumberPair.first;
7973 toNumberPair.second += fromNumberPair.second;

@@void SVGAnimatedNumberOptionalNumberAnim
8478 ASSERT(m_animationElement);
8579 ASSERT(m_contextElement);
8680
87  const std::pair<float, float>& fromNumberPair = m_animationElement->animationMode() == ToAnimation ? animated->numberOptionalNumber() : from->numberOptionalNumber();
88  const std::pair<float, float>& toNumberPair = to->numberOptionalNumber();
89  const std::pair<float, float>& toAtEndOfDurationNumberPair = toAtEndOfDuration->numberOptionalNumber();
90  std::pair<float, float>& animatedNumberPair = animated->numberOptionalNumber();
 81 const std::pair<float&, float&> fromNumberPair = m_animationElement->animationMode() == ToAnimation ? animated->properties<float, float>() : from->properties<float, float>();
 82 const std::pair<float&, float&> toNumberPair = to->properties<float, float>();
 83 const std::pair<float&, float&> toAtEndOfDurationNumberPair = toAtEndOfDuration->properties<float, float>();
 84 std::pair<float&, float&> animatedNumberPair = animated->properties<float, float>();
9185
9286 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.first, toNumberPair.first, toAtEndOfDurationNumberPair.first, animatedNumberPair.first);
9387 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.second, toNumberPair.second, toAtEndOfDurationNumberPair.second, animatedNumberPair.second);
212773

Source/WebCore/svg/SVGAnimatedPath.cpp

2222
2323#include "SVGAnimateElementBase.h"
2424#include "SVGAnimatedPathSegListPropertyTearOff.h"
25 #include "SVGPathUtilities.h"
2625
2726namespace WebCore {
2827

@@SVGAnimatedPathAnimator::SVGAnimatedPath
3332
3433std::unique_ptr<SVGAnimatedType> SVGAnimatedPathAnimator::constructFromString(const String& string)
3534{
36  auto byteStream = std::make_unique<SVGPathByteStream>();
37  buildSVGPathByteStreamFromString(string, *byteStream, UnalteredParsing);
38  return SVGAnimatedType::createPath(WTFMove(byteStream));
 35 return SVGAnimatedType::create(SVGPropertyTraits<SVGPathByteStream>::fromString(string));
3936}
4037
4138std::unique_ptr<SVGAnimatedType> SVGAnimatedPathAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@std::unique_ptr<SVGAnimatedType> SVGAnim
4340 ASSERT(animatedTypes.size() >= 1);
4441
4542 // Build initial path byte stream.
46  auto byteStream = std::make_unique<SVGPathByteStream>();
47  resetAnimValToBaseVal(animatedTypes, byteStream.get());
48  return SVGAnimatedType::createPath(WTFMove(byteStream));
 43 auto animatedType = SVGAnimatedType::create<SVGPathByteStream>();
 44 resetAnimValToBaseVal(animatedTypes, *animatedType);
 45 return animatedType;
4946}
5047
5148void SVGAnimatedPathAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedPathAnimator::resetAnimV
8077{
8178 ASSERT(animatedTypes.size() >= 1);
8279 ASSERT(type.type() == m_type);
83  resetAnimValToBaseVal(animatedTypes, type.path());
 80 resetAnimValToBaseVal(animatedTypes, &type.property<SVGPathByteStream>());
8481}
8582
8683void SVGAnimatedPathAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedPathAnimator::addAnimate
9895 ASSERT(from->type() == AnimatedPath);
9996 ASSERT(from->type() == to->type());
10097
101  SVGPathByteStream* fromPath = from->path();
102  SVGPathByteStream* toPath = to->path();
103  unsigned fromPathSize = fromPath->size();
104  if (!fromPathSize || fromPathSize != toPath->size())
 98 const auto& fromPath = from->property<SVGPathByteStream>();
 99 auto& toPath = to->property<SVGPathByteStream>();
 100 unsigned fromPathSize = fromPath.size();
 101 if (!fromPathSize || fromPathSize != toPath.size())
105102 return;
106  addToSVGPathByteStream(*toPath, *fromPath);
 103 addToSVGPathByteStream(toPath, fromPath);
107104}
108105
109106void SVGAnimatedPathAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)

@@void SVGAnimatedPathAnimator::calculateA
111108 ASSERT(m_animationElement);
112109 ASSERT(m_contextElement);
113110
114  SVGPathByteStream* fromPath = from->path();
115  SVGPathByteStream* toPath = to->path();
116  SVGPathByteStream* toAtEndOfDurationPath = toAtEndOfDuration->path();
117  SVGPathByteStream* animatedPath = animated->path();
 111 auto& fromPath = from->property<SVGPathByteStream>();
 112 auto& toPath = to->property<SVGPathByteStream>();
 113 auto& toAtEndOfDurationPath = toAtEndOfDuration->property<SVGPathByteStream>();
 114 auto& animatedPath = animated->property<SVGPathByteStream>();
118115
119  std::unique_ptr<SVGPathByteStream> underlyingPath;
120116 bool isToAnimation = m_animationElement->animationMode() == ToAnimation;
121  if (isToAnimation) {
122  underlyingPath = animatedPath->copy();
123  fromPath = underlyingPath.get();
124  }
 117 if (isToAnimation)
 118 fromPath = animatedPath;
125119
126120 // Cache the current animated value before the buildAnimatedSVGPathByteStream() clears animatedPath.
127  std::unique_ptr<SVGPathByteStream> lastAnimatedPath;
128  if (!fromPath->size() || (m_animationElement->isAdditive() && !isToAnimation))
129  lastAnimatedPath = animatedPath->copy();
 121 SVGPathByteStream lastAnimatedPath;
 122 if (!fromPath.size() || (m_animationElement->isAdditive() && !isToAnimation))
 123 lastAnimatedPath = animatedPath;
130124
131125 // Pass false to 'resizeAnimatedListIfNeeded' here, as the path animation is not a regular Vector<SVGXXX> type, but a SVGPathByteStream, that works differently.
132  if (!m_animationElement->adjustFromToListValues<SVGPathByteStream>(*fromPath, *toPath, *animatedPath, percentage, false))
 126 if (!m_animationElement->adjustFromToListValues<SVGPathByteStream>(fromPath, toPath, animatedPath, percentage, false))
133127 return;
134128
135  buildAnimatedSVGPathByteStream(*fromPath, *toPath, *animatedPath, percentage);
 129 buildAnimatedSVGPathByteStream(fromPath, toPath, animatedPath, percentage);
136130
137131 // Handle additive='sum'.
138  if (lastAnimatedPath)
139  addToSVGPathByteStream(*animatedPath, *lastAnimatedPath);
 132 if (!lastAnimatedPath.isEmpty())
 133 addToSVGPathByteStream(animatedPath, lastAnimatedPath);
140134
141135 // Handle accumulate='sum'.
142136 if (m_animationElement->isAccumulated() && repeatCount)
143  addToSVGPathByteStream(*animatedPath, *toAtEndOfDurationPath, repeatCount);
 137 addToSVGPathByteStream(animatedPath, toAtEndOfDurationPath, repeatCount);
144138}
145139
146140float SVGAnimatedPathAnimator::calculateDistance(const String&, const String&)
212773

Source/WebCore/svg/SVGAnimatedPointList.cpp

@@SVGAnimatedPointListAnimator::SVGAnimate
3434
3535std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::constructFromString(const String& string)
3636{
37  auto animatedType = SVGAnimatedType::createPointList(std::make_unique<SVGPointListValues>());
38  pointsListFromSVGData(animatedType->pointList(), string);
39  return animatedType;
 37 return SVGAnimatedType::create(SVGPropertyTraits<SVGPointListValues>::fromString(string));
4038}
4139
4240std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4341{
44  return SVGAnimatedType::createPointList(constructFromBaseValue<SVGAnimatedPointList>(animatedTypes));
 42 return constructFromBaseValue<SVGAnimatedPointList>(animatedTypes);
4543}
4644
4745void SVGAnimatedPointListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedPointListAnimator::stopA
5149
5250void SVGAnimatedPointListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5351{
54  resetFromBaseValue<SVGAnimatedPointList>(animatedTypes, type, &SVGAnimatedType::pointList);
 52 resetFromBaseValue<SVGAnimatedPointList>(animatedTypes, type);
5553}
5654
5755void SVGAnimatedPointListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedPointListAnimator::addAn
6967 ASSERT(from->type() == AnimatedPoints);
7068 ASSERT(from->type() == to->type());
7169
72  const auto& fromPointList = from->pointList();
73  auto& toPointList = to->pointList();
 70 const auto& fromPointList = from->property<SVGPointListValues>();
 71 auto& toPointList = to->property<SVGPointListValues>();
7472
7573 unsigned fromPointListSize = fromPointList.size();
7674 if (!fromPointListSize || fromPointListSize != toPointList.size())

@@void SVGAnimatedPointListAnimator::calcu
8482{
8583 ASSERT(m_animationElement);
8684
87  const auto& fromPointList = m_animationElement->animationMode() == ToAnimation ? animated->pointList() : from->pointList();
88  const auto& toPointList = to->pointList();
89  const auto& toAtEndOfDurationPointList = toAtEndOfDuration->pointList();
90  auto& animatedPointList = animated->pointList();
 85 const auto& fromPointList = m_animationElement->animationMode() == ToAnimation ? animated->property<SVGPointListValues>() : from->property<SVGPointListValues>();
 86 const auto& toPointList = to->property<SVGPointListValues>();
 87 const auto& toAtEndOfDurationPointList = toAtEndOfDuration->property<SVGPointListValues>();
 88 auto& animatedPointList = animated->property<SVGPointListValues>();
9189 if (!m_animationElement->adjustFromToListValues<SVGPointListValues>(fromPointList, toPointList, animatedPointList, percentage))
9290 return;
9391
212773

Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp

@@SVGAnimatedPreserveAspectRatioAnimator::
3131
3232std::unique_ptr<SVGAnimatedType> SVGAnimatedPreserveAspectRatioAnimator::constructFromString(const String& string)
3333{
34  auto animatedType = SVGAnimatedType::createPreserveAspectRatio(std::make_unique<SVGPreserveAspectRatioValue>());
35  animatedType->preserveAspectRatio().parse(string);
36  return animatedType;
 34 return SVGAnimatedType::create(SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString(string));
3735}
3836
3937std::unique_ptr<SVGAnimatedType> SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4038{
41  return SVGAnimatedType::createPreserveAspectRatio(constructFromBaseValue<SVGAnimatedPreserveAspectRatio>(animatedTypes));
 39 return constructFromBaseValue<SVGAnimatedPreserveAspectRatio>(animatedTypes);
4240}
4341
4442void SVGAnimatedPreserveAspectRatioAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedPreserveAspectRatioAnima
4846
4947void SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5048{
51  resetFromBaseValue<SVGAnimatedPreserveAspectRatio>(animatedTypes, type, &SVGAnimatedType::preserveAspectRatio);
 49 resetFromBaseValue<SVGAnimatedPreserveAspectRatio>(animatedTypes, type);
5250}
5351
5452void SVGAnimatedPreserveAspectRatioAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedPreserveAspectRatioAnima
7169 ASSERT(m_animationElement);
7270 ASSERT(m_contextElement);
7371
74  const auto& fromPreserveAspectRatio = m_animationElement->animationMode() == ToAnimation ? animated->preserveAspectRatio() : from->preserveAspectRatio();
75  const auto& toPreserveAspectRatio = to->preserveAspectRatio();
76  auto& animatedPreserveAspectRatio = animated->preserveAspectRatio();
 72 const auto& fromPreserveAspectRatio = m_animationElement->animationMode() == ToAnimation ? animated->property<SVGPreserveAspectRatioValue>() : from->property<SVGPreserveAspectRatioValue>();
 73 const auto& toPreserveAspectRatio = to->property<SVGPreserveAspectRatioValue>();
 74 auto& animatedPreserveAspectRatio = animated->property<SVGPreserveAspectRatioValue>();
7775
7876 m_animationElement->animateDiscreteType<SVGPreserveAspectRatioValue>(percentage, fromPreserveAspectRatio, toPreserveAspectRatio, animatedPreserveAspectRatio);
7977}
212773

Source/WebCore/svg/SVGAnimatedRect.cpp

@@SVGAnimatedRectAnimator::SVGAnimatedRect
3232
3333std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::constructFromString(const String& string)
3434{
35  auto animatedType = SVGAnimatedType::createRect(std::make_unique<FloatRect>());
36  parseRect(string, animatedType->rect());
37  return animatedType;
 35 return SVGAnimatedType::create(SVGPropertyTraits<FloatRect>::fromString(string));
3836}
3937
4038std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4139{
42  return SVGAnimatedType::createRect(constructFromBaseValue<SVGAnimatedRect>(animatedTypes));
 40 return constructFromBaseValue<SVGAnimatedRect>(animatedTypes);
4341}
4442
4543void SVGAnimatedRectAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedRectAnimator::stopAnimVa
4947
5048void SVGAnimatedRectAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5149{
52  resetFromBaseValue<SVGAnimatedRect>(animatedTypes, type, &SVGAnimatedType::rect);
 50 resetFromBaseValue<SVGAnimatedRect>(animatedTypes, type);
5351}
5452
5553void SVGAnimatedRectAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedRectAnimator::addAnimate
6765 ASSERT(from->type() == AnimatedRect);
6866 ASSERT(from->type() == to->type());
6967
70  to->rect() += from->rect();
 68 to->property<FloatRect>() += from->property<FloatRect>();
7169}
7270
7371void SVGAnimatedRectAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)

@@void SVGAnimatedRectAnimator::calculateA
7573 ASSERT(m_animationElement);
7674 ASSERT(m_contextElement);
7775
78  const FloatRect& fromRect = m_animationElement->animationMode() == ToAnimation ? animated->rect() : from->rect();
79  const FloatRect& toRect = to->rect();
80  const FloatRect& toAtEndOfDurationRect = toAtEndOfDuration->rect();
81  FloatRect& animatedRect = animated->rect();
 76 const FloatRect& fromRect = m_animationElement->animationMode() == ToAnimation ? animated->property<FloatRect>() : from->property<FloatRect>();
 77 const FloatRect& toRect = to->property<FloatRect>();
 78 const FloatRect& toAtEndOfDurationRect = toAtEndOfDuration->property<FloatRect>();
 79 FloatRect& animatedRect = animated->property<FloatRect>();
8280
8381 float animatedX = animatedRect.x();
8482 float animatedY = animatedRect.y();
212773

Source/WebCore/svg/SVGAnimatedString.cpp

@@SVGAnimatedStringAnimator::SVGAnimatedSt
3131
3232std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const String& string)
3333{
34  auto animatedType = SVGAnimatedType::createString(std::make_unique<String>());
35  animatedType->string() = string;
36  return animatedType;
 34 return SVGAnimatedType::create(SVGPropertyTraits<String>::fromString(string));
3735}
3836
3937std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4038{
41  return SVGAnimatedType::createString(constructFromBaseValue<SVGAnimatedString>(animatedTypes));
 39 return constructFromBaseValue<SVGAnimatedString>(animatedTypes);
4240}
4341
4442void SVGAnimatedStringAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedStringAnimator::stopAnim
4846
4947void SVGAnimatedStringAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5048{
51  resetFromBaseValue<SVGAnimatedString>(animatedTypes, type, &SVGAnimatedType::string);
 49 resetFromBaseValue<SVGAnimatedString>(animatedTypes, type);
5250}
5351
5452void SVGAnimatedStringAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedStringAnimator::calculat
7674 ASSERT(m_animationElement);
7775 ASSERT(m_contextElement);
7876
79  String fromString = from->string();
80  String toString = to->string();
81  String& animatedString = animated->string();
 77 String fromString = from->property<String>();
 78 String toString = to->property<String>();
 79 String& animatedString = animated->property<String>();
8280
8381 // Apply CSS inheritance rules.
8482 m_animationElement->adjustForInheritance<String>(parseStringFromString, m_animationElement->fromPropertyValueType(), fromString, m_contextElement);
212773

Source/WebCore/svg/SVGAnimatedTransformList.cpp

@@SVGAnimatedTransformListAnimator::SVGAni
4141
4242std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::constructFromString(const String& string)
4343{
44  auto animatedType = SVGAnimatedType::createTransformList(std::make_unique<SVGTransformListValues>());
45  animatedType->transformList().parse(m_transformTypeString + string + ')');
46  ASSERT(animatedType->transformList().size() <= 1);
47  return animatedType;
 44 return SVGAnimatedType::create(SVGPropertyTraits<SVGTransformListValues>::fromString(m_transformTypeString + string + ')'));
4845}
4946
5047std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
5148{
52  return SVGAnimatedType::createTransformList(constructFromBaseValue<SVGAnimatedTransformList>(animatedTypes));
 49 return constructFromBaseValue<SVGAnimatedTransformList>(animatedTypes);
5350}
5451
5552void SVGAnimatedTransformListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedTransformListAnimator::s
5956
6057void SVGAnimatedTransformListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
6158{
62  resetFromBaseValue<SVGAnimatedTransformList>(animatedTypes, type, &SVGAnimatedType::transformList);
 59 resetFromBaseValue<SVGAnimatedTransformList>(animatedTypes, type);
6360}
6461
6562void SVGAnimatedTransformListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedTransformListAnimator::a
7774 ASSERT(from->type() == AnimatedTransformList);
7875 ASSERT(from->type() == to->type());
7976
80  const auto& fromTransformList = from->transformList();
81  auto& toTransformList = to->transformList();
 77 const auto& fromTransformList = from->property<SVGTransformListValues>();
 78 auto& toTransformList = to->property<SVGTransformListValues>();
8279 auto fromTransformListSize = fromTransformList.size();
8380 if (!fromTransformListSize || fromTransformListSize != toTransformList.size())
8481 return;

@@void SVGAnimatedTransformListAnimator::c
9895 // Spec: To animations provide specific functionality to get a smooth change from the underlying value to the
9996 // ‘to’ attribute value, which conflicts mathematically with the requirement for additive transform animations
10097 // to be post-multiplied. As a consequence, in SVG 1.1 the behavior of to animations for ‘animateTransform’ is undefined.
101  const auto& fromTransformList = from->transformList();
102  const auto& toTransformList = to->transformList();
103  const auto& toAtEndOfDurationTransformList = toAtEndOfDuration->transformList();
104  auto& animatedTransformList = animated->transformList();
 98 const auto& fromTransformList = from->property<SVGTransformListValues>();
 99 const auto& toTransformList = to->property<SVGTransformListValues>();
 100 const auto& toAtEndOfDurationTransformList = toAtEndOfDuration->property<SVGTransformListValues>();
 101 auto& animatedTransformList = animated->property<SVGTransformListValues>();
105102
106103 // Pass false to 'resizeAnimatedListIfNeeded' here, as the special post-multiplication behavior of <animateTransform> needs to be respected below.
107104 if (!m_animationElement->adjustFromToListValues<SVGTransformListValues>(fromTransformList, toTransformList, animatedTransformList, percentage, false))

@@float SVGAnimatedTransformListAnimator::
131128 auto from = constructFromString(fromString);
132129 auto to = constructFromString(toString);
133130
134  auto& fromTransformList = from->transformList();
135  auto& toTransformList = to->transformList();
 131 auto& fromTransformList = from->property<SVGTransformListValues>();
 132 auto& toTransformList = to->property<SVGTransformListValues>();
136133 unsigned itemsCount = fromTransformList.size();
137134 if (!itemsCount || itemsCount != toTransformList.size())
138135 return -1;
212773

Source/WebCore/svg/SVGAnimatedType.cpp

11/*
22 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
 3 * Copyright (C) 2017 Apple Inc. All rights reserved.
34 *
45 * This library is free software; you can redistribute it and/or
56 * modify it under the terms of the GNU Library General Public

2627
2728namespace WebCore {
2829
29 SVGAnimatedType::SVGAnimatedType(AnimatedPropertyType type)
30  : m_type(type)
 30AnimatedPropertyType SVGAnimatedType::type() const
3131{
32 }
33 
34 SVGAnimatedType::~SVGAnimatedType()
35 {
36  switch (m_type) {
37  case AnimatedAngle:
38  delete m_data.angleAndEnumeration;
39  break;
40  case AnimatedBoolean:
41  delete m_data.boolean;
42  break;
43  case AnimatedColor:
44  delete m_data.color;
45  break;
46  case AnimatedEnumeration:
47  delete m_data.enumeration;
48  break;
49  case AnimatedInteger:
50  delete m_data.integer;
51  break;
52  case AnimatedIntegerOptionalInteger:
53  delete m_data.integerOptionalInteger;
54  break;
55  case AnimatedLength:
56  delete m_data.length;
57  break;
58  case AnimatedLengthList:
59  delete m_data.lengthList;
60  break;
61  case AnimatedNumber:
62  delete m_data.number;
63  break;
64  case AnimatedNumberList:
65  delete m_data.numberList;
66  break;
67  case AnimatedNumberOptionalNumber:
68  delete m_data.numberOptionalNumber;
69  break;
70  case AnimatedPath:
71  delete m_data.path;
72  break;
73  case AnimatedPoints:
74  delete m_data.pointList;
75  break;
76  case AnimatedPreserveAspectRatio:
77  delete m_data.preserveAspectRatio;
78  break;
79  case AnimatedRect:
80  delete m_data.rect;
81  break;
82  case AnimatedString:
83  delete m_data.string;
84  break;
85  case AnimatedTransformList:
86  delete m_data.transformList;
87  break;
88  case AnimatedUnknown:
89  ASSERT_NOT_REACHED();
90  break;
 32 if (m_value1->is<SVGAngleValue>()) {
 33 ASSERT(m_value2 && m_value2->is<unsigned>());
 34 return AnimatedAngle;
9135 }
92 }
93 
94 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngleValue, unsigned>> angleAndEnumeration)
95 {
96  ASSERT(angleAndEnumeration);
97  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedAngle);
98  animatedType->m_data.angleAndEnumeration = angleAndEnumeration.release();
99  return animatedType;
100 }
101 
102 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createBoolean(std::unique_ptr<bool> boolean)
103 {
104  ASSERT(boolean);
105  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedBoolean);
106  animatedType->m_data.boolean = boolean.release();
107  return animatedType;
108 }
109 
110 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createColor(std::unique_ptr<Color> color)
111 {
112  ASSERT(color);
113  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedColor);
114  animatedType->m_data.color = color.release();
115  return animatedType;
116 }
 36
 37 if (m_value1->is<bool>())
 38 return AnimatedBoolean;
 39
 40 if (m_value1->is<Color>())
 41 return AnimatedColor;
11742
118 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createEnumeration(std::unique_ptr<unsigned> enumeration)
119 {
120  ASSERT(enumeration);
121  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedEnumeration);
122  animatedType->m_data.enumeration = enumeration.release();
123  return animatedType;
124 }
125 
126 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createInteger(std::unique_ptr<int> integer)
127 {
128  ASSERT(integer);
129  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedInteger);
130  animatedType->m_data.integer = integer.release();
131  return animatedType;
132 }
133 
134 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createIntegerOptionalInteger(std::unique_ptr<std::pair<int, int>> integerOptionalInteger)
135 {
136  ASSERT(integerOptionalInteger);
137  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedIntegerOptionalInteger);
138  animatedType->m_data.integerOptionalInteger = integerOptionalInteger.release();
139  return animatedType;
140 }
141 
142 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createLength(std::unique_ptr<SVGLengthValue> length)
143 {
144  ASSERT(length);
145  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedLength);
146  animatedType->m_data.length = length.release();
147  return animatedType;
148 }
 43 if (m_value1->is<unsigned>())
 44 return AnimatedEnumeration;
14945
150 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createLengthList(std::unique_ptr<SVGLengthListValues> lengthList)
151 {
152  ASSERT(lengthList);
153  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedLengthList);
154  animatedType->m_data.lengthList = lengthList.release();
155  return animatedType;
156 }
 46 if (m_value1->is<int>())
 47 return m_value2 && m_value2->is<int>() ? AnimatedIntegerOptionalInteger : AnimatedInteger;
 48
 49 if (m_value1->is<SVGLengthValue>())
 50 return AnimatedLength;
 51
 52 if (m_value1->is<SVGLengthListValues>())
 53 return AnimatedLengthList;
15754
158 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumber(std::unique_ptr<float> number)
159 {
160  ASSERT(number);
161  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedNumber);
162  animatedType->m_data.number = number.release();
163  return animatedType;
164 }
 55 if (m_value1->is<float>())
 56 return m_value2 && m_value2->is<float>() ? AnimatedNumberOptionalNumber : AnimatedNumber;
16557
166 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumberList(std::unique_ptr<SVGNumberListValues> numberList)
167 {
168  ASSERT(numberList);
169  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedNumberList);
170  animatedType->m_data.numberList = numberList.release();
171  return animatedType;
172 }
 58 if (m_value1->is<SVGNumberListValues>())
 59 return AnimatedNumberList;
17360
174 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumberOptionalNumber(std::unique_ptr<std::pair<float, float>> numberOptionalNumber)
175 {
176  ASSERT(numberOptionalNumber);
177  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedNumberOptionalNumber);
178  animatedType->m_data.numberOptionalNumber = numberOptionalNumber.release();
179  return animatedType;
180 }
 61 if (m_value1->is<SVGPathByteStream>())
 62 return AnimatedPath;
18163
182 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPath(std::unique_ptr<SVGPathByteStream> path)
183 {
184  ASSERT(path);
185  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedPath);
186  animatedType->m_data.path = path.release();
187  return animatedType;
188 }
 64 if (m_value1->is<SVGPointListValues>())
 65 return AnimatedPoints;
18966
190 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPointList(std::unique_ptr<SVGPointListValues> pointList)
191 {
192  ASSERT(pointList);
193  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedPoints);
194  animatedType->m_data.pointList = pointList.release();
195  return animatedType;
196 }
 67 if (m_value1->is<SVGPreserveAspectRatioValue>())
 68 return AnimatedPreserveAspectRatio;
19769
198 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPreserveAspectRatio(std::unique_ptr<SVGPreserveAspectRatioValue> preserveAspectRatio)
199 {
200  ASSERT(preserveAspectRatio);
201  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedPreserveAspectRatio);
202  animatedType->m_data.preserveAspectRatio = preserveAspectRatio.release();
203  return animatedType;
204 }
 70 if (m_value1->is<FloatRect>())
 71 return AnimatedRect;
20572
206 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createRect(std::unique_ptr<FloatRect> rect)
207 {
208  ASSERT(rect);
209  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedRect);
210  animatedType->m_data.rect = rect.release();
211  return animatedType;
212 }
 73 if (m_value1->is<String>())
 74 return AnimatedString;
21375
214 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createString(std::unique_ptr<String> string)
215 {
216  ASSERT(string);
217  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedString);
218  animatedType->m_data.string = string.release();
219  return animatedType;
220 }
 76 if (m_value1->is<SVGTransformListValues>())
 77 return AnimatedTransformList;
22178
222 std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createTransformList(std::unique_ptr<SVGTransformListValues> transformList)
223 {
224  ASSERT(transformList);
225  auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedTransformList);
226  animatedType->m_data.transformList = transformList.release();
227  return animatedType;
 79 return AnimatedUnknown;
22880}
22981
230 String SVGAnimatedType::valueAsString()
 82String SVGAnimatedType::toString()
23183{
232  switch (m_type) {
 84 switch (type()) {
23385 case AnimatedColor:
234  ASSERT(m_data.color);
235  return m_data.color->serialized();
 86 return m_value1->toString<Color>();
23687 case AnimatedLength:
237  ASSERT(m_data.length);
238  return m_data.length->valueAsString();
 88 return m_value1->toString<SVGLengthValue>();
23989 case AnimatedLengthList:
240  ASSERT(m_data.lengthList);
241  return m_data.lengthList->valueAsString();
 90 return m_value1->toString<SVGLengthListValues>();
24291 case AnimatedNumber:
243  ASSERT(m_data.number);
244  return String::number(*m_data.number);
 92 return m_value1->toString<float>();
24593 case AnimatedRect:
246  ASSERT(m_data.rect);
247  return String::number(m_data.rect->x()) + ' ' + String::number(m_data.rect->y()) + ' '
248  + String::number(m_data.rect->width()) + ' ' + String::number(m_data.rect->height());
 94 return m_value1->toString<FloatRect>();
24995 case AnimatedString:
250  ASSERT(m_data.string);
251  return *m_data.string;
 96 return m_value1->toString<String>();
25297
25398 // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need valueAsString() support.
25499 case AnimatedAngle:

@@String SVGAnimatedType::valueAsString()
271116 return String();
272117}
273118
274 bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const String& value)
 119bool SVGAnimatedType::parse(const QualifiedName& attrName, const String& string)
275120{
276  switch (m_type) {
 121 switch (type()) {
277122 case AnimatedColor:
278  ASSERT(m_data.color);
279  *m_data.color = CSSParser::parseColor(value.stripWhiteSpace());
280  return true;
 123 return m_value1->parse<Color>(attrName, string);
281124 case AnimatedLength:
282  ASSERT(m_data.length);
283  return !m_data.length->setValueAsString(value, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName)).hasException();
 125 return m_value1->parse<SVGLengthValue>(attrName, string);
284126 case AnimatedLengthList:
285  ASSERT(m_data.lengthList);
286  m_data.lengthList->parse(value, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName));
287  return true;
 127 return m_value1->parse<SVGLengthListValues>(attrName, string);
288128 case AnimatedNumber:
289  ASSERT(m_data.number);
290  parseNumberFromString(value, *m_data.number);
291  return true;
 129 return m_value1->parse<float>(attrName, string);
292130 case AnimatedRect:
293  ASSERT(m_data.rect);
294  parseRect(value, *m_data.rect);
295  return true;
 131 return m_value1->parse<FloatRect>(attrName, string);
296132 case AnimatedString:
297  ASSERT(m_data.string);
298  *m_data.string = value;
299  return true;
 133 return m_value1->parse<String>(attrName, string);
300134
301135 // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need setValueAsString() support.
302136 case AnimatedAngle:
212773

Source/WebCore/svg/SVGAnimatedType.h

11/*
22 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
 3 * Copyright (C) 2017 Apple Inc. All rights reserved.
34 *
45 * This library is free software; you can redistribute it and/or
56 * modify it under the terms of the GNU Library General Public

1920
2021#pragma once
2122
22 #include "Color.h"
23 #include "FloatRect.h"
24 #include "SVGAngleValue.h"
25 #include "SVGLengthListValues.h"
26 #include "SVGLengthValue.h"
27 #include "SVGNumberListValues.h"
28 #include "SVGPointListValues.h"
29 #include "SVGPreserveAspectRatioValue.h"
30 #include "SVGPropertyInfo.h"
31 #include "SVGTransformListValues.h"
 23#include "SVGAnimatedValue.h"
3224
3325namespace WebCore {
3426
35 class SVGPathByteStream;
36 
3727class SVGAnimatedType {
3828 WTF_MAKE_FAST_ALLOCATED;
3929public:
40  SVGAnimatedType(AnimatedPropertyType);
41  virtual ~SVGAnimatedType();
42 
43  static std::unique_ptr<SVGAnimatedType> createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngleValue, unsigned>>);
44  static std::unique_ptr<SVGAnimatedType> createBoolean(std::unique_ptr<bool>);
45  static std::unique_ptr<SVGAnimatedType> createColor(std::unique_ptr<Color>);
46  static std::unique_ptr<SVGAnimatedType> createEnumeration(std::unique_ptr<unsigned>);
47  static std::unique_ptr<SVGAnimatedType> createInteger(std::unique_ptr<int>);
48  static std::unique_ptr<SVGAnimatedType> createIntegerOptionalInteger(std::unique_ptr<std::pair<int, int>>);
49  static std::unique_ptr<SVGAnimatedType> createLength(std::unique_ptr<SVGLengthValue>);
50  static std::unique_ptr<SVGAnimatedType> createLengthList(std::unique_ptr<SVGLengthListValues>);
51  static std::unique_ptr<SVGAnimatedType> createNumber(std::unique_ptr<float>);
52  static std::unique_ptr<SVGAnimatedType> createNumberList(std::unique_ptr<SVGNumberListValues>);
53  static std::unique_ptr<SVGAnimatedType> createNumberOptionalNumber(std::unique_ptr<std::pair<float, float>>);
54  static std::unique_ptr<SVGAnimatedType> createPath(std::unique_ptr<SVGPathByteStream>);
55  static std::unique_ptr<SVGAnimatedType> createPointList(std::unique_ptr<SVGPointListValues>);
56  static std::unique_ptr<SVGAnimatedType> createPreserveAspectRatio(std::unique_ptr<SVGPreserveAspectRatioValue>);
57  static std::unique_ptr<SVGAnimatedType> createRect(std::unique_ptr<FloatRect>);
58  static std::unique_ptr<SVGAnimatedType> createString(std::unique_ptr<String>);
59  static std::unique_ptr<SVGAnimatedType> createTransformList(std::unique_ptr<SVGTransformListValues>);
60  static bool supportsAnimVal(AnimatedPropertyType);
61 
62  AnimatedPropertyType type() const { return m_type; }
63 
64  // Non-mutable accessors.
65  const std::pair<SVGAngleValue, unsigned>& angleAndEnumeration() const
66  {
67  ASSERT(m_type == AnimatedAngle);
68  return *m_data.angleAndEnumeration;
69  }
70 
71  const bool& boolean() const
72  {
73  ASSERT(m_type == AnimatedBoolean);
74  return *m_data.boolean;
75  }
76 
77  const Color& color() const
78  {
79  ASSERT(m_type == AnimatedColor);
80  return *m_data.color;
81  }
82 
83  const unsigned& enumeration() const
84  {
85  ASSERT(m_type == AnimatedEnumeration);
86  return *m_data.enumeration;
87  }
88 
89  const int& integer() const
90  {
91  ASSERT(m_type == AnimatedInteger);
92  return *m_data.integer;
93  }
94 
95  const std::pair<int, int>& integerOptionalInteger() const
96  {
97  ASSERT(m_type == AnimatedIntegerOptionalInteger);
98  return *m_data.integerOptionalInteger;
99  }
100 
101  const SVGLengthValue& length() const
102  {
103  ASSERT(m_type == AnimatedLength);
104  return *m_data.length;
105  }
106 
107  const SVGLengthListValues& lengthList() const
108  {
109  ASSERT(m_type == AnimatedLengthList);
110  return *m_data.lengthList;
111  }
112 
113  const float& number() const
114  {
115  ASSERT(m_type == AnimatedNumber);
116  return *m_data.number;
117  }
118 
119  const SVGNumberListValues& numberList() const
120  {
121  ASSERT(m_type == AnimatedNumberList);
122  return *m_data.numberList;
123  }
124 
125  const std::pair<float, float>& numberOptionalNumber() const
126  {
127  ASSERT(m_type == AnimatedNumberOptionalNumber);
128  return *m_data.numberOptionalNumber;
129  }
130 
131  const SVGPathByteStream* path() const
132  {
133  ASSERT(m_type == AnimatedPath);
134  return m_data.path;
135  }
136 
137  const SVGPointListValues& pointList() const
138  {
139  ASSERT(m_type == AnimatedPoints);
140  return *m_data.pointList;
141  }
142 
143  const SVGPreserveAspectRatioValue& preserveAspectRatio() const
144  {
145  ASSERT(m_type == AnimatedPreserveAspectRatio);
146  return *m_data.preserveAspectRatio;
147  }
148 
149  const FloatRect& rect() const
150  {
151  ASSERT(m_type == AnimatedRect);
152  return *m_data.rect;
153  }
154 
155  const String& string() const
156  {
157  ASSERT(m_type == AnimatedString);
158  return *m_data.string;
159  }
160 
161  const SVGTransformListValues& transformList() const
162  {
163  ASSERT(m_type == AnimatedTransformList);
164  return *m_data.transformList;
165  }
166 
167  // Mutable accessors.
168  std::pair<SVGAngleValue, unsigned>& angleAndEnumeration()
 30 template<typename PropertyType>
 31 SVGAnimatedType(PropertyType&& property)
 32 : m_value1(SVGAnimatedValue::create(WTFMove(property)))
16933 {
170  ASSERT(m_type == AnimatedAngle);
171  return *m_data.angleAndEnumeration;
17234 }
17335
174  bool& boolean()
 36 SVGAnimatedType(RefPtr<SVGAnimatedValue>&& value)
 37 : m_value1(WTFMove(value))
17538 {
176  ASSERT(m_type == AnimatedBoolean);
177  return *m_data.boolean;
17839 }
17940
180  Color& color()
 41 template<typename PropertyType1, typename PropertyType2>
 42 SVGAnimatedType(std::pair<PropertyType1, PropertyType2>&& properties)
 43 : m_value1(SVGAnimatedValue::create(properties.first))
 44 , m_value2(SVGAnimatedValue::create(properties.second))
18145 {
182  ASSERT(m_type == AnimatedColor);
183  return *m_data.color;
18446 }
18547
186  unsigned& enumeration()
 48 SVGAnimatedType(RefPtr<SVGAnimatedValue>&& value1, RefPtr<SVGAnimatedValue>&& value2)
 49 : m_value1(WTFMove(value1))
 50 , m_value2(WTFMove(value2))
18751 {
188  ASSERT(m_type == AnimatedEnumeration);
189  return *m_data.enumeration;
19052 }
19153
192  int& integer()
 54 template<typename PropertyType>
 55 static std::unique_ptr<SVGAnimatedType> create()
19356 {
194  ASSERT(m_type == AnimatedInteger);
195  return *m_data.integer;
 57 return std::make_unique<SVGAnimatedType>(SVGPropertyTraits<PropertyType>::initialValue());
19658 }
19759
198  std::pair<int, int>& integerOptionalInteger()
 60 template<typename PropertyType>
 61 static std::unique_ptr<SVGAnimatedType> create(PropertyType&& property)
19962 {
200  ASSERT(m_type == AnimatedIntegerOptionalInteger);
201  return *m_data.integerOptionalInteger;
 63 return std::make_unique<SVGAnimatedType>(WTFMove(property));
20264 }
20365
204  SVGLengthValue& length()
 66 static std::unique_ptr<SVGAnimatedType> create(RefPtr<SVGAnimatedValue>&& value)
20567 {
206  ASSERT(m_type == AnimatedLength);
207  return *m_data.length;
 68 return std::make_unique<SVGAnimatedType>(WTFMove(value));
20869 }
20970
210  SVGLengthListValues& lengthList()
 71 template<typename PropertyType1, typename PropertyType2>
 72 static std::unique_ptr<SVGAnimatedType> create()
21173 {
212  ASSERT(m_type == AnimatedLengthList);
213  return *m_data.lengthList;
 74 return std::make_unique<SVGAnimatedType>(SVGPropertyTraits<std::pair<PropertyType1, PropertyType2>>::initialValue());
21475 }
21576
216  float& number()
 77 template<typename PropertyType1, typename PropertyType2>
 78 static std::unique_ptr<SVGAnimatedType> create(std::pair<PropertyType1, PropertyType2>&& properties)
21779 {
218  ASSERT(m_type == AnimatedNumber);
219  return *m_data.number;
 80 return std::make_unique<SVGAnimatedType>(WTFMove(properties));
22081 }
22182
222  SVGNumberListValues& numberList()
 83 static std::unique_ptr<SVGAnimatedType> create(RefPtr<SVGAnimatedValue>&& value1, RefPtr<SVGAnimatedValue>&& value2)
22384 {
224  ASSERT(m_type == AnimatedNumberList);
225  return *m_data.numberList;
 85 return std::make_unique<SVGAnimatedType>(WTFMove(value1), WTFMove(value2));
22686 }
22787
228  std::pair<float, float>& numberOptionalNumber()
 88 template<typename PropertyType>
 89 const PropertyType& property() const
22990 {
230  ASSERT(m_type == AnimatedNumberOptionalNumber);
231  return *m_data.numberOptionalNumber;
 91 return m_value1->property<PropertyType>();
23292 }
23393
234  SVGPathByteStream* path()
 94 template<typename PropertyType>
 95 PropertyType& property()
23596 {
236  ASSERT(m_type == AnimatedPath);
237  return m_data.path;
 97 return m_value1->property<PropertyType>();
23898 }
23999
240  SVGPointListValues& pointList()
 100 template<typename PropertyType1, typename PropertyType2>
 101 std::pair<PropertyType1&, PropertyType2&> properties()
241102 {
242  ASSERT(m_type == AnimatedPoints);
243  return *m_data.pointList;
 103 ASSERT(m_value2);
 104 return std::pair<PropertyType1&, PropertyType2&>(m_value1->property<PropertyType1>(), m_value2->property<PropertyType2>());
244105 }
245106
246  SVGPreserveAspectRatioValue& preserveAspectRatio()
247  {
248  ASSERT(m_type == AnimatedPreserveAspectRatio);
249  return *m_data.preserveAspectRatio;
250  }
251 
252  FloatRect& rect()
253  {
254  ASSERT(m_type == AnimatedRect);
255  return *m_data.rect;
256  }
257 
258  String& string()
259  {
260  ASSERT(m_type == AnimatedString);
261  return *m_data.string;
262  }
 107 static bool supportsAnimVal(AnimatedPropertyType);
263108
264  SVGTransformListValues& transformList()
265  {
266  ASSERT(m_type == AnimatedTransformList);
267  return *m_data.transformList;
268  }
 109 AnimatedPropertyType type() const;
269110
270  String valueAsString();
271  bool setValueAsString(const QualifiedName&, const String&);
 111 String toString();
 112 bool parse(const QualifiedName&, const String&);
272113
273114private:
274  AnimatedPropertyType m_type;
275 
276  union DataUnion {
277  DataUnion()
278  : length(nullptr)
279  {
280  }
281 
282  std::pair<SVGAngleValue, unsigned>* angleAndEnumeration;
283  bool* boolean;
284  Color* color;
285  unsigned* enumeration;
286  int* integer;
287  std::pair<int, int>* integerOptionalInteger;
288  SVGLengthValue* length;
289  SVGLengthListValues* lengthList;
290  float* number;
291  SVGNumberListValues* numberList;
292  std::pair<float, float>* numberOptionalNumber;
293  SVGPathByteStream* path;
294  SVGPreserveAspectRatioValue* preserveAspectRatio;
295  SVGPointListValues* pointList;
296  FloatRect* rect;
297  String* string;
298  SVGTransformListValues* transformList;
299  } m_data;
 115 RefPtr<SVGAnimatedValue> m_value1, m_value2;
300116};
301117
302118} // namespace WebCore
212773

Source/WebCore/svg/SVGAnimatedTypeAnimator.h

@@protected:
6363
6464 // Helpers for animators that operate on single types, eg. just one SVGAnimatedInteger.
6565 template<typename AnimValType>
66  std::unique_ptr<typename AnimValType::ContentType> constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
 66 std::unique_ptr<SVGAnimatedType> constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
6767 {
6868 ASSERT(animatedTypes[0].properties.size() == 1);
6969 const typename AnimValType::ContentType& animatedType = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get())->currentBaseValue();
7070
71  auto copy = std::make_unique<typename AnimValType::ContentType>(animatedType);
72  executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, copy.get());
73  return copy;
 71 RefPtr<SVGAnimatedValue> value = SVGAnimatedValue::create(animatedType);
 72 typename AnimValType::ContentType& property = value->property<typename AnimValType::ContentType>();
 73 executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, &property);
 74 return SVGAnimatedType::create(WTFMove(value));
7475 }
7576
7677 template<typename AnimValType>
77  void resetFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type, typename AnimValType::ContentType& (SVGAnimatedType::*getter)())
 78 void resetFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
7879 {
7980 ASSERT(animatedTypes[0].properties.size() == 1);
80  ASSERT(type.type() == m_type);
81  typename AnimValType::ContentType& animatedTypeValue = (type.*getter)();
82  animatedTypeValue = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get())->currentBaseValue();
83 
84  executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, &animatedTypeValue);
 81 typename AnimValType::ContentType& property = type.property<typename AnimValType::ContentType>();
 82 property = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get())->currentBaseValue();
 83 executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, &property);
8584 }
8685
8786 template<typename AnimValType>

@@protected:
107106
108107 // Helpers for animators that operate on pair types, eg. a pair of SVGAnimatedIntegers.
109108 template<typename AnimValType1, typename AnimValType2>
110  std::unique_ptr<std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>> constructFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes)
 109 std::unique_ptr<SVGAnimatedType> constructFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes)
111110 {
112111 ASSERT(animatedTypes[0].properties.size() == 2);
113112 const typename AnimValType1::ContentType& firstType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get())->currentBaseValue();
114113 const typename AnimValType2::ContentType& secondType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get())->currentBaseValue();
115114
116  auto copy = std::make_unique<std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>>(firstType, secondType);
117  executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &copy->first);
118  executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &copy->second);
119  return copy;
 115 RefPtr<SVGAnimatedValue> firstValue = SVGAnimatedValue::create(firstType);
 116 RefPtr<SVGAnimatedValue> secondValue = SVGAnimatedValue::create(secondType);
 117
 118 typename AnimValType1::ContentType& firstProperty = firstValue->property<typename AnimValType1::ContentType>();
 119 typename AnimValType2::ContentType& secondProperty = secondValue->property<typename AnimValType2::ContentType>();
 120
 121 executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &firstProperty);
 122 executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &secondProperty);
 123 return SVGAnimatedType::create(WTFMove(firstValue), WTFMove(secondValue));
120124 }
121125
122126 template<typename AnimValType1, typename AnimValType2>
123  void resetFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type, std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>& (SVGAnimatedType::*getter)())
 127 void resetFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
124128 {
125129 ASSERT(animatedTypes[0].properties.size() == 2);
126130 ASSERT(type.type() == m_type);
 131
 132 auto properties = type.properties<typename AnimValType1::ContentType, typename AnimValType2::ContentType>();
127133
128  std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>& animatedTypeValue = (type.*getter)();
129  animatedTypeValue.first = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get())->currentBaseValue();
130  animatedTypeValue.second = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get())->currentBaseValue();
131 
132  executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &animatedTypeValue.first);
133  executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &animatedTypeValue.second);
 134 executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &properties.first);
 135 executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &properties.second);
134136 }
135137
136138 template<typename AnimValType1, typename AnimValType2>

@@private:
183185 };
184186
185187 template<typename AnimValType>
186  void executeAction(AnimationAction action, const SVGElementAnimatedPropertyList& animatedTypes, unsigned whichProperty, typename AnimValType::ContentType* type = 0)
 188 void executeAction(AnimationAction action, const SVGElementAnimatedPropertyList& animatedTypes, unsigned whichProperty, typename AnimValType::ContentType* property = nullptr)
187189 {
188190 // FIXME: Can't use SVGElement::InstanceUpdateBlocker because of circular header dependency. Would be nice to untangle this.
189191 setInstanceUpdatesBlocked(*animatedTypes[0].element, true);
190192
191193 for (auto& animatedType : animatedTypes) {
192194 ASSERT_WITH_SECURITY_IMPLICATION(whichProperty < animatedType.properties.size());
193  AnimValType* property = castAnimatedPropertyToActualType<AnimValType>(animatedType.properties[whichProperty].get());
 195 AnimValType* animatedProperty = castAnimatedPropertyToActualType<AnimValType>(animatedType.properties[whichProperty].get());
194196
195197 switch (action) {
196198 case StartAnimationAction:
197  ASSERT(type);
198  if (!property->isAnimating())
199  property->animationStarted(type);
 199 ASSERT(property);
 200 if (!animatedProperty->isAnimating())
 201 animatedProperty->animationStarted(property);
200202 break;
201203 case StopAnimationAction:
202  ASSERT(!type);
203  if (property->isAnimating())
204  property->animationEnded();
 204 ASSERT(!property);
 205 if (animatedProperty->isAnimating())
 206 animatedProperty->animationEnded();
205207 break;
206208 case AnimValWillChangeAction:
207  ASSERT(!type);
208  property->animValWillChange();
 209 ASSERT(!property);
 210 animatedProperty->animValWillChange();
209211 break;
210212 case AnimValDidChangeAction:
211  ASSERT(!type);
212  property->animValDidChange();
 213 ASSERT(!property);
 214 animatedProperty->animValDidChange();
213215 break;
214216 }
215217 }
212773

Source/WebCore/svg/SVGAnimatedValue.h

 1/*
 2 * Copyright (C) 2017 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 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.
 24 */
 25
 26#pragma once
 27
 28#include "Color.h"
 29#include "FloatRect.h"
 30#include "SVGAngleValue.h"
 31#include "SVGLengthListValues.h"
 32#include "SVGLengthValue.h"
 33#include "SVGNumberListValues.h"
 34#include "SVGPathByteStream.h"
 35#include "SVGPointListValues.h"
 36#include "SVGPreserveAspectRatioValue.h"
 37#include "SVGPropertyInfo.h"
 38#include "SVGPropertyTraits.h"
 39#include "SVGTransformListValues.h"
 40#include <wtf/Variant.h>
 41
 42namespace WebCore {
 43
 44using SVGAnimatedVariant = Variant<
 45 SVGAngleValue,
 46 bool,
 47 Color,
 48 unsigned,
 49 int,
 50 SVGLengthValue,
 51 SVGLengthListValues,
 52 float,
 53 SVGNumberListValues,
 54 SVGPathByteStream,
 55 SVGPointListValues,
 56 SVGPreserveAspectRatioValue,
 57 FloatRect,
 58 String,
 59 SVGTransformListValues
 60>;
 61
 62class SVGAnimatedValue : public RefCounted<SVGAnimatedValue>, public SVGAnimatedVariant {
 63public:
 64 template<typename PropertyType>
 65 static Ref<SVGAnimatedValue> create(const PropertyType& property)
 66 {
 67 return adoptRef(*new SVGAnimatedValue(property));
 68 }
 69
 70 template<typename PropertyType>
 71 static Ref<SVGAnimatedValue> create(PropertyType&& property)
 72 {
 73 return adoptRef(*new SVGAnimatedValue(WTFMove(property)));
 74 }
 75
 76 template<typename PropertyType>
 77 static Ref<SVGAnimatedValue> create(const SVGAnimatedValue& value)
 78 {
 79 return adoptRef(*new SVGAnimatedValue(value.property<PropertyType>()));
 80 }
 81
 82 template<typename PropertyType>
 83 bool is() const
 84 {
 85 return WTF::holds_alternative<PropertyType>(*this);
 86 }
 87
 88 template<typename PropertyType>
 89 const PropertyType& property() const
 90 {
 91 ASSERT(is<PropertyType>());
 92 return WTF::get<PropertyType>(*this);
 93 }
 94
 95 template<typename PropertyType>
 96 PropertyType& property()
 97 {
 98 ASSERT(is<PropertyType>());
 99 return WTF::get<PropertyType>(*this);
 100 }
 101
 102 template<typename PropertyType>
 103 String toString() const
 104 {
 105 return SVGPropertyTraits<PropertyType>::toString(property<PropertyType>());
 106 }
 107
 108 template<typename PropertyType>
 109 bool parse(const QualifiedName& attrName, const String& string)
 110 {
 111 auto result = SVGPropertyTraits<PropertyType>::parse(attrName, string);
 112 if (!result)
 113 return false;
 114 property<PropertyType>() = WTFMove(result.value());
 115 return true;
 116 }
 117
 118private:
 119 template<typename PropertyType>
 120 SVGAnimatedValue(const PropertyType& value)
 121 : SVGAnimatedVariant(value)
 122 {
 123 ASSERT(is<PropertyType>());
 124 }
 125
 126 template<typename PropertyType>
 127 SVGAnimatedValue(PropertyType&& value)
 128 : SVGAnimatedVariant(WTFMove(value))
 129 {
 130 ASSERT(is<PropertyType>());
 131 }
 132};
 133
 134} // namespace WebCore
nonexistent

Source/WebCore/svg/SVGLengthListValues.h

@@public:
3434 String valueAsString() const;
3535};
3636
37 template<> struct SVGPropertyTraits<SVGLengthListValues> {
 37template<>
 38struct SVGPropertyTraits<SVGLengthListValues> {
3839 using ListItemType = SVGLengthValue;
3940 using ListItemTearOff = SVGLength;
4041 using ListPropertyTearOff = SVGLengthList;
4142
4243 static SVGLengthListValues initialValue() { return { }; }
 44 static SVGLengthListValues fromString(const String& string, SVGLengthMode lengthMode)
 45 {
 46 SVGLengthListValues list;
 47 list.parse(string, lengthMode);
 48 return list;
 49 }
 50 static std::optional<SVGLengthListValues> parse(const QualifiedName& attrName, const String& string)
 51 {
 52 SVGLengthListValues list;
 53 list.parse(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName));
 54 return list;
 55 }
4356 static String toString(const SVGLengthListValues& type) { return type.valueAsString(); }
4457};
4558
212773

Source/WebCore/svg/SVGLengthValue.h

@@private:
147147
148148template<> struct SVGPropertyTraits<SVGLengthValue> {
149149 static SVGLengthValue initialValue() { return { }; }
150  static String toString(const SVGLengthValue& type) { return type.valueAsString(); }
 150 static std::optional<SVGLengthValue> parse(const QualifiedName& attrName, const String& string)
 151 {
 152 SVGLengthValue length;
 153 length.setValueAsString(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName)).hasException();
 154 return length;
 155 }
 156 static String toString(const SVGLengthValue& length) { return length.valueAsString(); }
151157};
152158
153159TextStream& operator<<(TextStream&, const SVGLengthValue&);
212773

Source/WebCore/svg/SVGMarkerElement.h

2929#include "SVGElement.h"
3030#include "SVGExternalResourcesRequired.h"
3131#include "SVGFitToViewBox.h"
 32#include "SVGMarkerTypes.h"
3233
3334namespace WebCore {
3435
35 enum SVGMarkerUnitsType {
36  SVGMarkerUnitsUnknown = 0,
37  SVGMarkerUnitsUserSpaceOnUse,
38  SVGMarkerUnitsStrokeWidth
39 };
40 
41 enum SVGMarkerOrientType {
42  SVGMarkerOrientUnknown = 0,
43  SVGMarkerOrientAuto,
44  SVGMarkerOrientAngle,
45  SVGMarkerOrientAutoStartReverse,
46 
47  // Add new elements before here.
48  SVGMarkerOrientMax
49 };
50 
51 template<>
52 struct SVGPropertyTraits<SVGMarkerUnitsType> {
53  static unsigned highestEnumValue() { return SVGMarkerUnitsStrokeWidth; }
54 
55  static String toString(SVGMarkerUnitsType type)
56  {
57  switch (type) {
58  case SVGMarkerUnitsUnknown:
59  return emptyString();
60  case SVGMarkerUnitsUserSpaceOnUse:
61  return ASCIILiteral("userSpaceOnUse");
62  case SVGMarkerUnitsStrokeWidth:
63  return ASCIILiteral("strokeWidth");
64  }
65 
66  ASSERT_NOT_REACHED();
67  return emptyString();
68  }
69 
70  static SVGMarkerUnitsType fromString(const String& value)
71  {
72  if (value == "userSpaceOnUse")
73  return SVGMarkerUnitsUserSpaceOnUse;
74  if (value == "strokeWidth")
75  return SVGMarkerUnitsStrokeWidth;
76  return SVGMarkerUnitsUnknown;
77  }
78 };
79 
80 template<>
81 inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
82 
83 template<> struct SVGPropertyTraits<SVGMarkerOrientType> {
84  static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; }
85 
86  // toString is not needed, synchronizeOrientType() handles this on its own.
87 
88  static SVGMarkerOrientType fromString(const String& value, SVGAngleValue& angle)
89  {
90  if (value == "auto")
91  return SVGMarkerOrientAuto;
92  if (value == "auto-start-reverse")
93  return SVGMarkerOrientAutoStartReverse;
94  auto setValueResult = angle.setValueAsString(value);
95  if (setValueResult.hasException())
96  return SVGMarkerOrientUnknown;
97  return SVGMarkerOrientAngle;
98  }
99 };
100 
10136class SVGMarkerElement final : public SVGElement,
10237 public SVGExternalResourcesRequired,
10338 public SVGFitToViewBox {
212773

Source/WebCore/svg/SVGMarkerTypes.h

 1/*
 2 * Copyright (C) 2017 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 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.
 24 */
 25
 26#pragma once
 27
 28#include "SVGAnimatedAngle.h"
 29#include "SVGPropertyTraits.h"
 30
 31namespace WebCore {
 32
 33enum SVGMarkerUnitsType {
 34 SVGMarkerUnitsUnknown = 0,
 35 SVGMarkerUnitsUserSpaceOnUse,
 36 SVGMarkerUnitsStrokeWidth
 37};
 38
 39enum SVGMarkerOrientType {
 40 SVGMarkerOrientUnknown = 0,
 41 SVGMarkerOrientAuto,
 42 SVGMarkerOrientAngle,
 43 SVGMarkerOrientAutoStartReverse,
 44
 45 // Add new elements before here.
 46 SVGMarkerOrientMax
 47};
 48
 49template<>
 50struct SVGPropertyTraits<SVGMarkerUnitsType> {
 51 static unsigned highestEnumValue() { return SVGMarkerUnitsStrokeWidth; }
 52 static String toString(SVGMarkerUnitsType type)
 53 {
 54 switch (type) {
 55 case SVGMarkerUnitsUnknown:
 56 return emptyString();
 57 case SVGMarkerUnitsUserSpaceOnUse:
 58 return ASCIILiteral("userSpaceOnUse");
 59 case SVGMarkerUnitsStrokeWidth:
 60 return ASCIILiteral("strokeWidth");
 61 }
 62
 63 ASSERT_NOT_REACHED();
 64 return emptyString();
 65 }
 66 static SVGMarkerUnitsType fromString(const String& value)
 67 {
 68 if (value == "userSpaceOnUse")
 69 return SVGMarkerUnitsUserSpaceOnUse;
 70 if (value == "strokeWidth")
 71 return SVGMarkerUnitsStrokeWidth;
 72 return SVGMarkerUnitsUnknown;
 73 }
 74};
 75
 76template<>
 77struct SVGPropertyTraits<SVGMarkerOrientType> {
 78 static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; }
 79 static SVGMarkerOrientType fromString(const String& value, SVGAngleValue& angle)
 80 {
 81 if (value == "auto")
 82 return SVGMarkerOrientAuto;
 83 if (value == "auto-start-reverse")
 84 return SVGMarkerOrientAutoStartReverse;
 85 auto setValueResult = angle.setValueAsString(value);
 86 if (setValueResult.hasException())
 87 return SVGMarkerOrientUnknown;
 88 return SVGMarkerOrientAngle;
 89 }
 90};
 91
 92template<>
 93struct SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>> {
 94 static std::pair<SVGAngleValue, unsigned> fromString(const String& string)
 95 {
 96 SVGAngleValue angle;
 97 SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(string, angle);
 98 if (orientType != SVGMarkerOrientAngle)
 99 angle = { };
 100 return std::pair<SVGAngleValue, unsigned>(angle, orientType);
 101 }
 102};
 103
 104template<>
 105inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
 106
 107} // namespace WebCore
nonexistent

Source/WebCore/svg/SVGNumberListValues.h

@@public:
3434 String valueAsString() const;
3535};
3636
37 template<> struct SVGPropertyTraits<SVGNumberListValues> {
 37template<>
 38struct SVGPropertyTraits<SVGNumberListValues> {
3839 static SVGNumberListValues initialValue() { return { }; }
 40 static SVGNumberListValues fromString(const String& string)
 41 {
 42 SVGNumberListValues list;
 43 list.parse(string);
 44 return list;
 45 }
3946 static String toString(const SVGNumberListValues& list) { return list.valueAsString(); }
40 
4147 using ListItemType = float;
4248 using ListItemTearOff = SVGNumber;
4349 using ListPropertyTearOff = SVGNumberList;
212773

Source/WebCore/svg/SVGPathByteStream.h

1919
2020#pragma once
2121
 22#include "SVGPathConsumer.h"
 23#include "SVGPathUtilities.h"
 24#include "SVGPropertyTraits.h"
2225#include <wtf/Noncopyable.h>
2326#include <wtf/Vector.h>
2427

@@public:
4750 typedef Data::const_iterator DataIterator;
4851
4952 SVGPathByteStream() { }
50  SVGPathByteStream(const Data& data) : m_data(data) { }
 53 SVGPathByteStream(SVGPathByteStream&& other)
 54 : m_data(WTFMove(other.m_data))
 55 {
 56 }
5157
52  bool operator==(const SVGPathByteStream& other) const
 58 SVGPathByteStream(const SVGPathByteStream& other)
 59 : m_data(other.m_data)
5360 {
54  return m_data == other.m_data;
5561 }
5662
57  bool operator!=(const SVGPathByteStream& other) const
 63 SVGPathByteStream& operator=(SVGPathByteStream&& other)
5864 {
59  return !(*this == other);
 65 m_data = WTFMove(other.m_data);
 66 return *this;
6067 }
61 
62  std::unique_ptr<SVGPathByteStream> copy() const
 68 SVGPathByteStream& operator=(const SVGPathByteStream& other)
6369 {
64  return std::make_unique<SVGPathByteStream>(m_data);
 70 m_data = other.m_data;
 71 return *this;
6572 }
6673
 74 bool operator==(const SVGPathByteStream& other) const { return m_data == other.m_data; }
 75 bool operator!=(const SVGPathByteStream& other) const { return m_data != other.m_data; }
 76
 77 std::unique_ptr<SVGPathByteStream> copy() const { return std::make_unique<SVGPathByteStream>(*this); }
 78
6779 DataIterator begin() const { return m_data.begin(); }
6880 DataIterator end() const { return m_data.end(); }
6981
7082 void append(unsigned char byte) { m_data.append(byte); }
71  void append(const SVGPathByteStream& other)
72  {
73  for (auto stream : other)
74  append(stream);
75  }
 83 void append(const SVGPathByteStream& other) { m_data.appendVector(other.m_data); }
7684 void clear() { m_data.clear(); }
77  bool isEmpty() const { return !m_data.size(); }
 85 bool isEmpty() const { return m_data.isEmpty(); }
7886 unsigned size() const { return m_data.size(); }
7987
8088 // Only defined to let SVGAnimatedPathAnimator use the standard list code paths - this method is never called.

@@public:
8391private:
8492 Data m_data;
8593};
 94
 95template<>
 96struct SVGPropertyTraits<SVGPathByteStream> {
 97 static SVGPathByteStream initialValue() { return SVGPathByteStream(); }
 98 static SVGPathByteStream fromString(const String& string)
 99 {
 100 SVGPathByteStream byteStream;
 101 buildSVGPathByteStreamFromString(string, byteStream, UnalteredParsing);
 102 return byteStream;
 103 }
 104};
86105
87106} // namespace WebCore
212773

Source/WebCore/svg/SVGPathUtilities.cpp

@@bool buildAnimatedSVGPathByteStream(cons
149149
150150bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& byStream, unsigned repeatCount)
151151{
152  // Why return when streamToAppendTo is empty? Don't we still need to append?
 152 // The byStream will be blended with streamToAppendTo. So streamToAppendTo has to have elements.
153153 if (streamToAppendTo.isEmpty() || byStream.isEmpty())
154154 return true;
155155
156  // Is it OK to make the SVGPathByteStreamBuilder from a stream, and then clear that stream?
 156 // builder is the destination of blending fromSource and bySource. The stream of builder
 157 // (i.e. streamToAppendTo) has to be cleared before calling addAnimatedPath.
157158 SVGPathByteStreamBuilder builder(streamToAppendTo);
158 
159  SVGPathByteStream fromStreamCopy = streamToAppendTo;
160  streamToAppendTo.clear();
 159 SVGPathByteStream fromStreamCopy = WTFMove(streamToAppendTo);
161160
162161 SVGPathByteStreamSource fromSource(fromStreamCopy);
163162 SVGPathByteStreamSource bySource(byStream);
212773

Source/WebCore/svg/SVGPointListValues.h

@@public:
3434 String valueAsString() const;
3535};
3636
37 template<> struct SVGPropertyTraits<SVGPointListValues> {
 37template<>
 38struct SVGPropertyTraits<SVGPointListValues> {
3839 static SVGPointListValues initialValue() { return { }; }
39 
 40 static SVGPointListValues fromString(const String& string)
 41 {
 42 SVGPointListValues list;
 43 pointsListFromSVGData(list, string);
 44 return list;
 45 }
4046 using ListItemType = FloatPoint;
4147 using ListItemTearOff = SVGPoint;
4248 using ListPropertyTearOff = SVGPointList;
212773

Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp

@@SVGPreserveAspectRatioValue::SVGPreserve
3636{
3737}
3838
 39SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue(const String& string)
 40{
 41 parse(string);
 42}
 43
3944ExceptionOr<void> SVGPreserveAspectRatioValue::setAlign(unsigned short align)
4045{
4146 if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX)
212773

Source/WebCore/svg/SVGPreserveAspectRatioValue.h

@@public:
5252 };
5353
5454 SVGPreserveAspectRatioValue();
 55 SVGPreserveAspectRatioValue(const String&);
5556
5657 ExceptionOr<void> setAlign(unsigned short);
5758 unsigned short align() const { return m_align; }

@@private:
7778
7879template<> struct SVGPropertyTraits<SVGPreserveAspectRatioValue> {
7980 static SVGPreserveAspectRatioValue initialValue() { return SVGPreserveAspectRatioValue(); }
 81 static SVGPreserveAspectRatioValue fromString(const String& string) { return SVGPreserveAspectRatioValue(string); }
8082 static String toString(const SVGPreserveAspectRatioValue& type) { return type.valueAsString(); }
8183};
8284
212773

Source/WebCore/svg/SVGRect.h

2020#pragma once
2121
2222#include "SVGPropertyTearOff.h"
23 #include "SVGRectTraits.h"
 23#include "SVGPropertyTraits.h"
2424
2525namespace WebCore {
2626
212773

Source/WebCore/svg/SVGRectTraits.h

1 /*
2  * Copyright (C) 2016 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #pragma once
27 
28 #include "FloatRect.h"
29 #include "SVGPropertyTraits.h"
30 #include <wtf/text/StringBuilder.h>
31 
32 namespace WebCore {
33 
34 template<>
35 struct SVGPropertyTraits<FloatRect> {
36  static FloatRect initialValue() { return { }; }
37  static String toString(const FloatRect& type)
38  {
39  StringBuilder builder;
40  builder.appendNumber(type.x());
41  builder.append(' ');
42  builder.appendNumber(type.y());
43  builder.append(' ');
44  builder.appendNumber(type.width());
45  builder.append(' ');
46  builder.appendNumber(type.height());
47  return builder.toString();
48  }
49 };
50 
51 } // namespace WebCore
212773

Source/WebCore/svg/SVGTransformListValues.h

@@public:
4242 void parse(const String&);
4343};
4444
45 template<> struct SVGPropertyTraits<SVGTransformListValues> {
 45template<>
 46struct SVGPropertyTraits<SVGTransformListValues> {
4647 static SVGTransformListValues initialValue() { return { }; }
 48 static SVGTransformListValues fromString(const String& string)
 49 {
 50 SVGTransformListValues list;
 51 list.parse(string);
 52 ASSERT(list.size() <= 1);
 53 return list;
 54 }
4755 static String toString(const SVGTransformListValues& list) { return list.valueAsString(); }
4856
4957 using ListItemType = SVGTransformValue;
212773

Source/WebCore/svg/properties/SVGPropertyTraits.h

2020
2121#pragma once
2222
 23#include "CSSParser.h"
 24#include "Color.h"
 25#include "FloatRect.h"
 26#include "QualifiedName.h"
 27#include "SVGParserUtilities.h"
 28#include <wtf/text/StringBuilder.h>
2329#include <wtf/text/WTFString.h>
2430
2531namespace WebCore {

@@struct SVGPropertyTraits { };
3036template<>
3137struct SVGPropertyTraits<bool> {
3238 static bool initialValue() { return false; }
 39 static bool fromString(const String& string) { return string == "true"; }
3340 static String toString(bool type) { return type ? "true" : "false"; }
3441};
3542
3643template<>
 44struct SVGPropertyTraits<Color> {
 45 static Color initialValue() { return Color(); }
 46 static Color fromString(const String& string) { return CSSParser::parseColor(string.stripWhiteSpace()); }
 47 static std::optional<Color> parse(const QualifiedName&, const String& string)
 48 {
 49 Color color = CSSParser::parseColor(string.stripWhiteSpace());
 50 return color.isValid() ? color : std::optional<Color>();
 51 }
 52 static String toString(const Color& type) { return type.serialized(); }
 53};
 54
 55template<>
3756struct SVGPropertyTraits<unsigned> {
3857 static unsigned initialValue() { return 0; }
3958 static String toString(unsigned type) { return String::number(type); }

@@struct SVGPropertyTraits<unsigned> {
4261template<>
4362struct SVGPropertyTraits<int> {
4463 static int initialValue() { return 0; }
 64 static int fromString(const String&string) { return string.toIntStrict(); }
4565 static String toString(int type) { return String::number(type); }
4666};
 67
 68template<>
 69struct SVGPropertyTraits<std::pair<int, int>> {
 70 static std::pair<int, int> initialValue() { return { }; }
 71 static std::pair<int, int> fromString(const String& string)
 72 {
 73 float firstNumber = 0, secondNumber = 0;
 74 if (!parseNumberOptionalNumber(string, firstNumber, secondNumber))
 75 return { };
 76
 77 return std::make_pair(static_cast<int>(roundf(firstNumber)), static_cast<int>(roundf(secondNumber)));
 78 }
 79};
4780
4881template<>
4982struct SVGPropertyTraits<float> {
5083 static float initialValue() { return 0; }
 84 static float fromString(const String& string)
 85 {
 86 float type = 0;
 87 return parseNumberFromString(string, type) ? type : 0;
 88 }
 89 static std::optional<float> parse(const QualifiedName&, const String& string)
 90 {
 91 float number;
 92 return parseNumberFromString(string, number) ? number : std::optional<float>();
 93 }
5194 static String toString(float type) { return String::number(type); }
5295};
5396
5497template<>
 98struct SVGPropertyTraits<std::pair<float, float>> {
 99 static std::pair<float, float> initialValue() { return { }; }
 100 static std::pair<float, float> fromString(const String& string)
 101 {
 102 float firstNumber = 0, secondNumber = 0;
 103 if (!parseNumberOptionalNumber(string, firstNumber, secondNumber))
 104 return { };
 105
 106 return std::make_pair(firstNumber, secondNumber);
 107 }
 108};
 109
 110template<>
 111struct SVGPropertyTraits<FloatRect> {
 112 static FloatRect initialValue() { return FloatRect(); }
 113 static FloatRect fromString(const String& string)
 114 {
 115 FloatRect rect;
 116 return parseRect(string, rect) ? rect : FloatRect();
 117
 118 }
 119 static std::optional<FloatRect> parse(const QualifiedName&, const String& string)
 120 {
 121 FloatRect rect;
 122 return parseRect(string, rect) ? rect : std::optional<FloatRect>();
 123 }
 124 static String toString(const FloatRect& type)
 125 {
 126 StringBuilder builder;
 127 builder.appendNumber(type.x());
 128 builder.append(' ');
 129 builder.appendNumber(type.y());
 130 builder.append(' ');
 131 builder.appendNumber(type.width());
 132 builder.append(' ');
 133 builder.appendNumber(type.height());
 134 return builder.toString();
 135 }
 136};
 137
 138template<>
55139struct SVGPropertyTraits<String> {
56140 static String initialValue() { return String(); }
57  static String toString(const String& type) { return type; }
 141 static String fromString(const String& string) { return string; }
 142 static std::optional<String> parse(const QualifiedName&, const String& string) { return string; }
 143 static String toString(const String& string) { return string; }
58144};
59145
60146template<typename EnumType>
212773