12018-02-15 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 of the SVG attributes does
26 not look the cleanest solution. Besides, there are cases where the union
27 SVGAnimatedType is used to represent all the data types. So here is the
28 outline 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 attributes of all the SVGElement to be of type RefPtr<SVGValue>.
38
39 -- Change all the 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 Add new files for SVGValue and SVGListVlaues. Move definitions from
47 SVGMarkerElement.h to SVGMarkerTypes.h. Move definitions of SVGRectTraits.h
48 to SVGPropertyTraits.h.
49
50 * rendering/svg/SVGPathData.cpp:
51 (WebCore::pathFromPolygonElement):
52 (WebCore::pathFromPolylineElement):
53 * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
54 (WebCore::updateCharacterData):
55 * svg/SVGAngle.h:
56 (WebCore::SVGAngle::create): Replace the parameter SVGAngleValue& by
57 RefPtr<SVGValue>.
58 (WebCore::SVGAngle::SVGAngle):
59 * svg/SVGAnimateMotionElement.cpp:
60 (WebCore::parsePoint): Deleted. Moved to SVGParserUtilities.cpp.
61
62 * svg/SVGAnimatedAngle.cpp:
63 (WebCore::SVGAnimatedAngleAnimator::constructFromString):
64 Use the SVGPropertyTraits::fromString to create the data members of the
65 SVGAnimatedType.
66 (WebCore::SVGAnimatedAngleAnimator::startAnimValAnimation):
67 constructFromBaseValues() now returns a unique_ptr<SVGAnimatedType>.
68 (WebCore::SVGAnimatedAngleAnimator::resetAnimValToBaseVal):
69 Don't pass SVGAnimatedType getter to resetFromBaseValues(). The PropertyTYpe
70 can be used to get the data element from the SVGAnimatedType.
71 (WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes):
72 Cast the SVGValue elements to the required data members.
73 (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue): Ditto.
74
75 * svg/SVGAnimatedBoolean.cpp:
76 (WebCore::SVGAnimatedBooleanAnimator::constructFromString):
77 (WebCore::SVGAnimatedBooleanAnimator::startAnimValAnimation):
78 (WebCore::SVGAnimatedBooleanAnimator::resetAnimValToBaseVal):
79 (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
80 Ditto.
81
82 * svg/SVGAnimatedColor.cpp:
83 (WebCore::SVGAnimatedColorAnimator::constructFromString):
84 (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
85 (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
86 Ditto.
87
88 * svg/SVGAnimatedEnumeration.cpp:
89 (WebCore::SVGAnimatedEnumerationAnimator::constructFromString):
90 (WebCore::SVGAnimatedEnumerationAnimator::startAnimValAnimation):
91 (WebCore::SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal):
92 (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
93 Ditto.
94
95 * svg/SVGAnimatedInteger.cpp:
96 (WebCore::SVGAnimatedIntegerAnimator::constructFromString):
97 (WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
98 (WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
99 (WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes):
100 (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
101 Ditto.
102
103 * svg/SVGAnimatedIntegerOptionalInteger.cpp:
104 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
105 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
106 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
107 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes):
108 (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
109 Ditto.
110
111 * svg/SVGAnimatedLength.cpp:
112 (WebCore::SVGAnimatedLengthAnimator::constructFromString):
113 (WebCore::SVGAnimatedLengthAnimator::startAnimValAnimation):
114 (WebCore::SVGAnimatedLengthAnimator::resetAnimValToBaseVal):
115 (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
116 (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
117 Ditto.
118
119 * svg/SVGAnimatedLengthList.cpp:
120 (WebCore::SVGAnimatedLengthListAnimator::constructFromString):
121 (WebCore::SVGAnimatedLengthListAnimator::startAnimValAnimation):
122 (WebCore::SVGAnimatedLengthListAnimator::resetAnimValToBaseVal):
123 (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
124 (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
125 Ditto.
126
127 * svg/SVGAnimatedNumber.cpp:
128 (WebCore::SVGAnimatedNumberAnimator::constructFromString):
129 (WebCore::SVGAnimatedNumberAnimator::startAnimValAnimation):
130 (WebCore::SVGAnimatedNumberAnimator::resetAnimValToBaseVal):
131 (WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes):
132 (WebCore::parseNumberFromString):
133 (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
134 Ditto.
135
136 * svg/SVGAnimatedNumberList.cpp:
137 (WebCore::SVGAnimatedNumberListAnimator::constructFromString):
138 (WebCore::SVGAnimatedNumberListAnimator::startAnimValAnimation):
139 (WebCore::SVGAnimatedNumberListAnimator::resetAnimValToBaseVal):
140 (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
141 (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
142 Ditto.
143
144 * svg/SVGAnimatedNumberOptionalNumber.cpp:
145 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString):
146 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation):
147 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal):
148 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes):
149 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
150 Ditto.
151
152 * svg/SVGAnimatedPath.cpp:
153 (WebCore::SVGAnimatedPathAnimator::constructFromString):
154 (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation):
155 (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
156 (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
157 (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
158 Ditto.
159
160 * svg/SVGAnimatedPointList.cpp:
161 (WebCore::SVGAnimatedPointListAnimator::constructFromString):
162 (WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation):
163 (WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal):
164 (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
165 (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
166 Ditto.
167
168 * svg/SVGAnimatedPreserveAspectRatio.cpp:
169 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
170 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation):
171 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal):
172 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
173 Ditto.
174
175 * svg/SVGAnimatedRect.cpp:
176 (WebCore::SVGAnimatedRectAnimator::constructFromString):
177 (WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
178 (WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
179 (WebCore::SVGAnimatedRectAnimator::addAnimatedTypes):
180 (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
181 Ditto.
182
183 * svg/SVGAnimatedString.cpp:
184 (WebCore::SVGAnimatedStringAnimator::constructFromString):
185 (WebCore::SVGAnimatedStringAnimator::startAnimValAnimation):
186 (WebCore::SVGAnimatedStringAnimator::resetAnimValToBaseVal):
187 (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
188 Ditto.
189
190 * svg/SVGAnimatedTransformList.cpp:
191 (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
192 (WebCore::SVGAnimatedTransformListAnimator::startAnimValAnimation):
193 (WebCore::SVGAnimatedTransformListAnimator::resetAnimValToBaseVal):
194 (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
195 (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
196 (WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
197 Ditto.
198
199 * svg/SVGAnimatedType.cpp: Removed.
200 * svg/SVGAnimatedType.h:
201 (WebCore::SVGAnimatedType::SVGAnimatedType):
202 (WebCore::SVGAnimatedType::create):
203 (WebCore::SVGAnimatedType::type const):
204 (WebCore::SVGAnimatedType::valueAsString const):
205 (WebCore::SVGAnimatedType::setValueAsString):
206 (WebCore::SVGAnimatedType::supportsAnimVal):
207 (WebCore::SVGAnimatedType::valueAnimatedType):
208 (WebCore::SVGAnimatedType::angleAndEnumeration const): Deleted.
209 (WebCore::SVGAnimatedType::boolean const): Deleted.
210 (WebCore::SVGAnimatedType::color const): Deleted.
211 (WebCore::SVGAnimatedType::enumeration const): Deleted.
212 (WebCore::SVGAnimatedType::integer const): Deleted.
213 (WebCore::SVGAnimatedType::integerOptionalInteger const): Deleted.
214 (WebCore::SVGAnimatedType::length const): Deleted.
215 (WebCore::SVGAnimatedType::lengthList const): Deleted.
216 (WebCore::SVGAnimatedType::number const): Deleted.
217 (WebCore::SVGAnimatedType::numberList const): Deleted.
218 (WebCore::SVGAnimatedType::numberOptionalNumber const): Deleted.
219 (WebCore::SVGAnimatedType::path const): Deleted.
220 (WebCore::SVGAnimatedType::pointList const): Deleted.
221 (WebCore::SVGAnimatedType::preserveAspectRatio const): Deleted.
222 (WebCore::SVGAnimatedType::rect const): Deleted.
223 (WebCore::SVGAnimatedType::string const): Deleted.
224 (WebCore::SVGAnimatedType::transformList const): Deleted.
225 (WebCore::SVGAnimatedType::angleAndEnumeration): Deleted.
226 (WebCore::SVGAnimatedType::boolean): Deleted.
227 (WebCore::SVGAnimatedType::color): Deleted.
228 (WebCore::SVGAnimatedType::enumeration): Deleted.
229 (WebCore::SVGAnimatedType::integer): Deleted.
230 (WebCore::SVGAnimatedType::integerOptionalInteger): Deleted.
231 (WebCore::SVGAnimatedType::length): Deleted.
232 (WebCore::SVGAnimatedType::lengthList): Deleted.
233 (WebCore::SVGAnimatedType::number): Deleted.
234 (WebCore::SVGAnimatedType::numberList): Deleted.
235 (WebCore::SVGAnimatedType::numberOptionalNumber): Deleted.
236 (WebCore::SVGAnimatedType::path): Deleted.
237 (WebCore::SVGAnimatedType::pointList): Deleted.
238 (WebCore::SVGAnimatedType::preserveAspectRatio): Deleted.
239 (WebCore::SVGAnimatedType::rect): Deleted.
240 (WebCore::SVGAnimatedType::string): Deleted.
241 (WebCore::SVGAnimatedType::transformList): Deleted.
242 Simplify SVGAnimatedType. It is now a struct which has two RefPtr<SVGValue>.
243 The second pointer can be null expect with the types with two values.
244
245 * svg/SVGAnimatedTypeAnimator.h:
246 (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue): Construct the
247 animated SVGValue from the SVGValue of the base value before starting the
248 animation.
249 (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue): Reset the animated
250 SVGVAlue to the SVGValue of the base value before ending the animation.
251 (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues): Same as
252 constructFromBaseValue() but for two-SVGAvlues animated types.
253 (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): Same as
254 resetFromBaseValue() but for two-SVGAvlues animated types.
255 (WebCore::SVGAnimatedTypeAnimator::executeAction):
256
257 * svg/SVGAnimationElement.h:
258 * svg/SVGComponentTransferFunctionElement.cpp:
259 (WebCore::SVGComponentTransferFunctionElement::transferFunction const):
260 * svg/SVGCursorElement.cpp:
261 (WebCore::SVGCursorElement::SVGCursorElement): Explicitly create an
262 SVGLengthValue which will implicitly force calling the constructor of
263 SVGSynchronizableAnimatedProperty.
264
265 * svg/SVGEllipseElement.cpp:
266 (WebCore::SVGEllipseElement::SVGEllipseElement):
267 * svg/SVGFEColorMatrixElement.cpp:
268 (WebCore::SVGFEColorMatrixElement::setFilterEffectAttribute):
269 (WebCore::SVGFEColorMatrixElement::build):
270 * svg/SVGFEConvolveMatrixElement.cpp:
271 (WebCore::SVGFEConvolveMatrixElement::build):
272 * svg/SVGFilterElement.cpp:
273 (WebCore::SVGFilterElement::SVGFilterElement):
274 * svg/SVGFilterPrimitiveStandardAttributes.cpp:
275 (WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes):
276 * svg/SVGForeignObjectElement.cpp:
277 (WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
278 * svg/SVGImageElement.cpp:
279 (WebCore::SVGImageElement::SVGImageElement):
280 Ditto.
281
282 * svg/SVGLength.h:
283 (WebCore::SVGLength::create):
284 (WebCore::SVGLength::SVGLength):
285 * svg/SVGLengthList.h:
286 (WebCore::SVGLengthList::create):
287 (WebCore::SVGLengthList::SVGLengthList):
288 * svg/SVGLengthListValues.cpp:
289 (WebCore::SVGLengthListValues::parse):
290 (WebCore::SVGLengthListValues::valueAsString const):
291 * svg/SVGLengthListValues.h:
292 (WebCore::SVGPropertyTraits<SVGLengthListValues>::initialValue):
293 (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString):
294 (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse):
295 (WebCore::SVGPropertyTraits<SVGLengthListValues>::toString):
296 SVGLengthListValues is now a vector of RefPtr<SVGValue>. However the
297 only expected value in the elements of this vector is SVGLengthValue.
298
299 * svg/SVGLengthValue.h:
300 (WebCore::SVGPropertyTraits<SVGLengthValue>::parse):
301 (WebCore::SVGPropertyTraits<SVGLengthValue>::toString):
302 * svg/SVGLinearGradientElement.cpp:
303 (WebCore::SVGLinearGradientElement::SVGLinearGradientElement):
304 * svg/SVGListValues.cpp: Added.
305 (WebCore::SVGListValues<PropertyType>::resize):
306 (WebCore::SVGListValues<PropertyType>::deepCopy const):
307
308 * svg/SVGListValues.h: Added.
309 (WebCore::SVGListValues::SVGListValues):
310 (WebCore::SVGListValues::propertyAt const):
311 (WebCore::SVGListValues::propertyAt):
312 (WebCore::SVGListValues::firstProperty const):
313 (WebCore::SVGListValues::firstProperty):
314 (WebCore::SVGListValues::lastProperty const):
315 (WebCore::SVGListValues::lastProperty):
316 (WebCore::SVGListValues::properties const):
317 This is the base class of all the SVG list attributes. We need to have
318 the implementation of some function be in a source file to work around
319 header file dependency issues. The SVG list attributes can be one of
320 SVGValue data members but at the same time it is vector of RefPtr<SVGValue>.
321
322 * svg/SVGMarkerElement.cpp:
323 (WebCore::SVGMarkerElement::SVGMarkerElement):
324 (WebCore::SVGMarkerElement::synchronizeOrientType):
325 (WebCore::SVGMarkerElement::orientType const):
326 * svg/SVGMarkerElement.h:
327 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
328 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
329 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
330 (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
331 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
332 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
333 This code is moved to the new file SVGMarkerTypes.h.
334
335 * svg/SVGMarkerTypes.h: Added.
336 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
337 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
338 (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
339 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
340 (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
341 (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
342 * svg/SVGMaskElement.cpp:
343 (WebCore::SVGMaskElement::SVGMaskElement):
344 * svg/SVGMatrix.h:
345 (WebCore::SVGMatrix::create):
346 (WebCore::SVGMatrix::translate):
347 (WebCore::SVGMatrix::scale):
348 (WebCore::SVGMatrix::scaleNonUniform):
349 (WebCore::SVGMatrix::rotate):
350 (WebCore::SVGMatrix::rotateFromVector):
351 (WebCore::SVGMatrix::flipX):
352 (WebCore::SVGMatrix::flipY):
353 (WebCore::SVGMatrix::skewX):
354 (WebCore::SVGMatrix::skewY):
355 (WebCore::SVGMatrix::SVGMatrix):
356 * svg/SVGNumber.h:
357 (WebCore::SVGNumber::create):
358 (WebCore::SVGNumber::SVGNumber):
359 * svg/SVGNumberList.h:
360 (WebCore::SVGNumberList::create):
361 (WebCore::SVGNumberList::SVGNumberList):
362 * svg/SVGNumberListValues.cpp:
363 (WebCore::SVGNumberListValues::parse):
364 (WebCore::SVGNumberListValues::valueAsString const):
365 * svg/SVGNumberListValues.h:
366 (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString):
367 (WebCore::SVGPropertyTraits<SVGNumberListValues>::toString):
368
369 * svg/SVGParserUtilities.cpp:
370 (WebCore::parsePoint): This function was moved from SVGAnimateMotionElement.cpp.
371 (WebCore::pointsListFromSVGData):
372
373 * svg/SVGParserUtilities.h:
374
375 * svg/SVGPathByteStream.h:
376 (WebCore::SVGPathByteStream::SVGPathByteStream):
377 (WebCore::SVGPathByteStream::operator=):
378 (WebCore::SVGPathByteStream::operator== const):
379 (WebCore::SVGPathByteStream::operator!= const):
380 (WebCore::SVGPathByteStream::copy const):
381 (WebCore::SVGPathByteStream::append):
382 (WebCore::SVGPathByteStream::isEmpty const):
383 (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue):
384 (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString):
385 Add copy constructor and assignment operator.
386
387 * svg/SVGPathElement.cpp:
388 (WebCore::SVGPathElement::SVGPathElement):
389 (WebCore::SVGPathElement::svgAttributeChanged):
390 (WebCore::SVGPathElement::lookupOrCreateDWrapper):
391 (WebCore::SVGPathElement::synchronizeD):
392 (WebCore::SVGPathElement::pathSegListChanged):
393
394 * svg/SVGPathSegList.cpp:
395 (WebCore::SVGPathSegList::clearContextAndRoles):
396 (WebCore::SVGPathSegList::clear):
397 (WebCore::SVGPathSegList::replaceItem):
398 * svg/SVGPathSegList.h:
399 Access SVGPathSegListValues through valuesProperty() instead of m_values
400 which is now a RefPtr<SVGValue>.
401
402 * svg/SVGPathSegListBuilder.cpp:
403 (WebCore::SVGPathSegListBuilder::moveTo):
404 (WebCore::SVGPathSegListBuilder::lineTo):
405 (WebCore::SVGPathSegListBuilder::lineToHorizontal):
406 (WebCore::SVGPathSegListBuilder::lineToVertical):
407 (WebCore::SVGPathSegListBuilder::curveToCubic):
408 (WebCore::SVGPathSegListBuilder::curveToCubicSmooth):
409 (WebCore::SVGPathSegListBuilder::curveToQuadratic):
410 (WebCore::SVGPathSegListBuilder::curveToQuadraticSmooth):
411 (WebCore::SVGPathSegListBuilder::arcTo):
412 (WebCore::SVGPathSegListBuilder::closePath):
413 Store a new RefPtr<SVGValue> for every SVGPathSeg.
414
415 * svg/SVGPathSegListSource.cpp:
416 (WebCore::SVGPathSegListSource::parseSVGSegmentType):
417 (WebCore::SVGPathSegListSource::nextCommand):
418 * svg/SVGPathSegListValues.h:
419
420 * svg/SVGPathUtilities.cpp:
421 (WebCore::appendSVGPathByteStreamFromSVGPathSeg):
422 (WebCore::addToSVGPathByteStream):
423 Answer Simon's questions which were added in r190844.
424
425 * svg/SVGPoint.h:
426 (WebCore::SVGPoint::create):
427 (WebCore::SVGPoint::SVGPoint):
428 * svg/SVGPointList.h:
429 (WebCore::SVGPointList::create):
430 (WebCore::SVGPointList::SVGPointList):
431 * svg/SVGPointListValues.cpp:
432 (WebCore::SVGPointListValues::valueAsString const):
433 * svg/SVGPointListValues.h:
434 (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString):
435 * svg/SVGPolyElement.cpp:
436 (WebCore::SVGPolyElement::parseAttribute):
437 (WebCore::SVGPolyElement::synchronizePoints):
438 * svg/SVGPolyElement.h:
439 (WebCore::SVGPolyElement::pointList const):
440 * svg/SVGPreserveAspectRatio.h:
441 (WebCore::SVGPreserveAspectRatio::create):
442 (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio):
443 * svg/SVGPreserveAspectRatioValue.cpp:
444 (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue):
445 * svg/SVGPreserveAspectRatioValue.h:
446 (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString):
447 * svg/SVGRadialGradientElement.cpp:
448 (WebCore::SVGRadialGradientElement::SVGRadialGradientElement):
449 * svg/SVGRect.h:
450 (WebCore::SVGRect::create):
451 (WebCore::SVGRect::SVGRect):
452
453 * svg/SVGRectTraits.h: Removed. This struct was moved to SVGPropertyTraits.h
454
455 * svg/SVGSVGElement.cpp:
456 (WebCore::SVGSVGElement::SVGSVGElement):
457 (WebCore::SVGSVGElement::setCurrentTranslate):
458 * svg/SVGSVGElement.h:
459 (WebCore::SVGSVGElement::currentTranslateValue):
460 * svg/SVGStringList.h:
461 * svg/SVGStringListValues.cpp:
462 (WebCore::SVGStringListValues::reset):
463 (WebCore::SVGStringListValues::parse):
464 (WebCore::SVGStringListValues::valueAsString const):
465 * svg/SVGStringListValues.h:
466 * svg/SVGTests.cpp:
467 (WebCore::SVGTests::SVGTests):
468 (WebCore::SVGTests::isValid const):
469 (WebCore::SVGTests::parseAttribute):
470 (WebCore::SVGTests::synchronizeAttribute):
471 * svg/SVGTextContentElement.cpp:
472 (WebCore::SVGTextContentElement::SVGTextContentElement):
473 (WebCore::SVGTextContentElement::textLengthAnimated):
474 (WebCore::SVGTextContentElement::parseAttribute):
475 (WebCore::SVGTextContentElement::svgAttributeChanged):
476 * svg/SVGTextPathElement.cpp:
477 (WebCore::SVGTextPathElement::SVGTextPathElement):
478 * svg/SVGTransform.h:
479 (WebCore::SVGTransform::create):
480 (WebCore::SVGTransform::SVGTransform):
481 * svg/SVGTransformList.h:
482 * svg/SVGTransformListValues.cpp:
483 (WebCore::SVGTransformListValues::consolidate):
484 (WebCore::SVGTransformListValues::concatenate const):
485 (WebCore::SVGTransformListValues::valueAsString const):
486 * svg/SVGTransformListValues.h:
487 (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString):
488 * svg/SVGTransformValue.h:
489 (WebCore::SVGPropertyTraits<SVGTransformValue>::initialValue):
490 (WebCore::SVGPropertyTraits<SVGTransformValue>::toString):
491 * svg/SVGTransformable.cpp:
492 (WebCore::SVGTransformable::parseTransformAttribute):
493 * svg/SVGUseElement.cpp:
494 (WebCore::SVGUseElement::SVGUseElement):
495
496 * svg/SVGValue.h: Added.
497 (WebCore::toStringVisitor::operator()): This visitor returns the string
498 of the alternative of SVGValueVariant.
499 (WebCore::parseVisitor::parseVisitor):
500 (WebCore::parseVisitor::operator()): This replaces the alternative of
501 SVGValueVariant with the value we get from parsing the string of an
502 attribute.
503 (WebCore::SVGValue::create):
504 (WebCore::SVGValue::is const):
505 (WebCore::SVGValue::operator const PropertyType& const):
506 (WebCore::SVGValue::operator PropertyType&):
507 (WebCore::SVGValue::toString const):
508 (WebCore::SVGValue::parse):
509 (WebCore::SVGValue::SVGValue):
510
511 * svg/SVGViewElement.cpp:
512 (WebCore::SVGViewElement::SVGViewElement):
513 (WebCore::SVGViewElement::parseAttribute):
514 * svg/SVGViewElement.h:
515
516 * svg/SVGViewSpec.cpp:
517 (WebCore::SVGViewSpec::SVGViewSpec): Initialize pointers with the default
518 values.
519 (WebCore::SVGViewSpec::transformString const):
520 (WebCore::SVGViewSpec::viewBoxString const):
521 (WebCore::SVGViewSpec::preserveAspectRatioString const):
522 (WebCore::SVGViewSpec::reset):
523 (WebCore::SVGViewSpec::parseViewSpec):
524 * svg/SVGViewSpec.h:
525
526 * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
527 No need for the casting currentAnimatedValue() method since the base class
528 method now returns a RefPtr<SVGValue>. The casting will happen when getting
529 the enum value from the SVGValue.
530
531 * svg/properties/SVGAnimatedListPropertyTearOff.h:
532 (WebCore::SVGAnimatedListPropertyTearOff::create):
533 (WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue):
534 (WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue const):
535 (WebCore::SVGAnimatedListPropertyTearOff::currentBaseValue const):
536 (WebCore::SVGAnimatedListPropertyTearOff::animationStarted):
537 (WebCore::SVGAnimatedListPropertyTearOff::animationEnded):
538 (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
539 (WebCore::SVGAnimatedListPropertyTearOff::animValWillChange):
540 (WebCore::SVGAnimatedListPropertyTearOff::animValDidChange):
541 (WebCore::SVGAnimatedListPropertyTearOff::SVGAnimatedListPropertyTearOff):
542 * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
543 * svg/properties/SVGAnimatedProperty.h:
544 (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper):
545 * svg/properties/SVGAnimatedPropertyMacros.h:
546 (WebCore::SVGSynchronizableAnimatedProperty::SVGSynchronizableAnimatedProperty):
547 * svg/properties/SVGAnimatedPropertyTearOff.h:
548 * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
549 (WebCore::SVGAnimatedStaticPropertyTearOff::baseVal):
550 (WebCore::SVGAnimatedStaticPropertyTearOff::animVal):
551 (WebCore::SVGAnimatedStaticPropertyTearOff::setBaseVal):
552 (WebCore::SVGAnimatedStaticPropertyTearOff::create):
553 (WebCore::SVGAnimatedStaticPropertyTearOff::currentAnimatedValue):
554 (WebCore::SVGAnimatedStaticPropertyTearOff::currentAnimatedValue const):
555 (WebCore::SVGAnimatedStaticPropertyTearOff::currentBaseValue const):
556 (WebCore::SVGAnimatedStaticPropertyTearOff::animationStarted):
557 (WebCore::SVGAnimatedStaticPropertyTearOff::animationEnded):
558 (WebCore::SVGAnimatedStaticPropertyTearOff::SVGAnimatedStaticPropertyTearOff):
559 * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
560
561 * svg/properties/SVGListProperty.h:
562 (WebCore::SVGListProperty::setValuesAndWrappers):
563 (WebCore::SVGListProperty::clearValues):
564 (WebCore::SVGListProperty::clearValuesAndWrappers):
565 (WebCore::SVGListProperty::numberOfItems const):
566 (WebCore::SVGListProperty::initializeValues):
567 (WebCore::SVGListProperty::initializeValuesAndWrappers):
568 (WebCore::SVGListProperty::canGetItem):
569 (WebCore::SVGListProperty::getItemValues):
570 (WebCore::SVGListProperty::getItemValuesAndWrappers):
571 (WebCore::SVGListProperty::insertItemBeforeValues):
572 (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
573 (WebCore::SVGListProperty::canReplaceItem):
574 (WebCore::SVGListProperty::replaceItemValues):
575 (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
576 (WebCore::SVGListProperty::canRemoveItem):
577 (WebCore::SVGListProperty::removeItemValues):
578 (WebCore::SVGListProperty::removeItemValuesAndWrappers):
579 (WebCore::SVGListProperty::appendItemValues):
580 (WebCore::SVGListProperty::appendItemValuesAndWrappers):
581 (WebCore::SVGListProperty::values const):
582 (WebCore::SVGListProperty::valuesProperty const):
583 (WebCore::SVGListProperty::SVGListProperty):
584 (WebCore::SVGListProperty::values): Deleted.
585 (WebCore::SVGListProperty::~SVGListProperty): Deleted.
586 No need for m_ownsValues anymore. m_values is now a RefPtr<SVGValue>. It
587 will be deleted once the ref-count becomes zero.
588
589 * svg/properties/SVGListPropertyTearOff.h:
590 (WebCore::SVGListPropertyTearOff::create):
591 (WebCore::SVGListPropertyTearOff::findItem const):
592 (WebCore::SVGListPropertyTearOff::removeItemFromList):
593 (WebCore::SVGListPropertyTearOff::SVGListPropertyTearOff):
594 * svg/properties/SVGMatrixTearOff.h:
595 * svg/properties/SVGPropertyTearOff.h:
596 (WebCore::SVGPropertyTearOff::value const):
597 (WebCore::SVGPropertyTearOff::propertyReference):
598 (WebCore::SVGPropertyTearOff::setValue):
599 (WebCore::SVGPropertyTearOff::SVGPropertyTearOff):
600 (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
601
602 * svg/properties/SVGPropertyTraits.h:
603 (WebCore::SVGPropertyTraits<bool>::fromString):
604 (WebCore::SVGPropertyTraits<Color>::initialValue):
605 (WebCore::SVGPropertyTraits<Color>::fromString):
606 (WebCore::SVGPropertyTraits<Color>::parse):
607 (WebCore::SVGPropertyTraits<Color>::toString):
608 (WebCore::SVGPropertyTraits<int>::fromString):
609 (WebCore::SVGPropertyTraits<float>::fromString):
610 (WebCore::SVGPropertyTraits<float>::parse):
611 (WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
612 (WebCore::SVGPropertyTraits<FloatPoint>::fromString):
613 (WebCore::SVGPropertyTraits<FloatPoint>::parse):
614 (WebCore::SVGPropertyTraits<FloatPoint>::toString):
615 (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
616 (WebCore::SVGPropertyTraits<FloatRect>::fromString):
617 (WebCore::SVGPropertyTraits<FloatRect>::parse):
618 (WebCore::SVGPropertyTraits<FloatRect>::toString):
619 (WebCore::SVGPropertyTraits<String>::fromString):
620 (WebCore::SVGPropertyTraits<String>::parse):
621 (WebCore::SVGPropertyTraits<String>::toString):
622 Have all the SVGPropertyTraits with no specific SVG type be in one file.
623
624 * svg/properties/SVGStaticListPropertyTearOff.h:
625 (WebCore::SVGStaticListPropertyTearOff::SVGStaticListPropertyTearOff):
626 * svg/properties/SVGStaticPropertyTearOff.h:
627