Source/WebCore/ChangeLog

 12018-02-12 Said Abou-Hallawa <sabouhallawa@apple.com>
 2
 3 Make all the SVGElements' attributes be RefCounted objects
 4 https://bugs.webkit.org/show_bug.cgi?id=168586
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 The SVG tear-off objects have been causing many memory leak and use-after-
 9 free bugs. Tear-off objects are created on demand. More specifically, they
 10 are created when animating the SVGElement's attribute or when creating a
 11 DOM object for that attribute. The problem is these tear-off objects hold
 12 a raw reference to the SVGElement's attribute. To keep this reference valid,
 13 both the SVGElement and the tear-off object used to hold a RefPtr to each
 14 other which was causing a memory leak. When this strong double referencing
 15 was relaxed by using WeakPtr or raw pointer from one side to the other, a
 16 use-after-free bugs were happening. A more subtle problem can happen when
 17 the tear-off object is created for an element in a list attribute. Even if
 18 both the SVGElement and the tear-off exist in memory, a use-after-free may
 19 happen if the list attribute was reallocated.
 20
 21 The current state of the code can not guarantee the validity of the reference
 22 which is held by the tear-off object to the SVGElement's attribute. To fix
 23 this issue, all the SVGElement's attributes have to be RefCounted objects.
 24
 25 Creating different classes for every data type an SVG attribute may have
 26 does not look the cleanest solution. Besides, there are cases where the
 27 union SVGAnimatedType is used to represent all the data types. So here is
 28 the plan of this patch:
 29
 30 -- Create the class SVGValue which is a variant of all the SVG attribute
 31 basic data types including the type of the elements in the SVG attribute
 32 lists.
 33
 34 -- Change SVGAnimatedType to hold two SVGValues. The second one is optional
 35 and only used for animated types which requires two data types.
 36
 37 -- Change all the SVG attributes to be of type RefPtr<SVGValue>.
 38
 39 -- Change all the SVG list attributes to be of type Vector<RefPtr<SVGValue>>.
 40
 41 -- Change all the tear-off objects to hold RefPtr<SVGValue> instead of
 42 holding a raw reference.
 43
 44 * Sources.txt:
 45 * WebCore.xcodeproj/project.pbxproj:
 46 * rendering/svg/SVGPathData.cpp:
 47 (WebCore::pathFromPolygonElement):
 48 (WebCore::pathFromPolylineElement):
 49 * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
 50 (WebCore::updateCharacterData):
 51 * svg/SVGAngle.h:
 52 (WebCore::SVGAngle::create):
 53 (WebCore::SVGAngle::unitType):
 54 (WebCore::SVGAngle::setValueForBindings):
 55 (WebCore::SVGAngle::valueForBindings):
 56 (WebCore::SVGAngle::setValueInSpecifiedUnits):
 57 (WebCore::SVGAngle::valueInSpecifiedUnits):
 58 (WebCore::SVGAngle::setValueAsString):
 59 (WebCore::SVGAngle::valueAsString):
 60 (WebCore::SVGAngle::newValueSpecifiedUnits):
 61 (WebCore::SVGAngle::convertToSpecifiedUnits):
 62 (WebCore::SVGAngle::SVGAngle):
 63 * svg/SVGAnimateElementBase.cpp:
 64 (WebCore::SVGAnimateElementBase::resetAnimatedType):
 65 (WebCore::SVGAnimateElementBase::applyResultsToTarget):
 66 * svg/SVGAnimateMotionElement.cpp:
 67 (WebCore::parsePoint): Deleted.
 68 * svg/SVGAnimatedAngle.cpp:
 69 (WebCore::SVGAnimatedAngleAnimator::constructFromString):
 70 (WebCore::SVGAnimatedAngleAnimator::startAnimValAnimation):
 71 (WebCore::SVGAnimatedAngleAnimator::resetAnimValToBaseVal):
 72 (WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes):
 73 (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
 74 * svg/SVGAnimatedBoolean.cpp:
 75 (WebCore::SVGAnimatedBooleanAnimator::constructFromString):
 76 (WebCore::SVGAnimatedBooleanAnimator::startAnimValAnimation):
 77 (WebCore::SVGAnimatedBooleanAnimator::resetAnimValToBaseVal):
 78 (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
 79 * svg/SVGAnimatedColor.cpp:
 80 (WebCore::SVGAnimatedColorAnimator::constructFromString):
 81 (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
 82 (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
 83 * svg/SVGAnimatedEnumeration.cpp:
 84 (WebCore::SVGAnimatedEnumerationAnimator::constructFromString):
 85 (WebCore::SVGAnimatedEnumerationAnimator::startAnimValAnimation):
 86 (WebCore::SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal):
 87 (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
 88 * svg/SVGAnimatedInteger.cpp:
 89 (WebCore::SVGAnimatedIntegerAnimator::constructFromString):
 90 (WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
 91 (WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
 92 (WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes):
 93 (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
 94 * svg/SVGAnimatedIntegerOptionalInteger.cpp:
 95 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
 96 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
 97 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
 98 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes):
 99 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
 100 * svg/SVGAnimatedLength.cpp:
 101 (WebCore::SVGAnimatedLengthAnimator::constructFromString):
 102 (WebCore::SVGAnimatedLengthAnimator::startAnimValAnimation):
 103 (WebCore::SVGAnimatedLengthAnimator::resetAnimValToBaseVal):
 104 (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
 105 (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
 106 * svg/SVGAnimatedLengthList.cpp:
 107 (WebCore::SVGAnimatedLengthListAnimator::constructFromString):
 108 (WebCore::SVGAnimatedLengthListAnimator::startAnimValAnimation):
 109 (WebCore::SVGAnimatedLengthListAnimator::resetAnimValToBaseVal):
 110 (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
 111 (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
 112 * svg/SVGAnimatedNumber.cpp:
 113 (WebCore::SVGAnimatedNumberAnimator::constructFromString):
 114 (WebCore::SVGAnimatedNumberAnimator::startAnimValAnimation):
 115 (WebCore::SVGAnimatedNumberAnimator::resetAnimValToBaseVal):
 116 (WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes):
 117 (WebCore::parseNumberFromString):
 118 (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
 119 * svg/SVGAnimatedNumberList.cpp:
 120 (WebCore::SVGAnimatedNumberListAnimator::constructFromString):
 121 (WebCore::SVGAnimatedNumberListAnimator::startAnimValAnimation):
 122 (WebCore::SVGAnimatedNumberListAnimator::resetAnimValToBaseVal):
 123 (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
 124 (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
 125 * svg/SVGAnimatedNumberOptionalNumber.cpp:
 126 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString):
 127 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation):
 128 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal):
 129 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes):
 130 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
 131 * svg/SVGAnimatedPath.cpp:
 132 (WebCore::SVGAnimatedPathAnimator::constructFromString):
 133 (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation):
 134 (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
 135 (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
 136 (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
 137 * svg/SVGAnimatedPointList.cpp:
 138 (WebCore::SVGAnimatedPointListAnimator::constructFromString):
 139 (WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation):
 140 (WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal):
 141 (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
 142 (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
 143 * svg/SVGAnimatedPreserveAspectRatio.cpp:
 144 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
 145 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation):
 146 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal):
 147 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
 148 * svg/SVGAnimatedRect.cpp:
 149 (WebCore::SVGAnimatedRectAnimator::constructFromString):
 150 (WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
 151 (WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
 152 (WebCore::SVGAnimatedRectAnimator::addAnimatedTypes):
 153 (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
 154 * svg/SVGAnimatedString.cpp:
 155 (WebCore::SVGAnimatedStringAnimator::constructFromString):
 156 (WebCore::SVGAnimatedStringAnimator::startAnimValAnimation):
 157 (WebCore::SVGAnimatedStringAnimator::resetAnimValToBaseVal):
 158 (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
 159 * svg/SVGAnimatedTransformList.cpp:
 160 (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
 161 (WebCore::SVGAnimatedTransformListAnimator::startAnimValAnimation):
 162 (WebCore::SVGAnimatedTransformListAnimator::resetAnimValToBaseVal):
 163 (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
 164 (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
 165 (WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
 166 * svg/SVGAnimatedType.cpp: Removed.
 167 * svg/SVGAnimatedType.h:
 168 (WebCore::SVGAnimatedType::SVGAnimatedType):
 169 (WebCore::SVGAnimatedType::create):
 170 (WebCore::SVGAnimatedType::type const):
 171 (WebCore::SVGAnimatedType::toString const):
 172 (WebCore::SVGAnimatedType::parse):
 173 (WebCore::SVGAnimatedType::supportsAnimVal):
 174 (WebCore::SVGAnimatedType::valueAnimatedType):
 175 (WebCore::SVGAnimatedType::angleAndEnumeration const): Deleted.
 176 (WebCore::SVGAnimatedType::boolean const): Deleted.
 177 (WebCore::SVGAnimatedType::color const): Deleted.
 178 (WebCore::SVGAnimatedType::enumeration const): Deleted.
 179 (WebCore::SVGAnimatedType::integer const): Deleted.
 180 (WebCore::SVGAnimatedType::integerOptionalInteger const): Deleted.
 181 (WebCore::SVGAnimatedType::length const): Deleted.
 182 (WebCore::SVGAnimatedType::lengthList const): Deleted.
 183 (WebCore::SVGAnimatedType::number const): Deleted.
 184 (WebCore::SVGAnimatedType::numberList const): Deleted.
 185 (WebCore::SVGAnimatedType::numberOptionalNumber const): Deleted.
 186 (WebCore::SVGAnimatedType::path const): Deleted.
 187 (WebCore::SVGAnimatedType::pointList const): Deleted.
 188 (WebCore::SVGAnimatedType::preserveAspectRatio const): Deleted.
 189 (WebCore::SVGAnimatedType::rect const): Deleted.
 190 (WebCore::SVGAnimatedType::string const): Deleted.
 191 (WebCore::SVGAnimatedType::transformList const): Deleted.
 192 (WebCore::SVGAnimatedType::angleAndEnumeration): Deleted.
 193 (WebCore::SVGAnimatedType::boolean): Deleted.
 194 (WebCore::SVGAnimatedType::color): Deleted.
 195 (WebCore::SVGAnimatedType::enumeration): Deleted.
 196 (WebCore::SVGAnimatedType::integer): Deleted.
 197 (WebCore::SVGAnimatedType::integerOptionalInteger): Deleted.
 198 (WebCore::SVGAnimatedType::length): Deleted.
 199 (WebCore::SVGAnimatedType::lengthList): Deleted.
 200 (WebCore::SVGAnimatedType::number): Deleted.
 201 (WebCore::SVGAnimatedType::numberList): Deleted.
 202 (WebCore::SVGAnimatedType::numberOptionalNumber): Deleted.
 203 (WebCore::SVGAnimatedType::path): Deleted.
 204 (WebCore::SVGAnimatedType::pointList): Deleted.
 205 (WebCore::SVGAnimatedType::preserveAspectRatio): Deleted.
 206 (WebCore::SVGAnimatedType::rect): Deleted.
 207 (WebCore::SVGAnimatedType::string): Deleted.
 208 (WebCore::SVGAnimatedType::transformList): Deleted.
 209 (): Deleted.
 210 * svg/SVGAnimatedTypeAnimator.h:
 211 (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue):
 212 (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue):
 213 (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues):
 214 (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues):
 215 (WebCore::SVGAnimatedTypeAnimator::executeAction):
 216 * svg/SVGAnimationElement.h:
 217 * svg/SVGComponentTransferFunctionElement.cpp:
 218 (WebCore::SVGComponentTransferFunctionElement::transferFunction const):
 219 * svg/SVGCursorElement.cpp:
 220 (WebCore::SVGCursorElement::SVGCursorElement):
 221 * svg/SVGEllipseElement.cpp:
 222 (WebCore::SVGEllipseElement::SVGEllipseElement):
 223 * svg/SVGFEColorMatrixElement.cpp:
 224 (WebCore::SVGFEColorMatrixElement::setFilterEffectAttribute):
 225 (WebCore::SVGFEColorMatrixElement::build):
 226 * svg/SVGFEConvolveMatrixElement.cpp:
 227 (WebCore::SVGFEConvolveMatrixElement::build):
 228 * svg/SVGFilterElement.cpp:
 229 (WebCore::SVGFilterElement::SVGFilterElement):
 230 * svg/SVGFilterPrimitiveStandardAttributes.cpp:
 231 (WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes):
 232 * svg/SVGForeignObjectElement.cpp:
 233 (WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
 234 * svg/SVGImageElement.cpp:
 235 (WebCore::SVGImageElement::SVGImageElement):
 236 * svg/SVGLength.h:
 237 (WebCore::SVGLength::create):
 238 (WebCore::SVGLength::unitType):
 239 (WebCore::SVGLength::valueForBindings):
 240 (WebCore::SVGLength::setValueForBindings):
 241 (WebCore::SVGLength::valueInSpecifiedUnits):
 242 (WebCore::SVGLength::setValueInSpecifiedUnits):
 243 (WebCore::SVGLength::valueAsString):
 244 (WebCore::SVGLength::setValueAsString):
 245 (WebCore::SVGLength::newValueSpecifiedUnits):
 246 (WebCore::SVGLength::convertToSpecifiedUnits):
 247 (WebCore::SVGLength::SVGLength):
 248 * svg/SVGLengthList.h:
 249 (WebCore::SVGLengthList::create):
 250 (WebCore::SVGLengthList::SVGLengthList):
 251 * svg/SVGLengthListValues.cpp:
 252 (WebCore::SVGLengthListValues::parse):
 253 (WebCore::SVGLengthListValues::valueAsString const):
 254 * svg/SVGLengthListValues.h:
 255 (WebCore::SVGPropertyTraits<SVGLengthListValues>::initialValue):
 256 (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString):
 257 (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse):
 258 (WebCore::SVGPropertyTraits<SVGLengthListValues>::toString):
 259 * svg/SVGLengthValue.h:
 260 (WebCore::SVGPropertyTraits<SVGLengthValue>::parse):
 261 (WebCore::SVGPropertyTraits<SVGLengthValue>::toString):
 262 * svg/SVGLinearGradientElement.cpp:
 263 (WebCore::SVGLinearGradientElement::SVGLinearGradientElement):
 264 * svg/SVGListValues.cpp: Added.
 265 (WebCore::SVGListValues<PropertyType>::resize):
 266 (WebCore::SVGListValues<PropertyType>::deepCopy const):
 267 * svg/SVGListValues.h: Added.
 268 (WebCore::SVGListValues::SVGListValues):
 269 (WebCore::SVGListValues::propertyAt const):
 270 (WebCore::SVGListValues::propertyAt):
 271 (WebCore::SVGListValues::firstProperty const):
 272 (WebCore::SVGListValues::firstProperty):
 273 (WebCore::SVGListValues::lastProperty const):
 274 (WebCore::SVGListValues::lastProperty):
 275 (WebCore::SVGListValues::properties const):
 276 * svg/SVGMarkerElement.cpp:
 277 (WebCore::SVGMarkerElement::SVGMarkerElement):
 278 (WebCore::SVGMarkerElement::setOrientToAngle):
 279 (WebCore::SVGMarkerElement::synchronizeOrientType):
 280 (WebCore::SVGMarkerElement::orientType const):
 281 * svg/SVGMarkerElement.h:
 282 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
 283 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
 284 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
 285 (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
 286 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
 287 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
 288 * svg/SVGMarkerTypes.h: Added.
 289 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
 290 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
 291 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
 292 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
 293 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
 294 (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
 295 * svg/SVGMaskElement.cpp:
 296 (WebCore::SVGMaskElement::SVGMaskElement):
 297 * svg/SVGMatrix.h:
 298 (WebCore::SVGMatrix::create):
 299 (WebCore::SVGMatrix::a):
 300 (WebCore::SVGMatrix::setA):
 301 (WebCore::SVGMatrix::b):
 302 (WebCore::SVGMatrix::setB):
 303 (WebCore::SVGMatrix::c):
 304 (WebCore::SVGMatrix::setC):
 305 (WebCore::SVGMatrix::d):
 306 (WebCore::SVGMatrix::setD):
 307 (WebCore::SVGMatrix::e):
 308 (WebCore::SVGMatrix::setE):
 309 (WebCore::SVGMatrix::f):
 310 (WebCore::SVGMatrix::setF):
 311 (WebCore::SVGMatrix::multiply):
 312 (WebCore::SVGMatrix::inverse):
 313 (WebCore::SVGMatrix::translate):
 314 (WebCore::SVGMatrix::scale):
 315 (WebCore::SVGMatrix::scaleNonUniform):
 316 (WebCore::SVGMatrix::rotate):
 317 (WebCore::SVGMatrix::rotateFromVector):
 318 (WebCore::SVGMatrix::flipX):
 319 (WebCore::SVGMatrix::flipY):
 320 (WebCore::SVGMatrix::skewX):
 321 (WebCore::SVGMatrix::skewY):
 322 (WebCore::SVGMatrix::SVGMatrix):
 323 * svg/SVGNumber.h:
 324 (WebCore::SVGNumber::create):
 325 (WebCore::SVGNumber::valueForBindings):
 326 (WebCore::SVGNumber::setValueForBindings):
 327 (WebCore::SVGNumber::SVGNumber):
 328 * svg/SVGNumberList.h:
 329 (WebCore::SVGNumberList::create):
 330 (WebCore::SVGNumberList::SVGNumberList):
 331 * svg/SVGNumberListValues.cpp:
 332 (WebCore::SVGNumberListValues::parse):
 333 (WebCore::SVGNumberListValues::valueAsString const):
 334 * svg/SVGNumberListValues.h:
 335 (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString):
 336 (WebCore::SVGPropertyTraits<SVGNumberListValues>::toString):
 337 * svg/SVGParserUtilities.cpp:
 338 (WebCore::parsePoint):
 339 (WebCore::pointsListFromSVGData):
 340 * svg/SVGParserUtilities.h:
 341 * svg/SVGPathByteStream.h:
 342 (WebCore::SVGPathByteStream::SVGPathByteStream):
 343 (WebCore::SVGPathByteStream::operator=):
 344 (WebCore::SVGPathByteStream::operator== const):
 345 (WebCore::SVGPathByteStream::operator!= const):
 346 (WebCore::SVGPathByteStream::copy const):
 347 (WebCore::SVGPathByteStream::append):
 348 (WebCore::SVGPathByteStream::isEmpty const):
 349 (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue):
 350 (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString):
 351 * svg/SVGPathElement.cpp:
 352 (WebCore::SVGPathElement::SVGPathElement):
 353 (WebCore::SVGPathElement::svgAttributeChanged):
 354 (WebCore::SVGPathElement::lookupOrCreateDWrapper):
 355 (WebCore::SVGPathElement::synchronizeD):
 356 (WebCore::SVGPathElement::pathSegListChanged):
 357 * svg/SVGPathSegList.cpp:
 358 (WebCore::SVGPathSegList::clearContextAndRoles):
 359 (WebCore::SVGPathSegList::clear):
 360 (WebCore::SVGPathSegList::replaceItem):
 361 * svg/SVGPathSegList.h:
 362 * svg/SVGPathSegListBuilder.cpp:
 363 (WebCore::SVGPathSegListBuilder::moveTo):
 364 (WebCore::SVGPathSegListBuilder::lineTo):
 365 (WebCore::SVGPathSegListBuilder::lineToHorizontal):
 366 (WebCore::SVGPathSegListBuilder::lineToVertical):
 367 (WebCore::SVGPathSegListBuilder::curveToCubic):
 368 (WebCore::SVGPathSegListBuilder::curveToCubicSmooth):
 369 (WebCore::SVGPathSegListBuilder::curveToQuadratic):
 370 (WebCore::SVGPathSegListBuilder::curveToQuadraticSmooth):
 371 (WebCore::SVGPathSegListBuilder::arcTo):
 372 (WebCore::SVGPathSegListBuilder::closePath):
 373 * svg/SVGPathSegListSource.cpp:
 374 (WebCore::SVGPathSegListSource::parseSVGSegmentType):
 375 (WebCore::SVGPathSegListSource::nextCommand):
 376 * svg/SVGPathSegListValues.h:
 377 * svg/SVGPathUtilities.cpp:
 378 (WebCore::appendSVGPathByteStreamFromSVGPathSeg):
 379 (WebCore::addToSVGPathByteStream):
 380 * svg/SVGPoint.h:
 381 (WebCore::SVGPoint::create):
 382 (WebCore::SVGPoint::x):
 383 (WebCore::SVGPoint::setX):
 384 (WebCore::SVGPoint::y):
 385 (WebCore::SVGPoint::setY):
 386 (WebCore::SVGPoint::matrixTransform):
 387 (WebCore::SVGPoint::SVGPoint):
 388 * svg/SVGPointList.h:
 389 (WebCore::SVGPointList::create):
 390 (WebCore::SVGPointList::SVGPointList):
 391 * svg/SVGPointListValues.cpp:
 392 (WebCore::SVGPointListValues::valueAsString const):
 393 * svg/SVGPointListValues.h:
 394 (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString):
 395 * svg/SVGPolyElement.cpp:
 396 (WebCore::SVGPolyElement::parseAttribute):
 397 (WebCore::SVGPolyElement::synchronizePoints):
 398 * svg/SVGPolyElement.h:
 399 (WebCore::SVGPolyElement::pointList const):
 400 * svg/SVGPreserveAspectRatio.h:
 401 (WebCore::SVGPreserveAspectRatio::create):
 402 (WebCore::SVGPreserveAspectRatio::align):
 403 (WebCore::SVGPreserveAspectRatio::setAlign):
 404 (WebCore::SVGPreserveAspectRatio::meetOrSlice):
 405 (WebCore::SVGPreserveAspectRatio::setMeetOrSlice):
 406 (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio):
 407 * svg/SVGPreserveAspectRatioValue.cpp:
 408 (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue):
 409 * svg/SVGPreserveAspectRatioValue.h:
 410 (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString):
 411 * svg/SVGRadialGradientElement.cpp:
 412 (WebCore::SVGRadialGradientElement::SVGRadialGradientElement):
 413 * svg/SVGRect.h:
 414 (WebCore::SVGRect::create):
 415 (WebCore::SVGRect::x):
 416 (WebCore::SVGRect::setX):
 417 (WebCore::SVGRect::y):
 418 (WebCore::SVGRect::setY):
 419 (WebCore::SVGRect::width):
 420 (WebCore::SVGRect::setWidth):
 421 (WebCore::SVGRect::height):
 422 (WebCore::SVGRect::setHeight):
 423 (WebCore::SVGRect::SVGRect):
 424 * svg/SVGRectTraits.h: Removed.
 425 * svg/SVGSVGElement.cpp:
 426 (WebCore::SVGSVGElement::SVGSVGElement):
 427 (WebCore::SVGSVGElement::setCurrentTranslate):
 428 (WebCore::checkIntersectionWithoutUpdatingLayout):
 429 (WebCore::checkEnclosureWithoutUpdatingLayout):
 430 (WebCore::SVGSVGElement::createSVGTransformFromMatrix):
 431 * svg/SVGSVGElement.h:
 432 (WebCore::SVGSVGElement::currentTranslateValue):
 433 * svg/SVGStringList.h:
 434 * svg/SVGStringListValues.cpp:
 435 (WebCore::SVGStringListValues::reset):
 436 (WebCore::SVGStringListValues::parse):
 437 (WebCore::SVGStringListValues::valueAsString const):
 438 * svg/SVGStringListValues.h:
 439 * svg/SVGTests.cpp:
 440 (WebCore::SVGTests::SVGTests):
 441 (WebCore::SVGTests::isValid const):
 442 (WebCore::SVGTests::parseAttribute):
 443 (WebCore::SVGTests::synchronizeAttribute):
 444 * svg/SVGTextContentElement.cpp:
 445 (WebCore::SVGTextContentElement::SVGTextContentElement):
 446 (WebCore::SVGTextContentElement::textLengthAnimated):
 447 (WebCore::SVGTextContentElement::getCharNumAtPosition):
 448 (WebCore::SVGTextContentElement::parseAttribute):
 449 (WebCore::SVGTextContentElement::svgAttributeChanged):
 450 * svg/SVGTextPathElement.cpp:
 451 (WebCore::SVGTextPathElement::SVGTextPathElement):
 452 * svg/SVGTransform.cpp:
 453 (WebCore::SVGTransform::matrix):
 454 * svg/SVGTransform.h:
 455 (WebCore::SVGTransform::create):
 456 (WebCore::SVGTransform::type):
 457 (WebCore::SVGTransform::angle):
 458 (WebCore::SVGTransform::setMatrix):
 459 (WebCore::SVGTransform::setTranslate):
 460 (WebCore::SVGTransform::setScale):
 461 (WebCore::SVGTransform::setRotate):
 462 (WebCore::SVGTransform::setSkewX):
 463 (WebCore::SVGTransform::setSkewY):
 464 (WebCore::SVGTransform::SVGTransform):
 465 * svg/SVGTransformList.h:
 466 * svg/SVGTransformListValues.cpp:
 467 (WebCore::SVGTransformListValues::consolidate):
 468 (WebCore::SVGTransformListValues::concatenate const):
 469 (WebCore::SVGTransformListValues::valueAsString const):
 470 * svg/SVGTransformListValues.h:
 471 (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString):
 472 * svg/SVGTransformValue.h:
 473 (WebCore::SVGPropertyTraits<SVGTransformValue>::initialValue):
 474 (WebCore::SVGPropertyTraits<SVGTransformValue>::toString):
 475 * svg/SVGTransformable.cpp:
 476 (WebCore::SVGTransformable::parseTransformAttribute):
 477 * svg/SVGUseElement.cpp:
 478 (WebCore::SVGUseElement::SVGUseElement):
 479 * svg/SVGValue.h: Added.
 480 (WebCore::toStringVisitor::operator()):
 481 (WebCore::parseVisitor::parseVisitor):
 482 (WebCore::parseVisitor::operator()):
 483 (WebCore::SVGValue::create):
 484 (WebCore::SVGValue::is const):
 485 (WebCore::SVGValue::operator const PropertyType& const):
 486 (WebCore::SVGValue::operator PropertyType&):
 487 (WebCore::SVGValue::toString const):
 488 (WebCore::SVGValue::parse):
 489 (WebCore::SVGValue::SVGValue):
 490 * svg/SVGViewElement.cpp:
 491 (WebCore::SVGViewElement::SVGViewElement):
 492 (WebCore::SVGViewElement::parseAttribute):
 493 * svg/SVGViewElement.h:
 494 * svg/SVGViewSpec.cpp:
 495 (WebCore::SVGViewSpec::SVGViewSpec):
 496 (WebCore::SVGViewSpec::transformString const):
 497 (WebCore::SVGViewSpec::viewBoxString const):
 498 (WebCore::SVGViewSpec::preserveAspectRatioString const):
 499 (WebCore::SVGViewSpec::reset):
 500 (WebCore::SVGViewSpec::parseViewSpec):
 501 * svg/SVGViewSpec.h:
 502 * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
 503 * svg/properties/SVGAnimatedListPropertyTearOff.h:
 504 (WebCore::SVGAnimatedListPropertyTearOff::create):
 505 (WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue):
 506 (WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue const):
 507 (WebCore::SVGAnimatedListPropertyTearOff::currentBaseValue const):
 508 (WebCore::SVGAnimatedListPropertyTearOff::animationStarted):
 509 (WebCore::SVGAnimatedListPropertyTearOff::animationEnded):
 510 (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
 511 (WebCore::SVGAnimatedListPropertyTearOff::animValWillChange):
 512 (WebCore::SVGAnimatedListPropertyTearOff::animValDidChange):
 513 (WebCore::SVGAnimatedListPropertyTearOff::SVGAnimatedListPropertyTearOff):
 514 * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
 515 * svg/properties/SVGAnimatedProperty.h:
 516 (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper):
 517 * svg/properties/SVGAnimatedPropertyMacros.h:
 518 (WebCore::SVGSynchronizableAnimatedProperty::SVGSynchronizableAnimatedProperty):
 519 * svg/properties/SVGAnimatedPropertyTearOff.h:
 520 * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
 521 (WebCore::SVGAnimatedStaticPropertyTearOff::baseVal):
 522 (WebCore::SVGAnimatedStaticPropertyTearOff::animVal):
 523 (WebCore::SVGAnimatedStaticPropertyTearOff::setBaseVal):
 524 (WebCore::SVGAnimatedStaticPropertyTearOff::create):
 525 (WebCore::SVGAnimatedStaticPropertyTearOff::currentAnimatedValue):
 526 (WebCore::SVGAnimatedStaticPropertyTearOff::currentAnimatedValue const):
 527 (WebCore::SVGAnimatedStaticPropertyTearOff::currentBaseValue const):
 528 (WebCore::SVGAnimatedStaticPropertyTearOff::animationStarted):
 529 (WebCore::SVGAnimatedStaticPropertyTearOff::animationEnded):
 530 (WebCore::SVGAnimatedStaticPropertyTearOff::SVGAnimatedStaticPropertyTearOff):
 531 * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
 532 * svg/properties/SVGListProperty.h:
 533 (WebCore::SVGListProperty::setValuesAndWrappers):
 534 (WebCore::SVGListProperty::clearValues):
 535 (WebCore::SVGListProperty::clearValuesAndWrappers):
 536 (WebCore::SVGListProperty::numberOfItems const):
 537 (WebCore::SVGListProperty::initializeValues):
 538 (WebCore::SVGListProperty::initializeValuesAndWrappers):
 539 (WebCore::SVGListProperty::canGetItem):
 540 (WebCore::SVGListProperty::getItemValues):
 541 (WebCore::SVGListProperty::getItemValuesAndWrappers):
 542 (WebCore::SVGListProperty::insertItemBeforeValues):
 543 (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
 544 (WebCore::SVGListProperty::canReplaceItem):
 545 (WebCore::SVGListProperty::replaceItemValues):
 546 (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
 547 (WebCore::SVGListProperty::canRemoveItem):
 548 (WebCore::SVGListProperty::removeItemValues):
 549 (WebCore::SVGListProperty::removeItemValuesAndWrappers):
 550 (WebCore::SVGListProperty::appendItemValues):
 551 (WebCore::SVGListProperty::appendItemValuesAndWrappers):
 552 (WebCore::SVGListProperty::values const):
 553 (WebCore::SVGListProperty::valuesProperty const):
 554 (WebCore::SVGListProperty::SVGListProperty):
 555 (): Deleted.
 556 (WebCore::SVGListProperty::values): Deleted.
 557 (WebCore::SVGListProperty::~SVGListProperty): Deleted.
 558 * svg/properties/SVGListPropertyTearOff.h:
 559 (WebCore::SVGListPropertyTearOff::create):
 560 (WebCore::SVGListPropertyTearOff::findItem const):
 561 (WebCore::SVGListPropertyTearOff::removeItemFromList):
 562 (WebCore::SVGListPropertyTearOff::SVGListPropertyTearOff):
 563 * svg/properties/SVGMatrixTearOff.h:
 564 * svg/properties/SVGPropertyTearOff.h:
 565 (WebCore::SVGPropertyTearOff::value const):
 566 (WebCore::SVGPropertyTearOff::valueProperty):
 567 (WebCore::SVGPropertyTearOff::setValue):
 568 (WebCore::SVGPropertyTearOff::SVGPropertyTearOff):
 569 (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
 570 (WebCore::SVGPropertyTearOff::propertyReference): Deleted.
 571 * svg/properties/SVGPropertyTraits.h:
 572 (WebCore::SVGPropertyTraits<bool>::fromString):
 573 (WebCore::SVGPropertyTraits<Color>::initialValue):
 574 (WebCore::SVGPropertyTraits<Color>::fromString):
 575 (WebCore::SVGPropertyTraits<Color>::parse):
 576 (WebCore::SVGPropertyTraits<Color>::toString):
 577 (WebCore::SVGPropertyTraits<int>::fromString):
 578 (WebCore::SVGPropertyTraits<float>::fromString):
 579 (WebCore::SVGPropertyTraits<float>::parse):
 580 (WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
 581 (WebCore::SVGPropertyTraits<FloatPoint>::fromString):
 582 (WebCore::SVGPropertyTraits<FloatPoint>::parse):
 583 (WebCore::SVGPropertyTraits<FloatPoint>::toString):
 584 (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
 585 (WebCore::SVGPropertyTraits<FloatRect>::fromString):
 586 (WebCore::SVGPropertyTraits<FloatRect>::parse):
 587 (WebCore::SVGPropertyTraits<FloatRect>::toString):
 588 (WebCore::SVGPropertyTraits<String>::fromString):
 589 (WebCore::SVGPropertyTraits<String>::parse):
 590 (WebCore::SVGPropertyTraits<String>::toString):
 591 * svg/properties/SVGStaticListPropertyTearOff.h:
 592 (WebCore::SVGStaticListPropertyTearOff::SVGStaticListPropertyTearOff):
 593 * svg/properties/SVGStaticPropertyTearOff.h:
 594
15952018-02-12 Matt Lewis <jlewis3@apple.com>
2596
3597 Unreviewed, rolling out r228376.
228390

Source/WebCore/Sources.txt

@@svg/SVGAnimatedPreserveAspectRatio.cpp
20712071svg/SVGAnimatedRect.cpp
20722072svg/SVGAnimatedString.cpp
20732073svg/SVGAnimatedTransformList.cpp
2074 svg/SVGAnimatedType.cpp
20752074svg/SVGAnimatedTypeAnimator.cpp
20762075svg/SVGAnimationElement.cpp
20772076svg/SVGCircleElement.cpp

@@svg/SVGLengthListValues.cpp
21352134svg/SVGLengthValue.cpp
21362135svg/SVGLineElement.cpp
21372136svg/SVGLinearGradientElement.cpp
 2137svg/SVGListValues.cpp
21382138svg/SVGLocatable.cpp
21392139svg/SVGMPathElement.cpp
21402140svg/SVGMarkerElement.cpp
228390

Source/WebCore/WebCore.xcodeproj/project.pbxproj

16321632 5550CB421E955E3C00111AA0 /* ImageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5550CB411E955E3C00111AA0 /* ImageTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
16331633 555130011E7CCCCB00A69E38 /* DecodingOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 555130001E7CCCCA00A69E38 /* DecodingOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
16341634 555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */; };
 1635 55627B7820292BF4002D397D /* SVGListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 55627B762028EDC4002D397D /* SVGListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
16351636 5576A5651D88A70800CCC04C /* ImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 5576A5631D88A70800CCC04C /* ImageFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1637 558B69982025456D004D75F4 /* SVGValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 55E44AE01E4BFBC50092457B /* SVGValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1638 558B6999202545AC004D75F4 /* SVGAngleValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8F22431DD3B3B900E92DA3 /* SVGAngleValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1639 558B699B202545EA004D75F4 /* SVGNumberListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3691DDB86D300FEFB29 /* SVGNumberListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1640 558B699C20254605004D75F4 /* SVGPathSegListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C36F1DDBA3E000FEFB29 /* SVGPathSegListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1641 558B699D20254612004D75F4 /* SVGPointListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C36B1DDB871C00FEFB29 /* SVGPointListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1642 558B699E2025462B004D75F4 /* SVGPreserveAspectRatioValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8F22461DD3D1C500E92DA3 /* SVGPreserveAspectRatioValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1643 558B699F20254675004D75F4 /* SVGTransformListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C36D1DDB8BB000FEFB29 /* SVGTransformListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
16361644 55A336F71D8209F40022C4C7 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; };
16371645 55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
16381646 55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };

19301938 71556CBD1F9F0A4900E78D08 /* JSAnimationEffectTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CB91F9F09FD00E78D08 /* JSAnimationEffectTiming.h */; };
19311939 71556CBE1F9F0A4900E78D08 /* JSKeyframeEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CB71F9F09FC00E78D08 /* JSKeyframeEffect.h */; };
19321940 71A1B6081DEE5AD70073BCFB /* modern-media-controls-localized-strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 71A1B6061DEE5A820073BCFB /* modern-media-controls-localized-strings.js */; };
1933  71A57DF2154BE25C0009D120 /* SVGPathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */; };
 1941 71A57DF2154BE25C0009D120 /* SVGPathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
19341942 71C916081D1483A300ACA47D /* UserInterfaceLayoutDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
19351943 71DCB7021568197600862271 /* JSSVGZoomAndPan.h in Headers */ = {isa = PBXBuildFile; fileRef = 71DCB7001568197600862271 /* JSSVGZoomAndPan.h */; };
19361944 71E2183A17359FB8006E6E4D /* PlugInsResources.h in Headers */ = {isa = PBXBuildFile; fileRef = 71E2183817359FB8006E6E4D /* PlugInsResources.h */; };

20322040 7C30D9861F815AEC00268356 /* JSAbortSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C30D9811F815AC100268356 /* JSAbortSignal.h */; };
20332041 7C330A021DF8FAC600D3395C /* GraphicsContext3DAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
20342042 7C330A081DF9F95100D3395C /* JSPositionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A061DF9F95100D3395C /* JSPositionOptions.h */; };
2035  7C39C3651DDA865200FEFB29 /* SVGLengthListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */; };
 2043 7C39C3651DDA865200FEFB29 /* SVGLengthListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
20362044 7C39C3771DDBE17000FEFB29 /* SVGStringListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3671DDB82CF00FEFB29 /* SVGStringListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
20372045 7C3A91E61C963B8800D1A7E3 /* ClipboardAccessPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
20382046 7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */; };

21642172 7CE191791F2ABE7100272F78 /* JSFetchRequestMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE1916C1F2AB70A00272F78 /* JSFetchRequestMode.h */; };
21652173 7CE1917B1F2ABE7100272F78 /* JSFetchRequestRedirect.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE1916A1F2AB70600272F78 /* JSFetchRequestRedirect.h */; };
21662174 7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
2167  7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */; };
21682175 7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
2169  7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D561DD7D96D00128552 /* SVGTransformValue.h */; };
2170  7CE58D5C1DD7EC9C00128552 /* SVGMatrixValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D5B1DD7EC9C00128552 /* SVGMatrixValue.h */; };
 2176 7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D561DD7D96D00128552 /* SVGTransformValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 2177 7CE58D5C1DD7EC9C00128552 /* SVGMatrixValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D5B1DD7EC9C00128552 /* SVGMatrixValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
21712178 7CE68344192143A800F4D928 /* UserMessageHandlerDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */; };
21722179 7CE68345192143A800F4D928 /* UserMessageHandlerDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
21732180 7CE683471921821500F4D928 /* UserMessageHandlerDescriptorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };

23092316 83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA41DA9F1660037237C /* UIEventInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
23102317 83FE7CA81DA9F1B60037237C /* EventModifierInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA31DA9F1650037237C /* EventModifierInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
23112318 83FE90271E307C30003E9199 /* PerformanceMonitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE90261E307C1C003E9199 /* PerformanceMonitor.h */; };
2312  8419D2A7120D92D000141F8F /* SVGPathByteStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A4120D92D000141F8F /* SVGPathByteStream.h */; };
 2319 8419D2A7120D92D000141F8F /* SVGPathByteStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A4120D92D000141F8F /* SVGPathByteStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
23132320 8419D2A9120D92D000141F8F /* SVGPathByteStreamBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A6120D92D000141F8F /* SVGPathByteStreamBuilder.h */; };
23142321 8419D2AD120D92FC00141F8F /* SVGPathByteStreamSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2AB120D92FC00141F8F /* SVGPathByteStreamSource.h */; };
23152322 8419D2BA120E0C7600141F8F /* SVGPathStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2B8120E0C7600141F8F /* SVGPathStringBuilder.h */; };

23362343 84730D931248F0B300D3A9C9 /* SpotLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D761248F0B300D3A9C9 /* SpotLightSource.h */; };
23372344 8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9E411DF6A0B00555B02 /* SVGPathSegListBuilder.h */; };
23382345 8476C9EB11DF6A2900555B02 /* SVGPathBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9E811DF6A2900555B02 /* SVGPathBuilder.h */; };
2339  8476C9EC11DF6A2900555B02 /* SVGPathConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9E911DF6A2900555B02 /* SVGPathConsumer.h */; };
 2346 8476C9EC11DF6A2900555B02 /* SVGPathConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9E911DF6A2900555B02 /* SVGPathConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; };
23402347 8476C9F011DF6A5800555B02 /* SVGPathParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9EE11DF6A5800555B02 /* SVGPathParser.h */; };
23412348 84801955108BAFB300CB2B1F /* FEGaussianBlur.h in Headers */ = {isa = PBXBuildFile; fileRef = 84801953108BAFB300CB2B1F /* FEGaussianBlur.h */; };
23422349 8482B7461198C35400BFB005 /* HashChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2442BBF81194C9D300D49469 /* HashChangeEvent.h */; };

32813288 B2227A4B0D00BF220071B782 /* SVGMetadataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B50D00BF200071B782 /* SVGMetadataElement.h */; };
32823289 B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B80D00BF200071B782 /* SVGMPathElement.h */; };
32833290 B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278BB0D00BF200071B782 /* SVGNumberList.h */; settings = {ATTRIBUTES = (Private, ); }; };
3284  B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C10D00BF200071B782 /* SVGParserUtilities.h */; };
 3291 B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C10D00BF200071B782 /* SVGParserUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
32853292 B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C30D00BF200071B782 /* SVGPathElement.h */; };
3286  B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C50D00BF200071B782 /* SVGPathSeg.h */; };
 3293 B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C50D00BF200071B782 /* SVGPathSeg.h */; settings = {ATTRIBUTES = (Private, ); }; };
32873294 B2227A5E0D00BF220071B782 /* SVGPathSegArc.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C80D00BF200071B782 /* SVGPathSegArc.h */; };
32883295 B2227A620D00BF220071B782 /* SVGPathSegClosePath.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278CC0D00BF200071B782 /* SVGPathSegClosePath.h */; };
32893296 B2227A650D00BF220071B782 /* SVGPathSegCurvetoCubic.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278CF0D00BF200071B782 /* SVGPathSegCurvetoCubic.h */; };

72837290 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedTypeAnimator.h; sourceTree = "<group>"; };
72847291 439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatorFactory.h; sourceTree = "<group>"; };
72857292 43A0F0B013AC7D6D00A5F0A7 /* SVGAnimatedNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumber.cpp; sourceTree = "<group>"; };
7286  43A0F0B513ACCCFF00A5F0A7 /* SVGAnimatedType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedType.cpp; sourceTree = "<group>"; };
72877293 43A625F613B3304000AC94B8 /* SVGAnimatedColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedColor.h; sourceTree = "<group>"; };
72887294 43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedColor.cpp; sourceTree = "<group>"; };
72897295 43A6266613B3D11000AC94B8 /* SVGAnimatedString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedString.cpp; sourceTree = "<group>"; };

81748180 550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
81758181 554675771FD1FC1A003B10B0 /* ImageSource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageSource.cpp; sourceTree = "<group>"; };
81768182 554675781FD1FC1A003B10B0 /* ImageSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageSource.h; sourceTree = "<group>"; };
 8183 55504E94202CDFD200507C73 /* SVGListValues.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SVGListValues.cpp; sourceTree = "<group>"; };
81778184 5550CB411E955E3C00111AA0 /* ImageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageTypes.h; sourceTree = "<group>"; };
81788185 555130001E7CCCCA00A69E38 /* DecodingOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecodingOptions.h; sourceTree = "<group>"; };
81798186 555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDecoderCG.cpp; sourceTree = "<group>"; };
81808187 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDecoderCG.h; sourceTree = "<group>"; };
 8188 55627B762028EDC4002D397D /* SVGListValues.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGListValues.h; sourceTree = "<group>"; };
 8189 5575056C1E53B30C008DE30A /* SVGMarkerTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerTypes.h; sourceTree = "<group>"; };
81818190 5576A5621D88A70800CCC04C /* ImageFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrame.cpp; sourceTree = "<group>"; };
81828191 5576A5631D88A70800CCC04C /* ImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFrame.h; sourceTree = "<group>"; };
81838192 55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };

81858194 55AF14E31EAAC59B0026EEAA /* UTIRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UTIRegistry.cpp; sourceTree = "<group>"; };
81868195 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UTIRegistry.h; sourceTree = "<group>"; };
81878196 55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; };
 8197 55E44AE01E4BFBC50092457B /* SVGValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValue.h; sourceTree = "<group>"; };
81888198 570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; };
81898199 570440591E53936200356601 /* JSAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcCfbParams.h; sourceTree = "<group>"; };
81908200 5704405B1E53937900356601 /* JSAesCbcCfbParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesCbcCfbParams.cpp; sourceTree = "<group>"; };

94669476 7CE1916E1F2AB70D00272F7B /* JSCacheQueryOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCacheQueryOptions.cpp; sourceTree = "<group>"; };
94679477 7CE1916F1F2AB70F00272F78 /* JSFetchRequestRedirect.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchRequestRedirect.cpp; sourceTree = "<group>"; };
94689478 7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = "<group>"; };
9469  7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectTraits.h; sourceTree = "<group>"; };
94709479 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = "<group>"; };
94719480 7CE58D511DD7B09300128552 /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = "<group>"; };
94729481 7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthValue.cpp; sourceTree = "<group>"; };

2243122440 7157F061150B6564006EAABD /* SVGAnimatedTransformList.cpp */,
2243222441 08250938128BD4D800E2ED8E /* SVGAnimatedTransformList.h */,
2243322442 B22277F80D00BF1F0071B782 /* SVGAnimatedTransformList.idl */,
22434  43A0F0B513ACCCFF00A5F0A7 /* SVGAnimatedType.cpp */,
2243522443 439D334013A6911C00C20F4F /* SVGAnimatedType.h */,
2243622444 836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */,
2243722445 439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */,

2263222640 B22278A50D00BF200071B782 /* SVGLineElement.cpp */,
2263322641 B22278A60D00BF200071B782 /* SVGLineElement.h */,
2263422642 B22278A70D00BF200071B782 /* SVGLineElement.idl */,
 22643 55504E94202CDFD200507C73 /* SVGListValues.cpp */,
 22644 55627B762028EDC4002D397D /* SVGListValues.h */,
2263522645 B22278AA0D00BF200071B782 /* SVGLocatable.cpp */,
2263622646 B22278AB0D00BF200071B782 /* SVGLocatable.h */,
2263722647 B22278AD0D00BF200071B782 /* SVGMarkerElement.cpp */,
2263822648 B22278AE0D00BF200071B782 /* SVGMarkerElement.h */,
2263922649 B22278AF0D00BF200071B782 /* SVGMarkerElement.idl */,
 22650 5575056C1E53B30C008DE30A /* SVGMarkerTypes.h */,
2264022651 B22278B00D00BF200071B782 /* SVGMaskElement.cpp */,
2264122652 B22278B10D00BF200071B782 /* SVGMaskElement.h */,
2264222653 B22278B20D00BF200071B782 /* SVGMaskElement.idl */,

2277022781 B22279070D00BF210071B782 /* SVGRectElement.cpp */,
2277122782 B22279080D00BF210071B782 /* SVGRectElement.h */,
2277222783 B22279090D00BF210071B782 /* SVGRectElement.idl */,
22773  7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */,
2277422784 B222790A0D00BF210071B782 /* SVGRenderingIntent.h */,
2277522785 B222790B0D00BF210071B782 /* SVGRenderingIntent.idl */,
2277622786 B222790C0D00BF210071B782 /* SVGScriptElement.cpp */,

2284722857 B22279560D00BF210071B782 /* SVGUseElement.cpp */,
2284822858 B22279570D00BF210071B782 /* SVGUseElement.h */,
2284922859 B22279580D00BF210071B782 /* SVGUseElement.idl */,
 22860 55E44AE01E4BFBC50092457B /* SVGValue.h */,
2285022861 B22279590D00BF210071B782 /* SVGViewElement.cpp */,
2285122862 B222795A0D00BF210071B782 /* SVGViewElement.h */,
2285222863 B222795B0D00BF210071B782 /* SVGViewElement.idl */,

2969329704 65653F2E0D9727D200CA9723 /* SVGAltGlyphElement.h in Headers */,
2969429705 24D912B813CA9A6900D21915 /* SVGAltGlyphItemElement.h in Headers */,
2969529706 B22279770D00BF220071B782 /* SVGAngle.h in Headers */,
 29707 558B6999202545AC004D75F4 /* SVGAngleValue.h in Headers */,
2969629708 B222797A0D00BF220071B782 /* SVGAnimateColorElement.h in Headers */,
2969729709 087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */,
2969829710 085797091278394C00A8EC5F /* SVGAnimatedBoolean.h in Headers */,

2980429816 B2227A3C0D00BF220071B782 /* SVGLineElement.h in Headers */,
2980529817 0810764412828556007C63BA /* SVGListProperty.h in Headers */,
2980629818 088A0E09126EF1DB00978F7A /* SVGListPropertyTearOff.h in Headers */,
 29819 55627B7820292BF4002D397D /* SVGListValues.h in Headers */,
2980729820 B2227A410D00BF220071B782 /* SVGLocatable.h in Headers */,
2980829821 436708EE12D9CA4B00044234 /* SVGMarkerData.h in Headers */,
2980929822 B2227A440D00BF220071B782 /* SVGMarkerElement.h in Headers */,

2981629829 B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */,
2981729830 7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */,
2981829831 B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */,
 29832 558B699B202545EA004D75F4 /* SVGNumberListValues.h in Headers */,
2981929833 B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */,
2982029834 2D3A0E3613A7D76100E85AF0 /* SVGParsingError.h in Headers */,
2982129835 84C6784D1214814700A92902 /* SVGPathBlender.h in Headers */,

2985429868 B2227A810D00BF220071B782 /* SVGPathSegList.h in Headers */,
2985529869 8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */,
2985629870 84B6B978120F13E500B8EFAF /* SVGPathSegListSource.h in Headers */,
 29871 558B699C20254605004D75F4 /* SVGPathSegListValues.h in Headers */,
2985729872 83C1D435178D5AB500141E68 /* SVGPathSegMovetoAbs.h in Headers */,
2985829873 83C1D436178D5AB500141E68 /* SVGPathSegMovetoRel.h in Headers */,
2985929874 082DE42D1292621600D923DF /* SVGPathSegWithContext.h in Headers */,

2986529880 B2227A880D00BF220071B782 /* SVGPatternElement.h in Headers */,
2986629881 7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */,
2986729882 B2227A8C0D00BF220071B782 /* SVGPointList.h in Headers */,
 29883 558B699D20254612004D75F4 /* SVGPointListValues.h in Headers */,
2986829884 B2227A8F0D00BF220071B782 /* SVGPolyElement.h in Headers */,
2986929885 B2227A910D00BF220071B782 /* SVGPolygonElement.h in Headers */,
2987029886 B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */,
2987129887 B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */,
 29888 558B699E2025462B004D75F4 /* SVGPreserveAspectRatioValue.h in Headers */,
2987229889 088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */,
2987329890 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */,
2987429891 088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */,

2987629893 B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */,
2987729894 08EDE19F12A50B8E00B95797 /* SVGRect.h in Headers */,
2987829895 B2227A9E0D00BF220071B782 /* SVGRectElement.h in Headers */,
29879  7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */,
2988029896 197B180C1506353200E4ADA8 /* SVGRenderingContext.h in Headers */,
2988129897 B2227AA00D00BF220071B782 /* SVGRenderingIntent.h in Headers */,
2988229898 BC2274790E8366E200E7F975 /* SVGRenderStyle.h in Headers */,

2992129937 B2227ADA0D00BF220071B782 /* SVGTransformable.h in Headers */,
2992229938 B2227ADD0D00BF220071B782 /* SVGTransformDistance.h in Headers */,
2992329939 B2227ADF0D00BF220071B782 /* SVGTransformList.h in Headers */,
 29940 558B699F20254675004D75F4 /* SVGTransformListValues.h in Headers */,
2992429941 7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */,
2992529942 B2227AE20D00BF220071B782 /* SVGTRefElement.h in Headers */,
2992629943 B2227AE50D00BF220071B782 /* SVGTSpanElement.h in Headers */,

2992829945 37C738ED1EDBD5BC003F2B0B /* SVGUnknownElement.h in Headers */,
2992929946 B2227AEA0D00BF220071B782 /* SVGURIReference.h in Headers */,
2993029947 B2227AED0D00BF220071B782 /* SVGUseElement.h in Headers */,
 29948 558B69982025456D004D75F4 /* SVGValue.h in Headers */,
2993129949 B2227AF00D00BF220071B782 /* SVGViewElement.h in Headers */,
2993229950 B2227AF30D00BF220071B782 /* SVGViewSpec.h in Headers */,
2993329951 8485228B1190173C006EDC7F /* SVGVKernElement.h in Headers */,
228390

Source/WebCore/rendering/svg/SVGPathData.cpp

@@static Path pathFromPathElement(SVGEleme
100100
101101static Path pathFromPolygonElement(SVGElement& element)
102102{
103  auto& points = downcast<SVGPolygonElement>(element).animatedPoints()->values();
 103 auto& points = downcast<SVGPolygonElement>(element).animatedPoints()->valuesProperty();
104104 if (points.isEmpty())
105105 return { };
106106
107107 Path path;
108  path.moveTo(points.first());
 108 path.moveTo(points.firstProperty());
109109
110110 unsigned size = points.size();
111111 for (unsigned i = 1; i < size; ++i)
112  path.addLineTo(points.at(i));
 112 path.addLineTo(points.propertyAt(i));
113113
114114 path.closeSubpath();
115115 return path;

@@static Path pathFromPolygonElement(SVGEl
117117
118118static Path pathFromPolylineElement(SVGElement& element)
119119{
120  auto& points = downcast<SVGPolylineElement>(element).animatedPoints()->values();
 120 auto& points = downcast<SVGPolylineElement>(element).animatedPoints()->valuesProperty();
121121 if (points.isEmpty())
122122 return { };
123123
124124 Path path;
125  path.moveTo(points.first());
 125 path.moveTo(points.firstProperty());
126126
127127 unsigned size = points.size();
128128 for (unsigned i = 1; i < size; ++i)
129  path.addLineTo(points.at(i));
 129 path.addLineTo(points.propertyAt(i));
130130 return path;
131131}
132132
228390

Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp

@@void SVGTextLayoutAttributesBuilder::bui
163163static inline void updateCharacterData(unsigned i, float& lastRotation, SVGCharacterData& data, const SVGLengthContext& lengthContext, const SVGLengthListValues* xList, const SVGLengthListValues* yList, const SVGLengthListValues* dxList, const SVGLengthListValues* dyList, const SVGNumberListValues* rotateList)
164164{
165165 if (xList)
166  data.x = xList->at(i).value(lengthContext);
 166 data.x = xList->propertyAt(i).value(lengthContext);
167167 if (yList)
168  data.y = yList->at(i).value(lengthContext);
 168 data.y = yList->propertyAt(i).value(lengthContext);
169169 if (dxList)
170  data.dx = dxList->at(i).value(lengthContext);
 170 data.dx = dxList->propertyAt(i).value(lengthContext);
171171 if (dyList)
172  data.dy = dyList->at(i).value(lengthContext);
 172 data.dy = dyList->propertyAt(i).value(lengthContext);
173173 if (rotateList) {
174  data.rotate = rotateList->at(i);
 174 data.rotate = rotateList->propertyAt(i);
175175 lastRotation = data.rotate;
176176 }
177177}
228390

Source/WebCore/svg/SVGAngle.h

@@namespace WebCore {
3232
3333class SVGAngle : public SVGPropertyTearOff<SVGAngleValue> {
3434public:
35  static Ref<SVGAngle> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGAngleValue& value)
 35 static Ref<SVGAngle> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
3636 {
3737 return adoptRef(*new SVGAngle(animatedProperty, role, value));
3838 }

@@public:
4242 return adoptRef(*new SVGAngle(initialValue));
4343 }
4444
45  static Ref<SVGAngle> create(const SVGAngleValue* initialValue)
46  {
47  return adoptRef(*new SVGAngle(initialValue));
48  }
49 
5045 template<typename T> static ExceptionOr<Ref<SVGAngle>> create(ExceptionOr<T>&& initialValue)
5146 {
5247 if (initialValue.hasException())

@@public:
5651
5752 SVGAngleValue::Type unitType()
5853 {
59  return propertyReference().unitType();
 54 return valueProperty().unitType();
6055 }
6156
6257 ExceptionOr<void> setValueForBindings(float value)

@@public:
6459 if (isReadOnly())
6560 return Exception { NoModificationAllowedError };
6661
67  propertyReference().setValue(value);
 62 valueProperty().setValue(value);
6863 commitChange();
6964
7065 return { };

@@public:
7267
7368 float valueForBindings()
7469 {
75  return propertyReference().value();
 70 return valueProperty().value();
7671 }
7772
7873 ExceptionOr<void> setValueInSpecifiedUnits(float valueInSpecifiedUnits)

@@public:
8075 if (isReadOnly())
8176 return Exception { NoModificationAllowedError };
8277
83  propertyReference().setValueInSpecifiedUnits(valueInSpecifiedUnits);
 78 valueProperty().setValueInSpecifiedUnits(valueInSpecifiedUnits);
8479 commitChange();
8580
8681 return { };

@@public:
8883
8984 float valueInSpecifiedUnits()
9085 {
91  return propertyReference().valueInSpecifiedUnits();
 86 return valueProperty().valueInSpecifiedUnits();
9287 }
9388
9489 ExceptionOr<void> setValueAsString(const String& value)

@@public:
9691 if (isReadOnly())
9792 return Exception { NoModificationAllowedError };
9893
99  auto result = propertyReference().setValueAsString(value);
 94 auto result = valueProperty().setValueAsString(value);
10095 if (result.hasException())
10196 return result;
10297

@@public:
106101
107102 String valueAsString()
108103 {
109  return propertyReference().valueAsString();
 104 return valueProperty().valueAsString();
110105 }
111106
112107 ExceptionOr<void> newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits)

@@public:
114109 if (isReadOnly())
115110 return Exception { NoModificationAllowedError };
116111
117  auto result = propertyReference().newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
 112 auto result = valueProperty().newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
118113 if (result.hasException())
119114 return result;
120115

@@public:
127122 if (isReadOnly())
128123 return Exception { NoModificationAllowedError };
129124
130  auto result = propertyReference().convertToSpecifiedUnits(unitType);
 125 auto result = valueProperty().convertToSpecifiedUnits(unitType);
131126 if (result.hasException())
132127 return result;
133128

@@public:
136131 }
137132
138133private:
139  SVGAngle(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGAngleValue& value)
 134 SVGAngle(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
140135 : SVGPropertyTearOff<SVGAngleValue>(&animatedProperty, role, value)
141136 {
142137 }

@@private:
145140 : SVGPropertyTearOff<SVGAngleValue>(initialValue)
146141 {
147142 }
148 
149  explicit SVGAngle(const SVGAngleValue* initialValue)
150  : SVGPropertyTearOff<SVGAngleValue>(initialValue)
151  {
152  }
153143};
154144
155145} // namespace WebCore
228390

Source/WebCore/svg/SVGAnimateElementBase.cpp

@@void SVGAnimateElementBase::resetAnimate
224224 if (!m_animatedType)
225225 m_animatedType = animator->constructFromString(baseValue);
226226 else
227  m_animatedType->setValueAsString(attributeName, baseValue);
 227 m_animatedType->parse(attributeName, baseValue);
228228}
229229
230230static inline void applyCSSPropertyToTarget(SVGElement& targetElement, CSSPropertyID id, const String& value)

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

Source/WebCore/svg/SVGAnimateMotionElement.cpp

@@void SVGAnimateMotionElement::updateAnim
136136 updateAnimationMode();
137137}
138138
139 static bool parsePoint(const String& s, FloatPoint& point)
140 {
141  if (s.isEmpty())
142  return false;
143  auto upconvertedCharacters = StringView(s).upconvertedCharacters();
144  const UChar* cur = upconvertedCharacters;
145  const UChar* end = cur + s.length();
146 
147  if (!skipOptionalSVGSpaces(cur, end))
148  return false;
149 
150  float x = 0;
151  if (!parseNumber(cur, end, x))
152  return false;
153 
154  float y = 0;
155  if (!parseNumber(cur, end, y))
156  return false;
157 
158  point = FloatPoint(x, y);
159 
160  // disallow anything except spaces at the end
161  return !skipOptionalSVGSpaces(cur, end);
162 }
163 
164139void SVGAnimateMotionElement::resetAnimatedType()
165140{
166141 if (!hasValidAttributeType())
228390

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& fromAngle = static_cast<SVGAngleValue&>(*from->values[0]);
 69 const auto& fromEnumeration = static_cast<unsigned&>(*from->values[1]);
 70 auto& toAngle = static_cast<SVGAngleValue&>(*to->values[0]);
 71 auto& toEnumeration = static_cast<unsigned&>(*to->values[1]);
8072 // Only respect by animations, if from and by are both specified in angles (and not eg. 'auto').
81  if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second || fromAngleAndEnumeration.second != SVGMarkerOrientAngle)
 73 if (fromEnumeration != toEnumeration || fromEnumeration != SVGMarkerOrientAngle)
8274 return;
83  const auto& fromAngle = fromAngleAndEnumeration.first;
84  auto& toAngle = toAngleAndEnumeration.first;
8575 toAngle.setValue(toAngle.value() + fromAngle.value());
8676}
8777

@@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& fromAngle = m_animationElement->animationMode() == ToAnimation ? static_cast<SVGAngleValue&>(*animated->values[0]) : static_cast<SVGAngleValue&>(*from->values[0]);
 84 const auto& fromEnumeration = m_animationElement->animationMode() == ToAnimation ? static_cast<unsigned&>(*animated->values[1]) : static_cast<unsigned&>(*from->values[1]);
 85 auto& toAngle = static_cast<SVGAngleValue&>(*to->values[0]);
 86 auto& toEnumeration = static_cast<unsigned&>(*to->values[1]);
 87 auto& toAtEndOfDurationAngle = static_cast<SVGAngleValue&>(*toAtEndOfDuration->values[0]);
 88 auto& animatedAngle = static_cast<SVGAngleValue&>(*animated->values[0]);
 89 auto& animatedEnumeration = static_cast<unsigned&>(*animated->values[1]);
9790
98  if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second) {
 91 if (fromEnumeration != toEnumeration) {
9992 // Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
10093 if (percentage < 0.5f) {
101  animatedAngleAndEnumeration.second = fromAngleAndEnumeration.second;
102  if (fromAngleAndEnumeration.second == SVGMarkerOrientAngle)
103  animatedAngleAndEnumeration.first = fromAngleAndEnumeration.first;
 94 animatedEnumeration = fromEnumeration;
 95 if (fromEnumeration == SVGMarkerOrientAngle)
 96 animatedAngle = fromAngle;
10497 else
105  animatedAngleAndEnumeration.first.setValue(0);
 98 animatedAngle.setValue(0);
10699 return;
107100 }
108  animatedAngleAndEnumeration.second = toAngleAndEnumeration.second;
109  if (toAngleAndEnumeration.second == SVGMarkerOrientAngle)
110  animatedAngleAndEnumeration.first = toAngleAndEnumeration.first;
 101 animatedEnumeration = toEnumeration;
 102 if (toEnumeration == SVGMarkerOrientAngle)
 103 animatedAngle = toAngle;
111104 else
112  animatedAngleAndEnumeration.first.setValue(0);
 105 animatedAngle.setValue(0);
113106 return;
114107 }
115108
116  if (fromAngleAndEnumeration.second == SVGMarkerOrientAngle) {
 109 if (fromEnumeration == SVGMarkerOrientAngle) {
117110 // Regular from angle to angle animation, with support for smooth interpolation, and additive and accumulated animation.
118  animatedAngleAndEnumeration.second = SVGMarkerOrientAngle;
 111 animatedEnumeration = SVGMarkerOrientAngle;
119112
120  auto& animatedSVGAngle = animatedAngleAndEnumeration.first;
121  const auto& toAtEndOfDurationSVGAngle = toAtEndOfDurationAngleAndEnumeration.first;
122  float animatedAngle = animatedSVGAngle.value();
123  m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngleAndEnumeration.first.value(), toAngleAndEnumeration.first.value(), toAtEndOfDurationSVGAngle.value(), animatedAngle);
124  animatedSVGAngle.setValue(animatedAngle);
 113 float animatedAngleValue = animatedAngle.value();
 114 m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngle.value(), toAngle.value(), toAtEndOfDurationAngle.value(), animatedAngleValue);
 115 animatedAngle.setValue(animatedAngleValue);
125116 return;
126117 }
127118
128119 // auto, auto-start-reverse, or unknown.
129  animatedAngleAndEnumeration.first.setValue(0);
 120 animatedAngle.setValue(0);
130121
131  if (fromAngleAndEnumeration.second == SVGMarkerOrientAuto || fromAngleAndEnumeration.second == SVGMarkerOrientAutoStartReverse)
132  animatedAngleAndEnumeration.second = fromAngleAndEnumeration.second;
 122 if (fromEnumeration == SVGMarkerOrientAuto || fromEnumeration == SVGMarkerOrientAutoStartReverse)
 123 animatedEnumeration = fromEnumeration;
133124 else
134  animatedAngleAndEnumeration.second = SVGMarkerOrientUnknown;
 125 animatedEnumeration = SVGMarkerOrientUnknown;
135126}
136127
137128float SVGAnimatedAngleAnimator::calculateDistance(const String& fromString, const String& toString)
228390

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 ? static_cast<bool&>(*animated->values[0]) : static_cast<bool&>(*from->values[0]);
 73 bool toBoolean = static_cast<bool&>(*to->values[0]);
 74 bool& animatedBoolean = static_cast<bool&>(*animated->values[0]);
7775
7876 m_animationElement->animateDiscreteType<bool>(percentage, fromBoolean, toBoolean, animatedBoolean);
7977}
228390

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 = static_cast<Color&>(*from->values[0]);
 48 auto& toColor = static_cast<Color&>(*to->values[0]);
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 ? static_cast<Color&>(*animated->values[0]) : static_cast<Color&>(*from->values[0]);
 73 Color toColor = static_cast<Color&>(*to->values[0]);
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 = static_cast<Color&>(*toAtEndOfDuration->values[0]);
 86 auto& animatedColor = static_cast<Color&>(*animated->values[0]);
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.
228390

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 ? static_cast<unsigned&>(*animated->values[0]) : static_cast<unsigned&>(*from->values[0]);
 151 unsigned toEnumeration = static_cast<unsigned&>(*to->values[0]);
 152 unsigned& animatedEnumeration = static_cast<unsigned&>(*animated->values[0]);
155153
156154 m_animationElement->animateDiscreteType<unsigned>(percentage, fromEnumeration, toEnumeration, animatedEnumeration);
157155}
228390

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 static_cast<int&>(*to->values[0]) += static_cast<int&>(*from->values[0]);
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 ? static_cast<int&>(*animated->values[0]) : static_cast<int&>(*from->values[0]);
 85 int toInteger = static_cast<int&>(*to->values[0]);
 86 int toAtEndOfDurationInteger = static_cast<int&>(*toAtEndOfDuration->values[0]);
 87 int& animatedInteger = static_cast<int&>(*animated->values[0]);
9088
9189 calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromInteger, toInteger, toAtEndOfDurationInteger, animatedInteger);
9290}
228390

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();
82 
83  toIntegerPair.first += fromIntegerPair.first;
84  toIntegerPair.second += fromIntegerPair.second;
 69 static_cast<int&>(*to->values[0]) += static_cast<int&>(*from->values[0]);
 70 static_cast<int&>(*to->values[1]) += static_cast<int&>(*from->values[1]);
8571}
8672
8773void SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)

@@void SVGAnimatedIntegerOptionalIntegerAn
8975 ASSERT(m_animationElement);
9076 ASSERT(m_contextElement);
9177
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();
 78 const int& formFirst = m_animationElement->animationMode() == ToAnimation ? static_cast<int&>(*animated->values[0]) : static_cast<int&>(*from->values[0]);
 79 const int& formSecond = m_animationElement->animationMode() == ToAnimation ? static_cast<int&>(*animated->values[1]) : static_cast<int&>(*from->values[1]);
 80 const int& toFirst = static_cast<int&>(*to->values[0]);
 81 const int& toSecond = static_cast<int&>(*to->values[1]);
 82 const int& toAtEndOfDurationFirst = static_cast<int&>(*toAtEndOfDuration->values[0]);
 83 const int& toAtEndOfDurationSecond = static_cast<int&>(*toAtEndOfDuration->values[1]);
 84 int& animatedFirst = static_cast<int&>(*animated->values[0]);
 85 int& animatedSecond = static_cast<int&>(*animated->values[1]);
9686
97  SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.first, toIntegerPair.first, toAtEndOfDurationIntegerPair.first, animatedIntegerPair.first);
98  SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.second, toIntegerPair.second, toAtEndOfDurationIntegerPair.second, animatedIntegerPair.second);
 87 SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, formFirst, toFirst, toAtEndOfDurationFirst, animatedFirst);
 88 SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, formSecond, toSecond, toAtEndOfDurationSecond, animatedSecond);
9989}
10090
10191float SVGAnimatedIntegerOptionalIntegerAnimator::calculateDistance(const String&, const String&)
228390

Source/WebCore/svg/SVGAnimatedLength.cpp

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

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

@@void SVGAnimatedLengthAnimator::addAnima
6767 ASSERT(from->type() == to->type());
6868
6969 SVGLengthContext lengthContext(m_contextElement);
70  const auto& fromLength = from->length();
71  auto& toLength = to->length();
 70 const auto& fromLength = static_cast<SVGLengthValue&>(*from->values[0]);
 71 auto& toLength = static_cast<SVGLengthValue&>(*to->values[0]);
7272
7373 toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext);
7474}

@@void SVGAnimatedLengthAnimator::calculat
8585 ASSERT(m_animationElement);
8686 ASSERT(m_contextElement);
8787
88  auto fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->length() : from->length();
89  auto toSVGLength = to->length();
90  const auto& toAtEndOfDurationSVGLength = toAtEndOfDuration->length();
91  auto& animatedSVGLength = animated->length();
 88 auto fromSVGLength = m_animationElement->animationMode() == ToAnimation ? static_cast<SVGLengthValue&>(*animated->values[0]) : static_cast<SVGLengthValue&>(*from->values[0]);
 89 auto toSVGLength = static_cast<SVGLengthValue&>(*to->values[0]);
 90 const auto& toAtEndOfDurationSVGLength = static_cast<SVGLengthValue&>(*toAtEndOfDuration->values[0]);
 91 auto& animatedSVGLength = static_cast<SVGLengthValue&>(*animated->values[0]);
9292
9393 // Apply CSS inheritance rules.
9494 m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
228390

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 = static_cast<SVGLengthListValues&>(*from->values[0]);
 70 auto& toLengthList = static_cast<SVGLengthListValues&>(*to->values[0]);
7371
7472 unsigned fromLengthListSize = fromLengthList.size();
7573 if (!fromLengthListSize || fromLengthListSize != toLengthList.size())

@@void SVGAnimatedLengthListAnimator::addA
7775
7876 SVGLengthContext lengthContext(m_contextElement);
7977 for (unsigned i = 0; i < fromLengthListSize; ++i)
80  toLengthList[i].setValue(toLengthList[i].value(lengthContext) + fromLengthList[i].value(lengthContext), lengthContext);
 78 toLengthList.propertyAt(i).setValue(toLengthList.propertyAt(i).value(lengthContext) + fromLengthList.propertyAt(i).value(lengthContext), lengthContext);
8179}
8280
8381static SVGLengthListValues parseLengthListFromString(SVGAnimationElement* animationElement, const String& string)

@@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 ? static_cast<SVGLengthListValues&>(*animated->values[0]) : static_cast<SVGLengthListValues&>(*from->values[0]);
 94 auto toLengthList = static_cast<SVGLengthListValues&>(*to->values[0]);
 95 const auto& toAtEndOfDurationLengthList = static_cast<SVGLengthListValues&>(*toAtEndOfDuration->values[0]);
 96 auto& animatedLengthList = static_cast<SVGLengthListValues&>(*animated->values[0]);
9997
10098 // Apply CSS inheritance rules.
10199 m_animationElement->adjustForInheritance<SVGLengthListValues>(parseLengthListFromString, m_animationElement->fromPropertyValueType(), fromLengthList, m_contextElement);

@@void SVGAnimatedLengthListAnimator::calc
110108
111109 SVGLengthContext lengthContext(m_contextElement);
112110 for (unsigned i = 0; i < toLengthListSize; ++i) {
113  float animatedNumber = animatedLengthList[i].value(lengthContext);
114  SVGLengthType unitType = toLengthList[i].unitType();
 111 float animatedNumber = animatedLengthList.propertyAt(i).value(lengthContext);
 112 SVGLengthType unitType = toLengthList.propertyAt(i).unitType();
115113 float effectiveFrom = 0;
116114 if (fromLengthListSize) {
117115 if (percentage < 0.5)
118  unitType = fromLengthList[i].unitType();
119  effectiveFrom = fromLengthList[i].value(lengthContext);
 116 unitType = fromLengthList.propertyAt(i).unitType();
 117 effectiveFrom = fromLengthList.propertyAt(i).value(lengthContext);
120118 }
121  float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurationLengthList[i].value(lengthContext) : 0;
 119 float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurationLengthList.propertyAt(i).value(lengthContext) : 0;
122120
123  m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toLengthList[i].value(lengthContext), effectiveToAtEnd, animatedNumber);
124  animatedLengthList[i].setValue(lengthContext, animatedNumber, m_lengthMode, unitType);
 121 m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toLengthList.propertyAt(i).value(lengthContext), effectiveToAtEnd, animatedNumber);
 122 animatedLengthList.propertyAt(i).setValue(lengthContext, animatedNumber, m_lengthMode, unitType);
125123 }
126124}
127125
228390

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 static_cast<float&>(*to->values[0]) += static_cast<float&>(*from->values[0]);
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 ? static_cast<float&>(*animated->values[0]) : static_cast<float&>(*from->values[0]);
 82 float toNumber = static_cast<float&>(*to->values[0]);
 83 float toAtEndOfDurationNumber = static_cast<float&>(*toAtEndOfDuration->values[0]);
 84 float& animatedNumber = static_cast<float&>(*animated->values[0]);
9185
9286 // Apply CSS inheritance rules.
9387 m_animationElement->adjustForInheritance<float>(parseNumberFromString, m_animationElement->fromPropertyValueType(), fromNumber, m_contextElement);
228390

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 = static_cast<SVGNumberListValues&>(*from->values[0]);
 69 auto& toNumberList = static_cast<SVGNumberListValues&>(*to->values[0]);
7270
7371 unsigned fromNumberListSize = fromNumberList.size();
7472 if (!fromNumberListSize || fromNumberListSize != toNumberList.size())
7573 return;
7674
7775 for (unsigned i = 0; i < fromNumberListSize; ++i)
78  toNumberList[i] += fromNumberList[i];
 76 static_cast<float&>(*toNumberList[i]) += static_cast<float&>(*fromNumberList[i]);
7977}
8078
8179void SVGAnimatedNumberListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
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 ? static_cast<SVGNumberListValues&>(*animated->values[0]) : static_cast<SVGNumberListValues&>(*from->values[0]);
 84 const auto& toNumberList = static_cast<SVGNumberListValues&>(*to->values[0]);
 85 const auto& toAtEndOfDurationNumberList = static_cast<SVGNumberListValues&>(*toAtEndOfDuration->values[0]);
 86 auto& animatedNumberList = static_cast<SVGNumberListValues&>(*animated->values[0]);
8987 if (!m_animationElement->adjustFromToListValues<SVGNumberListValues>(fromNumberList, toNumberList, animatedNumberList, percentage))
9088 return;
9189

@@void SVGAnimatedNumberListAnimator::calc
9492 unsigned toAtEndOfDurationSize = toAtEndOfDurationNumberList.size();
9593
9694 for (unsigned i = 0; i < toNumberListSize; ++i) {
97  float effectiveFrom = fromNumberListSize ? fromNumberList[i] : 0;
98  float effectiveToAtEnd = i < toAtEndOfDurationSize ? toAtEndOfDurationNumberList[i] : 0;
99  m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toNumberList[i], effectiveToAtEnd, animatedNumberList[i]);
 95 float effectiveFrom = fromNumberListSize ? fromNumberList.propertyAt(i) : 0;
 96 float effectiveToAtEnd = i < toAtEndOfDurationSize ? toAtEndOfDurationNumberList.propertyAt(i) : 0;
 97 m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toNumberList.propertyAt(i), effectiveToAtEnd, animatedNumberList.propertyAt(i));
10098 }
10199}
102100
228390

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();
77 
78  toNumberPair.first += fromNumberPair.first;
79  toNumberPair.second += fromNumberPair.second;
 69 static_cast<float&>(*to->values[0]) += static_cast<float&>(*from->values[0]);
 70 static_cast<float&>(*to->values[1]) += static_cast<float&>(*from->values[1]);
8071}
8172
8273void SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)

@@void SVGAnimatedNumberOptionalNumberAnim
8475 ASSERT(m_animationElement);
8576 ASSERT(m_contextElement);
8677
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();
 78 const auto& formFirst = m_animationElement->animationMode() == ToAnimation ? static_cast<float&>(*animated->values[0]) : static_cast<float&>(*from->values[0]);
 79 const auto& formSecond = m_animationElement->animationMode() == ToAnimation ? static_cast<float&>(*animated->values[1]) : static_cast<float&>(*from->values[1]);
 80 const auto& toFirst = static_cast<float&>(*to->values[0]);
 81 const auto& toSecond = static_cast<float&>(*to->values[1]);
 82 const auto& toAtEndOfDurationFirst = static_cast<float&>(*toAtEndOfDuration->values[0]);
 83 const auto& toAtEndOfDurationSecond = static_cast<float&>(*toAtEndOfDuration->values[1]);
 84 auto& animatedFirst = static_cast<float&>(*animated->values[0]);
 85 auto& animatedSecond = static_cast<float&>(*animated->values[1]);
9186
92  m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.first, toNumberPair.first, toAtEndOfDurationNumberPair.first, animatedNumberPair.first);
93  m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.second, toNumberPair.second, toAtEndOfDurationNumberPair.second, animatedNumberPair.second);
 87 m_animationElement->animateAdditiveNumber(percentage, repeatCount, formFirst, toFirst, toAtEndOfDurationFirst, animatedFirst);
 88 m_animationElement->animateAdditiveNumber(percentage, repeatCount, formSecond, toSecond, toAtEndOfDurationSecond, animatedSecond);
9489}
9590
9691float SVGAnimatedNumberOptionalNumberAnimator::calculateDistance(const String&, const String&)
228390

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
5855 RefPtr<SVGAnimatedPathSegListPropertyTearOff> property = castAnimatedPropertyToActualType<SVGAnimatedPathSegListPropertyTearOff>(animatedTypes[0].properties[0].get());
5956 const auto& baseValue = property->currentBaseValue();
6057
61  buildSVGPathByteStreamFromSVGPathSegListValues(baseValue, *byteStream, UnalteredParsing);
 58 buildSVGPathByteStreamFromSVGPathSegListValues(static_cast<SVGPathSegListValues&>(*baseValue), *byteStream, UnalteredParsing);
6259
6360 Vector<RefPtr<SVGAnimatedPathSegListPropertyTearOff>> result;
6461

@@void SVGAnimatedPathAnimator::resetAnimV
7269 if (!result.isEmpty()) {
7370 SVGElement::InstanceUpdateBlocker blocker(*property->contextElement());
7471 for (auto& segment : result)
75  segment->animationStarted(byteStream, &baseValue);
 72 segment->animationStarted(byteStream, &static_cast<SVGPathSegListValues&>(*baseValue));
7673 }
7774}
7875

@@void SVGAnimatedPathAnimator::resetAnimV
8077{
8178 ASSERT(animatedTypes.size() >= 1);
8279 ASSERT(type.type() == m_type);
83  resetAnimValToBaseVal(animatedTypes, type.path());
 80 resetAnimValToBaseVal(animatedTypes, &static_cast<SVGPathByteStream&>(*type.values[0]));
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 = static_cast<SVGPathByteStream&>(*from->values[0]);
 99 auto& toPath = static_cast<SVGPathByteStream&>(*to->values[0]);
 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 = static_cast<SVGPathByteStream&>(*from->values[0]);
 112 auto& toPath = static_cast<SVGPathByteStream&>(*to->values[0]);
 113 auto& toAtEndOfDurationPath = static_cast<SVGPathByteStream&>(*toAtEndOfDuration->values[0]);
 114 auto& animatedPath = static_cast<SVGPathByteStream&>(*animated->values[0]);
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&)
228390

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 = static_cast<SVGPointListValues&>(*from->values[0]);
 71 auto& toPointList = static_cast<SVGPointListValues&>(*to->values[0]);
7472
7573 unsigned fromPointListSize = fromPointList.size();
7674 if (!fromPointListSize || fromPointListSize != toPointList.size())
7775 return;
7876
7977 for (unsigned i = 0; i < fromPointListSize; ++i)
80  toPointList[i] += fromPointList[i];
 78 toPointList.propertyAt(i) += fromPointList.propertyAt(i);
8179}
8280
8381void SVGAnimatedPointListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
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 ? static_cast<SVGPointListValues&>(*animated->values[0]) : static_cast<SVGPointListValues&>(*from->values[0]);
 86 const auto& toPointList = static_cast<SVGPointListValues&>(*to->values[0]);
 87 const auto& toAtEndOfDurationPointList = static_cast<SVGPointListValues&>(*toAtEndOfDuration->values[0]);
 88 auto& animatedPointList = static_cast<SVGPointListValues&>(*animated->values[0]);
9189 if (!m_animationElement->adjustFromToListValues<SVGPointListValues>(fromPointList, toPointList, animatedPointList, percentage))
9290 return;
9391

@@void SVGAnimatedPointListAnimator::calcu
9896 for (unsigned i = 0; i < toPointListSize; ++i) {
9997 FloatPoint effectiveFrom;
10098 if (fromPointListSize)
101  effectiveFrom = fromPointList[i];
102  FloatPoint effectiveToAtEnd = i < toAtEndOfDurationSize ? toAtEndOfDurationPointList[i] : FloatPoint();
 99 effectiveFrom = fromPointList.propertyAt(i);
 100 FloatPoint effectiveToAtEnd = i < toAtEndOfDurationSize ? toAtEndOfDurationPointList.propertyAt(i) : FloatPoint();
103101
104  float animatedX = animatedPointList[i].x();
105  float animatedY = animatedPointList[i].y();
106  m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.x(), toPointList[i].x(), effectiveToAtEnd.x(), animatedX);
107  m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.y(), toPointList[i].y(), effectiveToAtEnd.y(), animatedY);
108  animatedPointList[i] = FloatPoint(animatedX, animatedY);
 102 float animatedX = animatedPointList.propertyAt(i).x();
 103 float animatedY = animatedPointList.propertyAt(i).y();
 104 m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.x(), toPointList.propertyAt(i).x(), effectiveToAtEnd.x(), animatedX);
 105 m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.y(), toPointList.propertyAt(i).y(), effectiveToAtEnd.y(), animatedY);
 106 animatedPointList.propertyAt(i) = FloatPoint(animatedX, animatedY);
109107 }
110108}
111109
228390

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 ? static_cast<SVGPreserveAspectRatioValue&>(*animated->values[0]) : static_cast<SVGPreserveAspectRatioValue&>(*from->values[0]);
 73 const auto& toPreserveAspectRatio = static_cast<SVGPreserveAspectRatioValue&>(*to->values[0]);
 74 auto& animatedPreserveAspectRatio = static_cast<SVGPreserveAspectRatioValue&>(*animated->values[0]);
7775
7876 m_animationElement->animateDiscreteType<SVGPreserveAspectRatioValue>(percentage, fromPreserveAspectRatio, toPreserveAspectRatio, animatedPreserveAspectRatio);
7977}
228390

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 static_cast<FloatRect&>(*to->values[0]) += static_cast<FloatRect&>(*from->values[0]);
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 auto& fromRect = m_animationElement->animationMode() == ToAnimation ? static_cast<FloatRect&>(*animated->values[0]) : static_cast<FloatRect&>(*from->values[0]);
 77 const auto& toRect = static_cast<FloatRect&>(*to->values[0]);
 78 const auto& toAtEndOfDurationRect = static_cast<FloatRect&>(*toAtEndOfDuration->values[0]);
 79 auto& animatedRect = static_cast<FloatRect&>(*animated->values[0]);
8280
8381 float animatedX = animatedRect.x();
8482 float animatedY = animatedRect.y();
228390

Source/WebCore/svg/SVGAnimatedString.cpp

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

@@SVGAnimatedStringAnimator::SVGAnimatedSt
3132
3233std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const String& string)
3334{
34  auto animatedType = SVGAnimatedType::createString(std::make_unique<String>());
35  animatedType->string() = string;
36  return animatedType;
 35 return SVGAnimatedType::create(SVGPropertyTraits<String>::fromString(string));
3736}
3837
3938std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
4039{
41  return SVGAnimatedType::createString(constructFromBaseValue<SVGAnimatedString>(animatedTypes));
 40 return constructFromBaseValue<SVGAnimatedString>(animatedTypes);
4241}
4342
4443void SVGAnimatedStringAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedStringAnimator::stopAnim
4847
4948void SVGAnimatedStringAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
5049{
51  resetFromBaseValue<SVGAnimatedString>(animatedTypes, type, &SVGAnimatedType::string);
 50 resetFromBaseValue<SVGAnimatedString>(animatedTypes, type);
5251}
5352
5453void SVGAnimatedStringAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)

@@void SVGAnimatedStringAnimator::calculat
7675 ASSERT(m_animationElement);
7776 ASSERT(m_contextElement);
7877
79  String fromString = from->string();
80  String toString = to->string();
81  String& animatedString = animated->string();
 78 String fromString = static_cast<String&>(*from->values[0]);
 79 String toString = static_cast<String&>(*to->values[0]);
 80 String& animatedString = static_cast<String&>(*animated->values[0]);
8281
8382 // Apply CSS inheritance rules.
8483 m_animationElement->adjustForInheritance<String>(parseStringFromString, m_animationElement->fromPropertyValueType(), fromString, m_contextElement);
228390

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 = static_cast<SVGTransformListValues&>(*from->values[0]);
 78 auto& toTransformList = static_cast<SVGTransformListValues&>(*to->values[0]);
8279 auto fromTransformListSize = fromTransformList.size();
8380 if (!fromTransformListSize || fromTransformListSize != toTransformList.size())
8481 return;
8582
8683 ASSERT(fromTransformListSize == 1);
87  const auto& fromTransform = fromTransformList[0];
88  auto& toTransform = toTransformList[0];
 84 const auto& fromTransform = fromTransformList.propertyAt(0);
 85 auto& toTransform = toTransformList.propertyAt(0);
8986
9087 ASSERT(fromTransform.type() == toTransform.type());
9188 toTransform = SVGTransformDistance::addSVGTransforms(fromTransform, toTransform);

@@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 = static_cast<SVGTransformListValues&>(*from->values[0]);
 99 const auto& toTransformList = static_cast<SVGTransformListValues&>(*to->values[0]);
 100 const auto& toAtEndOfDurationTransformList = static_cast<SVGTransformListValues&>(*toAtEndOfDuration->values[0]);
 101 auto& animatedTransformList = static_cast<SVGTransformListValues&>(*animated->values[0]);
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))

@@void SVGAnimatedTransformListAnimator::c
112109 animatedTransformList.clear();
113110
114111 auto fromTransformListSize = fromTransformList.size();
115  const auto& toTransform = toTransformList[0];
116  const auto effectiveFrom = fromTransformListSize ? fromTransformList[0] : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
 112 const auto& toTransform = toTransformList.propertyAt(0);
 113 const auto effectiveFrom = fromTransformListSize ? fromTransformList.propertyAt(0) : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
117114 auto currentTransform = SVGTransformDistance(effectiveFrom, toTransform).scaledDistance(percentage).addToSVGTransform(effectiveFrom);
118115 if (m_animationElement->isAccumulated() && repeatCount) {
119  const auto effectiveToAtEnd = toAtEndOfDurationTransformList.size() ? toAtEndOfDurationTransformList[0] : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
120  animatedTransformList.append(SVGTransformDistance::addSVGTransforms(currentTransform, effectiveToAtEnd, repeatCount));
 116 const auto effectiveToAtEnd = toAtEndOfDurationTransformList.size() ? toAtEndOfDurationTransformList.propertyAt(0) : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
 117 animatedTransformList.append(SVGValue::create<SVGTransformValue>(SVGTransformDistance::addSVGTransforms(currentTransform, effectiveToAtEnd, repeatCount)));
121118 } else
122  animatedTransformList.append(currentTransform);
 119 animatedTransformList.append(SVGValue::create<SVGTransformValue>(currentTransform));
123120}
124121
125122float SVGAnimatedTransformListAnimator::calculateDistance(const String& fromString, const String& toString)

@@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 = static_cast<SVGTransformListValues&>(*from->values[0]);
 132 auto& toTransformList = static_cast<SVGTransformListValues&>(*to->values[0]);
136133 unsigned itemsCount = fromTransformList.size();
137134 if (!itemsCount || itemsCount != toTransformList.size())
138135 return -1;
139136
140137 ASSERT(itemsCount == 1);
141  if (fromTransformList[0].type() != toTransformList[0].type())
 138 if (fromTransformList.propertyAt(0).type() != toTransformList.propertyAt(0).type())
142139 return -1;
143140
144141 // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances
145142 // Paced animations assume a notion of distance between the various animation values defined by the ‘to’, ‘from’, ‘by’ and ‘values’ attributes.
146143 // Distance is defined only for scalar types (such as <length>), colors and the subset of transformation types that are supported by ‘animateTransform’.
147  return SVGTransformDistance(fromTransformList[0], toTransformList[0]).distance();
 144 return SVGTransformDistance(fromTransformList.propertyAt(0), toTransformList.propertyAt(0)).distance();
148145}
149146
150147}
228390

Source/WebCore/svg/SVGAnimatedType.cpp

1 /*
2  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #include "config.h"
21 #include "SVGAnimatedType.h"
22 
23 #include "CSSParser.h"
24 #include "SVGParserUtilities.h"
25 #include "SVGPathByteStream.h"
26 
27 namespace WebCore {
28 
29 SVGAnimatedType::SVGAnimatedType(AnimatedPropertyType type)
30  : m_type(type)
31 {
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;
91  }
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 }
117 
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 }
149 
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 }
157 
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 }
165 
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 }
173 
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 }
181 
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 }
189 
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 }
197 
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 }
205 
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 }
213 
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 }
221 
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;
228 }
229 
230 String SVGAnimatedType::valueAsString()
231 {
232  switch (m_type) {
233  case AnimatedColor:
234  ASSERT(m_data.color);
235  return m_data.color->serialized();
236  case AnimatedLength:
237  ASSERT(m_data.length);
238  return m_data.length->valueAsString();
239  case AnimatedLengthList:
240  ASSERT(m_data.lengthList);
241  return m_data.lengthList->valueAsString();
242  case AnimatedNumber:
243  ASSERT(m_data.number);
244  return String::number(*m_data.number);
245  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());
249  case AnimatedString:
250  ASSERT(m_data.string);
251  return *m_data.string;
252 
253  // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need valueAsString() support.
254  case AnimatedAngle:
255  case AnimatedBoolean:
256  case AnimatedEnumeration:
257  case AnimatedInteger:
258  case AnimatedIntegerOptionalInteger:
259  case AnimatedNumberList:
260  case AnimatedNumberOptionalNumber:
261  case AnimatedPath:
262  case AnimatedPoints:
263  case AnimatedPreserveAspectRatio:
264  case AnimatedTransformList:
265  case AnimatedUnknown:
266  // Only SVG DOM animations use these property types - that means valueAsString() is never used for those.
267  ASSERT_NOT_REACHED();
268  break;
269  }
270  ASSERT_NOT_REACHED();
271  return String();
272 }
273 
274 bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const String& value)
275 {
276  switch (m_type) {
277  case AnimatedColor:
278  ASSERT(m_data.color);
279  *m_data.color = CSSParser::parseColor(value.stripWhiteSpace());
280  return true;
281  case AnimatedLength:
282  ASSERT(m_data.length);
283  return !m_data.length->setValueAsString(value, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName)).hasException();
284  case AnimatedLengthList:
285  ASSERT(m_data.lengthList);
286  m_data.lengthList->parse(value, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName));
287  return true;
288  case AnimatedNumber:
289  ASSERT(m_data.number);
290  parseNumberFromString(value, *m_data.number);
291  return true;
292  case AnimatedRect:
293  ASSERT(m_data.rect);
294  parseRect(value, *m_data.rect);
295  return true;
296  case AnimatedString:
297  ASSERT(m_data.string);
298  *m_data.string = value;
299  return true;
300 
301  // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need setValueAsString() support.
302  case AnimatedAngle:
303  case AnimatedBoolean:
304  case AnimatedEnumeration:
305  case AnimatedInteger:
306  case AnimatedIntegerOptionalInteger:
307  case AnimatedNumberList:
308  case AnimatedNumberOptionalNumber:
309  case AnimatedPath:
310  case AnimatedPoints:
311  case AnimatedPreserveAspectRatio:
312  case AnimatedTransformList:
313  case AnimatedUnknown:
314  // Only SVG DOM animations use these property types - that means setValueAsString() is never used for those.
315  ASSERT_NOT_REACHED();
316  break;
317  }
318  return true;
319 }
320 
321 bool SVGAnimatedType::supportsAnimVal(AnimatedPropertyType type)
322 {
323  // AnimatedColor is only used for CSS property animations.
324  return type != AnimatedUnknown && type != AnimatedColor;
325 }
326 
327 } // namespace WebCore
228390

Source/WebCore/svg/SVGAnimatedType.h

11/*
22 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
 3 * Copyright (C) 2018 Apple Inc. All rights reserved.
34 *
45 * This library is free software; you can redistribute it and/or
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 "SVGValue.h"
3224
3325namespace WebCore {
3426
35 class SVGPathByteStream;
36 
37 class SVGAnimatedType {
38  WTF_MAKE_FAST_ALLOCATED;
39 public:
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
 27struct SVGAnimatedType {
 28 template<typename PropertyType>
 29 SVGAnimatedType(PropertyType&& property)
 30 : values { SVGValue::create(WTFMove(property)) }
12031 {
121  ASSERT(m_type == AnimatedNumberList);
122  return *m_data.numberList;
12332 }
12433
125  const std::pair<float, float>& numberOptionalNumber() const
 34 SVGAnimatedType(RefPtr<SVGValue>&& value)
 35 : values { WTFMove(value) }
12636 {
127  ASSERT(m_type == AnimatedNumberOptionalNumber);
128  return *m_data.numberOptionalNumber;
12937 }
13038
131  const SVGPathByteStream* path() const
 39 template<typename PropertyType1, typename PropertyType2>
 40 SVGAnimatedType(std::pair<PropertyType1, PropertyType2>&& properties)
 41 : values { SVGValue::create(properties.first), SVGValue::create(properties.second) }
13242 {
133  ASSERT(m_type == AnimatedPath);
134  return m_data.path;
13543 }
13644
137  const SVGPointListValues& pointList() const
 45 SVGAnimatedType(RefPtr<SVGValue>&& value1, RefPtr<SVGValue>&& value2)
 46 : values { WTFMove(value1), WTFMove(value2) }
13847 {
139  ASSERT(m_type == AnimatedPoints);
140  return *m_data.pointList;
14148 }
14249
143  const SVGPreserveAspectRatioValue& preserveAspectRatio() const
 50 template<typename PropertyType>
 51 static std::unique_ptr<SVGAnimatedType> create()
14452 {
145  ASSERT(m_type == AnimatedPreserveAspectRatio);
146  return *m_data.preserveAspectRatio;
 53 return std::make_unique<SVGAnimatedType>(SVGPropertyTraits<PropertyType>::initialValue());
14754 }
14855
149  const FloatRect& rect() const
 56 template<typename PropertyType>
 57 static std::unique_ptr<SVGAnimatedType> create(PropertyType&& property)
15058 {
151  ASSERT(m_type == AnimatedRect);
152  return *m_data.rect;
 59 return std::make_unique<SVGAnimatedType>(WTFMove(property));
15360 }
15461
155  const String& string() const
 62 static std::unique_ptr<SVGAnimatedType> create(RefPtr<SVGValue>&& value)
15663 {
157  ASSERT(m_type == AnimatedString);
158  return *m_data.string;
 64 return std::make_unique<SVGAnimatedType>(WTFMove(value));
15965 }
16066
161  const SVGTransformListValues& transformList() const
 67 template<typename PropertyType1, typename PropertyType2>
 68 static std::unique_ptr<SVGAnimatedType> create()
16269 {
163  ASSERT(m_type == AnimatedTransformList);
164  return *m_data.transformList;
 70 return std::make_unique<SVGAnimatedType>(SVGPropertyTraits<std::pair<PropertyType1, PropertyType2>>::initialValue());
16571 }
16672
167  // Mutable accessors.
168  std::pair<SVGAngleValue, unsigned>& angleAndEnumeration()
 73 template<typename PropertyType1, typename PropertyType2>
 74 static std::unique_ptr<SVGAnimatedType> create(std::pair<PropertyType1, PropertyType2>&& properties)
16975 {
170  ASSERT(m_type == AnimatedAngle);
171  return *m_data.angleAndEnumeration;
 76 return std::make_unique<SVGAnimatedType>(WTFMove(properties));
17277 }
17378
174  bool& boolean()
 79 static std::unique_ptr<SVGAnimatedType> create(RefPtr<SVGValue>&& value1, RefPtr<SVGValue>&& value2)
17580 {
176  ASSERT(m_type == AnimatedBoolean);
177  return *m_data.boolean;
 81 return std::make_unique<SVGAnimatedType>(WTFMove(value1), WTFMove(value2));
17882 }
17983
180  Color& color()
 84 AnimatedPropertyType type() const
18185 {
182  ASSERT(m_type == AnimatedColor);
183  return *m_data.color;
184  }
185 
186  unsigned& enumeration()
187  {
188  ASSERT(m_type == AnimatedEnumeration);
189  return *m_data.enumeration;
190  }
191 
192  int& integer()
193  {
194  ASSERT(m_type == AnimatedInteger);
195  return *m_data.integer;
196  }
197 
198  std::pair<int, int>& integerOptionalInteger()
199  {
200  ASSERT(m_type == AnimatedIntegerOptionalInteger);
201  return *m_data.integerOptionalInteger;
202  }
203 
204  SVGLengthValue& length()
205  {
206  ASSERT(m_type == AnimatedLength);
207  return *m_data.length;
208  }
209 
210  SVGLengthListValues& lengthList()
211  {
212  ASSERT(m_type == AnimatedLengthList);
213  return *m_data.lengthList;
214  }
 86 ASSERT(values[0]);
 87 AnimatedPropertyType animatedType1 = valueAnimatedType(*values[0]);
 88 AnimatedPropertyType animatedType2 = values[1] ? valueAnimatedType(*values[1]) : AnimatedUnknown;
21589
216  float& number()
217  {
218  ASSERT(m_type == AnimatedNumber);
219  return *m_data.number;
220  }
 90 if (animatedType1 == AnimatedAngle) {
 91 ASSERT(animatedType2 == AnimatedEnumeration);
 92 return AnimatedAngle;
 93 }
22194
222  SVGNumberListValues& numberList()
223  {
224  ASSERT(m_type == AnimatedNumberList);
225  return *m_data.numberList;
226  }
 95 if (animatedType1 == AnimatedInteger && animatedType2 == AnimatedInteger)
 96 return AnimatedIntegerOptionalInteger;
22797
228  std::pair<float, float>& numberOptionalNumber()
229  {
230  ASSERT(m_type == AnimatedNumberOptionalNumber);
231  return *m_data.numberOptionalNumber;
232  }
 98 if (animatedType1 == AnimatedNumber && animatedType2 == AnimatedNumber)
 99 return AnimatedNumberOptionalNumber;
233100
234  SVGPathByteStream* path()
235  {
236  ASSERT(m_type == AnimatedPath);
237  return m_data.path;
 101 ASSERT(animatedType2 == AnimatedUnknown);
 102 return animatedType1;
238103 }
239104
240  SVGPointListValues& pointList()
 105 String toString() const
241106 {
242  ASSERT(m_type == AnimatedPoints);
243  return *m_data.pointList;
 107 ASSERT(values[0] && !values[1]);
 108 return values[0]->toString();
244109 }
245110
246  SVGPreserveAspectRatioValue& preserveAspectRatio()
 111 bool parse(const QualifiedName& attrName, const String& string)
247112 {
248  ASSERT(m_type == AnimatedPreserveAspectRatio);
249  return *m_data.preserveAspectRatio;
 113 ASSERT(values[0] && !values[1]);
 114 return values[0]->parse(attrName, string);
250115 }
251116
252  FloatRect& rect()
 117 static bool supportsAnimVal(AnimatedPropertyType type)
253118 {
254  ASSERT(m_type == AnimatedRect);
255  return *m_data.rect;
 119 // AnimatedColor is only used for CSS property animations.
 120 return type != AnimatedUnknown && type != AnimatedColor;
256121 }
257122
258  String& string()
 123 static AnimatedPropertyType valueAnimatedType(const SVGValue& value)
259124 {
260  ASSERT(m_type == AnimatedString);
261  return *m_data.string;
 125 return WTF::visit(WTF::makeVisitor(
 126 [](const SVGAngleValue&) { return AnimatedAngle; },
 127 [](const bool&) { return AnimatedBoolean; },
 128 [](const Color&) { return AnimatedColor; },
 129 [](const unsigned&) { return AnimatedEnumeration; },
 130 [](const int&) { return AnimatedInteger; },
 131 [](const SVGLengthValue&) { return AnimatedLength; },
 132 [](const SVGLengthListValues&) { return AnimatedLengthList; },
 133 [](const float) { return AnimatedNumber; },
 134 [](const SVGNumberListValues&) { return AnimatedNumberList; },
 135 [](const SVGPathByteStream&) { return AnimatedPath; },
 136 [](const SVGPreserveAspectRatioValue&) { return AnimatedPreserveAspectRatio; },
 137 [](const SVGPointListValues&) { return AnimatedPoints; },
 138 [](const FloatRect&) { return AnimatedRect; },
 139 [](const String&) { return AnimatedString; },
 140 [](const SVGTransformListValues&) { return AnimatedTransformList; },
 141 [](const auto&) { return AnimatedUnknown; }
 142 ), static_cast<const SVGValueVariant&>(value));
262143 }
263144
264  SVGTransformListValues& transformList()
265  {
266  ASSERT(m_type == AnimatedTransformList);
267  return *m_data.transformList;
268  }
269 
270  String valueAsString();
271  bool setValueAsString(const QualifiedName&, const String&);
272 
273 private:
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;
 145 RefPtr<SVGValue> values[2];
300146};
301147
302148} // namespace WebCore
228390

Source/WebCore/svg/SVGAnimatedTypeAnimator.h

11/*
22 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
33 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
 4 * Copyright (C) 2018 Apple Inc. All rights reserved.
45 *
56 * This library is free software; you can redistribute it and/or
67 * modify it under the terms of the GNU Library General Public

@@protected:
6364
6465 // Helpers for animators that operate on single types, eg. just one SVGAnimatedInteger.
6566 template<typename AnimValType>
66  std::unique_ptr<typename AnimValType::ContentType> constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
 67 std::unique_ptr<SVGAnimatedType> constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
6768 {
6869 ASSERT(animatedTypes[0].properties.size() == 1);
69  const typename AnimValType::ContentType& animatedType = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get())->currentBaseValue();
 70 const AnimValType* animatedType = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get());
7071
71  auto copy = std::make_unique<typename AnimValType::ContentType>(animatedType);
72  executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, copy.get());
73  return copy;
 72 RefPtr<SVGValue> animatedValue = SVGValue::create(*animatedType->currentBaseValue());
 73 executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, animatedValue);
 74 return SVGAnimatedType::create(WTFMove(animatedValue));
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);
8081 ASSERT(type.type() == m_type);
81  auto* property = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get());
82  property->synchronizeWrappersIfNeeded();
 82 AnimValType* animatedType = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get());
 83 animatedType->synchronizeWrappersIfNeeded();
8384
84  typename AnimValType::ContentType& animatedTypeValue = (type.*getter)();
85  animatedTypeValue = property->currentBaseValue();
86 
87  executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, &animatedTypeValue);
 85 RefPtr<SVGValue> baseValue = animatedType->currentBaseValue();
 86 RefPtr<SVGValue> animatedValue = type.values[0];
 87 static_cast<typename AnimValType::ContentType&>(*animatedValue) = static_cast<typename AnimValType::ContentType&>(*baseValue);
 88 executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, animatedValue);
8889 }
8990
9091 template<typename AnimValType>

@@protected:
110111
111112 // Helpers for animators that operate on pair types, eg. a pair of SVGAnimatedIntegers.
112113 template<typename AnimValType1, typename AnimValType2>
113  std::unique_ptr<std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>> constructFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes)
 114 std::unique_ptr<SVGAnimatedType> constructFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes)
114115 {
115116 ASSERT(animatedTypes[0].properties.size() == 2);
116  const typename AnimValType1::ContentType& firstType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get())->currentBaseValue();
117  const typename AnimValType2::ContentType& secondType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get())->currentBaseValue();
 117 const AnimValType1* firstAnimatedType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get());
 118 const AnimValType2* secondAnimatedType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get());
118119
119  auto copy = std::make_unique<std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>>(firstType, secondType);
120  executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &copy->first);
121  executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &copy->second);
122  return copy;
 120 RefPtr<SVGValue> firstAnimatedValue = SVGValue::create(*firstAnimatedType->currentBaseValue());
 121 RefPtr<SVGValue> secondAnimatedValue = SVGValue::create(*secondAnimatedType->currentBaseValue());
 122 executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, firstAnimatedValue);
 123 executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, secondAnimatedValue);
 124 return SVGAnimatedType::create(WTFMove(firstAnimatedValue), WTFMove(secondAnimatedValue));
123125 }
124126
125127 template<typename AnimValType1, typename AnimValType2>
126  void resetFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type, std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>& (SVGAnimatedType::*getter)())
 128 void resetFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
127129 {
128130 ASSERT(animatedTypes[0].properties.size() == 2);
129131 ASSERT(type.type() == m_type);
130  auto* firstProperty = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get());
131  auto* secondProperty = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get());
132  firstProperty->synchronizeWrappersIfNeeded();
133  secondProperty->synchronizeWrappersIfNeeded();
134 
135  std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>& animatedTypeValue = (type.*getter)();
136  animatedTypeValue.first = firstProperty->currentBaseValue();
137  animatedTypeValue.second = secondProperty->currentBaseValue();
138 
139  executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &animatedTypeValue.first);
140  executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &animatedTypeValue.second);
 132 AnimValType1* firstAnimatedType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get());
 133 AnimValType2* secondAnimatedType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get());
 134 firstAnimatedType->synchronizeWrappersIfNeeded();
 135 secondAnimatedType->synchronizeWrappersIfNeeded();
 136
 137 RefPtr<SVGValue> firstBaseValue = firstAnimatedType->currentBaseValue();
 138 RefPtr<SVGValue> firstAnimatedValue = type.values[0];
 139 static_cast<typename AnimValType1::ContentType&>(*firstAnimatedValue) = static_cast<typename AnimValType1::ContentType&>(*firstBaseValue);
 140 executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, firstAnimatedValue);
 141
 142 RefPtr<SVGValue> secondBaseValue = secondAnimatedType->currentBaseValue();
 143 RefPtr<SVGValue> secondAnimatedValue = type.values[1];
 144 static_cast<typename AnimValType2::ContentType&>(*secondAnimatedValue) = static_cast<typename AnimValType2::ContentType&>(*secondBaseValue);
 145 executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, secondAnimatedValue);
141146 }
142147
143148 template<typename AnimValType1, typename AnimValType2>

@@private:
190195 };
191196
192197 template<typename AnimValType>
193  void executeAction(AnimationAction action, const SVGElementAnimatedPropertyList& animatedTypes, unsigned whichProperty, typename AnimValType::ContentType* type = 0)
 198 void executeAction(AnimationAction action, const SVGElementAnimatedPropertyList& animatedTypes, unsigned whichProperty, RefPtr<SVGValue> animatedValue = nullptr)
194199 {
195200 // FIXME: Can't use SVGElement::InstanceUpdateBlocker because of circular header dependency. Would be nice to untangle this.
196201 setInstanceUpdatesBlocked(*animatedTypes[0].element, true);
197202
198203 for (auto& animatedType : animatedTypes) {
199204 ASSERT_WITH_SECURITY_IMPLICATION(whichProperty < animatedType.properties.size());
200  AnimValType* property = castAnimatedPropertyToActualType<AnimValType>(animatedType.properties[whichProperty].get());
 205 AnimValType* animatedProperty = castAnimatedPropertyToActualType<AnimValType>(animatedType.properties[whichProperty].get());
201206
202207 switch (action) {
203208 case StartAnimationAction:
204  ASSERT(type);
205  if (!property->isAnimating())
206  property->animationStarted(type);
 209 ASSERT(animatedValue);
 210 if (!animatedProperty->isAnimating())
 211 animatedProperty->animationStarted(animatedValue);
207212 break;
208213 case StopAnimationAction:
209  ASSERT(!type);
210  if (property->isAnimating())
211  property->animationEnded();
 214 ASSERT(!animatedValue);
 215 if (animatedProperty->isAnimating())
 216 animatedProperty->animationEnded();
212217 break;
213218 case AnimValWillChangeAction:
214  ASSERT(!type);
215  property->animValWillChange();
 219 ASSERT(!animatedValue);
 220 animatedProperty->animValWillChange();
216221 break;
217222 case AnimValDidChangeAction:
218  ASSERT(!type);
219  property->animValDidChange();
 223 ASSERT(!animatedValue);
 224 animatedProperty->animValDidChange();
220225 break;
221226 }
222227 }
228390

Source/WebCore/svg/SVGAnimationElement.h

3333namespace WebCore {
3434
3535class ConditionEventListener;
36 class SVGAnimatedType;
 36struct SVGAnimatedType;
3737class TimeContainer;
3838
3939enum AnimationMode {
228390

Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp

@@ComponentTransferFunction SVGComponentTr
137137 func.amplitude = amplitude();
138138 func.exponent = exponent();
139139 func.offset = offset();
140  func.tableValues = tableValues();
 140 func.tableValues = tableValues().properties();
141141 return func;
142142}
143143
228390

Source/WebCore/svg/SVGCursorElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
4646
4747inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document& document)
4848 : SVGElement(tagName, document)
49  , m_x(LengthModeWidth)
50  , m_y(LengthModeHeight)
 49 , m_x(SVGLengthValue(LengthModeWidth))
 50 , m_y(SVGLengthValue(LengthModeHeight))
5151{
5252 ASSERT(hasTagName(SVGNames::cursorTag));
5353 registerAnimatedPropertiesForSVGCursorElement();
228390

Source/WebCore/svg/SVGEllipseElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
4848
4949inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document& document)
5050 : SVGGraphicsElement(tagName, document)
51  , m_cx(LengthModeWidth)
52  , m_cy(LengthModeHeight)
53  , m_rx(LengthModeWidth)
54  , m_ry(LengthModeHeight)
 51 , m_cx(SVGLengthValue(LengthModeWidth))
 52 , m_cy(SVGLengthValue(LengthModeHeight))
 53 , m_rx(SVGLengthValue(LengthModeWidth))
 54 , m_ry(SVGLengthValue(LengthModeHeight))
5555{
5656 ASSERT(hasTagName(SVGNames::ellipseTag));
5757 registerAnimatedPropertiesForSVGEllipseElement();
228390

Source/WebCore/svg/SVGFEColorMatrixElement.cpp

@@bool SVGFEColorMatrixElement::setFilterE
8383 if (attrName == SVGNames::typeAttr)
8484 return colorMatrix->setType(type());
8585 if (attrName == SVGNames::valuesAttr)
86  return colorMatrix->setValues(values());
 86 return colorMatrix->setValues(values().properties());
8787
8888 ASSERT_NOT_REACHED();
8989 return false;

@@RefPtr<FilterEffect> SVGFEColorMatrixEle
133133 break;
134134 }
135135 } else {
136  filterValues = values();
 136 filterValues = values().properties();
137137 unsigned size = filterValues.size();
138138
139139 if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20)
228390

Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp

@@RefPtr<FilterEffect> SVGFEConvolveMatrix
282282 return nullptr;
283283 if (!hasAttribute(SVGNames::divisorAttr)) {
284284 for (int i = 0; i < kernelMatrixSize; ++i)
285  divisorValue += kernelMatrix.at(i);
 285 divisorValue += kernelMatrix.propertyAt(i);
286286 if (!divisorValue)
287287 divisorValue = 1;
288288 }
289289
290  auto effect = FEConvolveMatrix::create(filter, IntSize(orderXValue, orderYValue), divisorValue, bias(), IntPoint(targetXValue, targetYValue), edgeMode(), FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), preserveAlpha(), kernelMatrix);
 290 auto effect = FEConvolveMatrix::create(filter, IntSize(orderXValue, orderYValue), divisorValue, bias(), IntPoint(targetXValue, targetYValue), edgeMode(), FloatPoint(kernelUnitLengthXValue, kernelUnitLengthYValue), preserveAlpha(), kernelMatrix.properties());
291291 effect->inputEffects().append(input1);
292292 return WTFMove(effect);
293293}
228390

Source/WebCore/svg/SVGFilterElement.cpp

@@inline SVGFilterElement::SVGFilterElemen
6464 : SVGElement(tagName, document)
6565 , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
6666 , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
67  , m_x(LengthModeWidth, "-10%")
68  , m_y(LengthModeHeight, "-10%")
69  , m_width(LengthModeWidth, "120%")
70  , m_height(LengthModeHeight, "120%")
 67 , m_x(SVGLengthValue(LengthModeWidth, "-10%"))
 68 , m_y(SVGLengthValue(LengthModeHeight, "-10%"))
 69 , m_width(SVGLengthValue(LengthModeWidth, "120%"))
 70 , m_height(SVGLengthValue(LengthModeHeight, "120%"))
7171{
7272 // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
7373 // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
228390

Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
5151
5252SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document)
5353 : SVGElement(tagName, document)
54  , m_x(LengthModeWidth, "0%")
55  , m_y(LengthModeHeight, "0%")
56  , m_width(LengthModeWidth, "100%")
57  , m_height(LengthModeHeight, "100%")
 54 , m_x(SVGLengthValue(LengthModeWidth, "0%"))
 55 , m_y(SVGLengthValue(LengthModeHeight, "0%"))
 56 , m_width(SVGLengthValue(LengthModeWidth, "100%"))
 57 , m_height(SVGLengthValue(LengthModeHeight, "100%"))
5858{
5959 // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified.
6060 // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified.
228390

Source/WebCore/svg/SVGForeignObjectElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
5353
5454inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document& document)
5555 : SVGGraphicsElement(tagName, document)
56  , m_x(LengthModeWidth)
57  , m_y(LengthModeHeight)
58  , m_width(LengthModeWidth)
59  , m_height(LengthModeHeight)
 56 , m_x(SVGLengthValue(LengthModeWidth))
 57 , m_y(SVGLengthValue(LengthModeHeight))
 58 , m_width(SVGLengthValue(LengthModeWidth))
 59 , m_height(SVGLengthValue(LengthModeHeight))
6060{
6161 ASSERT(hasTagName(SVGNames::foreignObjectTag));
6262 registerAnimatedPropertiesForSVGForeignObjectElement();
228390

Source/WebCore/svg/SVGImageElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
5555
5656inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& document)
5757 : SVGGraphicsElement(tagName, document)
58  , m_x(LengthModeWidth)
59  , m_y(LengthModeHeight)
60  , m_width(LengthModeWidth)
61  , m_height(LengthModeHeight)
 58 , m_x(SVGLengthValue(LengthModeWidth))
 59 , m_y(SVGLengthValue(LengthModeHeight))
 60 , m_width(SVGLengthValue(LengthModeWidth))
 61 , m_height(SVGLengthValue(LengthModeHeight))
6262 , m_imageLoader(*this)
6363{
6464 registerAnimatedPropertiesForSVGImageElement();
228390

Source/WebCore/svg/SVGLength.h

@@public:
4747 SVG_LENGTHTYPE_PC = LengthTypePC
4848 };
4949
50  static Ref<SVGLength> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGLengthValue& value)
 50 static Ref<SVGLength> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
5151 {
5252 return adoptRef(*new SVGLength(animatedProperty, role, value));
5353 }

@@public:
5757 return adoptRef(*new SVGLength(initialValue));
5858 }
5959
60  static Ref<SVGLength> create(const SVGLengthValue* initialValue)
61  {
62  return adoptRef(*new SVGLength(initialValue));
63  }
64 
6560 template<typename T> static ExceptionOr<Ref<SVGLength>> create(ExceptionOr<T>&& initialValue)
6661 {
6762 if (initialValue.hasException())

@@public:
7166
7267 unsigned short unitType()
7368 {
74  return propertyReference().unitType();
 69 return valueProperty().unitType();
7570 }
7671
7772 ExceptionOr<float> valueForBindings()
7873 {
79  return propertyReference().valueForBindings(SVGLengthContext { contextElement() });
 74 return valueProperty().valueForBindings(SVGLengthContext { contextElement() });
8075 }
8176
8277 ExceptionOr<void> setValueForBindings(float value)

@@public:
8479 if (isReadOnly())
8580 return Exception { NoModificationAllowedError };
8681
87  auto result = propertyReference().setValue(value, SVGLengthContext { contextElement() });
 82 auto result = valueProperty().setValue(value, SVGLengthContext { contextElement() });
8883 if (result.hasException())
8984 return result;
9085

@@public:
9489
9590 float valueInSpecifiedUnits()
9691 {
97  return propertyReference().valueInSpecifiedUnits();
 92 return valueProperty().valueInSpecifiedUnits();
9893 }
9994
10095 ExceptionOr<void> setValueInSpecifiedUnits(float valueInSpecifiedUnits)

@@public:
10297 if (isReadOnly())
10398 return Exception { NoModificationAllowedError };
10499
105  propertyReference().setValueInSpecifiedUnits(valueInSpecifiedUnits);
 100 valueProperty().setValueInSpecifiedUnits(valueInSpecifiedUnits);
106101 commitChange();
107102
108103 return { };

@@public:
110105
111106 String valueAsString()
112107 {
113  return propertyReference().valueAsString();
 108 return valueProperty().valueAsString();
114109 }
115110
116111 ExceptionOr<void> setValueAsString(const String& value)

@@public:
118113 if (isReadOnly())
119114 return Exception { NoModificationAllowedError };
120115
121  auto result = propertyReference().setValueAsString(value);
 116 auto result = valueProperty().setValueAsString(value);
122117 if (result.hasException())
123118 return result;
124119

@@public:
131126 if (isReadOnly())
132127 return Exception { NoModificationAllowedError };
133128
134  auto result = propertyReference().newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
 129 auto result = valueProperty().newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
135130 if (result.hasException())
136131 return result;
137132

@@public:
144139 if (isReadOnly())
145140 return Exception { NoModificationAllowedError };
146141
147  auto result = propertyReference().convertToSpecifiedUnits(unitType, SVGLengthContext { contextElement() });
 142 auto result = valueProperty().convertToSpecifiedUnits(unitType, SVGLengthContext { contextElement() });
148143 if (result.hasException())
149144 return result;
150145

@@public:
153148 }
154149
155150private:
156  SVGLength(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGLengthValue& value)
 151 SVGLength(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
157152 : SVGPropertyTearOff<SVGLengthValue>(&animatedProperty, role, value)
158153 {
159154 }

@@private:
162157 : SVGPropertyTearOff<SVGLengthValue>(initialValue)
163158 {
164159 }
165 
166  explicit SVGLength(const SVGLengthValue* initialValue)
167  : SVGPropertyTearOff<SVGLengthValue>(initialValue)
168  {
169  }
170160};
171161
172162} // namespace WebCore
228390

Source/WebCore/svg/SVGLengthList.h

@@public:
3636 using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGLengthListValues>;
3737 using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
3838
39  static Ref<SVGLengthList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGLengthListValues& values, ListWrapperCache& wrappers)
 39 static Ref<SVGLengthList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
4040 {
4141 return adoptRef(*new SVGLengthList(animatedProperty, role, values, wrappers));
4242 }
4343
4444private:
45  SVGLengthList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGLengthListValues& values, ListWrapperCache& wrappers)
 45 SVGLengthList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
4646 : SVGListPropertyTearOff<SVGLengthListValues>(animatedProperty, role, values, wrappers)
4747 {
4848 }
228390

Source/WebCore/svg/SVGLengthListValues.cpp

2222#include "SVGLengthListValues.h"
2323
2424#include "SVGParserUtilities.h"
 25#include "SVGValue.h"
2526#include <wtf/text/StringBuilder.h>
2627
2728namespace WebCore {

@@void SVGLengthListValues::parse(const St
4647 return;
4748 if (length.setValueAsString(valueString).hasException())
4849 return;
49  append(length);
 50 append(SVGValue::create<SVGLengthValue>(length));
5051 skipOptionalSVGSpacesOrDelimiter(ptr, end);
5152 }
5253}

@@String SVGLengthListValues::valueAsStrin
6061 if (i > 0)
6162 builder.append(' ');
6263
63  builder.append(at(i).valueAsString());
 64 builder.append(propertyAt(i).valueAsString());
6465 }
6566
6667 return builder.toString();
228390

Source/WebCore/svg/SVGLengthListValues.h

11/*
22 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
33 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
 4 * Copyright (C) 2018 Apple Inc. All rights reserved.
45 *
56 * This library is free software; you can redistribute it and/or
67 * modify it under the terms of the GNU Library General Public

2122#pragma once
2223
2324#include "SVGLengthValue.h"
24 #include <wtf/Vector.h>
 25#include "SVGListValues.h"
2526
2627namespace WebCore {
2728
2829class SVGLength;
2930class SVGLengthList;
3031
31 class SVGLengthListValues final : public Vector<SVGLengthValue> {
 32class SVGLengthListValues final : public SVGListValues<SVGLengthValue> {
3233public:
3334 void parse(const String& value, SVGLengthMode);
3435 String valueAsString() const;
3536};
3637
37 template<> struct SVGPropertyTraits<SVGLengthListValues> {
 38template<>
 39struct SVGPropertyTraits<SVGLengthListValues> {
 40 static SVGLengthListValues initialValue() { return { }; }
 41 static SVGLengthListValues fromString(const String& string, SVGLengthMode lengthMode)
 42 {
 43 SVGLengthListValues list;
 44 list.parse(string, lengthMode);
 45 return list;
 46 }
 47 static std::optional<SVGLengthListValues> parse(const QualifiedName& attrName, const String& string)
 48 {
 49 SVGLengthListValues list;
 50 list.parse(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName));
 51 return list;
 52 }
 53 static String toString(const SVGLengthListValues& list) { return list.valueAsString(); }
 54
3855 using ListItemType = SVGLengthValue;
3956 using ListItemTearOff = SVGLength;
4057 using ListPropertyTearOff = SVGLengthList;
41 
42  static SVGLengthListValues initialValue() { return { }; }
43  static String toString(const SVGLengthListValues& type) { return type.valueAsString(); }
4458};
4559
4660} // namespace WebCore
228390

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
153159WTF::TextStream& operator<<(WTF::TextStream&, const SVGLengthValue&);
228390

Source/WebCore/svg/SVGLinearGradientElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
5151
5252inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document& document)
5353 : SVGGradientElement(tagName, document)
54  , m_x1(LengthModeWidth)
55  , m_y1(LengthModeHeight)
56  , m_x2(LengthModeWidth, "100%")
57  , m_y2(LengthModeHeight)
 54 , m_x1(SVGLengthValue(LengthModeWidth))
 55 , m_y1(SVGLengthValue(LengthModeHeight))
 56 , m_x2(SVGLengthValue(LengthModeWidth, "100%"))
 57 , m_y2(SVGLengthValue(LengthModeHeight))
5858{
5959 // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified.
6060 ASSERT(hasTagName(SVGNames::linearGradientTag));
228390

Source/WebCore/svg/SVGListValues.cpp

 1/*
 2 * Copyright (C) 2018 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#include "config.h"
 27#include "SVGListValues.h"
 28
 29#include "SVGValue.h"
 30
 31namespace WebCore {
 32
 33template <typename PropertyType>
 34void SVGListValues<PropertyType>::resize(size_t newSize)
 35{
 36 size_t index = size();
 37 Vector<RefPtr<SVGValue>>::resize(newSize);
 38 for (; index < newSize; ++index)
 39 at(index) = SVGValue::create<PropertyType>();
 40}
 41
 42template <typename PropertyType>
 43Vector<RefPtr<SVGValue>> SVGListValues<PropertyType>::deepCopy() const
 44{
 45 Vector<RefPtr<SVGValue>> values;
 46 for (const RefPtr<SVGValue>& value : *this)
 47 values.append(SVGValue::create(*value));
 48 return values;
 49}
 50
 51// Template function explicit instantiation.
 52template void SVGListValues<float>::resize(size_t);
 53template void SVGListValues<FloatPoint>::resize(size_t);
 54template void SVGListValues<SVGLengthValue>::resize(size_t);
 55template void SVGListValues<SVGTransformValue>::resize(size_t);
 56
 57template Vector<RefPtr<SVGValue>> SVGListValues<float>::deepCopy() const;
 58template Vector<RefPtr<SVGValue>> SVGListValues<String>::deepCopy() const;
 59template Vector<RefPtr<SVGValue>> SVGListValues<FloatPoint>::deepCopy() const;
 60template Vector<RefPtr<SVGValue>> SVGListValues<SVGLengthValue>::deepCopy() const;
 61template Vector<RefPtr<SVGValue>> SVGListValues<RefPtr<SVGPathSeg>>::deepCopy() const;
 62template Vector<RefPtr<SVGValue>> SVGListValues<SVGTransformValue>::deepCopy() const;
 63
 64}
nonexistent

Source/WebCore/svg/SVGListValues.h

 1/*
 2 * Copyright (C) 2018 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 <wtf/Vector.h>
 29
 30namespace WebCore {
 31
 32class SVGValue;
 33
 34template<typename PropertyType>
 35class SVGListValues : public Vector<RefPtr<SVGValue>> {
 36public:
 37 SVGListValues() = default;
 38
 39 SVGListValues(const SVGListValues& other)
 40 : Vector<RefPtr<SVGValue>>(other.deepCopy())
 41 {
 42 }
 43
 44 void resize(size_t);
 45 Vector<RefPtr<SVGValue>> deepCopy() const;
 46
 47 const PropertyType& propertyAt(size_t index) const { return static_cast<PropertyType&>(*at(index)); }
 48 PropertyType& propertyAt(size_t index) { return static_cast<PropertyType&>(*at(index)); }
 49
 50 const PropertyType& firstProperty() const { return propertyAt(0); }
 51 PropertyType& firstProperty() { return propertyAt(0); }
 52
 53 const PropertyType& lastProperty() const { return propertyAt(size() - 1); }
 54 PropertyType& lastProperty() { return propertyAt(size() - 1); }
 55
 56 Vector<PropertyType> properties() const
 57 {
 58 Vector<PropertyType> properties;
 59 for (const auto& value : *this)
 60 properties.append(static_cast<PropertyType&>(*value));
 61 return properties;
 62 }
 63};
 64
 65}
nonexistent

Source/WebCore/svg/SVGMarkerElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
7171
7272inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document& document)
7373 : SVGElement(tagName, document)
74  , m_refX(LengthModeWidth)
75  , m_refY(LengthModeHeight)
76  , m_markerWidth(LengthModeWidth, "3")
77  , m_markerHeight(LengthModeHeight, "3")
 74 , m_refX(SVGLengthValue(LengthModeWidth))
 75 , m_refY(SVGLengthValue(LengthModeHeight))
 76 , m_markerWidth(SVGLengthValue(LengthModeWidth, "3"))
 77 , m_markerHeight(SVGLengthValue(LengthModeHeight, "3"))
7878 , m_markerUnits(SVGMarkerUnitsStrokeWidth)
7979 , m_orientType(SVGMarkerOrientAngle)
8080{

@@void SVGMarkerElement::setOrientToAuto()
211211
212212void SVGMarkerElement::setOrientToAngle(SVGAngle& angle)
213213{
214  setOrient(SVGMarkerOrientAngle, angle.propertyReference());
 214 setOrient(SVGMarkerOrientAngle, angle.valueProperty());
215215}
216216
217217RenderPtr<RenderElement> SVGMarkerElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)

@@void SVGMarkerElement::synchronizeOrient
238238 static NeverDestroyed<AtomicString> autoStartReverseString("auto-start-reverse", AtomicString::ConstructFromLiteral);
239239
240240 // If orient is not auto or auto-start-reverse, the previous call to synchronizeOrientAngle already set the orientAttr to the right angle.
241  if (ownerType.m_orientType.value == SVGMarkerOrientAuto) {
 241 if (static_cast<SVGMarkerOrientType&>(*ownerType.m_orientType.value) == SVGMarkerOrientAuto) {
242242 ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoString);
243243 return;
244244 }
245245
246  if (ownerType.m_orientType.value == SVGMarkerOrientAutoStartReverse)
 246 if (static_cast<SVGMarkerOrientType&>(*ownerType.m_orientType.value) == SVGMarkerOrientAutoStartReverse)
247247 ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoStartReverseString);
248248}
249249

@@SVGMarkerOrientType& SVGMarkerElement::o
259259{
260260 if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, SVGAnimatedEnumeration>(this, orientTypePropertyInfo())) {
261261 if (wrapper->isAnimating()) {
262  ASSERT(wrapper->currentAnimatedValue() < SVGMarkerOrientMax);
263  return reinterpret_cast<SVGMarkerOrientType&>(wrapper->currentAnimatedValue());
 262 ASSERT(static_cast<SVGMarkerOrientType&>(*wrapper->currentAnimatedValue()) < SVGMarkerOrientMax);
 263 return static_cast<SVGMarkerOrientType&>(*wrapper->currentAnimatedValue());
264264 }
265265 }
266  return m_orientType.value;
 266 return static_cast<SVGMarkerOrientType&>(*m_orientType.value);
267267}
268268
269269Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated()
228390

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 {

@@public:
16499 static void synchronizeOrientType(SVGElement* contextElement);
165100 static Ref<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
166101 SVGMarkerOrientType& orientType() const;
167  SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }
168  void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }
 102 SVGMarkerOrientType& orientTypeBaseValue() const { return static_cast<SVGMarkerOrientType&>(*m_orientType.value); }
 103 void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { orientTypeBaseValue() = type; }
169104 Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();
170105
171106private:
228390

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 "SVGPropertyTraits.h"
 29
 30namespace WebCore {
 31
 32enum SVGMarkerUnitsType {
 33 SVGMarkerUnitsUnknown = 0,
 34 SVGMarkerUnitsUserSpaceOnUse,
 35 SVGMarkerUnitsStrokeWidth
 36};
 37
 38enum SVGMarkerOrientType {
 39 SVGMarkerOrientUnknown = 0,
 40 SVGMarkerOrientAuto,
 41 SVGMarkerOrientAngle,
 42 SVGMarkerOrientAutoStartReverse,
 43
 44 // Add new elements before here.
 45 SVGMarkerOrientMax
 46};
 47
 48template<>
 49struct SVGPropertyTraits<SVGMarkerUnitsType> {
 50 static unsigned highestEnumValue() { return SVGMarkerUnitsStrokeWidth; }
 51 static String toString(SVGMarkerUnitsType type)
 52 {
 53 switch (type) {
 54 case SVGMarkerUnitsUnknown:
 55 return emptyString();
 56 case SVGMarkerUnitsUserSpaceOnUse:
 57 return ASCIILiteral("userSpaceOnUse");
 58 case SVGMarkerUnitsStrokeWidth:
 59 return ASCIILiteral("strokeWidth");
 60 }
 61
 62 ASSERT_NOT_REACHED();
 63 return emptyString();
 64 }
 65 static SVGMarkerUnitsType fromString(const String& value)
 66 {
 67 if (value == "userSpaceOnUse")
 68 return SVGMarkerUnitsUserSpaceOnUse;
 69 if (value == "strokeWidth")
 70 return SVGMarkerUnitsStrokeWidth;
 71 return SVGMarkerUnitsUnknown;
 72 }
 73};
 74
 75template<>
 76struct SVGPropertyTraits<SVGMarkerOrientType> {
 77 static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; }
 78 static SVGMarkerOrientType fromString(const String& value, SVGAngleValue& angle)
 79 {
 80 if (value == "auto")
 81 return SVGMarkerOrientAuto;
 82 if (value == "auto-start-reverse")
 83 return SVGMarkerOrientAutoStartReverse;
 84 auto setValueResult = angle.setValueAsString(value);
 85 if (setValueResult.hasException())
 86 return SVGMarkerOrientUnknown;
 87 return SVGMarkerOrientAngle;
 88 }
 89};
 90
 91template<>
 92struct SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>> {
 93 static std::pair<SVGAngleValue, unsigned> fromString(const String& string)
 94 {
 95 SVGAngleValue angle;
 96 SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(string, angle);
 97 if (orientType != SVGMarkerOrientAngle)
 98 angle = { };
 99 return std::pair<SVGAngleValue, unsigned>(angle, orientType);
 100 }
 101};
 102
 103template<>
 104inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
 105
 106} // namespace WebCore
nonexistent

Source/WebCore/svg/SVGMaskElement.cpp

@@inline SVGMaskElement::SVGMaskElement(co
6060 : SVGElement(tagName, document)
6161 , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
6262 , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
63  , m_x(LengthModeWidth, "-10%")
64  , m_y(LengthModeHeight, "-10%")
65  , m_width(LengthModeWidth, "120%")
66  , m_height(LengthModeHeight, "120%")
 63 , m_x(SVGLengthValue(LengthModeWidth, "-10%"))
 64 , m_y(SVGLengthValue(LengthModeHeight, "-10%"))
 65 , m_width(SVGLengthValue(LengthModeWidth, "120%"))
 66 , m_height(SVGLengthValue(LengthModeHeight, "120%"))
6767{
6868 // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
6969 // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
228390

Source/WebCore/svg/SVGMatrix.h

@@namespace WebCore {
3333// FIXME: Remove this class once SVGMatrix becomes an alias to DOMMatrix.
3434class SVGMatrix : public SVGPropertyTearOff<SVGMatrixValue> {
3535public:
36  static Ref<SVGMatrix> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGMatrixValue& value)
 36 static Ref<SVGMatrix> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
3737 {
3838 return adoptRef(*new SVGMatrix(animatedProperty, role, value));
3939 }

@@public:
5757
5858 double a()
5959 {
60  return propertyReference().a();
 60 return valueProperty().a();
6161 }
6262
6363 ExceptionOr<void> setA(double value)

@@public:
6565 if (isReadOnly())
6666 return Exception { NoModificationAllowedError };
6767
68  propertyReference().setA(value);
 68 valueProperty().setA(value);
6969 commitChange();
7070
7171 return { };

@@public:
7373
7474 double b()
7575 {
76  return propertyReference().b();
 76 return valueProperty().b();
7777 }
7878
7979 ExceptionOr<void> setB(double value)

@@public:
8181 if (isReadOnly())
8282 return Exception { NoModificationAllowedError };
8383
84  propertyReference().setB(value);
 84 valueProperty().setB(value);
8585 commitChange();
8686
8787 return { };

@@public:
8989
9090 double c()
9191 {
92  return propertyReference().c();
 92 return valueProperty().c();
9393 }
9494
9595 ExceptionOr<void> setC(double value)

@@public:
9797 if (isReadOnly())
9898 return Exception { NoModificationAllowedError };
9999
100  propertyReference().setC(value);
 100 valueProperty().setC(value);
101101 commitChange();
102102
103103 return { };

@@public:
105105
106106 double d()
107107 {
108  return propertyReference().d();
 108 return valueProperty().d();
109109 }
110110
111111 ExceptionOr<void> setD(double value)

@@public:
113113 if (isReadOnly())
114114 return Exception { NoModificationAllowedError };
115115
116  propertyReference().setD(value);
 116 valueProperty().setD(value);
117117 commitChange();
118118
119119 return { };

@@public:
121121
122122 double e()
123123 {
124  return propertyReference().e();
 124 return valueProperty().e();
125125 }
126126
127127 ExceptionOr<void> setE(double value)

@@public:
129129 if (isReadOnly())
130130 return Exception { NoModificationAllowedError };
131131
132  propertyReference().setE(value);
 132 valueProperty().setE(value);
133133 commitChange();
134134
135135 return { };

@@public:
137137
138138 double f()
139139 {
140  return propertyReference().f();
 140 return valueProperty().f();
141141 }
142142
143143 ExceptionOr<void> setF(double value)

@@public:
145145 if (isReadOnly())
146146 return Exception { NoModificationAllowedError };
147147
148  propertyReference().setF(value);
 148 valueProperty().setF(value);
149149 commitChange();
150150
151151 return { };

@@public:
156156 if (isReadOnly())
157157 return Exception { NoModificationAllowedError };
158158
159  auto result = propertyReference().multiply(secondMatrix.propertyReference());
 159 auto result = valueProperty().multiply(secondMatrix.valueProperty());
160160 commitChange();
161161
162162 return SVGMatrix::create(result);

@@public:
167167 if (isReadOnly())
168168 return Exception { NoModificationAllowedError };
169169
170  auto result = propertyReference().inverse();
 170 auto result = valueProperty().inverse();
171171 if (result.hasException())
172172 return result.releaseException();
173173

@@public:
180180 if (isReadOnly())
181181 return Exception { NoModificationAllowedError };
182182
183  auto result = propertyReference().translate(x, y);
 183 auto result = valueProperty().translate(x, y);
184184 commitChange();
185185
186186 return SVGMatrix::create(result);

@@public:
191191 if (isReadOnly())
192192 return Exception { NoModificationAllowedError };
193193
194  auto result = propertyReference().scale(scaleFactor);
 194 auto result = valueProperty().scale(scaleFactor);
195195 commitChange();
196196
197197 return SVGMatrix::create(result);

@@public:
202202 if (isReadOnly())
203203 return Exception { NoModificationAllowedError };
204204
205  auto result = propertyReference().scaleNonUniform(scaleFactorX, scaleFactorY);
 205 auto result = valueProperty().scaleNonUniform(scaleFactorX, scaleFactorY);
206206 commitChange();
207207
208208 return SVGMatrix::create(result);

@@public:
213213 if (isReadOnly())
214214 return Exception { NoModificationAllowedError };
215215
216  auto result = propertyReference().rotate(angle);
 216 auto result = valueProperty().rotate(angle);
217217 commitChange();
218218
219219 return SVGMatrix::create(result);

@@public:
224224 if (isReadOnly())
225225 return Exception { NoModificationAllowedError };
226226
227  auto result = propertyReference().rotateFromVector(x, y);
 227 auto result = valueProperty().rotateFromVector(x, y);
228228 if (result.hasException())
229229 return result.releaseException();
230230

@@public:
237237 if (isReadOnly())
238238 return Exception { NoModificationAllowedError };
239239
240  auto result = propertyReference().flipX();
 240 auto result = valueProperty().flipX();
241241 commitChange();
242242
243243 return SVGMatrix::create(result);

@@public:
248248 if (isReadOnly())
249249 return Exception { NoModificationAllowedError };
250250
251  auto result = propertyReference().flipY();
 251 auto result = valueProperty().flipY();
252252 commitChange();
253253
254254 return SVGMatrix::create(result);

@@public:
259259 if (isReadOnly())
260260 return Exception { NoModificationAllowedError };
261261
262  auto result = propertyReference().skewX(angle);
 262 auto result = valueProperty().skewX(angle);
263263 commitChange();
264264
265265 return SVGMatrix::create(result);

@@public:
270270 if (isReadOnly())
271271 return Exception { NoModificationAllowedError };
272272
273  auto result = propertyReference().skewY(angle);
 273 auto result = valueProperty().skewY(angle);
274274 commitChange();
275275
276276 return SVGMatrix::create(result);
277277 }
278278
279279protected:
280  SVGMatrix(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGMatrixValue& value)
 280 SVGMatrix(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
281281 : SVGPropertyTearOff<SVGMatrixValue>(&animatedProperty, role, value)
282282 {
283283 }
228390

Source/WebCore/svg/SVGNumber.h

@@namespace WebCore {
3131
3232class SVGNumber : public SVGPropertyTearOff<float> {
3333public:
34  static Ref<SVGNumber> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, float& value)
 34 static Ref<SVGNumber> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
3535 {
3636 return adoptRef(*new SVGNumber(animatedProperty, role, value));
3737 }

@@public:
4141 return adoptRef(*new SVGNumber(initialValue));
4242 }
4343
44  static Ref<SVGNumber> create(const float* initialValue)
45  {
46  return adoptRef(*new SVGNumber(initialValue));
47  }
48 
4944 template<typename T> static ExceptionOr<Ref<SVGNumber>> create(ExceptionOr<T>&& initialValue)
5045 {
5146 if (initialValue.hasException())

@@public:
5550
5651 float valueForBindings()
5752 {
58  return propertyReference();
 53 return valueProperty();
5954 }
6055
6156 ExceptionOr<void> setValueForBindings(float value)

@@public:
6358 if (isReadOnly())
6459 return Exception { NoModificationAllowedError };
6560
66  propertyReference() = value;
 61 valueProperty() = value;
6762 commitChange();
6863
6964 return { };
7065 }
7166
7267private:
73  SVGNumber(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, float& value)
 68 SVGNumber(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
7469 : SVGPropertyTearOff<float>(&animatedProperty, role, value)
7570 {
7671 }

@@private:
7974 : SVGPropertyTearOff<float>(initialValue)
8075 {
8176 }
82 
83  explicit SVGNumber(const float* initialValue)
84  : SVGPropertyTearOff<float>(initialValue)
85  {
86  }
8777};
8878
8979} // namespace WebCore
228390

Source/WebCore/svg/SVGNumberList.h

@@public:
3636 using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGNumberListValues>;
3737 using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
3838
39  static Ref<SVGNumberList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGNumberListValues& values, ListWrapperCache& wrappers)
 39 static Ref<SVGNumberList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
4040 {
4141 return adoptRef(*new SVGNumberList(animatedProperty, role, values, wrappers));
4242 }
4343
4444private:
45  SVGNumberList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGNumberListValues& values, ListWrapperCache& wrappers)
 45 SVGNumberList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
4646 : SVGListPropertyTearOff<SVGNumberListValues>(animatedProperty, role, values, wrappers)
4747 {
4848 }
228390

Source/WebCore/svg/SVGNumberListValues.cpp

@@void SVGNumberListValues::parse(const St
3939 while (ptr < end) {
4040 if (!parseNumber(ptr, end, number))
4141 return;
42  append(number);
 42 append(SVGValue::create<float>(number));
4343 }
4444}
4545

@@String SVGNumberListValues::valueAsStrin
5252 if (i > 0)
5353 builder.append(' ');
5454
55  builder.appendNumber(at(i));
 55 builder.appendNumber(propertyAt(i));
5656 }
5757
5858 return builder.toString();
228390

Source/WebCore/svg/SVGNumberListValues.h

2020
2121#pragma once
2222
 23#include "SVGListValues.h"
2324#include "SVGPropertyTraits.h"
24 #include <wtf/Vector.h>
2525
2626namespace WebCore {
2727
2828class SVGNumber;
2929class SVGNumberList;
3030
31 class SVGNumberListValues final : public Vector<float> {
 31class SVGNumberListValues final : public SVGListValues<float> {
3232public:
3333 void parse(const String&);
3434 String valueAsString() const;
 35
3536};
3637
37 template<> struct SVGPropertyTraits<SVGNumberListValues> {
 38template<>
 39struct SVGPropertyTraits<SVGNumberListValues> {
3840 static SVGNumberListValues initialValue() { return { }; }
 41 static SVGNumberListValues fromString(const String& string)
 42 {
 43 SVGNumberListValues list;
 44 list.parse(string);
 45 return list;
 46 }
3947 static String toString(const SVGNumberListValues& list) { return list.valueAsString(); }
40 
4148 using ListItemType = float;
4249 using ListItemTearOff = SVGNumber;
4350 using ListPropertyTearOff = SVGNumberList;
228390

Source/WebCore/svg/SVGParserUtilities.cpp

@@bool parseNumberOptionalNumber(const Str
219219 return cur == end;
220220}
221221
 222bool parsePoint(const String& s, FloatPoint& point)
 223{
 224 if (s.isEmpty())
 225 return false;
 226 auto upconvertedCharacters = StringView(s).upconvertedCharacters();
 227 const UChar* cur = upconvertedCharacters;
 228 const UChar* end = cur + s.length();
 229
 230 if (!skipOptionalSVGSpaces(cur, end))
 231 return false;
 232
 233 float x = 0;
 234 if (!parseNumber(cur, end, x))
 235 return false;
 236
 237 float y = 0;
 238 if (!parseNumber(cur, end, y))
 239 return false;
 240
 241 point = FloatPoint(x, y);
 242
 243 // disallow anything except spaces at the end
 244 return !skipOptionalSVGSpaces(cur, end);
 245}
 246
222247bool parseRect(const String& string, FloatRect& rect)
223248{
224249 auto upconvertedCharacters = StringView(string).upconvertedCharacters();

@@bool pointsListFromSVGData(SVGPointListV
264289 }
265290 skipOptionalSVGSpaces(cur, end);
266291
267  pointsList.append(FloatPoint(xPos, yPos));
 292 pointsList.append(SVGValue::create<FloatPoint>(FloatPoint(xPos, yPos)));
268293 }
269294 return cur == end && !delimParsed;
270295}
228390

Source/WebCore/svg/SVGParserUtilities.h

@@bool parseNumberOptionalNumber(const Str
4343bool parseArcFlag(const LChar*& ptr, const LChar* end, bool& flag);
4444bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag);
4545bool parseRect(const String&, FloatRect&);
 46bool parsePoint(const String&, FloatPoint&);
4647
4748template <typename CharacterType>
4849bool parseFloatPoint(const CharacterType*& current, const CharacterType* end, FloatPoint&);
228390

Source/WebCore/svg/SVGPathByteStream.h

1919
2020#pragma once
2121
 22#include "SVGPathUtilities.h"
 23#include "SVGPropertyTraits.h"
2224#include <wtf/Vector.h>
2325
2426namespace WebCore {

@@public:
4648 typedef Data::const_iterator DataIterator;
4749
4850 SVGPathByteStream() { }
49  SVGPathByteStream(const Data& data) : m_data(data) { }
 51 SVGPathByteStream(SVGPathByteStream&& other)
 52 : m_data(WTFMove(other.m_data))
 53 {
 54 }
5055
51  bool operator==(const SVGPathByteStream& other) const
 56 SVGPathByteStream(const SVGPathByteStream& other)
 57 : m_data(other.m_data)
5258 {
53  return m_data == other.m_data;
5459 }
5560
56  bool operator!=(const SVGPathByteStream& other) const
 61 SVGPathByteStream& operator=(SVGPathByteStream&& other)
 62 {
 63 m_data = WTFMove(other.m_data);
 64 return *this;
 65 }
 66 SVGPathByteStream& operator=(const SVGPathByteStream& other)
5767 {
58  return !(*this == other);
 68 m_data = other.m_data;
 69 return *this;
5970 }
6071
 72 bool operator==(const SVGPathByteStream& other) const { return m_data == other.m_data; }
 73 bool operator!=(const SVGPathByteStream& other) const { return m_data != other.m_data; }
 74
6175 std::unique_ptr<SVGPathByteStream> copy() const
6276 {
63  return std::make_unique<SVGPathByteStream>(m_data);
 77 return std::make_unique<SVGPathByteStream>(*this);
6478 }
6579
6680 DataIterator begin() const { return m_data.begin(); }
6781 DataIterator end() const { return m_data.end(); }
6882
6983 void append(unsigned char byte) { m_data.append(byte); }
70  void append(const SVGPathByteStream& other)
71  {
72  for (auto stream : other)
73  append(stream);
74  }
 84 void append(const SVGPathByteStream& other) { m_data.appendVector(other.m_data); }
7585 void clear() { m_data.clear(); }
76  bool isEmpty() const { return !m_data.size(); }
 86 bool isEmpty() const { return m_data.isEmpty(); }
7787 unsigned size() const { return m_data.size(); }
7888
7989 // Only defined to let SVGAnimatedPathAnimator use the standard list code paths - this method is never called.

@@public:
8292private:
8393 Data m_data;
8494};
 95
 96template<>
 97struct SVGPropertyTraits<SVGPathByteStream> {
 98 static SVGPathByteStream initialValue() { return SVGPathByteStream(); }
 99 static SVGPathByteStream fromString(const String& string)
 100 {
 101 SVGPathByteStream byteStream;
 102 buildSVGPathByteStreamFromString(string, byteStream, UnalteredParsing);
 103 return byteStream;
 104 }
 105};
85106
86107} // namespace WebCore
228390

Source/WebCore/svg/SVGPathElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
8080
8181inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& document)
8282 : SVGGraphicsElement(tagName, document)
83  , m_pathSegList(PathSegUnalteredRole)
 83 , m_pathSegList(SVGPathSegListValues(PathSegUnalteredRole))
8484 , m_isAnimValObserved(false)
8585{
8686 ASSERT(hasTagName(SVGNames::pathTag));

@@void SVGPathElement::svgAttributeChanged
255255 if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo())->isAnimating()) {
256256 SVGPathSegListValues newList(PathSegUnalteredRole);
257257 buildSVGPathSegListValuesFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing);
258  m_pathSegList.value = newList;
 258 static_cast<SVGPathSegListValues&>(*m_pathSegList.value) = WTFMove(newList);
259259 }
260260
261261 if (renderer)

@@Ref<SVGAnimatedProperty> SVGPathElement:
327327 if (auto property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(&ownerType, dPropertyInfo()))
328328 return *property;
329329
330  if (ownerType.m_pathSegList.value.isEmpty())
331  buildSVGPathSegListValuesFromByteStream(ownerType.m_pathByteStream, ownerType, ownerType.m_pathSegList.value, UnalteredParsing);
 330 if (static_cast<SVGPathSegListValues&>(*ownerType.m_pathSegList.value).isEmpty())
 331 buildSVGPathSegListValuesFromByteStream(ownerType.m_pathByteStream, ownerType, static_cast<SVGPathSegListValues&>(*ownerType.m_pathSegList.value), UnalteredParsing);
332332
333333 return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegListValues>(&ownerType, dPropertyInfo(), ownerType.m_pathSegList.value);
334334}

@@void SVGPathElement::synchronizeD(SVGEle
339339 SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement);
340340 if (!ownerType.m_pathSegList.shouldSynchronize)
341341 return;
342  ownerType.m_pathSegList.synchronize(&ownerType, dPropertyInfo()->attributeName, ownerType.m_pathSegList.value.valueAsString());
 342 ownerType.m_pathSegList.synchronize(&ownerType, dPropertyInfo()->attributeName, static_cast<SVGPathSegListValues&>(*ownerType.m_pathSegList.value).valueAsString());
343343}
344344
345345void SVGPathElement::animatedPropertyWillBeDeleted()

@@void SVGPathElement::pathSegListChanged(
392392 break;
393393 case PathSegUnalteredRole:
394394 if (listModification == ListModificationAppend) {
395  ASSERT(!m_pathSegList.value.isEmpty());
396  appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last().copyRef(), m_pathByteStream, UnalteredParsing);
 395 ASSERT(!static_cast<SVGPathSegListValues&>(*m_pathSegList.value).isEmpty());
 396 appendSVGPathByteStreamFromSVGPathSeg(static_cast<SVGPathSegListValues&>(*m_pathSegList.value).lastProperty().copyRef(), m_pathByteStream, UnalteredParsing);
397397 } else
398  buildSVGPathByteStreamFromSVGPathSegListValues(m_pathSegList.value, m_pathByteStream, UnalteredParsing);
 398 buildSVGPathByteStreamFromSVGPathSegListValues(static_cast<SVGPathSegListValues&>(*m_pathSegList.value), m_pathByteStream, UnalteredParsing);
399399 m_cachedPath = std::nullopt;
400400 break;
401401 case PathSegUndefinedRole:
228390

Source/WebCore/svg/SVGPathSegList.cpp

@@namespace WebCore {
2828
2929void SVGPathSegList::clearContextAndRoles()
3030{
31  ASSERT(m_values);
32  for (auto& item : *m_values)
 31 for (auto& item : valuesProperty().properties())
3332 static_cast<SVGPathSegWithContext*>(item.get())->setContextAndRole(nullptr, PathSegUndefinedRole);
3433}
3534
3635ExceptionOr<void> SVGPathSegList::clear()
3736{
38  ASSERT(m_values);
39  if (m_values->isEmpty())
 37 if (valuesProperty().isEmpty())
4038 return { };
4139
4240 clearContextAndRoles();

@@ExceptionOr<RefPtr<SVGPathSeg>> SVGPathS
5048
5149ExceptionOr<RefPtr<SVGPathSeg>> SVGPathSegList::replaceItem(Ref<SVGPathSeg>&& newItem, unsigned index)
5250{
53  if (index < m_values->size()) {
54  ListItemType replacedItem = m_values->at(index);
 51 if (index < valuesProperty().size()) {
 52 ListItemType replacedItem = valuesProperty().propertyAt(index);
5553 ASSERT(replacedItem);
5654 static_cast<SVGPathSegWithContext*>(replacedItem.get())->setContextAndRole(nullptr, PathSegUndefinedRole);
5755 }
228390

Source/WebCore/svg/SVGPathSegList.h

@@public:
3232 using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGPathSegListValues>;
3333 using ListItemType = SVGPropertyTraits<SVGPathSegListValues>::ListItemType;
3434
35  static Ref<SVGPathSegList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPathSegRole pathSegRole, SVGPathSegListValues& values, ListWrapperCache& wrappers)
 35 static Ref<SVGPathSegList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPathSegRole pathSegRole, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
3636 {
3737 return adoptRef(*new SVGPathSegList(animatedProperty, role, pathSegRole, values, wrappers));
3838 }
3939
40  static Ref<SVGPathSegList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPathSegListValues& values, ListWrapperCache& wrappers)
 40 static Ref<SVGPathSegList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
4141 {
4242 ASSERT_NOT_REACHED();
4343 return adoptRef(*new SVGPathSegList(animatedProperty, role, PathSegUndefinedRole, values, wrappers));

@@public:
4545
4646 int findItem(const ListItemType& item) const
4747 {
48  ASSERT(m_values);
49 
50  unsigned size = m_values->size();
 48 unsigned size = valuesProperty().size();
5149 for (size_t i = 0; i < size; ++i) {
52  if (item == m_values->at(i))
 50 if (item == valuesProperty().propertyAt(i))
5351 return i;
5452 }
5553

@@public:
5856
5957 void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
6058 {
61  ASSERT(m_values);
62  ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < m_values->size());
 59 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < valuesProperty().size());
6360
64  m_values->remove(itemIndex);
 61 valuesProperty().remove(itemIndex);
6562
6663 if (shouldSynchronizeWrappers)
6764 commitChange();

@@public:
9390 }
9491
9592private:
96  SVGPathSegList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPathSegRole pathSegRole, SVGPathSegListValues& values, ListWrapperCache& wrappers)
 93 SVGPathSegList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPathSegRole pathSegRole, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
9794 : SVGListProperty<SVGPathSegListValues>(role, values, &wrappers)
9895 , m_animatedProperty(&animatedProperty)
9996 , m_pathSegRole(pathSegRole)

@@private:
117114
118115 void commitChange() final
119116 {
120  ASSERT(m_values);
121  m_values->commitChange(*m_animatedProperty->contextElement(), ListModificationUnknown);
 117 valuesProperty().commitChange(*m_animatedProperty->contextElement(), ListModificationUnknown);
122118 }
123119
124120 void commitChange(ListModification listModification) final
125121 {
126  ASSERT(m_values);
127  m_values->commitChange(*m_animatedProperty->contextElement(), listModification);
 122 valuesProperty().commitChange(*m_animatedProperty->contextElement(), listModification);
128123 }
129124
130125 bool processIncomingListItemValue(const ListItemType& newItem, unsigned* indexToModify) final;
228390

Source/WebCore/svg/SVGPathSegListBuilder.cpp

@@SVGPathSegListBuilder::SVGPathSegListBui
5858void SVGPathSegListBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode mode)
5959{
6060 if (mode == AbsoluteCoordinates)
61  m_pathSegList.append(m_pathElement.createSVGPathSegMovetoAbs(targetPoint.x(), targetPoint.y(), m_pathSegRole));
 61 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegMovetoAbs(targetPoint.x(), targetPoint.y(), m_pathSegRole)));
6262 else
63  m_pathSegList.append(m_pathElement.createSVGPathSegMovetoRel(targetPoint.x(), targetPoint.y(), m_pathSegRole));
 63 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegMovetoRel(targetPoint.x(), targetPoint.y(), m_pathSegRole)));
6464}
6565
6666void SVGPathSegListBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
6767{
6868 if (mode == AbsoluteCoordinates)
69  m_pathSegList.append(m_pathElement.createSVGPathSegLinetoAbs(targetPoint.x(), targetPoint.y(), m_pathSegRole));
 69 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegLinetoAbs(targetPoint.x(), targetPoint.y(), m_pathSegRole)));
7070 else
71  m_pathSegList.append(m_pathElement.createSVGPathSegLinetoRel(targetPoint.x(), targetPoint.y(), m_pathSegRole));
 71 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegLinetoRel(targetPoint.x(), targetPoint.y(), m_pathSegRole)));
7272}
7373
7474void SVGPathSegListBuilder::lineToHorizontal(float x, PathCoordinateMode mode)
7575{
7676 if (mode == AbsoluteCoordinates)
77  m_pathSegList.append(m_pathElement.createSVGPathSegLinetoHorizontalAbs(x, m_pathSegRole));
 77 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegLinetoHorizontalAbs(x, m_pathSegRole)));
7878 else
79  m_pathSegList.append(m_pathElement.createSVGPathSegLinetoHorizontalRel(x, m_pathSegRole));
 79 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegLinetoHorizontalRel(x, m_pathSegRole)));
8080}
8181
8282void SVGPathSegListBuilder::lineToVertical(float y, PathCoordinateMode mode)
8383{
8484 if (mode == AbsoluteCoordinates)
85  m_pathSegList.append(m_pathElement.createSVGPathSegLinetoVerticalAbs(y, m_pathSegRole));
 85 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegLinetoVerticalAbs(y, m_pathSegRole)));
8686 else
87  m_pathSegList.append(m_pathElement.createSVGPathSegLinetoVerticalRel(y, m_pathSegRole));
 87 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegLinetoVerticalRel(y, m_pathSegRole)));
8888}
8989
9090void SVGPathSegListBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
9191{
9292 if (mode == AbsoluteCoordinates)
93  m_pathSegList.append(m_pathElement.createSVGPathSegCurvetoCubicAbs(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), point2.x(), point2.y(), m_pathSegRole));
 93 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegCurvetoCubicAbs(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), point2.x(), point2.y(), m_pathSegRole)));
9494 else
95  m_pathSegList.append(m_pathElement.createSVGPathSegCurvetoCubicRel(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), point2.x(), point2.y(), m_pathSegRole));
 95 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegCurvetoCubicRel(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), point2.x(), point2.y(), m_pathSegRole)));
9696}
9797
9898void SVGPathSegListBuilder::curveToCubicSmooth(const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
9999{
100100 if (mode == AbsoluteCoordinates)
101  m_pathSegList.append(m_pathElement.createSVGPathSegCurvetoCubicSmoothAbs(targetPoint.x(), targetPoint.y(), point2.x(), point2.y(), m_pathSegRole));
 101 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegCurvetoCubicSmoothAbs(targetPoint.x(), targetPoint.y(), point2.x(), point2.y(), m_pathSegRole)));
102102 else
103  m_pathSegList.append(m_pathElement.createSVGPathSegCurvetoCubicSmoothRel(targetPoint.x(), targetPoint.y(), point2.x(), point2.y(), m_pathSegRole));
 103 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegCurvetoCubicSmoothRel(targetPoint.x(), targetPoint.y(), point2.x(), point2.y(), m_pathSegRole)));
104104}
105105
106106void SVGPathSegListBuilder::curveToQuadratic(const FloatPoint& point1, const FloatPoint& targetPoint, PathCoordinateMode mode)
107107{
108108 if (mode == AbsoluteCoordinates)
109  m_pathSegList.append(m_pathElement.createSVGPathSegCurvetoQuadraticAbs(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), m_pathSegRole));
 109 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegCurvetoQuadraticAbs(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), m_pathSegRole)));
110110 else
111  m_pathSegList.append(m_pathElement.createSVGPathSegCurvetoQuadraticRel(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), m_pathSegRole));
 111 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegCurvetoQuadraticRel(targetPoint.x(), targetPoint.y(), point1.x(), point1.y(), m_pathSegRole)));
112112}
113113
114114void SVGPathSegListBuilder::curveToQuadraticSmooth(const FloatPoint& targetPoint, PathCoordinateMode mode)
115115{
116116 if (mode == AbsoluteCoordinates)
117  m_pathSegList.append(m_pathElement.createSVGPathSegCurvetoQuadraticSmoothAbs(targetPoint.x(), targetPoint.y(), m_pathSegRole));
 117 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegCurvetoQuadraticSmoothAbs(targetPoint.x(), targetPoint.y(), m_pathSegRole)));
118118 else
119  m_pathSegList.append(m_pathElement.createSVGPathSegCurvetoQuadraticSmoothRel(targetPoint.x(), targetPoint.y(), m_pathSegRole));
 119 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegCurvetoQuadraticSmoothRel(targetPoint.x(), targetPoint.y(), m_pathSegRole)));
120120}
121121
122122void SVGPathSegListBuilder::arcTo(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, const FloatPoint& targetPoint, PathCoordinateMode mode)
123123{
124124 if (mode == AbsoluteCoordinates)
125  m_pathSegList.append(m_pathElement.createSVGPathSegArcAbs(targetPoint.x(), targetPoint.y(), r1, r2, angle, largeArcFlag, sweepFlag, m_pathSegRole));
 125 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegArcAbs(targetPoint.x(), targetPoint.y(), r1, r2, angle, largeArcFlag, sweepFlag, m_pathSegRole)));
126126 else
127  m_pathSegList.append(m_pathElement.createSVGPathSegArcRel(targetPoint.x(), targetPoint.y(), r1, r2, angle, largeArcFlag, sweepFlag, m_pathSegRole));
 127 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegArcRel(targetPoint.x(), targetPoint.y(), r1, r2, angle, largeArcFlag, sweepFlag, m_pathSegRole)));
128128}
129129
130130void SVGPathSegListBuilder::closePath()
131131{
132  m_pathSegList.append(m_pathElement.createSVGPathSegClosePath(m_pathSegRole));
 132 m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegClosePath(m_pathSegRole)));
133133}
134134
135135}
228390

Source/WebCore/svg/SVGPathSegListSource.cpp

@@bool SVGPathSegListSource::hasMoreData()
4343
4444bool SVGPathSegListSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
4545{
46  m_segment = m_pathSegList.at(m_itemCurrent);
 46 m_segment = m_pathSegList.propertyAt(m_itemCurrent);
4747 pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
4848 ++m_itemCurrent;
4949 return true;

@@bool SVGPathSegListSource::parseSVGSegme
5151
5252SVGPathSegType SVGPathSegListSource::nextCommand(SVGPathSegType)
5353{
54  m_segment = m_pathSegList.at(m_itemCurrent);
 54 m_segment = m_pathSegList.propertyAt(m_itemCurrent);
5555 SVGPathSegType pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
5656 ++m_itemCurrent;
5757 return pathSegType;
228390

Source/WebCore/svg/SVGPathSegListValues.h

1919
2020#pragma once
2121
22 #include "SVGListProperty.h"
 22#include "SVGListValues.h"
2323#include "SVGPathSeg.h"
2424#include "SVGPropertyTraits.h"
25 #include <wtf/Vector.h>
2625#include <wtf/text/WTFString.h>
2726
2827namespace WebCore {

@@class SVGPathSegList;
3332template<typename T>
3433class SVGPropertyTearOff;
3534
36 class SVGPathSegListValues : public Vector<RefPtr<SVGPathSeg>> {
 35class SVGPathSegListValues : public SVGListValues<RefPtr<SVGPathSeg>> {
3736public:
3837 explicit SVGPathSegListValues(SVGPathSegRole role)
3938 : m_role(role)
228390

Source/WebCore/svg/SVGPathUtilities.cpp

@@bool appendSVGPathByteStreamFromSVGPathS
120120 ASSERT(parsingMode == UnalteredParsing);
121121
122122 SVGPathSegListValues appendedItemList(PathSegUnalteredRole);
123  appendedItemList.append(WTFMove(pathSeg));
 123 appendedItemList.append(SVGValue::create<RefPtr<SVGPathSeg>>(WTFMove(pathSeg)));
124124
125125 SVGPathByteStream appendedByteStream;
126126 SVGPathSegListSource source(appendedItemList);

@@bool buildAnimatedSVGPathByteStream(cons
206206
207207bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& byStream, unsigned repeatCount)
208208{
209  // Why return when streamToAppendTo is empty? Don't we still need to append?
 209 // The byStream will be blended with streamToAppendTo. So streamToAppendTo has to have elements.
210210 if (streamToAppendTo.isEmpty() || byStream.isEmpty())
211211 return true;
212212
213  // Is it OK to make the SVGPathByteStreamBuilder from a stream, and then clear that stream?
 213 // builder is the destination of blending fromSource and bySource. The stream of builder
 214 // (i.e. streamToAppendTo) has to be cleared before calling addAnimatedPath.
214215 SVGPathByteStreamBuilder builder(streamToAppendTo);
215 
216  SVGPathByteStream fromStreamCopy = streamToAppendTo;
217  streamToAppendTo.clear();
 216 SVGPathByteStream fromStreamCopy = WTFMove(streamToAppendTo);
218217
219218 SVGPathByteStreamSource fromSource(fromStreamCopy);
220219 SVGPathByteStreamSource bySource(byStream);
228390

Source/WebCore/svg/SVGPoint.h

@@namespace WebCore {
3333
3434class SVGPoint : public SVGPropertyTearOff<FloatPoint> {
3535public:
36  static Ref<SVGPoint> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatPoint& value)
 36 static Ref<SVGPoint> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
3737 {
3838 return adoptRef(*new SVGPoint(animatedProperty, role, value));
3939 }

@@public:
4343 return adoptRef(*new SVGPoint(initialValue));
4444 }
4545
46  static Ref<SVGPoint> create(const FloatPoint* initialValue)
47  {
48  return adoptRef(*new SVGPoint(initialValue));
49  }
50 
5146 template<typename T> static ExceptionOr<Ref<SVGPoint>> create(ExceptionOr<T>&& initialValue)
5247 {
5348 if (initialValue.hasException())

@@public:
5752
5853 float x()
5954 {
60  return propertyReference().x();
 55 return valueProperty().x();
6156 }
6257
6358 ExceptionOr<void> setX(float xValue)

@@public:
6560 if (isReadOnly())
6661 return Exception { NoModificationAllowedError };
6762
68  propertyReference().setX(xValue);
 63 valueProperty().setX(xValue);
6964 commitChange();
7065
7166 return { };

@@public:
7368
7469 float y()
7570 {
76  return propertyReference().y();
 71 return valueProperty().y();
7772 }
7873
7974 ExceptionOr<void> setY(float xValue)

@@public:
8176 if (isReadOnly())
8277 return Exception { NoModificationAllowedError };
8378
84  propertyReference().setY(xValue);
 79 valueProperty().setY(xValue);
8580 commitChange();
8681
8782 return { };

@@public:
9287 if (isReadOnly())
9388 return Exception { NoModificationAllowedError };
9489
95  auto newPoint = propertyReference().matrixTransform(matrix.propertyReference());
 90 auto newPoint = valueProperty().matrixTransform(matrix.valueProperty());
9691 commitChange();
9792
9893 return SVGPoint::create(newPoint);
9994 }
10095
10196protected:
102  SVGPoint(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatPoint& value)
 97 SVGPoint(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
10398 : SVGPropertyTearOff<FloatPoint>(&animatedProperty, role, value)
10499 {
105100 }
106101
107  SVGPoint(SVGPropertyRole role, FloatPoint& value)
 102 SVGPoint(SVGPropertyRole role, const RefPtr<SVGValue>& value)
108103 : SVGPropertyTearOff<FloatPoint>(nullptr, role, value)
109104 {
110105 }

@@protected:
113108 : SVGPropertyTearOff<FloatPoint>(initialValue)
114109 {
115110 }
116 
117  explicit SVGPoint(const FloatPoint* initialValue)
118  : SVGPropertyTearOff<FloatPoint>(initialValue)
119  {
120  }
121111};
122112
123113} // namespace WebCore
228390

Source/WebCore/svg/SVGPointList.h

@@public:
3737 using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGPointListValues>;
3838 using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
3939
40  static Ref<SVGPointList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPointListValues& values, ListWrapperCache& wrappers)
 40 static Ref<SVGPointList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
4141 {
4242 return adoptRef(*new SVGPointList(animatedProperty, role, values, wrappers));
4343 }
4444
4545private:
46  SVGPointList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPointListValues& values, ListWrapperCache& wrappers)
 46 SVGPointList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
4747 : SVGListPropertyTearOff<SVGPointListValues>(animatedProperty, role, values, wrappers)
4848 {
4949 }
228390

Source/WebCore/svg/SVGPointListValues.cpp

@@String SVGPointListValues::valueAsString
3535 if (i > 0)
3636 builder.append(' '); // FIXME: Shouldn't we use commas to seperate?
3737
38  const auto& point = at(i);
 38 const auto& point = propertyAt(i);
3939 builder.appendNumber(point.x());
4040 builder.append(' ');
4141 builder.appendNumber(point.y());
228390

Source/WebCore/svg/SVGPointListValues.h

2121#pragma once
2222
2323#include "FloatPoint.h"
 24#include "SVGListValues.h"
2425#include "SVGPropertyTraits.h"
25 #include <wtf/Vector.h>
2626
2727namespace WebCore {
2828
2929class SVGPoint;
3030class SVGPointList;
3131
32 class SVGPointListValues final : public Vector<FloatPoint> {
 32class SVGPointListValues final : public SVGListValues<FloatPoint> {
3333public:
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;
228390

Source/WebCore/svg/SVGPolyElement.cpp

@@void SVGPolyElement::parseAttribute(cons
7373 if (auto wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()))
7474 static_pointer_cast<SVGAnimatedPointList>(wrapper)->detachListWrappers(newList.size());
7575
76  m_points.value = newList;
 76 static_cast<SVGPointListValues&>(*m_points.value) = WTFMove(newList);
7777 return;
7878 }
7979

@@void SVGPolyElement::synchronizePoints(S
109109 SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement);
110110 if (!ownerType.m_points.shouldSynchronize)
111111 return;
112  ownerType.m_points.synchronize(&ownerType, pointsPropertyInfo()->attributeName, ownerType.m_points.value.valueAsString());
 112 ownerType.m_points.synchronize(&ownerType, pointsPropertyInfo()->attributeName, static_cast<SVGPointListValues&>(*ownerType.m_points.value).valueAsString());
113113}
114114
115115Ref<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement)
228390

Source/WebCore/svg/SVGPolyElement.h

@@public:
3333 Ref<SVGPointList> points();
3434 Ref<SVGPointList> animatedPoints();
3535
36  SVGPointListValues& pointList() const { return m_points.value; }
 36 SVGPointListValues& pointList() const { return static_cast<SVGPointListValues&>(*m_points.value); }
3737
3838 static const SVGPropertyInfo* pointsPropertyInfo();
3939
228390

Source/WebCore/svg/SVGPreserveAspectRatio.h

@@namespace WebCore {
3232
3333class SVGPreserveAspectRatio : public SVGPropertyTearOff<SVGPreserveAspectRatioValue> {
3434public:
35  static Ref<SVGPreserveAspectRatio> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGPreserveAspectRatioValue& value)
 35 static Ref<SVGPreserveAspectRatio> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
3636 {
3737 return adoptRef(*new SVGPreserveAspectRatio(animatedProperty, role, value));
3838 }

@@public:
4242 return adoptRef(*new SVGPreserveAspectRatio(initialValue));
4343 }
4444
45  static Ref<SVGPreserveAspectRatio> create(const SVGPreserveAspectRatioValue* initialValue)
46  {
47  return adoptRef(*new SVGPreserveAspectRatio(initialValue));
48  }
49 
5045 template<typename T> static ExceptionOr<Ref<SVGPreserveAspectRatio>> create(ExceptionOr<T>&& initialValue)
5146 {
5247 if (initialValue.hasException())

@@public:
5651
5752 unsigned short align()
5853 {
59  return propertyReference().align();
 54 return valueProperty().align();
6055 }
6156
6257 ExceptionOr<void> setAlign(float value)

@@public:
6459 if (isReadOnly())
6560 return Exception { NoModificationAllowedError };
6661
67  auto result = propertyReference().setAlign(value);
 62 auto result = valueProperty().setAlign(value);
6863 if (result.hasException())
6964 return result;
7065

@@public:
7469
7570 unsigned short meetOrSlice()
7671 {
77  return propertyReference().meetOrSlice();
 72 return valueProperty().meetOrSlice();
7873 }
7974
8075 ExceptionOr<void> setMeetOrSlice(float value)

@@public:
8277 if (isReadOnly())
8378 return Exception { NoModificationAllowedError };
8479
85  auto result = propertyReference().setMeetOrSlice(value);
 80 auto result = valueProperty().setMeetOrSlice(value);
8681 if (result.hasException())
8782 return result;
8883

@@public:
9186 }
9287
9388private:
94  SVGPreserveAspectRatio(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGPreserveAspectRatioValue& value)
 89 SVGPreserveAspectRatio(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
9590 : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(&animatedProperty, role, value)
9691 {
9792 }

@@private:
10095 : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(initialValue)
10196 {
10297 }
103 
104  explicit SVGPreserveAspectRatio(const SVGPreserveAspectRatioValue* initialValue)
105  : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(initialValue)
106  {
107  }
10898};
10999
110100} // namespace WebCore
228390

Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp

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

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
228390

Source/WebCore/svg/SVGRadialGradientElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
5555
5656inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document& document)
5757 : SVGGradientElement(tagName, document)
58  , m_cx(LengthModeWidth, "50%")
59  , m_cy(LengthModeHeight, "50%")
60  , m_r(LengthModeOther, "50%")
61  , m_fx(LengthModeWidth)
62  , m_fy(LengthModeHeight)
63  , m_fr(LengthModeOther, "0%")
 58 , m_cx(SVGLengthValue(LengthModeWidth, "50%"))
 59 , m_cy(SVGLengthValue(LengthModeHeight, "50%"))
 60 , m_r(SVGLengthValue(LengthModeOther, "50%"))
 61 , m_fx(SVGLengthValue(LengthModeWidth))
 62 , m_fy(SVGLengthValue(LengthModeHeight))
 63 , m_fr(SVGLengthValue(LengthModeOther, "0%"))
6464{
6565 // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified.
6666 ASSERT(hasTagName(SVGNames::radialGradientTag));
228390

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
2727class SVGRect : public SVGPropertyTearOff<FloatRect> {
2828public:
29  static Ref<SVGRect> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatRect& value)
 29 static Ref<SVGRect> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
3030 {
3131 return adoptRef(*new SVGRect(animatedProperty, role, value));
3232 }

@@public:
3636 return adoptRef(*new SVGRect(initialValue));
3737 }
3838
39  static Ref<SVGRect> create(const FloatRect* initialValue)
40  {
41  return adoptRef(*new SVGRect(initialValue));
42  }
43 
4439 template<typename T> static ExceptionOr<Ref<SVGRect>> create(ExceptionOr<T>&& initialValue)
4540 {
4641 if (initialValue.hasException())

@@public:
5045
5146 float x()
5247 {
53  return propertyReference().x();
 48 return valueProperty().x();
5449 }
5550
5651 ExceptionOr<void> setX(float xValue)

@@public:
5853 if (isReadOnly())
5954 return Exception { NoModificationAllowedError };
6055
61  propertyReference().setX(xValue);
 56 valueProperty().setX(xValue);
6257 commitChange();
6358
6459 return { };

@@public:
6661
6762 float y()
6863 {
69  return propertyReference().y();
 64 return valueProperty().y();
7065 }
7166
7267 ExceptionOr<void> setY(float xValue)

@@public:
7469 if (isReadOnly())
7570 return Exception { NoModificationAllowedError };
7671
77  propertyReference().setY(xValue);
 72 valueProperty().setY(xValue);
7873 commitChange();
7974
8075 return { };

@@public:
8277
8378 float width()
8479 {
85  return propertyReference().width();
 80 return valueProperty().width();
8681 }
8782
8883 ExceptionOr<void> setWidth(float widthValue)

@@public:
9085 if (isReadOnly())
9186 return Exception { NoModificationAllowedError };
9287
93  propertyReference().setWidth(widthValue);
 88 valueProperty().setWidth(widthValue);
9489 commitChange();
9590
9691 return { };

@@public:
9893
9994 float height()
10095 {
101  return propertyReference().height();
 96 return valueProperty().height();
10297 }
10398
10499 ExceptionOr<void> setHeight(float heightValue)

@@public:
106101 if (isReadOnly())
107102 return Exception { NoModificationAllowedError };
108103
109  propertyReference().setHeight(heightValue);
 104 valueProperty().setHeight(heightValue);
110105 commitChange();
111106
112107 return { };
113108 }
114109
115110private:
116  SVGRect(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatRect& value)
 111 SVGRect(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
117112 : SVGPropertyTearOff<FloatRect>(&animatedProperty, role, value)
118113 {
119114 }

@@private:
122117 : SVGPropertyTearOff<FloatRect>(initialValue)
123118 {
124119 }
125 
126  explicit SVGRect(const FloatRect* initialValue)
127  : SVGPropertyTearOff<FloatRect>(initialValue)
128  {
129  }
130120};
131121
132122
228390

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
228390

Source/WebCore/svg/SVGSVGElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
7171
7272inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& document)
7373 : SVGGraphicsElement(tagName, document)
74  , m_x(LengthModeWidth)
75  , m_y(LengthModeHeight)
76  , m_width(LengthModeWidth, ASCIILiteral("100%"))
77  , m_height(LengthModeHeight, ASCIILiteral("100%"))
 74 , m_x(SVGLengthValue(LengthModeWidth))
 75 , m_y(SVGLengthValue(LengthModeHeight))
 76 , m_width(SVGLengthValue(LengthModeWidth, ASCIILiteral("100%")))
 77 , m_height(SVGLengthValue(LengthModeHeight, ASCIILiteral("100%")))
7878 , m_timeContainer(SMILTimeContainer::create(*this))
 79 , m_currentTranslate(SVGValue::create<FloatPoint>())
7980{
8081 ASSERT(hasTagName(SVGNames::svgTag));
8182 registerAnimatedPropertiesForSVGSVGElement();

@@Ref<SVGPoint> SVGSVGElement::currentTran
197198
198199void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation)
199200{
200  if (m_currentTranslate == translation)
 201 if (static_cast<FloatPoint&>(*m_currentTranslate) == translation)
201202 return;
202  m_currentTranslate = translation;
 203 static_cast<FloatPoint&>(*m_currentTranslate) = translation;
203204 updateCurrentTranslate();
204205}
205206

@@Ref<NodeList> SVGSVGElement::collectInte
335336
336337static bool checkIntersectionWithoutUpdatingLayout(SVGElement& element, SVGRect& rect)
337338{
338  return RenderSVGModelObject::checkIntersection(element.renderer(), rect.propertyReference());
 339 return RenderSVGModelObject::checkIntersection(element.renderer(), rect.valueProperty());
339340}
340341
341342static bool checkEnclosureWithoutUpdatingLayout(SVGElement& element, SVGRect& rect)
342343{
343  return RenderSVGModelObject::checkEnclosure(element.renderer(), rect.propertyReference());
 344 return RenderSVGModelObject::checkEnclosure(element.renderer(), rect.valueProperty());
344345}
345346
346347Ref<NodeList> SVGSVGElement::getIntersectionList(SVGRect& rect, SVGElement* referenceElement)

@@Ref<SVGTransform> SVGSVGElement::createS
414415
415416Ref<SVGTransform> SVGSVGElement::createSVGTransformFromMatrix(SVGMatrix& matrix)
416417{
417  return SVGTransform::create(SVGTransformValue { matrix.propertyReference() });
 418 return SVGTransform::create(SVGTransformValue { matrix.valueProperty() });
418419}
419420
420421AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const
228390

Source/WebCore/svg/SVGSVGElement.h

@@private:
163163 bool m_useCurrentView { false };
164164 SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
165165 Ref<SMILTimeContainer> m_timeContainer;
166  FloatPoint m_currentTranslate;
 166 RefPtr<SVGValue> m_currentTranslate;
167167 RefPtr<SVGViewSpec> m_viewSpec;
168168 String m_currentViewFragmentIdentifier;
169169};

@@inline bool SVGSVGElement::useCurrentVie
175175
176176inline FloatPoint SVGSVGElement::currentTranslateValue()
177177{
178  return m_currentTranslate;
 178 return static_cast<FloatPoint&>(*m_currentTranslate);
179179}
180180
181181inline SVGZoomAndPanType SVGSVGElement::zoomAndPan() const
228390

Source/WebCore/svg/SVGStringList.h

@@public:
3636 using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGStringListValues>;
3737 using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
3838
39  static Ref<SVGStringList> create(SVGElement& contextElement, SVGStringListValues& values)
 39 static Ref<SVGStringList> create(SVGElement& contextElement, const RefPtr<SVGValue>& values)
4040 {
4141 return adoptRef(*new SVGStringList(&contextElement, values));
4242 }
4343
44  static Ref<SVGStringList> create(AnimatedListPropertyTearOff&, SVGPropertyRole, SVGStringListValues& values, ListWrapperCache&)
 44 static Ref<SVGStringList> create(AnimatedListPropertyTearOff&, SVGPropertyRole, const RefPtr<SVGValue>& values, ListWrapperCache&)
4545 {
4646 // FIXME: Find a way to remove this. It's only needed to keep Windows compiling.
4747 ASSERT_NOT_REACHED();

@@public:
4949 }
5050
5151private:
52  SVGStringList(SVGElement* contextElement, SVGStringListValues& values)
 52 SVGStringList(SVGElement* contextElement, const RefPtr<SVGValue>& values)
5353 : SVGStaticListPropertyTearOff<SVGStringListValues>(contextElement, values)
5454 {
5555 }
228390

Source/WebCore/svg/SVGStringListValues.cpp

@@void SVGStringListValues::reset(const St
3939
4040 // Add empty string, if list is empty.
4141 if (isEmpty())
42  append(emptyString());
 42 append(SVGValue::create<String>(emptyString()));
4343}
4444
4545void SVGStringListValues::parse(const String& data, UChar delimiter)

@@void SVGStringListValues::parse(const St
5656 ptr++;
5757 if (ptr == start)
5858 break;
59  append(String(start, ptr - start));
 59 append(SVGValue::create<String>(String(start, ptr - start)));
6060 skipOptionalSVGSpacesOrDelimiter(ptr, end, delimiter);
6161 }
6262}

@@String SVGStringListValues::valueAsStrin
7070 if (i > 0)
7171 builder.append(' ');
7272
73  builder.append(at(i));
 73 builder.append(propertyAt(i));
7474 }
7575
7676 return builder.toString();
228390

Source/WebCore/svg/SVGStringListValues.h

2121#pragma once
2222
2323#include "QualifiedName.h"
 24#include "SVGListValues.h"
2425#include "SVGPropertyTraits.h"
25 #include <wtf/Vector.h>
2626
2727namespace WebCore {
2828

@@class SVGStringList;
3232template<typename T>
3333class SVGPropertyTearOff;
3434
35 class SVGStringListValues final : public Vector<String> {
 35class SVGStringListValues final : public SVGListValues<String> {
3636public:
3737 SVGStringListValues(const QualifiedName& attributeName)
3838 : m_attributeName(attributeName)
228390

Source/WebCore/svg/SVGTests.cpp

@@static const HashSet<String, ASCIICaseIn
107107}
108108
109109SVGTests::SVGTests()
110  : m_requiredFeatures(requiredFeaturesAttr)
111  , m_requiredExtensions(requiredExtensionsAttr)
112  , m_systemLanguage(systemLanguageAttr)
 110 : m_requiredFeatures(SVGStringListValues(requiredFeaturesAttr))
 111 , m_requiredExtensions(SVGStringListValues(requiredExtensionsAttr))
 112 , m_systemLanguage(SVGStringListValues(systemLanguageAttr))
113113{
114114}
115115

@@bool SVGTests::hasExtension(const String
154154
155155bool SVGTests::isValid() const
156156{
157  for (auto& feature : m_requiredFeatures.value) {
 157 auto features = static_cast<SVGStringListValues&>(*m_requiredFeatures.value).properties();
 158 for (auto& feature : features) {
158159 if (feature.isEmpty() || !supportedSVGFeatures().contains(feature))
159160 return false;
160161 }
161  for (auto& language : m_systemLanguage.value) {
 162
 163 auto languages = static_cast<SVGStringListValues&>(*m_systemLanguage.value).properties();
 164 for (auto& language : languages) {
162165 if (language != defaultLanguage().substring(0, 2))
163166 return false;
164167 }
165  for (auto& extension : m_requiredExtensions.value) {
 168
 169 auto extensions = static_cast<SVGStringListValues&>(*m_requiredExtensions.value).properties();
 170 for (auto& extension : extensions) {
166171 if (!hasExtension(extension))
167172 return false;
168173 }

@@bool SVGTests::isValid() const
172177void SVGTests::parseAttribute(const QualifiedName& attributeName, const AtomicString& value)
173178{
174179 if (attributeName == requiredFeaturesAttr)
175  m_requiredFeatures.value.reset(value);
 180 static_cast<SVGStringListValues&>(*m_requiredFeatures.value).reset(value);
176181 if (attributeName == requiredExtensionsAttr)
177  m_requiredExtensions.value.reset(value);
 182 static_cast<SVGStringListValues&>(*m_requiredExtensions.value).reset(value);
178183 if (attributeName == systemLanguageAttr)
179  m_systemLanguage.value.reset(value);
 184 static_cast<SVGStringListValues&>(*m_systemLanguage.value).reset(value);
180185}
181186
182187bool SVGTests::isKnownAttribute(const QualifiedName& attributeName)

@@void SVGTests::synchronizeAttribute(SVGE
208213{
209214 if (!property.shouldSynchronize)
210215 return;
211  m_requiredFeatures.synchronize(&contextElement, attributeName, property.value.valueAsString());
 216 m_requiredFeatures.synchronize(&contextElement, attributeName, static_cast<SVGStringListValues&>(*property.value).valueAsString());
212217}
213218
214219void SVGTests::synchronizeRequiredFeatures(SVGElement& contextElement)
228390

Source/WebCore/svg/SVGTextContentElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
6666
6767SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Document& document)
6868 : SVGGraphicsElement(tagName, document)
69  , m_textLength(LengthModeOther)
70  , m_specifiedTextLength(LengthModeOther)
 69 , m_textLength(SVGLengthValue(LengthModeOther))
 70 , m_specifiedTextLength(SVGLengthValue(LengthModeOther))
7171 , m_lengthAdjust(SVGLengthAdjustSpacing)
7272{
7373 registerAnimatedPropertiesForSVGTextContentElement();

@@Ref<SVGAnimatedLength> SVGTextContentEle
9595{
9696 static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther);
9797 if (m_specifiedTextLength == defaultTextLength)
98  m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength());
 98 static_cast<SVGLengthValue&>(*m_textLength.value).newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength());
9999
100100 m_textLength.shouldSynchronize = true;
101101 return static_reference_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this));

@@ExceptionOr<float> SVGTextContentElement
158158int SVGTextContentElement::getCharNumAtPosition(SVGPoint& point)
159159{
160160 document().updateLayoutIgnorePendingStylesheets();
161  return SVGTextQuery(renderer()).characterNumberAtPosition(point.propertyReference());
 161 return SVGTextQuery(renderer()).characterNumberAtPosition(point.valueProperty());
162162}
163163
164164ExceptionOr<void> SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars)

@@void SVGTextContentElement::parseAttribu
229229 if (propertyValue > 0)
230230 setLengthAdjustBaseValue(propertyValue);
231231 } else if (name == SVGNames::textLengthAttr)
232  m_textLength.value = SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths);
 232 static_cast<SVGLengthValue&>(*m_textLength.value) = SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths);
233233
234234 reportAttributeParsingError(parseError, name, value);
235235

@@void SVGTextContentElement::svgAttribute
245245 }
246246
247247 if (attrName == SVGNames::textLengthAttr)
248  m_specifiedTextLength = m_textLength.value;
 248 m_specifiedTextLength = static_cast<SVGLengthValue&>(*m_textLength.value);
249249
250250 if (auto renderer = this->renderer()) {
251251 InstanceInvalidationGuard guard(*this);
228390

Source/WebCore/svg/SVGTextPathElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
4646
4747inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document& document)
4848 : SVGTextContentElement(tagName, document)
49  , m_startOffset(LengthModeOther)
 49 , m_startOffset(SVGLengthValue(LengthModeOther))
5050 , m_method(SVGTextPathMethodAlign)
5151 , m_spacing(SVGTextPathSpacingExact)
5252{
228390

Source/WebCore/svg/SVGTransform.cpp

@@namespace WebCore {
3232
3333Ref<SVGMatrix> SVGTransform::matrix()
3434{
35  return SVGMatrixTearOff::create(*this, propertyReference().svgMatrix());
 35 return SVGMatrixTearOff::create(*this, valueProperty().svgMatrix());
3636}
3737
3838} // namespace WebCore
228390

Source/WebCore/svg/SVGTransform.h

@@namespace WebCore {
3333
3434class SVGTransform : public SVGPropertyTearOff<SVGTransformValue> {
3535public:
36  static Ref<SVGTransform> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGTransformValue& value)
 36 static Ref<SVGTransform> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
3737 {
3838 return adoptRef(*new SVGTransform(animatedProperty, role, value));
3939 }

@@public:
4343 return adoptRef(*new SVGTransform(initialValue));
4444 }
4545
46  static Ref<SVGTransform> create(const SVGTransformValue* initialValue)
47  {
48  return adoptRef(*new SVGTransform(initialValue));
49  }
50 
5146 template<typename T> static ExceptionOr<Ref<SVGTransform>> create(ExceptionOr<T>&& initialValue)
5247 {
5348 if (initialValue.hasException())

@@public:
5752
5853 unsigned short type()
5954 {
60  return propertyReference().type();
 55 return valueProperty().type();
6156 }
6257
6358 Ref<SVGMatrix> matrix();
6459
6560 float angle()
6661 {
67  return propertyReference().angle();
 62 return valueProperty().angle();
6863 }
6964
7065 ExceptionOr<void> setMatrix(SVGMatrix& matrix)

@@public:
7267 if (isReadOnly())
7368 return Exception { NoModificationAllowedError };
7469
75  propertyReference().setMatrix(matrix.propertyReference());
 70 valueProperty().setMatrix(matrix.valueProperty());
7671 commitChange();
7772
7873 return { };

@@public:
8378 if (isReadOnly())
8479 return Exception { NoModificationAllowedError };
8580
86  propertyReference().setTranslate(tx, ty);
 81 valueProperty().setTranslate(tx, ty);
8782 commitChange();
8883
8984 return { };

@@public:
9489 if (isReadOnly())
9590 return Exception { NoModificationAllowedError };
9691
97  propertyReference().setScale(sx, sy);
 92 valueProperty().setScale(sx, sy);
9893 commitChange();
9994
10095 return { };

@@public:
105100 if (isReadOnly())
106101 return Exception { NoModificationAllowedError };
107102
108  propertyReference().setRotate(angle, cx, cy);
 103 valueProperty().setRotate(angle, cx, cy);
109104 commitChange();
110105
111106 return { };

@@public:
116111 if (isReadOnly())
117112 return Exception { NoModificationAllowedError };
118113
119  propertyReference().setSkewX(angle);
 114 valueProperty().setSkewX(angle);
120115 commitChange();
121116
122117 return { };

@@public:
127122 if (isReadOnly())
128123 return Exception { NoModificationAllowedError };
129124
130  propertyReference().setSkewY(angle);
 125 valueProperty().setSkewY(angle);
131126 commitChange();
132127
133128 return { };
134129 }
135130
136131private:
137  SVGTransform(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGTransformValue& value)
 132 SVGTransform(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
138133 : SVGPropertyTearOff<SVGTransformValue>(&animatedProperty, role, value)
139134 {
140135 }

@@private:
143138 : SVGPropertyTearOff<SVGTransformValue>(initialValue)
144139 {
145140 }
146 
147  explicit SVGTransform(const SVGTransformValue* initialValue)
148  : SVGPropertyTearOff<SVGTransformValue>(initialValue)
149  {
150  }
151141};
152142
153143} // namespace WebCore
228390

Source/WebCore/svg/SVGTransformList.h

2222
2323#include "SVGAnimatedListPropertyTearOff.h"
2424#include "SVGListPropertyTearOff.h"
 25#include "SVGTransform.h"
2526#include "SVGTransformListValues.h"
2627
2728namespace WebCore {

@@public:
3132 using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGTransformListValues>;
3233 using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
3334
34  static Ref<SVGTransformList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGTransformListValues& values, ListWrapperCache& wrappers)
 35 static Ref<SVGTransformList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
3536 {
3637 return adoptRef(*new SVGTransformList(animatedProperty, role, values, wrappers));
3738 }
3839
3940 ExceptionOr<Ref<SVGTransform>> createSVGTransformFromMatrix(SVGMatrix& matrix)
4041 {
41  ASSERT(m_values);
42  return m_values->createSVGTransformFromMatrix(matrix);
 42 return valuesProperty().createSVGTransformFromMatrix(matrix);
4343 }
4444
4545 ExceptionOr<RefPtr<SVGTransform>> consolidate()
4646 {
47  ASSERT(m_values);
4847 ASSERT(m_wrappers);
4948
5049 auto result = canAlterList();

@@public:
5251 return result.releaseException();
5352 ASSERT(result.releaseReturnValue());
5453
55  ASSERT(m_values->size() == m_wrappers->size());
 54 ASSERT(valuesProperty().size() == m_wrappers->size());
5655
5756 // Spec: If the list was empty, then a value of null is returned.
58  if (m_values->isEmpty())
 57 if (valuesProperty().isEmpty())
5958 return nullptr;
6059
6160 detachListWrappers(0);
6261
63  RefPtr<SVGTransform> wrapper = m_values->consolidate();
 62 RefPtr<SVGTransform> wrapper = valuesProperty().consolidate();
6463 m_wrappers->append(wrapper->createWeakPtr());
6564
66  ASSERT(m_values->size() == m_wrappers->size());
 65 ASSERT(valuesProperty().size() == m_wrappers->size());
6766 return WTFMove(wrapper);
6867 }
6968
7069private:
71  SVGTransformList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGTransformListValues& values, ListWrapperCache& wrappers)
 70 SVGTransformList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
7271 : SVGListPropertyTearOff<SVGTransformListValues>(animatedProperty, role, values, wrappers)
7372 {
7473 }
228390

Source/WebCore/svg/SVGTransformListValues.cpp

@@Ref<SVGTransform> SVGTransformListValues
4141
4242 SVGTransformValue transform(matrix);
4343 clear();
44  append(transform);
 44 append(SVGValue::create<SVGTransformValue>(transform));
4545 return SVGTransform::create(transform);
4646}
4747

@@bool SVGTransformListValues::concatenate
5252 return false;
5353
5454 for (unsigned i = 0; i < size; ++i)
55  result *= at(i).matrix();
 55 result *= propertyAt(i).matrix();
5656
5757 return true;
5858}

@@String SVGTransformListValues::valueAsSt
6565 if (i > 0)
6666 builder.append(' ');
6767
68  builder.append(at(i).valueAsString());
 68 builder.append(propertyAt(i).valueAsString());
6969 }
7070
7171 return builder.toString();
228390

Source/WebCore/svg/SVGTransformListValues.h

11/*
22 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
 4 * Copyright (C) 2018 Apple Inc. All rights reserved.
45 *
56 * This library is free software; you can redistribute it and/or
67 * modify it under the terms of the GNU Library General Public

2021
2122#pragma once
2223
23 #include "SVGPropertyTraits.h"
24 #include "SVGTransform.h"
25 #include <wtf/Vector.h>
 24#include "SVGListValues.h"
 25#include "SVGTransformValue.h"
2626
2727namespace WebCore {
2828
29 template<typename T>
30 class SVGListPropertyTearOff;
31 
 29class SVGMatrix;
 30class SVGTransform;
3231class SVGTransformList;
3332
34 class SVGTransformListValues final : public Vector<SVGTransformValue, 1> {
 33class SVGTransformListValues final : public SVGListValues<SVGTransformValue> {
3534public:
3635 Ref<SVGTransform> createSVGTransformFromMatrix(SVGMatrix&) const;
3736 Ref<SVGTransform> consolidate();

@@public:
4241 void parse(const String&);
4342};
4443
45 template<> struct SVGPropertyTraits<SVGTransformListValues> {
 44template<>
 45struct SVGPropertyTraits<SVGTransformListValues> {
4646 static SVGTransformListValues initialValue() { return { }; }
 47 static SVGTransformListValues fromString(const String& string)
 48 {
 49 SVGTransformListValues list;
 50 list.parse(string);
 51 ASSERT(list.size() <= 1);
 52 return list;
 53 }
4754 static String toString(const SVGTransformListValues& list) { return list.valueAsString(); }
4855
4956 using ListItemType = SVGTransformValue;
228390

Source/WebCore/svg/SVGTransformValue.h

@@inline bool operator!=(const SVGTransfor
9191 return !(a == b);
9292}
9393
 94template<> struct SVGPropertyTraits<SVGTransformValue> {
 95 static SVGTransformValue initialValue() { return { }; }
 96 static String toString(const SVGTransformValue& transform) { return transform.valueAsString(); }
 97};
 98
9499} // namespace WebCore
228390

Source/WebCore/svg/SVGTransformable.cpp

@@bool SVGTransformable::parseTransformAtt
197197 if (!parseTransformValue(type, currTransform, end, transform))
198198 return false;
199199
200  list.append(transform);
 200 list.append(SVGValue::create<SVGTransformValue>(transform));
201201 skipOptionalSVGSpaces(currTransform, end);
202202 if (currTransform < end && *currTransform == ',') {
203203 delimParsed = true;
228390

Source/WebCore/svg/SVGUseElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
6262
6363inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& document)
6464 : SVGGraphicsElement(tagName, document)
65  , m_x(LengthModeWidth)
66  , m_y(LengthModeHeight)
67  , m_width(LengthModeWidth)
68  , m_height(LengthModeHeight)
 65 , m_x(SVGLengthValue(LengthModeWidth))
 66 , m_y(SVGLengthValue(LengthModeHeight))
 67 , m_width(SVGLengthValue(LengthModeWidth))
 68 , m_height(SVGLengthValue(LengthModeHeight))
6969 , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired)
7070{
7171 ASSERT(hasCustomStyleResolveCallbacks());
228390

Source/WebCore/svg/SVGValue.h

 1/*
 2 * Copyright (C) 2018 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 "FloatPoint.h"
 30#include "FloatRect.h"
 31#include "SVGAngleValue.h"
 32#include "SVGLengthListValues.h"
 33#include "SVGLengthValue.h"
 34#include "SVGMatrixValue.h"
 35#include "SVGNumberListValues.h"
 36#include "SVGPathByteStream.h"
 37#include "SVGPathSegListValues.h"
 38#include "SVGPointListValues.h"
 39#include "SVGPreserveAspectRatioValue.h"
 40#include "SVGPropertyTraits.h"
 41#include "SVGStringListValues.h"
 42#include "SVGTransformListValues.h"
 43#include "SVGTransformValue.h"
 44#include <wtf/Variant.h>
 45
 46namespace WebCore {
 47
 48using SVGValueVariant = Variant<
 49 SVGAngleValue, // 0: angle
 50 bool, // 1: boolean
 51 Color, // 2: color
 52 unsigned, // 3: enumeration
 53 int, // 4: integer
 54 SVGLengthValue, // 5: length
 55 SVGLengthListValues, // 6: lengthList
 56 SVGMatrixValue, // 7: matrix
 57 float, // 8: number
 58 SVGNumberListValues, // 9: numberList
 59 SVGPathByteStream, // 10: path
 60 RefPtr<SVGPathSeg>, // 11: pathSeg
 61 SVGPathSegListValues, // 12: pathSegList
 62 SVGPreserveAspectRatioValue, // 13: preserveAspectRatio
 63 FloatPoint, // 14: point
 64 SVGPointListValues, // 15: pointList
 65 FloatRect, // 16: rect
 66 String, // 17: string
 67 SVGStringListValues, // 18: stringList
 68 SVGTransformValue, // 19: transform
 69 SVGTransformListValues // 20: transformList
 70>;
 71
 72template <typename PropertyType>
 73class SVGTraitHasToString {
 74 typedef char one;
 75 typedef long two;
 76
 77 template <typename T> static one test(decltype(&SVGPropertyTraits<T>::toString));
 78 template <typename T> static two test(...);
 79
 80public:
 81 enum { value = sizeof(test<PropertyType>(nullptr)) == sizeof(char) };
 82};
 83
 84struct toStringVisitor {
 85 template<typename PropertyType, std::enable_if_t<SVGTraitHasToString<PropertyType>::value>* = nullptr>
 86 String operator()(const PropertyType& value)
 87 {
 88 return SVGPropertyTraits<PropertyType>::toString(value);
 89 }
 90
 91 template<typename PropertyType, std::enable_if_t<!SVGTraitHasToString<PropertyType>::value>* = nullptr>
 92 String operator()(const PropertyType&)
 93 {
 94 ASSERT_NOT_REACHED();
 95 return { };
 96 }
 97};
 98
 99template <typename PropertyType>
 100class SVGTraitHasParse {
 101 typedef char one;
 102 typedef long two;
 103
 104 template <typename T> static one test(decltype(&SVGPropertyTraits<T>::parse));
 105 template <typename T> static two test(...);
 106
 107public:
 108 enum { value = sizeof(test<PropertyType>(nullptr)) == sizeof(char) };
 109};
 110
 111struct parseVisitor {
 112 parseVisitor(const QualifiedName& attrName, const String& string, SVGValueVariant& variant)
 113 : m_attrName(attrName)
 114 , m_string(string)
 115 , m_variant(variant)
 116 {
 117 }
 118
 119 template<typename PropertyType, std::enable_if_t<SVGTraitHasParse<PropertyType>::value>* = nullptr>
 120 bool operator()(const PropertyType&)
 121 {
 122 std::optional<PropertyType> result = SVGPropertyTraits<PropertyType>::parse(m_attrName, m_string);
 123 if (!result)
 124 return false;
 125 m_variant.emplace<PropertyType>(WTFMove(result.value()));
 126 return true;
 127 }
 128
 129 template<typename PropertyType, std::enable_if_t<!SVGTraitHasParse<PropertyType>::value>* = nullptr>
 130 bool operator()(const PropertyType&)
 131 {
 132 ASSERT_NOT_REACHED();
 133 return false;
 134 }
 135
 136 const QualifiedName& m_attrName;
 137 const String& m_string;
 138 SVGValueVariant& m_variant;
 139};
 140
 141class SVGValue : public RefCounted<SVGValue>, public SVGValueVariant {
 142public:
 143 template<typename PropertyType>
 144 static Ref<SVGValue> create()
 145 {
 146 return create<PropertyType>(SVGPropertyTraits<PropertyType>::initialValue());
 147 }
 148
 149 template <class PropertyType, std::enable_if_t<std::is_enum<PropertyType>::value>* = nullptr>
 150 static Ref<SVGValue> create(const PropertyType& property)
 151 {
 152 return adoptRef(*new SVGValue(reinterpret_cast<const unsigned&>(property)));
 153 }
 154
 155 template <class PropertyType, std::enable_if_t<!std::is_enum<PropertyType>::value>* = nullptr>
 156 static Ref<SVGValue> create(const PropertyType& property)
 157 {
 158 return adoptRef(*new SVGValue(property));
 159 }
 160
 161 static Ref<SVGValue> create(const SVGValue& value)
 162 {
 163 return adoptRef(*new SVGValue(value));
 164 }
 165
 166 template<typename PropertyType>
 167 bool is() const
 168 {
 169 return WTF::holds_alternative<PropertyType>(*this) || (std::is_enum<PropertyType>::value && WTF::holds_alternative<unsigned>(*this));
 170 }
 171
 172 template <class PropertyType, std::enable_if_t<std::is_enum<PropertyType>::value>* = nullptr>
 173 operator const PropertyType&() const
 174 {
 175 ASSERT(WTF::holds_alternative<unsigned>(*this));
 176 return reinterpret_cast<const PropertyType&>(WTF::get<unsigned>(*this));
 177 }
 178
 179 template <class PropertyType, std::enable_if_t<!std::is_enum<PropertyType>::value>* = nullptr>
 180 operator const PropertyType&() const
 181 {
 182 ASSERT(is<PropertyType>());
 183 return WTF::get<PropertyType>(*this);
 184 }
 185
 186 template <class PropertyType, std::enable_if_t<std::is_enum<PropertyType>::value>* = nullptr>
 187 operator PropertyType&()
 188 {
 189 ASSERT(WTF::holds_alternative<unsigned>(*this));
 190 return reinterpret_cast<PropertyType&>(WTF::get<unsigned>(*this));
 191 }
 192
 193 template <class PropertyType, std::enable_if_t<!std::is_enum<PropertyType>::value>* = nullptr>
 194 operator PropertyType&()
 195 {
 196 ASSERT(is<PropertyType>());
 197 return WTF::get<PropertyType>(*this);
 198 }
 199
 200 String toString() const
 201 {
 202 return WTF::visit(toStringVisitor(), static_cast<const SVGValueVariant&>(*this));
 203 }
 204
 205 bool parse(const QualifiedName& attrName, const String& string)
 206 {
 207 return WTF::visit(parseVisitor(attrName, string, static_cast<SVGValueVariant&>(*this)), static_cast<const SVGValueVariant&>(*this));
 208 }
 209
 210private:
 211 template<typename PropertyType>
 212 explicit SVGValue(const PropertyType& value)
 213 : SVGValueVariant(value)
 214 {
 215 ASSERT(is<PropertyType>());
 216 }
 217
 218 SVGValue(const SVGValue& value)
 219 : SVGValueVariant(static_cast<const SVGValueVariant&>(value))
 220 {
 221 ASSERT(index() == value.index());
 222 }
 223};
 224
 225} // namespace WebCore
nonexistent

Source/WebCore/svg/SVGViewElement.cpp

@@END_REGISTER_ANIMATED_PROPERTIES
4141inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document& document)
4242 : SVGElement(tagName, document)
4343 , m_zoomAndPan(SVGZoomAndPanMagnify)
44  , m_viewTarget(SVGNames::viewTargetAttr)
 44 , m_viewTarget(SVGValue::create(SVGStringListValues(SVGNames::viewTargetAttr)))
4545{
4646 ASSERT(hasTagName(SVGNames::viewTag));
4747 registerAnimatedPropertiesForSVGViewElement();

@@Ref<SVGStringList> SVGViewElement::viewT
6060void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
6161{
6262 if (name == SVGNames::viewTargetAttr)
63  m_viewTarget.reset(value);
 63 static_cast<SVGStringListValues&>(*m_viewTarget).reset(value);
6464
6565 SVGExternalResourcesRequired::parseAttribute(name, value);
6666 SVGFitToViewBox::parseAttribute(this, name, value);
228390

Source/WebCore/svg/SVGViewElement.h

@@private:
5959 END_DECLARE_ANIMATED_PROPERTIES
6060
6161 SVGZoomAndPanType m_zoomAndPan;
62  SVGStringListValues m_viewTarget;
 62 RefPtr<SVGValue> m_viewTarget;
6363};
6464
6565} // namespace WebCore
228390

Source/WebCore/svg/SVGViewSpec.cpp

@@const SVGPropertyInfo* SVGViewSpec::tran
7979
8080SVGViewSpec::SVGViewSpec(SVGElement& contextElement)
8181 : m_contextElement(&contextElement)
 82 , m_transform(SVGValue::create<SVGTransformListValues>())
 83 , m_viewBox(SVGValue::create<FloatRect>())
 84 , m_preserveAspectRatio(SVGValue::create<SVGPreserveAspectRatioValue>())
8285{
8386}
8487

@@ExceptionOr<void> SVGViewSpec::setZoomAn
108111
109112String SVGViewSpec::transformString() const
110113{
111  return SVGPropertyTraits<SVGTransformListValues>::toString(m_transform);
 114 return m_transform->toString();
112115}
113116
114117String SVGViewSpec::viewBoxString() const
115118{
116  return SVGPropertyTraits<FloatRect>::toString(m_viewBox);
 119 return m_viewBox->toString();
117120}
118121
119122String SVGViewSpec::preserveAspectRatioString() const
120123{
121  return SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString(m_preserveAspectRatio);
 124 return m_preserveAspectRatio->toString();
122125}
123126
124127SVGElement* SVGViewSpec::viewTarget() const

@@Ref<SVGAnimatedProperty> SVGViewSpec::lo
177180void SVGViewSpec::reset()
178181{
179182 m_zoomAndPan = SVGZoomAndPanMagnify;
180  m_transform.clear();
181  m_viewBox = { };
182  m_preserveAspectRatio = { };
 183 static_cast<SVGTransformListValues&>(*m_transform).clear();
 184 static_cast<FloatRect&>(*m_viewBox) = { };
 185 static_cast<SVGPreserveAspectRatioValue&>(*m_preserveAspectRatio) = { };
183186 m_viewTargetString = emptyString();
184187}
185188

@@bool SVGViewSpec::parseViewSpec(const St
261264 if (currViewSpec >= end || *currViewSpec != '(')
262265 return false;
263266 currViewSpec++;
264  SVGTransformable::parseTransformAttribute(m_transform, currViewSpec, end, SVGTransformable::DoNotClearList);
 267 SVGTransformable::parseTransformAttribute(static_cast<SVGTransformListValues&>(*m_transform), currViewSpec, end, SVGTransformable::DoNotClearList);
265268 if (currViewSpec >= end || *currViewSpec != ')')
266269 return false;
267270 currViewSpec++;
228390

Source/WebCore/svg/SVGViewSpec.h

@@public:
5555
5656 // Custom non-animated 'transform' property.
5757 RefPtr<SVGTransformList> transform();
58  SVGTransformListValues transformBaseValue() const { return m_transform; }
 58 SVGTransformListValues transformBaseValue() const { return static_cast<SVGTransformListValues&>(*m_transform); }
5959
6060 // Custom animated 'viewBox' property.
6161 RefPtr<SVGAnimatedRect> viewBoxAnimated();
62  FloatRect& viewBox() { return m_viewBox; }
63  void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; }
 62 FloatRect& viewBox() { return static_cast<FloatRect&>(*m_viewBox); }
 63 void setViewBoxBaseValue(const FloatRect& viewBox) { static_cast<FloatRect&>(*m_viewBox) = viewBox; }
6464
6565 // Custom animated 'preserveAspectRatio' property.
6666 RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated();
67  SVGPreserveAspectRatioValue& preserveAspectRatio() { return m_preserveAspectRatio; }
68  void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; }
 67 SVGPreserveAspectRatioValue& preserveAspectRatio() { return static_cast<SVGPreserveAspectRatioValue&>(*m_preserveAspectRatio); }
 68 void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatioValue& preserveAspectRatio) { static_cast<SVGPreserveAspectRatioValue&>(*m_preserveAspectRatio) = preserveAspectRatio; }
6969
7070private:
7171 explicit SVGViewSpec(SVGElement&);

@@private:
8484
8585 SVGElement* m_contextElement;
8686 SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
87  SVGTransformListValues m_transform;
88  FloatRect m_viewBox;
89  SVGPreserveAspectRatioValue m_preserveAspectRatio;
 87 RefPtr<SVGValue> m_transform;
 88 RefPtr<SVGValue> m_viewBox;
 89 RefPtr<SVGValue> m_preserveAspectRatio;
9090 String m_viewTargetString;
9191};
9292
228390

Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h

@@public:
5555 return SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property);
5656 }
5757
58  static Ref<SVGAnimatedEnumerationPropertyTearOff<EnumType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, EnumType& property)
 58 static Ref<SVGAnimatedEnumerationPropertyTearOff<EnumType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& baseValue)
5959 {
6060 ASSERT(contextElement);
61  return adoptRef(*new SVGAnimatedEnumerationPropertyTearOff<EnumType>(contextElement, attributeName, animatedPropertyType, reinterpret_cast<unsigned&>(property)));
62  }
63 
64  EnumType& currentAnimatedValue()
65  {
66  unsigned& animatedValue = SVGAnimatedStaticPropertyTearOff<unsigned>::currentAnimatedValue();
67  ASSERT(animatedValue <= SVGPropertyTraits<EnumType>::highestEnumValue());
68  return reinterpret_cast<EnumType&>(animatedValue);
 61 return adoptRef(*new SVGAnimatedEnumerationPropertyTearOff<EnumType>(contextElement, attributeName, animatedPropertyType, baseValue));
6962 }
7063
7164private:
72  SVGAnimatedEnumerationPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, unsigned& property)
73  : SVGAnimatedStaticPropertyTearOff<unsigned>(contextElement, attributeName, animatedPropertyType, property)
 65 SVGAnimatedEnumerationPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& baseValue)
 66 : SVGAnimatedStaticPropertyTearOff<unsigned>(contextElement, attributeName, animatedPropertyType, baseValue)
7467 {
7568 }
7669
228390

Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h

@@public:
3939 using ListPropertyTearOff = typename SVGPropertyTraits<PropertyType>::ListPropertyTearOff;
4040 using ContentType = PropertyType;
4141
42  static Ref<SVGAnimatedListPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& values)
 42 static Ref<SVGAnimatedListPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& values)
4343 {
4444 ASSERT(contextElement);
4545 return adoptRef(*new SVGAnimatedListPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, values));

@@public:
8585 ListProperty::detachListWrappersAndResize(&m_wrappers, newListSize);
8686 }
8787
88  PropertyType& currentAnimatedValue()
 88 RefPtr<SVGValue> currentAnimatedValue()
8989 {
9090 ASSERT(isAnimating());
9191 return m_animatedProperty->values();
9292 }
9393
94  const PropertyType& currentBaseValue() const
 94 const RefPtr<SVGValue> currentAnimatedValue() const
 95 {
 96 ASSERT(isAnimating());
 97 return m_animatedProperty->values();
 98 }
 99
 100 const RefPtr<SVGValue> currentBaseValue() const
95101 {
96102 return m_values;
97103 }
98104
99  void animationStarted(PropertyType* newAnimVal, bool shouldOwnValues = false)
 105 void animationStarted(RefPtr<SVGValue> newAnimVal)
100106 {
101107 ASSERT(!isAnimating());
102108 ASSERT(newAnimVal);
103  ASSERT(m_values.size() == m_wrappers.size());
 109 ASSERT(static_cast<PropertyType&>(*currentBaseValue()).size() == m_wrappers.size());
104110 ASSERT(m_animatedWrappers.isEmpty());
105111
106112 // Switch to new passed in value type & new wrappers list. The new wrappers list must be created for the new value.
107  if (!newAnimVal->isEmpty())
108  m_animatedWrappers.fill(0, newAnimVal->size());
 113 if (size_t size = static_cast<PropertyType&>(*newAnimVal).size())
 114 m_animatedWrappers.fill(0, size);
109115
110116 m_animatedProperty = animVal();
111  m_animatedProperty->setValuesAndWrappers(newAnimVal, &m_animatedWrappers, shouldOwnValues);
112  ASSERT(m_animatedProperty->values().size() == m_animatedProperty->wrappers().size());
 117 m_animatedProperty->setValuesAndWrappers(newAnimVal, &m_animatedWrappers);
 118 ASSERT(m_animatedProperty->valuesProperty().size() == m_animatedProperty->wrappers().size());
113119 ASSERT(m_animatedProperty->wrappers().size() == m_animatedWrappers.size());
114120 }
115121
116122 void animationEnded()
117123 {
118124 ASSERT(isAnimating());
119  ASSERT(m_values.size() == m_wrappers.size());
 125 ASSERT(static_cast<PropertyType&>(*currentBaseValue()).size() == m_wrappers.size());
120126
121  ASSERT(m_animatedProperty->values().size() == m_animatedProperty->wrappers().size());
 127 ASSERT(m_animatedProperty->valuesProperty().size() == m_animatedProperty->wrappers().size());
122128 ASSERT(m_animatedProperty->wrappers().size() == m_animatedWrappers.size());
123129
124  m_animatedProperty->setValuesAndWrappers(&m_values, &m_wrappers, false);
125  ASSERT(m_animatedProperty->values().size() == m_animatedProperty->wrappers().size());
 130 m_animatedProperty->setValuesAndWrappers(m_values, &m_wrappers);
 131 ASSERT(m_animatedProperty->valuesProperty().size() == m_animatedProperty->wrappers().size());
126132 ASSERT(m_animatedProperty->wrappers().size() == m_wrappers.size());
127133
128134 m_animatedWrappers.clear();

@@public:
142148 // Also existing wrappers which point directly at elements in the existing SVGLengthListValues have to be detached (so a copy
143149 // of them is created, so existing animVal variables in JS are kept-alive). If we'd detach them later the underlying
144150 // SVGLengthListValues was already mutated, and our list item wrapper tear offs would point nowhere. Assertions would fire.
145  m_animatedProperty->detachListWrappers(m_animatedProperty->values().size());
 151 m_animatedProperty->detachListWrappers(m_animatedProperty->valuesProperty().size());
146152
147  ASSERT(m_animatedProperty->values().size() == m_animatedProperty->wrappers().size());
 153 ASSERT(m_animatedProperty->valuesProperty().size() == m_animatedProperty->wrappers().size());
148154 ASSERT(m_animatedProperty->wrappers().size() == m_animatedWrappers.size());
149155 }
150156
151157 void animValWillChange()
152158 {
153  ASSERT(m_values.size() == m_wrappers.size());
 159 ASSERT(static_cast<PropertyType&>(*currentBaseValue()).size() == m_wrappers.size());
154160 synchronizeWrappersIfNeeded();
155161 }
156162
157163 void animValDidChange()
158164 {
159  ASSERT(m_values.size() == m_wrappers.size());
 165 ASSERT(static_cast<PropertyType&>(*currentBaseValue()).size() == m_wrappers.size());
160166 synchronizeWrappersIfNeeded();
161167 }
162168
163169protected:
164  SVGAnimatedListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& values)
 170 SVGAnimatedListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& values)
165171 : SVGAnimatedProperty(contextElement, attributeName, animatedPropertyType)
166172 , m_values(values)
167173 {
168  if (!values.isEmpty())
169  m_wrappers.fill(0, values.size());
 174 if (size_t size = static_cast<PropertyType&>(*values).size())
 175 m_wrappers.fill(0, size);
170176 }
171177
172  PropertyType& m_values;
 178 RefPtr<SVGValue> m_values;
173179
174180 ListWrapperCache m_wrappers;
175181 ListWrapperCache m_animatedWrappers;
228390

Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h

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

@@class SVGAnimatedPathSegListPropertyTear
3132public:
3233 using Base = SVGAnimatedListPropertyTearOff<SVGPathSegListValues>;
3334
34  static Ref<SVGAnimatedPathSegListPropertyTearOff> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegListValues& values)
 35 static Ref<SVGAnimatedPathSegListPropertyTearOff> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& values)
3536 {
3637 ASSERT(contextElement);
3738 return adoptRef(*new SVGAnimatedPathSegListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));

@@public:
7677 m_animatedPathByteStream = byteStream;
7778
7879 // Pass shouldOwnValues=true, as the SVGPathSegListValues lifetime is solely managed by its tear off class.
79  auto* copy = new SVGPathSegListValues(*baseValue);
80  Base::animationStarted(copy, true);
 80 auto copy = SVGValue::create(*baseValue);
 81 Base::animationStarted(copy.ptr());
8182 }
8283
8384 void animationEnded()

@@public:
9596 // If the animVal is observed from JS, we have to update it on each animation step.
9697 // This is an expensive operation and only done, if someone actually observes the animatedPathSegList() while an animation is running.
9798 if (pathElement->isAnimValObserved()) {
98  auto& animatedList = currentAnimatedValue();
 99 auto& animatedList = static_cast<SVGPathSegListValues&>(*currentAnimatedValue());
99100 animatedList.clear();
100101 buildSVGPathSegListValuesFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing);
101102 }

@@public:
106107 SVGPathByteStream* animatedPathByteStream() const { return m_animatedPathByteStream; }
107108
108109private:
109  SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegListValues& values)
 110 SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& values)
110111 : Base(contextElement, attributeName, animatedPropertyType, values)
111112 , m_animatedPathByteStream(nullptr)
112113 {
228390

Source/WebCore/svg/properties/SVGAnimatedProperty.h

2727
2828namespace WebCore {
2929
 30class SVGValue;
3031class SVGElement;
3132class SVGProperty;
3233

@@public:
4950 virtual ~SVGAnimatedProperty();
5051
5152 template<typename OwnerType, typename TearOffType, typename PropertyType>
52  static Ref<TearOffType> lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, PropertyType& property)
 53 static Ref<TearOffType> lookupOrCreateWrapper(OwnerType* element, const SVGPropertyInfo* info, const RefPtr<SVGValue>& value)
5354 {
5455 ASSERT(info);
5556 SVGAnimatedPropertyDescription key(element, info->propertyIdentifier);

@@public:
5859 if (!result.isNewEntry)
5960 return static_cast<TearOffType&>(*result.iterator->value);
6061
61  Ref<SVGAnimatedProperty> wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property);
 62 Ref<SVGAnimatedProperty> wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, value);
6263 if (info->animatedPropertyState == PropertyIsReadOnly)
6364 wrapper->setIsReadOnly();
6465
228390

Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h

22 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
33 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
44 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
 5 * Copyright (C) 2018 Apple Inc. All rights reserved.
56 *
67 * This library is free software; you can redistribute it and/or
78 * modify it under the terms of the GNU Library General Public

2526#include "SVGAnimatedProperty.h"
2627#include "SVGAttributeToPropertyMap.h"
2728#include "SVGPropertyTraits.h"
 29#include "SVGValue.h"
2830#include <wtf/NeverDestroyed.h>
2931#include <wtf/StdLibExtras.h>
3032

@@namespace WebCore {
3436template<typename PropertyType>
3537struct SVGSynchronizableAnimatedProperty {
3638 SVGSynchronizableAnimatedProperty()
37  : value(SVGPropertyTraits<PropertyType>::initialValue())
38  , shouldSynchronize(false)
39  , isValid(false)
 39 : value(SVGValue::create<PropertyType>())
4040 {
4141 }
4242
43  template<typename ConstructorParameter1>
44  SVGSynchronizableAnimatedProperty(const ConstructorParameter1& value1)
45  : value(value1)
46  , shouldSynchronize(false)
47  , isValid(false)
48  {
49  }
50 
51  template<typename ConstructorParameter1, typename ConstructorParameter2>
52  SVGSynchronizableAnimatedProperty(const ConstructorParameter1& value1, const ConstructorParameter2& value2)
53  : value(value1, value2)
54  , shouldSynchronize(false)
55  , isValid(false)
 43 SVGSynchronizableAnimatedProperty(const PropertyType& value)
 44 : value(SVGValue::create<PropertyType>(value))
5645 {
5746 }
5847

@@struct SVGSynchronizableAnimatedProperty
6150 ownerElement->setSynchronizedLazyAttribute(attrName, value);
6251 }
6352
64  PropertyType value;
65  bool shouldSynchronize : 1;
66  bool isValid : 1;
 53 RefPtr<SVGValue> value;
 54 bool shouldSynchronize { false };
 55 bool isValid { false };
6756};
6857
6958// Property registration helpers

@@public: \
124113 { \
125114 if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) { \
126115 if (wrapper->isAnimating()) \
127  return wrapper->currentAnimatedValue(); \
 116 return static_cast<PropertyType&>(*wrapper->currentAnimatedValue()); \
128117 } \
129  return m_##LowerProperty.value; \
 118 return static_cast<PropertyType&>(*m_##LowerProperty.value); \
130119 } \
131120\
132121 PropertyType& LowerProperty##BaseValue() const OverrideSpecifier \
133122 { \
134  return m_##LowerProperty.value; \
 123 return static_cast<PropertyType&>(*m_##LowerProperty.value); \
135124 } \
136125\
137  void set##UpperProperty##BaseValue(const PropertyType& type, const bool validValue = true) OverrideSpecifier \
 126 void set##UpperProperty##BaseValue(const PropertyType& value, const bool validValue = true) OverrideSpecifier \
138127 { \
139  m_##LowerProperty.value = type; \
 128 static_cast<PropertyType&>(*m_##LowerProperty.value) = value; \
140129 m_##LowerProperty.isValid = validValue; \
141130 } \
142131\

@@private: \
156145 { \
157146 if (!m_##LowerProperty.shouldSynchronize) \
158147 return; \
159  AtomicString value(SVGPropertyTraits<PropertyType>::toString(m_##LowerProperty.value)); \
 148 AtomicString value(SVGPropertyTraits<PropertyType>::toString(static_cast<PropertyType&>(*m_##LowerProperty.value))); \
160149 m_##LowerProperty.synchronize(this, LowerProperty##PropertyInfo()->attributeName, value); \
161150 } \
162151\
228390

Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h

@@public:
3232 using PropertyType = typename PropertyTearOff::PropertyType;
3333 using ContentType = PropertyType;
3434
35  static Ref<SVGAnimatedPropertyTearOff<PropertyTearOff>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
 35 static Ref<SVGAnimatedPropertyTearOff<PropertyTearOff>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& baseValue)
3636 {
3737 ASSERT(contextElement);
38  return adoptRef(*new SVGAnimatedPropertyTearOff<PropertyTearOff>(contextElement, attributeName, animatedPropertyType, property));
 38 return adoptRef(*new SVGAnimatedPropertyTearOff<PropertyTearOff>(contextElement, attributeName, animatedPropertyType, baseValue));
3939 }
4040
4141 Ref<PropertyTearOff> baseVal()

@@public:
4343 if (m_baseVal)
4444 return *static_cast<PropertyTearOff*>(m_baseVal.get());
4545
46  auto property = PropertyTearOff::create(*this, BaseValRole, m_property);
 46 auto property = PropertyTearOff::create(*this, BaseValRole, m_baseValue);
4747 m_baseVal = property->createWeakPtr();
4848 return property;
4949 }

@@public:
5353 if (m_animVal)
5454 return *static_cast<PropertyTearOff*>(m_animVal.get());
5555
56  auto property = PropertyTearOff::create(*this, AnimValRole, m_property);
 56 auto property = PropertyTearOff::create(*this, AnimValRole, m_baseValue);
5757 m_animVal = property->createWeakPtr();
5858 return property;
5959 }
6060
6161 bool isAnimating() const final { return m_animatedProperty; }
6262
63  PropertyType& currentAnimatedValue()
 63 RefPtr<SVGValue> currentAnimatedValue()
6464 {
6565 ASSERT(isAnimating());
66  return m_animatedProperty->propertyReference();
 66 return m_animatedProperty->value();
6767 }
6868
69  const PropertyType& currentBaseValue() const
 69 const RefPtr<SVGValue> currentAnimatedValue() const
7070 {
71  return m_property;
 71 ASSERT(isAnimating());
 72 return m_animatedProperty->value();
 73 }
 74
 75 const RefPtr<SVGValue> currentBaseValue() const
 76 {
 77 return m_baseValue;
7278 }
7379
74  void animationStarted(PropertyType* newAnimVal)
 80 void animationStarted(const RefPtr<SVGValue>& newAnimVal)
7581 {
7682 ASSERT(!isAnimating());
7783 ASSERT(newAnimVal);
7884 m_animatedProperty = animVal();
79  m_animatedProperty->setValue(*newAnimVal);
 85 m_animatedProperty->setValue(newAnimVal);
8086 }
8187
8288 void animationEnded()
8389 {
8490 ASSERT(isAnimating());
85  m_animatedProperty->setValue(m_property);
 91 m_animatedProperty->setValue(m_baseValue);
8692 m_animatedProperty = nullptr;
8793 }
8894

@@public:
104110 }
105111
106112private:
107  SVGAnimatedPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
 113 SVGAnimatedPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& baseValue)
108114 : SVGAnimatedProperty(contextElement, attributeName, animatedPropertyType)
109  , m_property(property)
 115 , m_baseValue(baseValue)
110116 {
111117 }
112118
113  PropertyType& m_property;
 119 RefPtr<SVGValue> m_baseValue;
114120 WeakPtr<SVGPropertyTearOff<PropertyType>> m_baseVal;
115121 WeakPtr<SVGPropertyTearOff<PropertyType>> m_animVal;
116122
228390

Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h

2222
2323#include "ExceptionOr.h"
2424#include "SVGAnimatedProperty.h"
 25#include "SVGValue.h"
2526
2627namespace WebCore {
2728

@@public:
3233
3334 virtual const PropertyType& baseVal()
3435 {
35  return m_property;
 36 return static_cast<PropertyType&>(*m_baseValue);
3637 }
3738
3839 virtual const PropertyType& animVal()
3940 {
40  if (m_animatedProperty)
41  return *m_animatedProperty;
42  return m_property;
 41 if (m_animatedValue)
 42 return static_cast<PropertyType&>(*m_animatedValue);
 43 return baseVal();
4344 }
4445
45  virtual ExceptionOr<void> setBaseVal(const PropertyType& property)
 46 virtual ExceptionOr<void> setBaseVal(const PropertyType& baseValue)
4647 {
47  m_property = property;
 48 static_cast<PropertyType&>(*m_baseValue) = baseValue;
4849 commitChange();
4950 return { };
5051 }
5152
52  bool isAnimating() const override { return m_animatedProperty; }
 53 bool isAnimating() const override { return m_animatedValue; }
5354
54  static Ref<SVGAnimatedStaticPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
 55 static Ref<SVGAnimatedStaticPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& baseValue)
5556 {
5657 ASSERT(contextElement);
57  return adoptRef(*new SVGAnimatedStaticPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, property));
 58 return adoptRef(*new SVGAnimatedStaticPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, baseValue));
5859 }
5960
60  PropertyType& currentAnimatedValue()
 61 RefPtr<SVGValue> currentAnimatedValue()
6162 {
6263 ASSERT(isAnimating());
63  return *m_animatedProperty;
 64 return m_animatedValue;
6465 }
6566
66  const PropertyType& currentBaseValue() const
 67 const RefPtr<SVGValue> currentAnimatedValue() const
6768 {
68  return m_property;
 69 ASSERT(isAnimating());
 70 return m_animatedValue;
 71 }
 72
 73 const RefPtr<SVGValue> currentBaseValue() const
 74 {
 75 return m_baseValue;
6976 }
7077
71  void animationStarted(PropertyType* newAnimVal)
 78 void animationStarted(RefPtr<SVGValue> newAnimVal)
7279 {
7380 ASSERT(!isAnimating());
7481 ASSERT(newAnimVal);
75  m_animatedProperty = newAnimVal;
 82 m_animatedValue = newAnimVal;
7683 }
7784
7885 void animationEnded()
7986 {
8087 ASSERT(isAnimating());
81  m_animatedProperty = nullptr;
 88 m_animatedValue = nullptr;
8289 }
8390
8491 void animValWillChange()

@@public:
99106 }
100107
101108protected:
102  SVGAnimatedStaticPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
 109 SVGAnimatedStaticPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& baseValue)
103110 : SVGAnimatedProperty(contextElement, attributeName, animatedPropertyType)
104  , m_property(property)
105  , m_animatedProperty(nullptr)
 111 , m_baseValue(baseValue)
106112 {
 113 ASSERT_IMPLIES(m_baseValue, m_baseValue->is<PropertyType>());
107114 }
108115
109116private:
110  PropertyType& m_property;
111  PropertyType* m_animatedProperty;
 117 RefPtr<SVGValue> m_baseValue;
 118 RefPtr<SVGValue> m_animatedValue;
112119};
113120
114121}
228390

Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h

@@namespace WebCore {
2626
2727class SVGAnimatedTransformListPropertyTearOff final : public SVGAnimatedListPropertyTearOff<SVGTransformListValues> {
2828public:
29  static Ref<SVGAnimatedTransformListPropertyTearOff> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGTransformListValues& values)
 29 static Ref<SVGAnimatedTransformListPropertyTearOff> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& values)
3030 {
3131 ASSERT(contextElement);
3232 return adoptRef(*new SVGAnimatedTransformListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));

@@public:
5353 }
5454
5555private:
56  SVGAnimatedTransformListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGTransformListValues& values)
 56 SVGAnimatedTransformListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& values)
5757 : SVGAnimatedListPropertyTearOff<SVGTransformListValues>(contextElement, attributeName, animatedPropertyType, values)
5858 {
5959 }
228390

Source/WebCore/svg/properties/SVGListProperty.h

2525
2626namespace WebCore {
2727
28 enum ListModification {
29  ListModificationUnknown = 0,
30  ListModificationInsert = 1,
31  ListModificationReplace = 2,
32  ListModificationRemove = 3,
33  ListModificationAppend = 4
34 };
35 
3628template<typename PropertyType>
3729class SVGAnimatedListPropertyTearOff;
3830

@@public:
7567 detachListWrappersAndResize(m_wrappers, newListSize);
7668 }
7769
78  void setValuesAndWrappers(PropertyType* values, ListWrapperCache* wrappers, bool shouldOwnValues)
 70 void setValuesAndWrappers(const RefPtr<SVGValue>& values, ListWrapperCache* wrappers)
7971 {
8072 // This is only used for animVal support, to switch the underlying values & wrappers
8173 // to the current animated values, once animation for a list starts.
8274 ASSERT(m_values);
8375 ASSERT(m_wrappers);
8476 ASSERT(m_role == AnimValRole);
85  if (m_ownsValues)
86  delete m_values;
8777 m_values = values;
88  m_ownsValues = shouldOwnValues;
8978 m_wrappers = wrappers;
90  ASSERT(m_values->size() == m_wrappers->size());
 79 ASSERT(valuesProperty().size() == m_wrappers->size());
9180 }
9281
9382 // SVGList::clear()

@@public:
9887 return result.releaseException();
9988 ASSERT(result.releaseReturnValue());
10089
101  m_values->clear();
 90 valuesProperty().clear();
10291 commitChange();
10392 return { };
10493 }

@@public:
111100 ASSERT(result.releaseReturnValue());
112101
113102 detachListWrappers(0);
114  m_values->clear();
 103 valuesProperty().clear();
115104 commitChange();
116105 return { };
117106 }

@@public:
119108 // SVGList::numberOfItems()
120109 unsigned numberOfItems() const
121110 {
122  return m_values->size();
 111 return valuesProperty().size();
123112 }
124113
125114 // SVGList::initialize()

@@public:
134123 processIncomingListItemValue(newItem, 0);
135124
136125 // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
137  m_values->clear();
138  m_values->append(newItem);
 126 valuesProperty().clear();
 127 valuesProperty().append(SVGValue::create<ListItemType>(newItem));
139128
140129 commitChange();
141130 return ListItemType { newItem };

@@public:
150139 return result.releaseException();
151140 ASSERT(result.releaseReturnValue());
152141
153  ASSERT(m_values->size() == m_wrappers->size());
 142 ASSERT(valuesProperty().size() == m_wrappers->size());
154143
155144 Ref<ListItemTearOff> newItem(item);
156145

@@public:
159148
160149 // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
161150 detachListWrappers(0);
162  m_values->clear();
 151 valuesProperty().clear();
163152
164  m_values->append(newItem->propertyReference());
 153 valuesProperty().append(newItem->value());
165154 m_wrappers->append(newItem->createWeakPtr());
166155
167156 commitChange();

@@public:
171160 // SVGList::getItem()
172161 ExceptionOr<bool> canGetItem(unsigned index)
173162 {
174  if (index >= m_values->size())
 163 if (index >= valuesProperty().size())
175164 return Exception { IndexSizeError };
176165
177166 return true;

@@public:
185174 ASSERT(result.releaseReturnValue());
186175
187176 // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
188  return ListItemType { m_values->at(index) };
 177 return ListItemType { static_cast<ListItemType&>(*valuesProperty().at(index)) };
189178 }
190179
191180 ExceptionOr<Ref<ListItemTearOff>> getItemValuesAndWrappers(AnimatedListPropertyTearOff& animatedList, unsigned index)

@@public:
199188
200189 // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
201190 // Any changes made to the item are immediately reflected in the list.
202  ASSERT(m_values->size() == m_wrappers->size());
 191 ASSERT(valuesProperty().size() == m_wrappers->size());
203192 RefPtr<ListItemTearOff> wrapper = static_cast<ListItemTearOff*>(m_wrappers->at(index).get());
204193 if (!wrapper) {
205194 // Create new wrapper, which is allowed to directly modify the item in the list, w/o copying and cache the wrapper in our map.
206195 // It is also associated with our animated property, so it can notify the SVG Element which holds the SVGAnimated*List
207196 // that it has been modified (and thus can call svgAttributeChanged(associatedAttributeName)).
208  wrapper = ListItemTearOff::create(animatedList, UndefinedRole, m_values->at(index));
 197 wrapper = ListItemTearOff::create(animatedList, UndefinedRole, valuesProperty().at(index));
209198 m_wrappers->at(index) = wrapper->createWeakPtr();
210199 }
211200

@@public:
221210 ASSERT(result.releaseReturnValue());
222211
223212 // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
224  if (index > m_values->size())
225  index = m_values->size();
 213 if (index > valuesProperty().size())
 214 index = valuesProperty().size();
226215
227216 // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
228217 if (!processIncomingListItemValue(newItem, &index)) {

@@public:
232221
233222 // Spec: Inserts a new item into the list at the specified position. The index of the item before which the new item is to be
234223 // inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list.
235  m_values->insert(index, newItem);
 224 valuesProperty().insert(index, SVGValue::create<ListItemType>(newItem));
236225
237226 commitChange();
238227 return ListItemType { newItem };

@@public:
248237 ASSERT(result.releaseReturnValue());
249238
250239 // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
251  if (index > m_values->size())
252  index = m_values->size();
 240 if (index > valuesProperty().size())
 241 index = valuesProperty().size();
253242
254  ASSERT(m_values->size() == m_wrappers->size());
 243 ASSERT(valuesProperty().size() == m_wrappers->size());
255244
256245 Ref<ListItemTearOff> newItem(item);
257246

@@public:
261250
262251 // Spec: Inserts a new item into the list at the specified position. The index of the item before which the new item is to be
263252 // inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list.
264  m_values->insert(index, newItem->propertyReference());
 253 valuesProperty().insert(index, newItem->value());
265254
266255 // Store new wrapper at position 'index', change its underlying value, so mutations of newItem, directly affect the item in the list.
267256 m_wrappers->insert(index, newItem->createWeakPtr());

@@public:
278267 return result.releaseException();
279268 ASSERT(result.releaseReturnValue());
280269
281  if (index >= m_values->size())
 270 if (index >= valuesProperty().size())
282271 return Exception { IndexSizeError };
283272
284273 return true;

@@public:
298287 return ListItemType { newItem };
299288 }
300289
301  if (m_values->isEmpty()) {
 290 if (valuesProperty().isEmpty()) {
302291 // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
303292 return Exception { IndexSizeError };
304293 }
305294
306295 // Update the value at the desired position 'index'.
307  m_values->at(index) = newItem;
 296 static_cast<ListItemType&>(*valuesProperty().at(index)) = newItem;
308297
309298 commitChange();
310299 return ListItemType { newItem };

@@public:
319308 return result.releaseException();
320309 ASSERT(result.releaseReturnValue());
321310
322  ASSERT(m_values->size() == m_wrappers->size());
 311 ASSERT(valuesProperty().size() == m_wrappers->size());
323312
324313 Ref<ListItemTearOff> newItem(item);
325314

@@public:
328317 if (!processIncomingListItemWrapper(newItem, &index))
329318 return WTFMove(newItem);
330319
331  if (m_values->isEmpty()) {
 320 if (valuesProperty().isEmpty()) {
332321 ASSERT(m_wrappers->isEmpty());
333322 // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
334323 return Exception { IndexSizeError };

@@public:
340329 oldItem->detachWrapper();
341330
342331 // Update the value and the wrapper at the desired position 'index'.
343  m_values->at(index) = newItem->propertyReference();
 332 valuesProperty().at(index) = newItem->value();
344333 m_wrappers->at(index) = newItem->createWeakPtr();
345334
346335 commitChange();

@@public:
355344 return result.releaseException();
356345 ASSERT(result.releaseReturnValue());
357346
358  if (index >= m_values->size())
 347 if (index >= valuesProperty().size())
359348 return Exception { IndexSizeError };
360349
361350 return true;

@@public:
368357 return result.releaseException();
369358 ASSERT(result.releaseReturnValue());
370359
371  ListItemType oldItem = m_values->at(index);
372  m_values->remove(index);
 360 ListItemType oldItem = static_cast<ListItemType&>(*valuesProperty().at(index));
 361 valuesProperty().remove(index);
373362
374363 commitChange();
375364 return WTFMove(oldItem);

@@public:
384373 return result.releaseException();
385374 ASSERT(result.releaseReturnValue());
386375
387  ASSERT(m_values->size() == m_wrappers->size());
 376 ASSERT(valuesProperty().size() == m_wrappers->size());
388377
389378 // Detach the existing wrapper.
390379 RefPtr<ListItemTearOff> oldItem = static_cast<ListItemTearOff*>(m_wrappers->at(index).get());
391380 if (!oldItem)
392  oldItem = ListItemTearOff::create(animatedList, UndefinedRole, m_values->at(index));
 381 oldItem = ListItemTearOff::create(animatedList, UndefinedRole, valuesProperty().at(index));
393382
394383 oldItem->detachWrapper();
395384 m_wrappers->remove(index);
396  m_values->remove(index);
 385 valuesProperty().remove(index);
397386
398387 commitChange();
399388 return oldItem.releaseNonNull();

@@public:
411400 processIncomingListItemValue(newItem, 0);
412401
413402 // Append the value at the end of the list.
414  m_values->append(newItem);
 403 valuesProperty().append(SVGValue::create<ListItemType>(newItem));
415404
416405 commitChange(ListModificationAppend);
417406 return ListItemType { newItem };

@@public:
426415 return result.releaseException();
427416 ASSERT(result.releaseReturnValue());
428417
429  ASSERT(m_values->size() == m_wrappers->size());
 418 ASSERT(valuesProperty().size() == m_wrappers->size());
430419
431420 Ref<ListItemTearOff> newItem(item);
432421

@@public:
434423 processIncomingListItemWrapper(newItem, 0);
435424
436425 // Append the value and wrapper at the end of the list.
437  m_values->append(newItem->propertyReference());
 426 valuesProperty().append(newItem->value());
438427 m_wrappers->append(newItem->createWeakPtr());
439428
440429 commitChange(ListModificationAppend);
441430 return WTFMove(newItem);
442431 }
443432
444  PropertyType& values()
 433 Ref<SVGValue> values() const
445434 {
446435 ASSERT(m_values);
447436 return *m_values;
448437 }
449438
 439 PropertyType& valuesProperty() const
 440 {
 441 ASSERT(m_values);
 442 return static_cast<PropertyType&>(*m_values);
 443 }
 444
450445 ListWrapperCache& wrappers() const
451446 {
452447 ASSERT(m_wrappers);

@@public:
459454 }
460455
461456protected:
462  SVGListProperty(SVGPropertyRole role, PropertyType& values, ListWrapperCache* wrappers)
 457 SVGListProperty(SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache* wrappers)
463458 : m_role(role)
464  , m_ownsValues(false)
465  , m_values(&values)
 459 , m_values(values)
466460 , m_wrappers(wrappers)
467461 {
468462 }
469463
470  virtual ~SVGListProperty()
471  {
472  if (m_ownsValues)
473  delete m_values;
474  }
475 
476464 void commitChange() override = 0;
477465 virtual void commitChange(ListModification)
478466 {

@@protected:
483471 virtual bool processIncomingListItemWrapper(Ref<ListItemTearOff>& newItem, unsigned* indexToModify) = 0;
484472
485473 SVGPropertyRole m_role;
486  bool m_ownsValues;
487  PropertyType* m_values;
 474 RefPtr<SVGValue> m_values;
488475 ListWrapperCache* m_wrappers;
489476 WeakPtrFactory<SVGListProperty> m_weakPtrFactory;
490477};
228390

Source/WebCore/svg/properties/SVGListPropertyTearOff.h

@@public:
3535 using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<PropertyType>;
3636 using ListWrapperCache = typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache;
3737
 38 using Base::valuesProperty;
3839 using Base::m_role;
39  using Base::m_values;
4040 using Base::m_wrappers;
4141
42  static Ref<Self> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, PropertyType& values, ListWrapperCache& wrappers)
 42 static Ref<Self> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
4343 {
4444 return adoptRef(*new Self(animatedProperty, role, values, wrappers));
4545 }
4646
4747 int findItem(ListItemTearOff* item) const
4848 {
49  ASSERT(m_values);
5049 ASSERT(m_wrappers);
5150
5251 unsigned size = m_wrappers->size();
53  ASSERT(size == m_values->size());
 52 ASSERT(size == valuesProperty().size());
5453 for (size_t i = 0; i < size; ++i) {
5554 if (item == m_wrappers->at(i))
5655 return i;

@@public:
6160
6261 void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
6362 {
64  ASSERT(m_values);
6563 ASSERT(m_wrappers);
66  ASSERT(m_values->size() == m_wrappers->size());
 64 ASSERT(valuesProperty().size() == m_wrappers->size());
6765 ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < m_wrappers->size());
6866
6967 auto item = m_wrappers->at(itemIndex);
7068 item->detachWrapper();
7169 m_wrappers->remove(itemIndex);
72  m_values->remove(itemIndex);
 70 valuesProperty().remove(itemIndex);
7371
7472 if (shouldSynchronizeWrappers)
7573 commitChange();

@@public:
112110 }
113111
114112protected:
115  SVGListPropertyTearOff(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, PropertyType& values, ListWrapperCache& wrappers)
 113 SVGListPropertyTearOff(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
116114 : SVGListProperty<PropertyType>(role, values, &wrappers)
117115 , m_animatedProperty(animatedProperty)
118116 {

@@protected:
129127
130128 void commitChange() override
131129 {
132  ASSERT(m_values);
133130 ASSERT(m_wrappers);
134131
135132 // Update existing wrappers, as the index in the values list has changed.
136133 unsigned size = m_wrappers->size();
137  ASSERT(size == m_values->size());
 134 ASSERT(size == valuesProperty().size());
138135 for (unsigned i = 0; i < size; ++i) {
139136 auto item = m_wrappers->at(i);
140137 if (!item)
141138 continue;
142139 item->setAnimatedProperty(m_animatedProperty.ptr());
143  item->setValue(m_values->at(i));
 140 item->setValue(valuesProperty().at(i));
144141 }
145142
146143 m_animatedProperty->commitChange();

@@protected:
169166 // SVGRectElements SVGAnimatedLength 'width' property baseVal points to the same tear off object
170167 // that's inserted into SVGTextElements SVGAnimatedLengthList 'x'. textElement.x.baseVal.getItem(0).value += 150 would
171168 // mutate the rectElement width _and_ the textElement x list. That's obviously wrong, take care of that.
172  newItem = ListItemTearOff::create(newItem->propertyReference());
 169 newItem = ListItemTearOff::create(newItem->valueProperty());
173170 return true;
174171 }
175172
228390

Source/WebCore/svg/properties/SVGMatrixTearOff.h

@@class SVGMatrixTearOff final : public SV
2828public:
2929 static Ref<SVGMatrixTearOff> create(SVGTransform& parent, SVGMatrixValue& value)
3030 {
31  ASSERT_UNUSED(value, &parent.propertyReference().svgMatrix() == &value);
 31 ASSERT_UNUSED(value, &parent.valueProperty().svgMatrix() == &value);
3232 Ref<SVGMatrixTearOff> result = adoptRef(*new SVGMatrixTearOff(parent));
3333 parent.addChild(result->m_weakFactory.createWeakPtr(result));
3434 return result;
3535 }
3636
37  SVGMatrixValue& propertyReference() final { return m_parent->propertyReference().svgMatrix(); }
 37 SVGMatrixValue& valueProperty() final { return m_parent->valueProperty().svgMatrix(); }
3838
39  void setValue(SVGMatrixValue& value) final { m_parent->propertyReference().setMatrix(value); }
 39 void setValue(const RefPtr<SVGValue>& value) final { m_parent->valueProperty().setMatrix(static_cast<SVGMatrixValue&>(*value)); }
4040
4141 void commitChange() final
4242 {
43  m_parent->propertyReference().updateSVGMatrix();
 43 m_parent->valueProperty().updateSVGMatrix();
4444 m_parent->commitChange();
4545 }
4646
228390

Source/WebCore/svg/properties/SVGPropertyTearOff.h

2323#include "ExceptionOr.h"
2424#include "SVGAnimatedProperty.h"
2525#include "SVGProperty.h"
 26#include "SVGValue.h"
2627#include <wtf/WeakPtr.h>
2728
2829namespace WebCore {

@@public:
6566 return create(initialValue.releaseReturnValue());
6667 }
6768
68  virtual PropertyType& propertyReference() { return *m_value; }
 69 RefPtr<SVGValue> value() const { return m_value; }
 70 virtual PropertyType& valueProperty() { return static_cast<PropertyType&>(*m_value); }
6971 SVGAnimatedProperty* animatedProperty() const { return m_animatedProperty.get(); }
7072
71  virtual void setValue(PropertyType& value)
 73 virtual void setValue(const RefPtr<SVGValue>& value)
7274 {
73  if (m_valueIsCopy) {
 75 if (m_valueIsCopy)
7476 detachChildren();
75  delete m_value;
76  }
7777 m_valueIsCopy = false;
78  m_value = &value;
 78 m_value = value;
7979 }
8080
8181 void setAnimatedProperty(SVGAnimatedProperty* animatedProperty)

@@public:
109109 // item.value still has to report '50' and it has to be possible to modify 'item'
110110 // w/o changing the "new item" (with x=100) in the text element.
111111 // Whenever the XML DOM modifies the "x" attribute, all existing wrappers are detached, using this function.
112  m_value = new PropertyType(*m_value);
 112 m_value = SVGValue::create(static_cast<PropertyType&>(*m_value));
113113 m_valueIsCopy = true;
114114 m_animatedProperty = nullptr;
115115 }

@@public:
136136 }
137137
138138protected:
139  SVGPropertyTearOff(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, PropertyType& value)
 139 SVGPropertyTearOff(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
140140 : m_animatedProperty(animatedProperty)
141141 , m_role(role)
142  , m_value(&value)
 142 , m_value(value)
143143 , m_valueIsCopy(false)
144144 {
145145 }

@@protected:
152152 SVGPropertyTearOff(const PropertyType* initialValue)
153153 : m_animatedProperty(nullptr)
154154 , m_role(UndefinedRole)
155  , m_value(initialValue ? new PropertyType(*initialValue) : nullptr)
156155 , m_valueIsCopy(true)
157156 {
 157 if (initialValue)
 158 m_value = SVGValue::create(*initialValue);
158159 }
159160
160161 virtual ~SVGPropertyTearOff()
161162 {
162  if (m_valueIsCopy) {
 163 if (m_valueIsCopy)
163164 detachChildren();
164  delete m_value;
165  }
166165 }
167166
168167 void detachChildren()

@@protected:
176175
177176 RefPtr<SVGAnimatedProperty> m_animatedProperty;
178177 SVGPropertyRole m_role;
179  PropertyType* m_value;
 178 RefPtr<SVGValue> m_value;
180179 Vector<WeakPtr<SVGPropertyTearOffBase>> m_childTearOffs;
181180 WeakPtrFactory<SVGPropertyTearOff> m_weakPtrFactory;
182  bool m_valueIsCopy;
 181 bool m_valueIsCopy { false };
183182};
184183
185184}
228390

Source/WebCore/svg/properties/SVGPropertyTraits.h

2020
2121#pragma once
2222
 23#include "CSSParser.h"
 24#include "Color.h"
 25#include "FloatPoint.h"
 26#include "FloatRect.h"
 27#include "QualifiedName.h"
 28#include "SVGParserUtilities.h"
 29#include <wtf/text/StringBuilder.h>
2330#include <wtf/text/WTFString.h>
2431
2532namespace WebCore {
2633
 34enum ListModification {
 35 ListModificationUnknown = 0,
 36 ListModificationInsert = 1,
 37 ListModificationReplace = 2,
 38 ListModificationRemove = 3,
 39 ListModificationAppend = 4
 40};
 41
2742template<typename PropertyType>
2843struct SVGPropertyTraits { };
2944
3045template<>
3146struct SVGPropertyTraits<bool> {
3247 static bool initialValue() { return false; }
 48 static bool fromString(const String& string) { return string == "true"; }
3349 static String toString(bool type) { return type ? "true" : "false"; }
3450};
3551
3652template<>
 53struct SVGPropertyTraits<Color> {
 54 static Color initialValue() { return Color(); }
 55 static Color fromString(const String& string) { return CSSParser::parseColor(string.stripWhiteSpace()); }
 56 static std::optional<Color> parse(const QualifiedName&, const String& string)
 57 {
 58 Color color = CSSParser::parseColor(string.stripWhiteSpace());
 59 return color.isValid() ? color : std::optional<Color>();
 60 }
 61 static String toString(const Color& type) { return type.serialized(); }
 62};
 63
 64template<>
3765struct SVGPropertyTraits<unsigned> {
3866 static unsigned initialValue() { return 0; }
3967 static String toString(unsigned type) { return String::number(type); }

@@struct SVGPropertyTraits<unsigned> {
4270template<>
4371struct SVGPropertyTraits<int> {
4472 static int initialValue() { return 0; }
 73 static int fromString(const String&string) { return string.toIntStrict(); }
4574 static String toString(int type) { return String::number(type); }
4675};
 76
 77template<>
 78struct SVGPropertyTraits<std::pair<int, int>> {
 79 static std::pair<int, int> initialValue() { return { }; }
 80 static std::pair<int, int> fromString(const String& string)
 81 {
 82 float firstNumber = 0, secondNumber = 0;
 83 if (!parseNumberOptionalNumber(string, firstNumber, secondNumber))
 84 return { };
 85
 86 return std::make_pair(static_cast<int>(roundf(firstNumber)), static_cast<int>(roundf(secondNumber)));
 87 }
 88};
4789
4890template<>
4991struct SVGPropertyTraits<float> {
5092 static float initialValue() { return 0; }
 93 static float fromString(const String& string)
 94 {
 95 float type = 0;
 96 return parseNumberFromString(string, type) ? type : 0;
 97 }
 98 static std::optional<float> parse(const QualifiedName&, const String& string)
 99 {
 100 float number;
 101 return parseNumberFromString(string, number) ? number : std::optional<float>();
 102 }
51103 static String toString(float type) { return String::number(type); }
52104};
53105
54106template<>
 107struct SVGPropertyTraits<std::pair<float, float>> {
 108 static std::pair<float, float> initialValue() { return { }; }
 109 static std::pair<float, float> fromString(const String& string)
 110 {
 111 float firstNumber = 0, secondNumber = 0;
 112 if (!parseNumberOptionalNumber(string, firstNumber, secondNumber))
 113 return { };
 114
 115 return std::make_pair(firstNumber, secondNumber);
 116 }
 117};
 118
 119template<>
 120struct SVGPropertyTraits<FloatPoint> {
 121 static FloatPoint initialValue() { return FloatPoint(); }
 122 static FloatPoint fromString(const String& string)
 123 {
 124 FloatPoint point;
 125 return parsePoint(string, point) ? point : FloatPoint();
 126 }
 127 static std::optional<FloatPoint> parse(const QualifiedName&, const String& string)
 128 {
 129 FloatPoint point;
 130 return parsePoint(string, point) ? point : std::optional<FloatPoint>();
 131 }
 132 static String toString(const FloatPoint& type)
 133 {
 134 StringBuilder builder;
 135 builder.appendNumber(type.x());
 136 builder.append(' ');
 137 builder.appendNumber(type.y());
 138 return builder.toString();
 139 }
 140};
 141
 142template<>
 143struct SVGPropertyTraits<FloatRect> {
 144 static FloatRect initialValue() { return FloatRect(); }
 145 static FloatRect fromString(const String& string)
 146 {
 147 FloatRect rect;
 148 return parseRect(string, rect) ? rect : FloatRect();
 149
 150 }
 151 static std::optional<FloatRect> parse(const QualifiedName&, const String& string)
 152 {
 153 FloatRect rect;
 154 return parseRect(string, rect) ? rect : std::optional<FloatRect>();
 155 }
 156 static String toString(const FloatRect& type)
 157 {
 158 StringBuilder builder;
 159 builder.appendNumber(type.x());
 160 builder.append(' ');
 161 builder.appendNumber(type.y());
 162 builder.append(' ');
 163 builder.appendNumber(type.width());
 164 builder.append(' ');
 165 builder.appendNumber(type.height());
 166 return builder.toString();
 167 }
 168};
 169
 170template<>
55171struct SVGPropertyTraits<String> {
56172 static String initialValue() { return String(); }
57  static String toString(const String& type) { return type; }
 173 static String fromString(const String& string) { return string; }
 174 static std::optional<String> parse(const QualifiedName&, const String& string) { return string; }
 175 static String toString(const String& string) { return string; }
58176};
59177
60178template<typename EnumType>
228390

Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h

@@public:
3333 using ListItemTearOff = typename SVGPropertyTraits<PropertyType>::ListItemTearOff;
3434
3535 using Base::m_role;
36  using Base::m_values;
 36 using Base::valuesProperty;
3737
3838 static Ref<Self> create(SVGElement& contextElement, PropertyType& values)
3939 {

@@public:
7676 }
7777
7878protected:
79  SVGStaticListPropertyTearOff(SVGElement* contextElement, PropertyType& values)
 79 SVGStaticListPropertyTearOff(SVGElement* contextElement, const RefPtr<SVGValue>& values)
8080 : Base(UndefinedRole, values, nullptr)
8181 , m_contextElement(*contextElement)
8282 {

@@protected:
8989
9090 void commitChange() override
9191 {
92  ASSERT(m_values);
93  m_values->commitChange(m_contextElement);
 92 valuesProperty().commitChange(m_contextElement);
9493 }
9594
9695 bool processIncomingListItemValue(const ListItemType&, unsigned*) override
228390

Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h

@@public:
3636
3737 // Used for non-animated POD types that are not associated with a SVGAnimatedProperty object, nor with a XML DOM attribute
3838 // (for example: SVGSVGElement::currentTranslate).
39  static Ref<Self> create(ContextElement& contextElement, PropertyType& value, UpdateMethod update)
 39 static Ref<Self> create(ContextElement& contextElement, const RefPtr<SVGValue>& value, UpdateMethod update)
4040 {
4141 return adoptRef(*new Self(contextElement, value, update));
4242 }

@@public:
4444 void commitChange() final { (m_contextElement.get()->*m_update)(); }
4545
4646private:
47  SVGStaticPropertyTearOff(ContextElement& contextElement, PropertyType& value, UpdateMethod update)
 47 SVGStaticPropertyTearOff(ContextElement& contextElement, const RefPtr<SVGValue>& value, UpdateMethod update)
4848 : PropertyTearOff(UndefinedRole, value)
4949 , m_update(update)
5050 , m_contextElement(&contextElement)
228390