| Differences between
and this patch
- Source/WebCore/ChangeLog +628 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2018-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 which have been
9
        difficult to track. The SVG tear-off objects are created on demand. More
10
        specifically, they are created when animating the SVGElement's attribute
11
        or when creating a DOM object for that attribute. The problem is these
12
        tear-off objects hold a raw reference to the SVGElement's attribute. To
13
        keep this reference valid, both the SVGElement and the tear-off object
14
        used to hold a RefPtr to each other which was causing a memory leak. When
15
        this strong double referencing was relaxed by using WeakPtr or raw pointer
16
        from one side to the other, memory bugs started to occur. A more  subtle
17
        problem can happen when the tear-off object is created for an element in
18
        a list attribute. Even if both the SVGElement and the tear-off exist in
19
        memory, accessing freed memory may still happen if the list attribute was
20
        reallocated.
21
22
        The current state of the code can not guarantee the validity of the reference
23
        which is held by the tear-off object to the SVGElement's attribute. To fix
24
        this issue, all the SVGElement's attributes have to be RefCounted objects.
25
26
        Creating different classes for every data type of the SVG attributes does
27
        not look the cleanest solution. Besides, there are cases where the union
28
        SVGAnimatedType is used to represent all the data types. So here is the
29
        outline of this patch:
30
31
        -- Create the class SVGValue which is a variant of all the SVG attribute
32
        basic data types including the type of the elements in the SVG attribute
33
        lists.
34
35
        -- Change SVGAnimatedType to hold two SVGValues. The second one is optional
36
        and only used for animated types which requires two data types.
37
38
        -- Change all the attributes of all the SVGElement to be of type RefPtr<SVGValue>.
39
40
        -- Change all the list attributes to be of type Vector<RefPtr<SVGValue>>.
41
42
        -- Change all the tear-off objects to hold RefPtr<SVGValue> instead of
43
        holding a raw reference.
44
45
        * Sources.txt:
46
        * WebCore.xcodeproj/project.pbxproj:
47
        Add new files for SVGValue and SVGListVlaues. Move definitions from
48
        SVGMarkerElement.h to SVGMarkerTypes.h. Move definitions of SVGRectTraits.h
49
        to SVGPropertyTraits.h.
50
51
        * rendering/svg/SVGPathData.cpp:
52
        (WebCore::pathFromPolygonElement):
53
        (WebCore::pathFromPolylineElement):
54
        * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
55
        (WebCore::updateCharacterData):
56
        * svg/SVGAngle.h:
57
        (WebCore::SVGAngle::create): Replace the parameter SVGAngleValue& by
58
        RefPtr<SVGValue>.
59
        (WebCore::SVGAngle::SVGAngle):
60
        * svg/SVGAnimateMotionElement.cpp:
61
        (WebCore::parsePoint): Deleted. Moved to SVGParserUtilities.cpp.
62
63
        * svg/SVGAnimatedAngle.cpp:
64
        (WebCore::SVGAnimatedAngleAnimator::constructFromString):
65
        Use the SVGPropertyTraits::fromString to create the data members of the
66
        SVGAnimatedType.
67
        (WebCore::SVGAnimatedAngleAnimator::startAnimValAnimation):
68
        constructFromBaseValues() now returns a unique_ptr<SVGAnimatedType>.
69
        (WebCore::SVGAnimatedAngleAnimator::resetAnimValToBaseVal):
70
        Don't pass SVGAnimatedType getter to resetFromBaseValues(). The PropertyTYpe
71
        can be used to get the data element from the SVGAnimatedType.
72
        (WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes):
73
        Cast the SVGValue elements to the required data members.
74
        (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue): Ditto.
75
76
        * svg/SVGAnimatedBoolean.cpp:
77
        (WebCore::SVGAnimatedBooleanAnimator::constructFromString):
78
        (WebCore::SVGAnimatedBooleanAnimator::startAnimValAnimation):
79
        (WebCore::SVGAnimatedBooleanAnimator::resetAnimValToBaseVal):
80
        (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
81
        Ditto.
82
83
        * svg/SVGAnimatedColor.cpp:
84
        (WebCore::SVGAnimatedColorAnimator::constructFromString):
85
        (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
86
        (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
87
        Ditto.
88
89
        * svg/SVGAnimatedEnumeration.cpp:
90
        (WebCore::SVGAnimatedEnumerationAnimator::constructFromString):
91
        (WebCore::SVGAnimatedEnumerationAnimator::startAnimValAnimation):
92
        (WebCore::SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal):
93
        (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
94
        Ditto.
95
96
        * svg/SVGAnimatedInteger.cpp:
97
        (WebCore::SVGAnimatedIntegerAnimator::constructFromString):
98
        (WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
99
        (WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
100
        (WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes):
101
        (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
102
        Ditto.
103
104
        * svg/SVGAnimatedIntegerOptionalInteger.cpp:
105
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
106
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
107
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
108
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes):
109
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
110
        Ditto.
111
112
        * svg/SVGAnimatedLength.cpp:
113
        (WebCore::SVGAnimatedLengthAnimator::constructFromString):
114
        (WebCore::SVGAnimatedLengthAnimator::startAnimValAnimation):
115
        (WebCore::SVGAnimatedLengthAnimator::resetAnimValToBaseVal):
116
        (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
117
        (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
118
        Ditto.
119
120
        * svg/SVGAnimatedLengthList.cpp:
121
        (WebCore::SVGAnimatedLengthListAnimator::constructFromString):
122
        (WebCore::SVGAnimatedLengthListAnimator::startAnimValAnimation):
123
        (WebCore::SVGAnimatedLengthListAnimator::resetAnimValToBaseVal):
124
        (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
125
        (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
126
        Ditto.
127
128
        * svg/SVGAnimatedNumber.cpp:
129
        (WebCore::SVGAnimatedNumberAnimator::constructFromString):
130
        (WebCore::SVGAnimatedNumberAnimator::startAnimValAnimation):
131
        (WebCore::SVGAnimatedNumberAnimator::resetAnimValToBaseVal):
132
        (WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes):
133
        (WebCore::parseNumberFromString):
134
        (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
135
        Ditto.
136
137
        * svg/SVGAnimatedNumberList.cpp:
138
        (WebCore::SVGAnimatedNumberListAnimator::constructFromString):
139
        (WebCore::SVGAnimatedNumberListAnimator::startAnimValAnimation):
140
        (WebCore::SVGAnimatedNumberListAnimator::resetAnimValToBaseVal):
141
        (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
142
        (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
143
        Ditto.
144
145
        * svg/SVGAnimatedNumberOptionalNumber.cpp:
146
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString):
147
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation):
148
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal):
149
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes):
150
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
151
        Ditto.
152
153
        * svg/SVGAnimatedPath.cpp:
154
        (WebCore::SVGAnimatedPathAnimator::constructFromString):
155
        (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation):
156
        (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
157
        (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
158
        (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
159
        Ditto.
160
161
        * svg/SVGAnimatedPointList.cpp:
162
        (WebCore::SVGAnimatedPointListAnimator::constructFromString):
163
        (WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation):
164
        (WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal):
165
        (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
166
        (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
167
        Ditto.
168
169
        * svg/SVGAnimatedPreserveAspectRatio.cpp:
170
        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
171
        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation):
172
        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal):
173
        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
174
        Ditto.
175
176
        * svg/SVGAnimatedRect.cpp:
177
        (WebCore::SVGAnimatedRectAnimator::constructFromString):
178
        (WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
179
        (WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
180
        (WebCore::SVGAnimatedRectAnimator::addAnimatedTypes):
181
        (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
182
        Ditto.
183
184
        * svg/SVGAnimatedString.cpp:
185
        (WebCore::SVGAnimatedStringAnimator::constructFromString):
186
        (WebCore::SVGAnimatedStringAnimator::startAnimValAnimation):
187
        (WebCore::SVGAnimatedStringAnimator::resetAnimValToBaseVal):
188
        (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
189
        Ditto.
190
191
        * svg/SVGAnimatedTransformList.cpp:
192
        (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
193
        (WebCore::SVGAnimatedTransformListAnimator::startAnimValAnimation):
194
        (WebCore::SVGAnimatedTransformListAnimator::resetAnimValToBaseVal):
195
        (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
196
        (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
197
        (WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
198
        Ditto.
199
200
        * svg/SVGAnimatedType.cpp: Removed.
201
        * svg/SVGAnimatedType.h:
202
        (WebCore::SVGAnimatedType::SVGAnimatedType):
203
        (WebCore::SVGAnimatedType::create):
204
        (WebCore::SVGAnimatedType::type const):
205
        (WebCore::SVGAnimatedType::valueAsString const):
206
        (WebCore::SVGAnimatedType::setValueAsString):
207
        (WebCore::SVGAnimatedType::supportsAnimVal):
208
        (WebCore::SVGAnimatedType::valueAnimatedType):
209
        (WebCore::SVGAnimatedType::angleAndEnumeration const): Deleted.
210
        (WebCore::SVGAnimatedType::boolean const): Deleted.
211
        (WebCore::SVGAnimatedType::color const): Deleted.
212
        (WebCore::SVGAnimatedType::enumeration const): Deleted.
213
        (WebCore::SVGAnimatedType::integer const): Deleted.
214
        (WebCore::SVGAnimatedType::integerOptionalInteger const): Deleted.
215
        (WebCore::SVGAnimatedType::length const): Deleted.
216
        (WebCore::SVGAnimatedType::lengthList const): Deleted.
217
        (WebCore::SVGAnimatedType::number const): Deleted.
218
        (WebCore::SVGAnimatedType::numberList const): Deleted.
219
        (WebCore::SVGAnimatedType::numberOptionalNumber const): Deleted.
220
        (WebCore::SVGAnimatedType::path const): Deleted.
221
        (WebCore::SVGAnimatedType::pointList const): Deleted.
222
        (WebCore::SVGAnimatedType::preserveAspectRatio const): Deleted.
223
        (WebCore::SVGAnimatedType::rect const): Deleted.
224
        (WebCore::SVGAnimatedType::string const): Deleted.
225
        (WebCore::SVGAnimatedType::transformList const): Deleted.
226
        (WebCore::SVGAnimatedType::angleAndEnumeration): Deleted.
227
        (WebCore::SVGAnimatedType::boolean): Deleted.
228
        (WebCore::SVGAnimatedType::color): Deleted.
229
        (WebCore::SVGAnimatedType::enumeration): Deleted.
230
        (WebCore::SVGAnimatedType::integer): Deleted.
231
        (WebCore::SVGAnimatedType::integerOptionalInteger): Deleted.
232
        (WebCore::SVGAnimatedType::length): Deleted.
233
        (WebCore::SVGAnimatedType::lengthList): Deleted.
234
        (WebCore::SVGAnimatedType::number): Deleted.
235
        (WebCore::SVGAnimatedType::numberList): Deleted.
236
        (WebCore::SVGAnimatedType::numberOptionalNumber): Deleted.
237
        (WebCore::SVGAnimatedType::path): Deleted.
238
        (WebCore::SVGAnimatedType::pointList): Deleted.
239
        (WebCore::SVGAnimatedType::preserveAspectRatio): Deleted.
240
        (WebCore::SVGAnimatedType::rect): Deleted.
241
        (WebCore::SVGAnimatedType::string): Deleted.
242
        (WebCore::SVGAnimatedType::transformList): Deleted.
243
        Simplify SVGAnimatedType. It is now a struct which has two RefPtr<SVGValue>.
244
        The second pointer can be null expect with the types with two values.
245
246
        * svg/SVGAnimatedTypeAnimator.h:
247
        (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue): Construct the 
248
        animated SVGValue from the SVGValue of the base value before starting the
249
        animation.
250
        (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue): Reset the animated
251
        SVGVAlue to the SVGValue of the base value before ending the animation.
252
        (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues): Same as 
253
        constructFromBaseValue() but for two-SVGAvlues animated types.
254
        (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): Same as
255
        resetFromBaseValue() but for two-SVGAvlues animated types.
256
        (WebCore::SVGAnimatedTypeAnimator::executeAction):
257
258
        * svg/SVGAnimationElement.h:
259
        * svg/SVGComponentTransferFunctionElement.cpp:
260
        (WebCore::SVGComponentTransferFunctionElement::transferFunction const):
261
        * svg/SVGCursorElement.cpp:
262
        (WebCore::SVGCursorElement::SVGCursorElement): Explicitly create an
263
        SVGLengthValue which will implicitly force calling the constructor of
264
        SVGSynchronizableAnimatedProperty.
265
266
        * svg/SVGEllipseElement.cpp:
267
        (WebCore::SVGEllipseElement::SVGEllipseElement):
268
        * svg/SVGFEColorMatrixElement.cpp:
269
        (WebCore::SVGFEColorMatrixElement::setFilterEffectAttribute):
270
        (WebCore::SVGFEColorMatrixElement::build):
271
        * svg/SVGFEConvolveMatrixElement.cpp:
272
        (WebCore::SVGFEConvolveMatrixElement::build):
273
        * svg/SVGFilterElement.cpp:
274
        (WebCore::SVGFilterElement::SVGFilterElement):
275
        * svg/SVGFilterPrimitiveStandardAttributes.cpp:
276
        (WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes):
277
        * svg/SVGForeignObjectElement.cpp:
278
        (WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
279
        * svg/SVGImageElement.cpp:
280
        (WebCore::SVGImageElement::SVGImageElement):
281
        Ditto.
282
283
        * svg/SVGLength.h:
284
        (WebCore::SVGLength::create):
285
        (WebCore::SVGLength::SVGLength):
286
        * svg/SVGLengthList.h:
287
        (WebCore::SVGLengthList::create):
288
        (WebCore::SVGLengthList::SVGLengthList):
289
        * svg/SVGLengthListValues.cpp:
290
        (WebCore::SVGLengthListValues::parse):
291
        (WebCore::SVGLengthListValues::valueAsString const):
292
        * svg/SVGLengthListValues.h:
293
        (WebCore::SVGPropertyTraits<SVGLengthListValues>::initialValue):
294
        (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString):
295
        (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse):
296
        (WebCore::SVGPropertyTraits<SVGLengthListValues>::toString):
297
        SVGLengthListValues is now a vector of RefPtr<SVGValue>. However the
298
        only expected value in the elements of this vector is SVGLengthValue.
299
300
        * svg/SVGLengthValue.h:
301
        (WebCore::SVGPropertyTraits<SVGLengthValue>::parse):
302
        (WebCore::SVGPropertyTraits<SVGLengthValue>::toString):
303
        * svg/SVGLinearGradientElement.cpp:
304
        (WebCore::SVGLinearGradientElement::SVGLinearGradientElement):
305
        * svg/SVGListValues.cpp: Added.
306
        (WebCore::SVGListValues<PropertyType>::resize):
307
        (WebCore::SVGListValues<PropertyType>::deepCopy const):
308
309
        * svg/SVGListValues.h: Added.
310
        (WebCore::SVGListValues::SVGListValues):
311
        (WebCore::SVGListValues::propertyAt const):
312
        (WebCore::SVGListValues::propertyAt):
313
        (WebCore::SVGListValues::firstProperty const):
314
        (WebCore::SVGListValues::firstProperty):
315
        (WebCore::SVGListValues::lastProperty const):
316
        (WebCore::SVGListValues::lastProperty):
317
        (WebCore::SVGListValues::properties const):
318
        This is the base class of all the SVG list attributes. We need to have
319
        the implementation of some function be in a source file to work around
320
        header file dependency issues. The SVG list attributes can be one of
321
        SVGValue data members but at the same time it is vector of RefPtr<SVGValue>.
322
323
        * svg/SVGMarkerElement.cpp:
324
        (WebCore::SVGMarkerElement::SVGMarkerElement):
325
        (WebCore::SVGMarkerElement::synchronizeOrientType):
326
        (WebCore::SVGMarkerElement::orientType const):
327
        * svg/SVGMarkerElement.h:
328
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
329
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
330
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
331
        (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
332
        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
333
        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
334
        This code is moved to the new file SVGMarkerTypes.h.
335
336
        * svg/SVGMarkerTypes.h: Added.
337
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
338
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
339
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
340
        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
341
        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
342
        (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
343
        * svg/SVGMaskElement.cpp:
344
        (WebCore::SVGMaskElement::SVGMaskElement):
345
        * svg/SVGMatrix.h:
346
        (WebCore::SVGMatrix::create):
347
        (WebCore::SVGMatrix::translate):
348
        (WebCore::SVGMatrix::scale):
349
        (WebCore::SVGMatrix::scaleNonUniform):
350
        (WebCore::SVGMatrix::rotate):
351
        (WebCore::SVGMatrix::rotateFromVector):
352
        (WebCore::SVGMatrix::flipX):
353
        (WebCore::SVGMatrix::flipY):
354
        (WebCore::SVGMatrix::skewX):
355
        (WebCore::SVGMatrix::skewY):
356
        (WebCore::SVGMatrix::SVGMatrix):
357
        * svg/SVGNumber.h:
358
        (WebCore::SVGNumber::create):
359
        (WebCore::SVGNumber::SVGNumber):
360
        * svg/SVGNumberList.h:
361
        (WebCore::SVGNumberList::create):
362
        (WebCore::SVGNumberList::SVGNumberList):
363
        * svg/SVGNumberListValues.cpp:
364
        (WebCore::SVGNumberListValues::parse):
365
        (WebCore::SVGNumberListValues::valueAsString const):
366
        * svg/SVGNumberListValues.h:
367
        (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString):
368
        (WebCore::SVGPropertyTraits<SVGNumberListValues>::toString):
369
370
        * svg/SVGParserUtilities.cpp:
371
        (WebCore::parsePoint): This function was moved from SVGAnimateMotionElement.cpp.
372
        (WebCore::pointsListFromSVGData):
373
374
        * svg/SVGParserUtilities.h:
375
376
        * svg/SVGPathByteStream.h:
377
        (WebCore::SVGPathByteStream::SVGPathByteStream):
378
        (WebCore::SVGPathByteStream::operator=):
379
        (WebCore::SVGPathByteStream::operator== const):
380
        (WebCore::SVGPathByteStream::operator!= const):
381
        (WebCore::SVGPathByteStream::copy const):
382
        (WebCore::SVGPathByteStream::append):
383
        (WebCore::SVGPathByteStream::isEmpty const):
384
        (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue):
385
        (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString):
386
        Add copy constructor and assignment operator.
387
388
        * svg/SVGPathElement.cpp:
389
        (WebCore::SVGPathElement::SVGPathElement):
390
        (WebCore::SVGPathElement::svgAttributeChanged):
391
        (WebCore::SVGPathElement::lookupOrCreateDWrapper):
392
        (WebCore::SVGPathElement::synchronizeD):
393
        (WebCore::SVGPathElement::pathSegListChanged):
394
395
        * svg/SVGPathSegList.cpp:
396
        (WebCore::SVGPathSegList::clearContextAndRoles):
397
        (WebCore::SVGPathSegList::clear):
398
        (WebCore::SVGPathSegList::replaceItem):
399
        * svg/SVGPathSegList.h:
400
        Access SVGPathSegListValues through valuesProperty() instead of m_values
401
        which is now a RefPtr<SVGValue>.
402
403
        * svg/SVGPathSegListBuilder.cpp:
404
        (WebCore::SVGPathSegListBuilder::moveTo):
405
        (WebCore::SVGPathSegListBuilder::lineTo):
406
        (WebCore::SVGPathSegListBuilder::lineToHorizontal):
407
        (WebCore::SVGPathSegListBuilder::lineToVertical):
408
        (WebCore::SVGPathSegListBuilder::curveToCubic):
409
        (WebCore::SVGPathSegListBuilder::curveToCubicSmooth):
410
        (WebCore::SVGPathSegListBuilder::curveToQuadratic):
411
        (WebCore::SVGPathSegListBuilder::curveToQuadraticSmooth):
412
        (WebCore::SVGPathSegListBuilder::arcTo):
413
        (WebCore::SVGPathSegListBuilder::closePath):
414
        Store a new RefPtr<SVGValue> for every SVGPathSeg.
415
416
        * svg/SVGPathSegListSource.cpp:
417
        (WebCore::SVGPathSegListSource::parseSVGSegmentType):
418
        (WebCore::SVGPathSegListSource::nextCommand):
419
        * svg/SVGPathSegListValues.h:
420
421
        * svg/SVGPathUtilities.cpp:
422
        (WebCore::appendSVGPathByteStreamFromSVGPathSeg):
423
        (WebCore::addToSVGPathByteStream):
424
        Answer Simon's questions which were added in r190844.
425
426
        * svg/SVGPoint.h:
427
        (WebCore::SVGPoint::create):
428
        (WebCore::SVGPoint::SVGPoint):
429
        * svg/SVGPointList.h:
430
        (WebCore::SVGPointList::create):
431
        (WebCore::SVGPointList::SVGPointList):
432
        * svg/SVGPointListValues.cpp:
433
        (WebCore::SVGPointListValues::valueAsString const):
434
        * svg/SVGPointListValues.h:
435
        (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString):
436
        * svg/SVGPolyElement.cpp:
437
        (WebCore::SVGPolyElement::parseAttribute):
438
        (WebCore::SVGPolyElement::synchronizePoints):
439
        * svg/SVGPolyElement.h:
440
        (WebCore::SVGPolyElement::pointList const):
441
        * svg/SVGPreserveAspectRatio.h:
442
        (WebCore::SVGPreserveAspectRatio::create):
443
        (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio):
444
        * svg/SVGPreserveAspectRatioValue.cpp:
445
        (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue):
446
        * svg/SVGPreserveAspectRatioValue.h:
447
        (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString):
448
        * svg/SVGRadialGradientElement.cpp:
449
        (WebCore::SVGRadialGradientElement::SVGRadialGradientElement):
450
        * svg/SVGRect.h:
451
        (WebCore::SVGRect::create):
452
        (WebCore::SVGRect::SVGRect):
453
454
        * svg/SVGRectTraits.h: Removed. This struct was moved to SVGPropertyTraits.h
455
456
        * svg/SVGSVGElement.cpp:
457
        (WebCore::SVGSVGElement::SVGSVGElement):
458
        (WebCore::SVGSVGElement::setCurrentTranslate):
459
        * svg/SVGSVGElement.h:
460
        (WebCore::SVGSVGElement::currentTranslateValue):
461
        * svg/SVGStringList.h:
462
        * svg/SVGStringListValues.cpp:
463
        (WebCore::SVGStringListValues::reset):
464
        (WebCore::SVGStringListValues::parse):
465
        (WebCore::SVGStringListValues::valueAsString const):
466
        * svg/SVGStringListValues.h:
467
        * svg/SVGTests.cpp:
468
        (WebCore::SVGTests::SVGTests):
469
        (WebCore::SVGTests::isValid const):
470
        (WebCore::SVGTests::parseAttribute):
471
        (WebCore::SVGTests::synchronizeAttribute):
472
        * svg/SVGTextContentElement.cpp:
473
        (WebCore::SVGTextContentElement::SVGTextContentElement):
474
        (WebCore::SVGTextContentElement::textLengthAnimated):
475
        (WebCore::SVGTextContentElement::parseAttribute):
476
        (WebCore::SVGTextContentElement::svgAttributeChanged):
477
        * svg/SVGTextPathElement.cpp:
478
        (WebCore::SVGTextPathElement::SVGTextPathElement):
479
        * svg/SVGTransform.h:
480
        (WebCore::SVGTransform::create):
481
        (WebCore::SVGTransform::SVGTransform):
482
        * svg/SVGTransformList.h:
483
        * svg/SVGTransformListValues.cpp:
484
        (WebCore::SVGTransformListValues::consolidate):
485
        (WebCore::SVGTransformListValues::concatenate const):
486
        (WebCore::SVGTransformListValues::valueAsString const):
487
        * svg/SVGTransformListValues.h:
488
        (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString):
489
        * svg/SVGTransformValue.h:
490
        (WebCore::SVGPropertyTraits<SVGTransformValue>::initialValue):
491
        (WebCore::SVGPropertyTraits<SVGTransformValue>::toString):
492
        * svg/SVGTransformable.cpp:
493
        (WebCore::SVGTransformable::parseTransformAttribute):
494
        * svg/SVGUseElement.cpp:
495
        (WebCore::SVGUseElement::SVGUseElement):
496
497
        * svg/SVGValue.h: Added.
498
        (WebCore::toStringVisitor::operator()): This visitor returns the string
499
        of the alternative of SVGValueVariant.
500
        (WebCore::parseVisitor::parseVisitor):
501
        (WebCore::parseVisitor::operator()): This replaces the alternative of
502
        SVGValueVariant with the value we get from parsing the string of an
503
        attribute.
504
        (WebCore::SVGValue::create):
505
        (WebCore::SVGValue::is const):
506
        (WebCore::SVGValue::operator const PropertyType& const):
507
        (WebCore::SVGValue::operator PropertyType&):
508
        (WebCore::SVGValue::toString const):
509
        (WebCore::SVGValue::parse):
510
        (WebCore::SVGValue::SVGValue):
511
512
        * svg/SVGViewElement.cpp:
513
        (WebCore::SVGViewElement::SVGViewElement):
514
        (WebCore::SVGViewElement::parseAttribute):
515
        * svg/SVGViewElement.h:
516
517
        * svg/SVGViewSpec.cpp:
518
        (WebCore::SVGViewSpec::SVGViewSpec): Initialize pointers with the default
519
        values.
520
        (WebCore::SVGViewSpec::transformString const):
521
        (WebCore::SVGViewSpec::viewBoxString const):
522
        (WebCore::SVGViewSpec::preserveAspectRatioString const):
523
        (WebCore::SVGViewSpec::reset):
524
        (WebCore::SVGViewSpec::parseViewSpec):
525
        * svg/SVGViewSpec.h:
526
527
        * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
528
        No need for the casting currentAnimatedValue() method since the base class
529
        method now returns a RefPtr<SVGValue>. The casting will happen when getting
530
        the enum value from the SVGValue.
531
532
        * svg/properties/SVGAnimatedListPropertyTearOff.h:
533
        (WebCore::SVGAnimatedListPropertyTearOff::create):
534
        (WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue):
535
        (WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue const):
536
        (WebCore::SVGAnimatedListPropertyTearOff::currentBaseValue const):
537
        (WebCore::SVGAnimatedListPropertyTearOff::animationStarted):
538
        (WebCore::SVGAnimatedListPropertyTearOff::animationEnded):
539
        (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
540
        (WebCore::SVGAnimatedListPropertyTearOff::animValWillChange):
541
        (WebCore::SVGAnimatedListPropertyTearOff::animValDidChange):
542
        (WebCore::SVGAnimatedListPropertyTearOff::SVGAnimatedListPropertyTearOff):
543
        * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
544
        * svg/properties/SVGAnimatedProperty.h:
545
        (WebCore::SVGAnimatedProperty::lookupOrCreateWrapper):
546
        * svg/properties/SVGAnimatedPropertyMacros.h:
547
        (WebCore::SVGSynchronizableAnimatedProperty::SVGSynchronizableAnimatedProperty):
548
        * svg/properties/SVGAnimatedPropertyTearOff.h:
549
        * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
550
        (WebCore::SVGAnimatedStaticPropertyTearOff::baseVal):
551
        (WebCore::SVGAnimatedStaticPropertyTearOff::animVal):
552
        (WebCore::SVGAnimatedStaticPropertyTearOff::setBaseVal):
553
        (WebCore::SVGAnimatedStaticPropertyTearOff::create):
554
        (WebCore::SVGAnimatedStaticPropertyTearOff::currentAnimatedValue):
555
        (WebCore::SVGAnimatedStaticPropertyTearOff::currentAnimatedValue const):
556
        (WebCore::SVGAnimatedStaticPropertyTearOff::currentBaseValue const):
557
        (WebCore::SVGAnimatedStaticPropertyTearOff::animationStarted):
558
        (WebCore::SVGAnimatedStaticPropertyTearOff::animationEnded):
559
        (WebCore::SVGAnimatedStaticPropertyTearOff::SVGAnimatedStaticPropertyTearOff):
560
        * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
561
562
        * svg/properties/SVGListProperty.h:
563
        (WebCore::SVGListProperty::setValuesAndWrappers):
564
        (WebCore::SVGListProperty::clearValues):
565
        (WebCore::SVGListProperty::clearValuesAndWrappers):
566
        (WebCore::SVGListProperty::numberOfItems const):
567
        (WebCore::SVGListProperty::initializeValues):
568
        (WebCore::SVGListProperty::initializeValuesAndWrappers):
569
        (WebCore::SVGListProperty::canGetItem):
570
        (WebCore::SVGListProperty::getItemValues):
571
        (WebCore::SVGListProperty::getItemValuesAndWrappers):
572
        (WebCore::SVGListProperty::insertItemBeforeValues):
573
        (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
574
        (WebCore::SVGListProperty::canReplaceItem):
575
        (WebCore::SVGListProperty::replaceItemValues):
576
        (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
577
        (WebCore::SVGListProperty::canRemoveItem):
578
        (WebCore::SVGListProperty::removeItemValues):
579
        (WebCore::SVGListProperty::removeItemValuesAndWrappers):
580
        (WebCore::SVGListProperty::appendItemValues):
581
        (WebCore::SVGListProperty::appendItemValuesAndWrappers):
582
        (WebCore::SVGListProperty::values const):
583
        (WebCore::SVGListProperty::valuesProperty const):
584
        (WebCore::SVGListProperty::SVGListProperty):
585
        (WebCore::SVGListProperty::values): Deleted.
586
        (WebCore::SVGListProperty::~SVGListProperty): Deleted.
587
        No need for m_ownsValues anymore. m_values is now a RefPtr<SVGValue>. It
588
        will be deleted once the ref-count becomes zero.
589
590
        * svg/properties/SVGListPropertyTearOff.h:
591
        (WebCore::SVGListPropertyTearOff::create):
592
        (WebCore::SVGListPropertyTearOff::findItem const):
593
        (WebCore::SVGListPropertyTearOff::removeItemFromList):
594
        (WebCore::SVGListPropertyTearOff::SVGListPropertyTearOff):
595
        * svg/properties/SVGMatrixTearOff.h:
596
        * svg/properties/SVGPropertyTearOff.h:
597
        (WebCore::SVGPropertyTearOff::value const):
598
        (WebCore::SVGPropertyTearOff::propertyReference):
599
        (WebCore::SVGPropertyTearOff::setValue):
600
        (WebCore::SVGPropertyTearOff::SVGPropertyTearOff):
601
        (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
602
603
        * svg/properties/SVGPropertyTraits.h:
604
        (WebCore::SVGPropertyTraits<bool>::fromString):
605
        (WebCore::SVGPropertyTraits<Color>::initialValue):
606
        (WebCore::SVGPropertyTraits<Color>::fromString):
607
        (WebCore::SVGPropertyTraits<Color>::parse):
608
        (WebCore::SVGPropertyTraits<Color>::toString):
609
        (WebCore::SVGPropertyTraits<int>::fromString):
610
        (WebCore::SVGPropertyTraits<float>::fromString):
611
        (WebCore::SVGPropertyTraits<float>::parse):
612
        (WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
613
        (WebCore::SVGPropertyTraits<FloatPoint>::fromString):
614
        (WebCore::SVGPropertyTraits<FloatPoint>::parse):
615
        (WebCore::SVGPropertyTraits<FloatPoint>::toString):
616
        (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
617
        (WebCore::SVGPropertyTraits<FloatRect>::fromString):
618
        (WebCore::SVGPropertyTraits<FloatRect>::parse):
619
        (WebCore::SVGPropertyTraits<FloatRect>::toString):
620
        (WebCore::SVGPropertyTraits<String>::fromString):
621
        (WebCore::SVGPropertyTraits<String>::parse):
622
        (WebCore::SVGPropertyTraits<String>::toString):
623
        Have all the SVGPropertyTraits with no specific SVG type be in one file.
624
625
        * svg/properties/SVGStaticListPropertyTearOff.h:
626
        (WebCore::SVGStaticListPropertyTearOff::SVGStaticListPropertyTearOff):
627
        * svg/properties/SVGStaticPropertyTearOff.h:
628
1
2018-02-15  Zan Dobersek  <zdobersek@igalia.com>
629
2018-02-15  Zan Dobersek  <zdobersek@igalia.com>
2
630
3
        HarfBuzzFace: rework cache entry reference holding
631
        HarfBuzzFace: rework cache entry reference holding
- Source/WebCore/Sources.txt -1 / +1 lines
Lines 2071-2077 svg/SVGAnimatedPreserveAspectRatio.cpp Source/WebCore/Sources.txt_sec1
2071
svg/SVGAnimatedRect.cpp
2071
svg/SVGAnimatedRect.cpp
2072
svg/SVGAnimatedString.cpp
2072
svg/SVGAnimatedString.cpp
2073
svg/SVGAnimatedTransformList.cpp
2073
svg/SVGAnimatedTransformList.cpp
2074
svg/SVGAnimatedType.cpp
2075
svg/SVGAnimatedTypeAnimator.cpp
2074
svg/SVGAnimatedTypeAnimator.cpp
2076
svg/SVGAnimationElement.cpp
2075
svg/SVGAnimationElement.cpp
2077
svg/SVGCircleElement.cpp
2076
svg/SVGCircleElement.cpp
Lines 2135-2140 svg/SVGLengthListValues.cpp Source/WebCore/Sources.txt_sec2
2135
svg/SVGLengthValue.cpp
2134
svg/SVGLengthValue.cpp
2136
svg/SVGLineElement.cpp
2135
svg/SVGLineElement.cpp
2137
svg/SVGLinearGradientElement.cpp
2136
svg/SVGLinearGradientElement.cpp
2137
svg/SVGListValues.cpp
2138
svg/SVGLocatable.cpp
2138
svg/SVGLocatable.cpp
2139
svg/SVGMPathElement.cpp
2139
svg/SVGMPathElement.cpp
2140
svg/SVGMarkerElement.cpp
2140
svg/SVGMarkerElement.cpp
- Source/WebCore/WebCore.xcodeproj/project.pbxproj -14 / +32 lines
Lines 1632-1638 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
1632
		5550CB421E955E3C00111AA0 /* ImageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5550CB411E955E3C00111AA0 /* ImageTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
1632
		5550CB421E955E3C00111AA0 /* ImageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5550CB411E955E3C00111AA0 /* ImageTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
1633
		555130011E7CCCCB00A69E38 /* DecodingOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 555130001E7CCCCA00A69E38 /* DecodingOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
1633
		555130011E7CCCCB00A69E38 /* DecodingOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 555130001E7CCCCA00A69E38 /* DecodingOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
1634
		555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */; };
1634
		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, ); }; };
1635
		5576A5651D88A70800CCC04C /* ImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 5576A5631D88A70800CCC04C /* ImageFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
1636
		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, ); }; };
1636
		55A336F71D8209F40022C4C7 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; };
1644
		55A336F71D8209F40022C4C7 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; };
1637
		55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
1645
		55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
1638
		55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
1646
		55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
Lines 1930-1936 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
1930
		71556CBD1F9F0A4900E78D08 /* JSAnimationEffectTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CB91F9F09FD00E78D08 /* JSAnimationEffectTiming.h */; };
1938
		71556CBD1F9F0A4900E78D08 /* JSAnimationEffectTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CB91F9F09FD00E78D08 /* JSAnimationEffectTiming.h */; };
1931
		71556CBE1F9F0A4900E78D08 /* JSKeyframeEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CB71F9F09FC00E78D08 /* JSKeyframeEffect.h */; };
1939
		71556CBE1F9F0A4900E78D08 /* JSKeyframeEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CB71F9F09FC00E78D08 /* JSKeyframeEffect.h */; };
1932
		71A1B6081DEE5AD70073BCFB /* modern-media-controls-localized-strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 71A1B6061DEE5A820073BCFB /* modern-media-controls-localized-strings.js */; };
1940
		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, ); }; };
1934
		71C916081D1483A300ACA47D /* UserInterfaceLayoutDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
1942
		71C916081D1483A300ACA47D /* UserInterfaceLayoutDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
1935
		71DCB7021568197600862271 /* JSSVGZoomAndPan.h in Headers */ = {isa = PBXBuildFile; fileRef = 71DCB7001568197600862271 /* JSSVGZoomAndPan.h */; };
1943
		71DCB7021568197600862271 /* JSSVGZoomAndPan.h in Headers */ = {isa = PBXBuildFile; fileRef = 71DCB7001568197600862271 /* JSSVGZoomAndPan.h */; };
1936
		71E2183A17359FB8006E6E4D /* PlugInsResources.h in Headers */ = {isa = PBXBuildFile; fileRef = 71E2183817359FB8006E6E4D /* PlugInsResources.h */; };
1944
		71E2183A17359FB8006E6E4D /* PlugInsResources.h in Headers */ = {isa = PBXBuildFile; fileRef = 71E2183817359FB8006E6E4D /* PlugInsResources.h */; };
Lines 2032-2038 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
2032
		7C30D9861F815AEC00268356 /* JSAbortSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C30D9811F815AC100268356 /* JSAbortSignal.h */; };
2040
		7C30D9861F815AEC00268356 /* JSAbortSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C30D9811F815AC100268356 /* JSAbortSignal.h */; };
2033
		7C330A021DF8FAC600D3395C /* GraphicsContext3DAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
2041
		7C330A021DF8FAC600D3395C /* GraphicsContext3DAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
2034
		7C330A081DF9F95100D3395C /* JSPositionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A061DF9F95100D3395C /* JSPositionOptions.h */; };
2042
		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, ); }; };
2036
		7C39C3771DDBE17000FEFB29 /* SVGStringListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3671DDB82CF00FEFB29 /* SVGStringListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
2044
		7C39C3771DDBE17000FEFB29 /* SVGStringListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3671DDB82CF00FEFB29 /* SVGStringListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
2037
		7C3A91E61C963B8800D1A7E3 /* ClipboardAccessPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
2045
		7C3A91E61C963B8800D1A7E3 /* ClipboardAccessPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
2038
		7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */; };
2046
		7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */; };
Lines 2164-2173 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
2164
		7CE191791F2ABE7100272F78 /* JSFetchRequestMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE1916C1F2AB70A00272F78 /* JSFetchRequestMode.h */; };
2172
		7CE191791F2ABE7100272F78 /* JSFetchRequestMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE1916C1F2AB70A00272F78 /* JSFetchRequestMode.h */; };
2165
		7CE1917B1F2ABE7100272F78 /* JSFetchRequestRedirect.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE1916A1F2AB70600272F78 /* JSFetchRequestRedirect.h */; };
2173
		7CE1917B1F2ABE7100272F78 /* JSFetchRequestRedirect.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE1916A1F2AB70600272F78 /* JSFetchRequestRedirect.h */; };
2166
		7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
2174
		7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
2167
		7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */; };
2168
		7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
2175
		7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
2169
		7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D561DD7D96D00128552 /* SVGTransformValue.h */; };
2176
		7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D561DD7D96D00128552 /* SVGTransformValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
2170
		7CE58D5C1DD7EC9C00128552 /* SVGMatrixValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D5B1DD7EC9C00128552 /* SVGMatrixValue.h */; };
2177
		7CE58D5C1DD7EC9C00128552 /* SVGMatrixValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D5B1DD7EC9C00128552 /* SVGMatrixValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
2171
		7CE68344192143A800F4D928 /* UserMessageHandlerDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */; };
2178
		7CE68344192143A800F4D928 /* UserMessageHandlerDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */; };
2172
		7CE68345192143A800F4D928 /* UserMessageHandlerDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
2179
		7CE68345192143A800F4D928 /* UserMessageHandlerDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
2173
		7CE683471921821500F4D928 /* UserMessageHandlerDescriptorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
2180
		7CE683471921821500F4D928 /* UserMessageHandlerDescriptorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE683461921821500F4D928 /* UserMessageHandlerDescriptorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
Lines 2309-2315 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
2309
		83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA41DA9F1660037237C /* UIEventInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
2316
		83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA41DA9F1660037237C /* UIEventInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
2310
		83FE7CA81DA9F1B60037237C /* EventModifierInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA31DA9F1650037237C /* EventModifierInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
2317
		83FE7CA81DA9F1B60037237C /* EventModifierInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA31DA9F1650037237C /* EventModifierInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
2311
		83FE90271E307C30003E9199 /* PerformanceMonitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE90261E307C1C003E9199 /* PerformanceMonitor.h */; };
2318
		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, ); }; };
2313
		8419D2A9120D92D000141F8F /* SVGPathByteStreamBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A6120D92D000141F8F /* SVGPathByteStreamBuilder.h */; };
2320
		8419D2A9120D92D000141F8F /* SVGPathByteStreamBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A6120D92D000141F8F /* SVGPathByteStreamBuilder.h */; };
2314
		8419D2AD120D92FC00141F8F /* SVGPathByteStreamSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2AB120D92FC00141F8F /* SVGPathByteStreamSource.h */; };
2321
		8419D2AD120D92FC00141F8F /* SVGPathByteStreamSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2AB120D92FC00141F8F /* SVGPathByteStreamSource.h */; };
2315
		8419D2BA120E0C7600141F8F /* SVGPathStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2B8120E0C7600141F8F /* SVGPathStringBuilder.h */; };
2322
		8419D2BA120E0C7600141F8F /* SVGPathStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2B8120E0C7600141F8F /* SVGPathStringBuilder.h */; };
Lines 2336-2342 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
2336
		84730D931248F0B300D3A9C9 /* SpotLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D761248F0B300D3A9C9 /* SpotLightSource.h */; };
2343
		84730D931248F0B300D3A9C9 /* SpotLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D761248F0B300D3A9C9 /* SpotLightSource.h */; };
2337
		8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9E411DF6A0B00555B02 /* SVGPathSegListBuilder.h */; };
2344
		8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9E411DF6A0B00555B02 /* SVGPathSegListBuilder.h */; };
2338
		8476C9EB11DF6A2900555B02 /* SVGPathBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9E811DF6A2900555B02 /* SVGPathBuilder.h */; };
2345
		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, ); }; };
2340
		8476C9F011DF6A5800555B02 /* SVGPathParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9EE11DF6A5800555B02 /* SVGPathParser.h */; };
2347
		8476C9F011DF6A5800555B02 /* SVGPathParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8476C9EE11DF6A5800555B02 /* SVGPathParser.h */; };
2341
		84801955108BAFB300CB2B1F /* FEGaussianBlur.h in Headers */ = {isa = PBXBuildFile; fileRef = 84801953108BAFB300CB2B1F /* FEGaussianBlur.h */; };
2348
		84801955108BAFB300CB2B1F /* FEGaussianBlur.h in Headers */ = {isa = PBXBuildFile; fileRef = 84801953108BAFB300CB2B1F /* FEGaussianBlur.h */; };
2342
		8482B7461198C35400BFB005 /* HashChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2442BBF81194C9D300D49469 /* HashChangeEvent.h */; };
2349
		8482B7461198C35400BFB005 /* HashChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2442BBF81194C9D300D49469 /* HashChangeEvent.h */; };
Lines 3281-3289 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
3281
		B2227A4B0D00BF220071B782 /* SVGMetadataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B50D00BF200071B782 /* SVGMetadataElement.h */; };
3288
		B2227A4B0D00BF220071B782 /* SVGMetadataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B50D00BF200071B782 /* SVGMetadataElement.h */; };
3282
		B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B80D00BF200071B782 /* SVGMPathElement.h */; };
3289
		B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B80D00BF200071B782 /* SVGMPathElement.h */; };
3283
		B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278BB0D00BF200071B782 /* SVGNumberList.h */; settings = {ATTRIBUTES = (Private, ); }; };
3290
		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, ); }; };
3285
		B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C30D00BF200071B782 /* SVGPathElement.h */; };
3292
		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, ); }; };
3287
		B2227A5E0D00BF220071B782 /* SVGPathSegArc.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C80D00BF200071B782 /* SVGPathSegArc.h */; };
3294
		B2227A5E0D00BF220071B782 /* SVGPathSegArc.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C80D00BF200071B782 /* SVGPathSegArc.h */; };
3288
		B2227A620D00BF220071B782 /* SVGPathSegClosePath.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278CC0D00BF200071B782 /* SVGPathSegClosePath.h */; };
3295
		B2227A620D00BF220071B782 /* SVGPathSegClosePath.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278CC0D00BF200071B782 /* SVGPathSegClosePath.h */; };
3289
		B2227A650D00BF220071B782 /* SVGPathSegCurvetoCubic.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278CF0D00BF200071B782 /* SVGPathSegCurvetoCubic.h */; };
3296
		B2227A650D00BF220071B782 /* SVGPathSegCurvetoCubic.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278CF0D00BF200071B782 /* SVGPathSegCurvetoCubic.h */; };
Lines 7283-7289 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
7283
		439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedTypeAnimator.h; sourceTree = "<group>"; };
7290
		439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedTypeAnimator.h; sourceTree = "<group>"; };
7284
		439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatorFactory.h; sourceTree = "<group>"; };
7291
		439D334213A6911C00C20F4F /* SVGAnimatorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatorFactory.h; sourceTree = "<group>"; };
7285
		43A0F0B013AC7D6D00A5F0A7 /* SVGAnimatedNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumber.cpp; sourceTree = "<group>"; };
7292
		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>"; };
7287
		43A625F613B3304000AC94B8 /* SVGAnimatedColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedColor.h; sourceTree = "<group>"; };
7293
		43A625F613B3304000AC94B8 /* SVGAnimatedColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedColor.h; sourceTree = "<group>"; };
7288
		43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedColor.cpp; sourceTree = "<group>"; };
7294
		43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedColor.cpp; sourceTree = "<group>"; };
7289
		43A6266613B3D11000AC94B8 /* SVGAnimatedString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedString.cpp; sourceTree = "<group>"; };
7295
		43A6266613B3D11000AC94B8 /* SVGAnimatedString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedString.cpp; sourceTree = "<group>"; };
Lines 8174-8183 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec9
8174
		550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
8180
		550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
8175
		554675771FD1FC1A003B10B0 /* ImageSource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageSource.cpp; sourceTree = "<group>"; };
8181
		554675771FD1FC1A003B10B0 /* ImageSource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageSource.cpp; sourceTree = "<group>"; };
8176
		554675781FD1FC1A003B10B0 /* ImageSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageSource.h; sourceTree = "<group>"; };
8182
		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>"; };
8177
		5550CB411E955E3C00111AA0 /* ImageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageTypes.h; sourceTree = "<group>"; };
8184
		5550CB411E955E3C00111AA0 /* ImageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageTypes.h; sourceTree = "<group>"; };
8178
		555130001E7CCCCA00A69E38 /* DecodingOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecodingOptions.h; sourceTree = "<group>"; };
8185
		555130001E7CCCCA00A69E38 /* DecodingOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecodingOptions.h; sourceTree = "<group>"; };
8179
		555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDecoderCG.cpp; sourceTree = "<group>"; };
8186
		555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDecoderCG.cpp; sourceTree = "<group>"; };
8180
		555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDecoderCG.h; sourceTree = "<group>"; };
8187
		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>"; };
8181
		5576A5621D88A70800CCC04C /* ImageFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrame.cpp; sourceTree = "<group>"; };
8190
		5576A5621D88A70800CCC04C /* ImageFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrame.cpp; sourceTree = "<group>"; };
8182
		5576A5631D88A70800CCC04C /* ImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFrame.h; sourceTree = "<group>"; };
8191
		5576A5631D88A70800CCC04C /* ImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFrame.h; sourceTree = "<group>"; };
8183
		55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };
8192
		55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };
Lines 8185-8190 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec10
8185
		55AF14E31EAAC59B0026EEAA /* UTIRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UTIRegistry.cpp; sourceTree = "<group>"; };
8194
		55AF14E31EAAC59B0026EEAA /* UTIRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UTIRegistry.cpp; sourceTree = "<group>"; };
8186
		55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UTIRegistry.h; sourceTree = "<group>"; };
8195
		55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UTIRegistry.h; sourceTree = "<group>"; };
8187
		55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; };
8196
		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>"; };
8188
		570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; };
8198
		570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; };
8189
		570440591E53936200356601 /* JSAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcCfbParams.h; sourceTree = "<group>"; };
8199
		570440591E53936200356601 /* JSAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcCfbParams.h; sourceTree = "<group>"; };
8190
		5704405B1E53937900356601 /* JSAesCbcCfbParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesCbcCfbParams.cpp; sourceTree = "<group>"; };
8200
		5704405B1E53937900356601 /* JSAesCbcCfbParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesCbcCfbParams.cpp; sourceTree = "<group>"; };
Lines 9466-9472 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec11
9466
		7CE1916E1F2AB70D00272F7B /* JSCacheQueryOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCacheQueryOptions.cpp; sourceTree = "<group>"; };
9476
		7CE1916E1F2AB70D00272F7B /* JSCacheQueryOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSCacheQueryOptions.cpp; sourceTree = "<group>"; };
9467
		7CE1916F1F2AB70F00272F78 /* JSFetchRequestRedirect.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchRequestRedirect.cpp; sourceTree = "<group>"; };
9477
		7CE1916F1F2AB70F00272F78 /* JSFetchRequestRedirect.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchRequestRedirect.cpp; sourceTree = "<group>"; };
9468
		7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = "<group>"; };
9478
		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>"; };
9470
		7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = "<group>"; };
9479
		7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = "<group>"; };
9471
		7CE58D511DD7B09300128552 /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = "<group>"; };
9480
		7CE58D511DD7B09300128552 /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = "<group>"; };
9472
		7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthValue.cpp; sourceTree = "<group>"; };
9481
		7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthValue.cpp; sourceTree = "<group>"; };
Lines 22431-22437 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec12
22431
				7157F061150B6564006EAABD /* SVGAnimatedTransformList.cpp */,
22440
				7157F061150B6564006EAABD /* SVGAnimatedTransformList.cpp */,
22432
				08250938128BD4D800E2ED8E /* SVGAnimatedTransformList.h */,
22441
				08250938128BD4D800E2ED8E /* SVGAnimatedTransformList.h */,
22433
				B22277F80D00BF1F0071B782 /* SVGAnimatedTransformList.idl */,
22442
				B22277F80D00BF1F0071B782 /* SVGAnimatedTransformList.idl */,
22434
				43A0F0B513ACCCFF00A5F0A7 /* SVGAnimatedType.cpp */,
22435
				439D334013A6911C00C20F4F /* SVGAnimatedType.h */,
22443
				439D334013A6911C00C20F4F /* SVGAnimatedType.h */,
22436
				836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */,
22444
				836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */,
22437
				439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */,
22445
				439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */,
Lines 22632-22642 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec13
22632
				B22278A50D00BF200071B782 /* SVGLineElement.cpp */,
22640
				B22278A50D00BF200071B782 /* SVGLineElement.cpp */,
22633
				B22278A60D00BF200071B782 /* SVGLineElement.h */,
22641
				B22278A60D00BF200071B782 /* SVGLineElement.h */,
22634
				B22278A70D00BF200071B782 /* SVGLineElement.idl */,
22642
				B22278A70D00BF200071B782 /* SVGLineElement.idl */,
22643
				55504E94202CDFD200507C73 /* SVGListValues.cpp */,
22644
				55627B762028EDC4002D397D /* SVGListValues.h */,
22635
				B22278AA0D00BF200071B782 /* SVGLocatable.cpp */,
22645
				B22278AA0D00BF200071B782 /* SVGLocatable.cpp */,
22636
				B22278AB0D00BF200071B782 /* SVGLocatable.h */,
22646
				B22278AB0D00BF200071B782 /* SVGLocatable.h */,
22637
				B22278AD0D00BF200071B782 /* SVGMarkerElement.cpp */,
22647
				B22278AD0D00BF200071B782 /* SVGMarkerElement.cpp */,
22638
				B22278AE0D00BF200071B782 /* SVGMarkerElement.h */,
22648
				B22278AE0D00BF200071B782 /* SVGMarkerElement.h */,
22639
				B22278AF0D00BF200071B782 /* SVGMarkerElement.idl */,
22649
				B22278AF0D00BF200071B782 /* SVGMarkerElement.idl */,
22650
				5575056C1E53B30C008DE30A /* SVGMarkerTypes.h */,
22640
				B22278B00D00BF200071B782 /* SVGMaskElement.cpp */,
22651
				B22278B00D00BF200071B782 /* SVGMaskElement.cpp */,
22641
				B22278B10D00BF200071B782 /* SVGMaskElement.h */,
22652
				B22278B10D00BF200071B782 /* SVGMaskElement.h */,
22642
				B22278B20D00BF200071B782 /* SVGMaskElement.idl */,
22653
				B22278B20D00BF200071B782 /* SVGMaskElement.idl */,
Lines 22770-22776 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec14
22770
				B22279070D00BF210071B782 /* SVGRectElement.cpp */,
22781
				B22279070D00BF210071B782 /* SVGRectElement.cpp */,
22771
				B22279080D00BF210071B782 /* SVGRectElement.h */,
22782
				B22279080D00BF210071B782 /* SVGRectElement.h */,
22772
				B22279090D00BF210071B782 /* SVGRectElement.idl */,
22783
				B22279090D00BF210071B782 /* SVGRectElement.idl */,
22773
				7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */,
22774
				B222790A0D00BF210071B782 /* SVGRenderingIntent.h */,
22784
				B222790A0D00BF210071B782 /* SVGRenderingIntent.h */,
22775
				B222790B0D00BF210071B782 /* SVGRenderingIntent.idl */,
22785
				B222790B0D00BF210071B782 /* SVGRenderingIntent.idl */,
22776
				B222790C0D00BF210071B782 /* SVGScriptElement.cpp */,
22786
				B222790C0D00BF210071B782 /* SVGScriptElement.cpp */,
Lines 22847-22852 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec15
22847
				B22279560D00BF210071B782 /* SVGUseElement.cpp */,
22857
				B22279560D00BF210071B782 /* SVGUseElement.cpp */,
22848
				B22279570D00BF210071B782 /* SVGUseElement.h */,
22858
				B22279570D00BF210071B782 /* SVGUseElement.h */,
22849
				B22279580D00BF210071B782 /* SVGUseElement.idl */,
22859
				B22279580D00BF210071B782 /* SVGUseElement.idl */,
22860
				55E44AE01E4BFBC50092457B /* SVGValue.h */,
22850
				B22279590D00BF210071B782 /* SVGViewElement.cpp */,
22861
				B22279590D00BF210071B782 /* SVGViewElement.cpp */,
22851
				B222795A0D00BF210071B782 /* SVGViewElement.h */,
22862
				B222795A0D00BF210071B782 /* SVGViewElement.h */,
22852
				B222795B0D00BF210071B782 /* SVGViewElement.idl */,
22863
				B222795B0D00BF210071B782 /* SVGViewElement.idl */,
Lines 29693-29698 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec16
29693
				65653F2E0D9727D200CA9723 /* SVGAltGlyphElement.h in Headers */,
29704
				65653F2E0D9727D200CA9723 /* SVGAltGlyphElement.h in Headers */,
29694
				24D912B813CA9A6900D21915 /* SVGAltGlyphItemElement.h in Headers */,
29705
				24D912B813CA9A6900D21915 /* SVGAltGlyphItemElement.h in Headers */,
29695
				B22279770D00BF220071B782 /* SVGAngle.h in Headers */,
29706
				B22279770D00BF220071B782 /* SVGAngle.h in Headers */,
29707
				558B6999202545AC004D75F4 /* SVGAngleValue.h in Headers */,
29696
				B222797A0D00BF220071B782 /* SVGAnimateColorElement.h in Headers */,
29708
				B222797A0D00BF220071B782 /* SVGAnimateColorElement.h in Headers */,
29697
				087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */,
29709
				087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */,
29698
				085797091278394C00A8EC5F /* SVGAnimatedBoolean.h in Headers */,
29710
				085797091278394C00A8EC5F /* SVGAnimatedBoolean.h in Headers */,
Lines 29804-29809 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec17
29804
				B2227A3C0D00BF220071B782 /* SVGLineElement.h in Headers */,
29816
				B2227A3C0D00BF220071B782 /* SVGLineElement.h in Headers */,
29805
				0810764412828556007C63BA /* SVGListProperty.h in Headers */,
29817
				0810764412828556007C63BA /* SVGListProperty.h in Headers */,
29806
				088A0E09126EF1DB00978F7A /* SVGListPropertyTearOff.h in Headers */,
29818
				088A0E09126EF1DB00978F7A /* SVGListPropertyTearOff.h in Headers */,
29819
				55627B7820292BF4002D397D /* SVGListValues.h in Headers */,
29807
				B2227A410D00BF220071B782 /* SVGLocatable.h in Headers */,
29820
				B2227A410D00BF220071B782 /* SVGLocatable.h in Headers */,
29808
				436708EE12D9CA4B00044234 /* SVGMarkerData.h in Headers */,
29821
				436708EE12D9CA4B00044234 /* SVGMarkerData.h in Headers */,
29809
				B2227A440D00BF220071B782 /* SVGMarkerElement.h in Headers */,
29822
				B2227A440D00BF220071B782 /* SVGMarkerElement.h in Headers */,
Lines 29816-29821 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec18
29816
				B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */,
29829
				B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */,
29817
				7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */,
29830
				7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */,
29818
				B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */,
29831
				B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */,
29832
				558B699B202545EA004D75F4 /* SVGNumberListValues.h in Headers */,
29819
				B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */,
29833
				B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */,
29820
				2D3A0E3613A7D76100E85AF0 /* SVGParsingError.h in Headers */,
29834
				2D3A0E3613A7D76100E85AF0 /* SVGParsingError.h in Headers */,
29821
				84C6784D1214814700A92902 /* SVGPathBlender.h in Headers */,
29835
				84C6784D1214814700A92902 /* SVGPathBlender.h in Headers */,
Lines 29854-29859 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec19
29854
				B2227A810D00BF220071B782 /* SVGPathSegList.h in Headers */,
29868
				B2227A810D00BF220071B782 /* SVGPathSegList.h in Headers */,
29855
				8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */,
29869
				8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */,
29856
				84B6B978120F13E500B8EFAF /* SVGPathSegListSource.h in Headers */,
29870
				84B6B978120F13E500B8EFAF /* SVGPathSegListSource.h in Headers */,
29871
				558B699C20254605004D75F4 /* SVGPathSegListValues.h in Headers */,
29857
				83C1D435178D5AB500141E68 /* SVGPathSegMovetoAbs.h in Headers */,
29872
				83C1D435178D5AB500141E68 /* SVGPathSegMovetoAbs.h in Headers */,
29858
				83C1D436178D5AB500141E68 /* SVGPathSegMovetoRel.h in Headers */,
29873
				83C1D436178D5AB500141E68 /* SVGPathSegMovetoRel.h in Headers */,
29859
				082DE42D1292621600D923DF /* SVGPathSegWithContext.h in Headers */,
29874
				082DE42D1292621600D923DF /* SVGPathSegWithContext.h in Headers */,
Lines 29865-29874 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec20
29865
				B2227A880D00BF220071B782 /* SVGPatternElement.h in Headers */,
29880
				B2227A880D00BF220071B782 /* SVGPatternElement.h in Headers */,
29866
				7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */,
29881
				7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */,
29867
				B2227A8C0D00BF220071B782 /* SVGPointList.h in Headers */,
29882
				B2227A8C0D00BF220071B782 /* SVGPointList.h in Headers */,
29883
				558B699D20254612004D75F4 /* SVGPointListValues.h in Headers */,
29868
				B2227A8F0D00BF220071B782 /* SVGPolyElement.h in Headers */,
29884
				B2227A8F0D00BF220071B782 /* SVGPolyElement.h in Headers */,
29869
				B2227A910D00BF220071B782 /* SVGPolygonElement.h in Headers */,
29885
				B2227A910D00BF220071B782 /* SVGPolygonElement.h in Headers */,
29870
				B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */,
29886
				B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */,
29871
				B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */,
29887
				B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */,
29888
				558B699E2025462B004D75F4 /* SVGPreserveAspectRatioValue.h in Headers */,
29872
				088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */,
29889
				088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */,
29873
				081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */,
29890
				081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */,
29874
				088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */,
29891
				088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */,
Lines 29876-29882 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec21
29876
				B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */,
29893
				B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */,
29877
				08EDE19F12A50B8E00B95797 /* SVGRect.h in Headers */,
29894
				08EDE19F12A50B8E00B95797 /* SVGRect.h in Headers */,
29878
				B2227A9E0D00BF220071B782 /* SVGRectElement.h in Headers */,
29895
				B2227A9E0D00BF220071B782 /* SVGRectElement.h in Headers */,
29879
				7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */,
29880
				197B180C1506353200E4ADA8 /* SVGRenderingContext.h in Headers */,
29896
				197B180C1506353200E4ADA8 /* SVGRenderingContext.h in Headers */,
29881
				B2227AA00D00BF220071B782 /* SVGRenderingIntent.h in Headers */,
29897
				B2227AA00D00BF220071B782 /* SVGRenderingIntent.h in Headers */,
29882
				BC2274790E8366E200E7F975 /* SVGRenderStyle.h in Headers */,
29898
				BC2274790E8366E200E7F975 /* SVGRenderStyle.h in Headers */,
Lines 29921-29926 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec22
29921
				B2227ADA0D00BF220071B782 /* SVGTransformable.h in Headers */,
29937
				B2227ADA0D00BF220071B782 /* SVGTransformable.h in Headers */,
29922
				B2227ADD0D00BF220071B782 /* SVGTransformDistance.h in Headers */,
29938
				B2227ADD0D00BF220071B782 /* SVGTransformDistance.h in Headers */,
29923
				B2227ADF0D00BF220071B782 /* SVGTransformList.h in Headers */,
29939
				B2227ADF0D00BF220071B782 /* SVGTransformList.h in Headers */,
29940
				558B699F20254675004D75F4 /* SVGTransformListValues.h in Headers */,
29924
				7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */,
29941
				7CE58D581DD7D96D00128552 /* SVGTransformValue.h in Headers */,
29925
				B2227AE20D00BF220071B782 /* SVGTRefElement.h in Headers */,
29942
				B2227AE20D00BF220071B782 /* SVGTRefElement.h in Headers */,
29926
				B2227AE50D00BF220071B782 /* SVGTSpanElement.h in Headers */,
29943
				B2227AE50D00BF220071B782 /* SVGTSpanElement.h in Headers */,
Lines 29928-29933 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec23
29928
				37C738ED1EDBD5BC003F2B0B /* SVGUnknownElement.h in Headers */,
29945
				37C738ED1EDBD5BC003F2B0B /* SVGUnknownElement.h in Headers */,
29929
				B2227AEA0D00BF220071B782 /* SVGURIReference.h in Headers */,
29946
				B2227AEA0D00BF220071B782 /* SVGURIReference.h in Headers */,
29930
				B2227AED0D00BF220071B782 /* SVGUseElement.h in Headers */,
29947
				B2227AED0D00BF220071B782 /* SVGUseElement.h in Headers */,
29948
				558B69982025456D004D75F4 /* SVGValue.h in Headers */,
29931
				B2227AF00D00BF220071B782 /* SVGViewElement.h in Headers */,
29949
				B2227AF00D00BF220071B782 /* SVGViewElement.h in Headers */,
29932
				B2227AF30D00BF220071B782 /* SVGViewSpec.h in Headers */,
29950
				B2227AF30D00BF220071B782 /* SVGViewSpec.h in Headers */,
29933
				8485228B1190173C006EDC7F /* SVGVKernElement.h in Headers */,
29951
				8485228B1190173C006EDC7F /* SVGVKernElement.h in Headers */,
- Source/WebCore/rendering/svg/SVGPathData.cpp -6 / +6 lines
Lines 100-115 static Path pathFromPathElement(SVGEleme Source/WebCore/rendering/svg/SVGPathData.cpp_sec1
100
100
101
static Path pathFromPolygonElement(SVGElement& element)
101
static Path pathFromPolygonElement(SVGElement& element)
102
{
102
{
103
    auto& points = downcast<SVGPolygonElement>(element).animatedPoints()->values();
103
    auto& points = downcast<SVGPolygonElement>(element).animatedPoints()->valuesProperty();
104
    if (points.isEmpty())
104
    if (points.isEmpty())
105
        return { };
105
        return { };
106
106
107
    Path path;
107
    Path path;
108
    path.moveTo(points.first());
108
    path.moveTo(points.firstProperty());
109
109
110
    unsigned size = points.size();
110
    unsigned size = points.size();
111
    for (unsigned i = 1; i < size; ++i)
111
    for (unsigned i = 1; i < size; ++i)
112
        path.addLineTo(points.at(i));
112
        path.addLineTo(points.propertyAt(i));
113
113
114
    path.closeSubpath();
114
    path.closeSubpath();
115
    return path;
115
    return path;
Lines 117-132 static Path pathFromPolygonElement(SVGEl Source/WebCore/rendering/svg/SVGPathData.cpp_sec2
117
117
118
static Path pathFromPolylineElement(SVGElement& element)
118
static Path pathFromPolylineElement(SVGElement& element)
119
{
119
{
120
    auto& points = downcast<SVGPolylineElement>(element).animatedPoints()->values();
120
    auto& points = downcast<SVGPolylineElement>(element).animatedPoints()->valuesProperty();
121
    if (points.isEmpty())
121
    if (points.isEmpty())
122
        return { };
122
        return { };
123
123
124
    Path path;
124
    Path path;
125
    path.moveTo(points.first());
125
    path.moveTo(points.firstProperty());
126
126
127
    unsigned size = points.size();
127
    unsigned size = points.size();
128
    for (unsigned i = 1; i < size; ++i)
128
    for (unsigned i = 1; i < size; ++i)
129
        path.addLineTo(points.at(i));
129
        path.addLineTo(points.propertyAt(i));
130
    return path;
130
    return path;
131
}
131
}
132
132
- Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp -5 / +5 lines
Lines 163-177 void SVGTextLayoutAttributesBuilder::bui Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp_sec1
163
static 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)
163
static 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)
164
{
164
{
165
    if (xList)
165
    if (xList)
166
        data.x = xList->at(i).value(lengthContext);
166
        data.x = xList->propertyAt(i).value(lengthContext);
167
    if (yList)
167
    if (yList)
168
        data.y = yList->at(i).value(lengthContext);
168
        data.y = yList->propertyAt(i).value(lengthContext);
169
    if (dxList)
169
    if (dxList)
170
        data.dx = dxList->at(i).value(lengthContext);
170
        data.dx = dxList->propertyAt(i).value(lengthContext);
171
    if (dyList)
171
    if (dyList)
172
        data.dy = dyList->at(i).value(lengthContext);
172
        data.dy = dyList->propertyAt(i).value(lengthContext);
173
    if (rotateList) {
173
    if (rotateList) {
174
        data.rotate = rotateList->at(i);
174
        data.rotate = rotateList->propertyAt(i);
175
        lastRotation = data.rotate;
175
        lastRotation = data.rotate;
176
    }
176
    }
177
}
177
}
- Source/WebCore/svg/SVGAngle.h -12 / +2 lines
Lines 32-38 namespace WebCore { Source/WebCore/svg/SVGAngle.h_sec1
32
32
33
class SVGAngle : public SVGPropertyTearOff<SVGAngleValue> {
33
class SVGAngle : public SVGPropertyTearOff<SVGAngleValue> {
34
public:
34
public:
35
    static Ref<SVGAngle> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGAngleValue& value)
35
    static Ref<SVGAngle> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
36
    {
36
    {
37
        return adoptRef(*new SVGAngle(animatedProperty, role, value));
37
        return adoptRef(*new SVGAngle(animatedProperty, role, value));
38
    }
38
    }
Lines 42-52 public: Source/WebCore/svg/SVGAngle.h_sec2
42
        return adoptRef(*new SVGAngle(initialValue));
42
        return adoptRef(*new SVGAngle(initialValue));
43
    }
43
    }
44
44
45
    static Ref<SVGAngle> create(const SVGAngleValue* initialValue)
46
    {
47
        return adoptRef(*new SVGAngle(initialValue));
48
    }
49
50
    template<typename T> static ExceptionOr<Ref<SVGAngle>> create(ExceptionOr<T>&& initialValue)
45
    template<typename T> static ExceptionOr<Ref<SVGAngle>> create(ExceptionOr<T>&& initialValue)
51
    {
46
    {
52
        if (initialValue.hasException())
47
        if (initialValue.hasException())
Lines 136-142 public: Source/WebCore/svg/SVGAngle.h_sec3
136
    }
131
    }
137
132
138
private:
133
private:
139
    SVGAngle(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGAngleValue& value)
134
    SVGAngle(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
140
        : SVGPropertyTearOff<SVGAngleValue>(&animatedProperty, role, value)
135
        : SVGPropertyTearOff<SVGAngleValue>(&animatedProperty, role, value)
141
    {
136
    {
142
    }
137
    }
Lines 145-155 private: Source/WebCore/svg/SVGAngle.h_sec4
145
        : SVGPropertyTearOff<SVGAngleValue>(initialValue)
140
        : SVGPropertyTearOff<SVGAngleValue>(initialValue)
146
    {
141
    {
147
    }
142
    }
148
149
    explicit SVGAngle(const SVGAngleValue* initialValue)
150
        : SVGPropertyTearOff<SVGAngleValue>(initialValue)
151
    {
152
    }
153
};
143
};
154
144
155
} // namespace WebCore
145
} // namespace WebCore
- Source/WebCore/svg/SVGAnimateMotionElement.cpp -25 lines
Lines 136-166 void SVGAnimateMotionElement::updateAnim Source/WebCore/svg/SVGAnimateMotionElement.cpp_sec1
136
    updateAnimationMode();
136
    updateAnimationMode();
137
}
137
}
138
138
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
    
164
void SVGAnimateMotionElement::resetAnimatedType()
139
void SVGAnimateMotionElement::resetAnimatedType()
165
{
140
{
166
    if (!hasValidAttributeType())
141
    if (!hasValidAttributeType())
- Source/WebCore/svg/SVGAnimatedAngle.cpp -42 / +33 lines
Lines 32-53 SVGAnimatedAngleAnimator::SVGAnimatedAng Source/WebCore/svg/SVGAnimatedAngle.cpp_sec1
32
32
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::constructFromString(const String& string)
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::constructFromString(const String& string)
34
{
34
{
35
    auto animatedType = SVGAnimatedType::createAngleAndEnumeration(std::make_unique<std::pair<SVGAngleValue, unsigned>>());
35
    return SVGAnimatedType::create(SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>>::fromString(string));
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;
46
}
36
}
47
37
48
std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
38
std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
49
{
39
{
50
    return SVGAnimatedType::createAngleAndEnumeration(constructFromBaseValues<SVGAnimatedAngle, SVGAnimatedEnumeration>(animatedTypes));
40
    return constructFromBaseValues<SVGAnimatedAngle, SVGAnimatedEnumeration>(animatedTypes);
51
}
41
}
52
42
53
void SVGAnimatedAngleAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
43
void SVGAnimatedAngleAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 57-63 void SVGAnimatedAngleAnimator::stopAnimV Source/WebCore/svg/SVGAnimatedAngle.cpp_sec2
57
47
58
void SVGAnimatedAngleAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
48
void SVGAnimatedAngleAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
59
{
49
{
60
    resetFromBaseValues<SVGAnimatedAngle, SVGAnimatedEnumeration>(animatedTypes, type, &SVGAnimatedType::angleAndEnumeration);
50
    resetFromBaseValues<SVGAnimatedAngle, SVGAnimatedEnumeration>(animatedTypes, type);
61
}
51
}
62
52
63
void SVGAnimatedAngleAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
53
void SVGAnimatedAngleAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 75-87 void SVGAnimatedAngleAnimator::addAnimat Source/WebCore/svg/SVGAnimatedAngle.cpp_sec3
75
    ASSERT(from->type() == AnimatedAngle);
65
    ASSERT(from->type() == AnimatedAngle);
76
    ASSERT(from->type() == to->type());
66
    ASSERT(from->type() == to->type());
77
67
78
    const auto& fromAngleAndEnumeration = from->angleAndEnumeration();
68
    const auto& fromAngle = static_cast<SVGAngleValue&>(*from->values[0]);
79
    auto& toAngleAndEnumeration = to->angleAndEnumeration();
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]);
80
    // Only respect by animations, if from and by are both specified in angles (and not eg. 'auto').
72
    // 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)
82
        return;
74
        return;
83
    const auto& fromAngle = fromAngleAndEnumeration.first;
84
    auto& toAngle = toAngleAndEnumeration.first;
85
    toAngle.setValue(toAngle.value() + fromAngle.value());
75
    toAngle.setValue(toAngle.value() + fromAngle.value());
86
}
76
}
87
77
Lines 90-137 void SVGAnimatedAngleAnimator::calculate Source/WebCore/svg/SVGAnimatedAngle.cpp_sec4
90
    ASSERT(m_animationElement);
80
    ASSERT(m_animationElement);
91
    ASSERT(m_contextElement);
81
    ASSERT(m_contextElement);
92
82
93
    const auto& fromAngleAndEnumeration = m_animationElement->animationMode() == ToAnimation ? animated->angleAndEnumeration() : from->angleAndEnumeration();
83
    const auto& fromAngle = m_animationElement->animationMode() == ToAnimation ? static_cast<SVGAngleValue&>(*animated->values[0]) : static_cast<SVGAngleValue&>(*from->values[0]);
94
    auto& toAngleAndEnumeration = to->angleAndEnumeration();
84
    const auto& fromEnumeration = m_animationElement->animationMode() == ToAnimation ? static_cast<unsigned&>(*animated->values[1]) : static_cast<unsigned&>(*from->values[1]);
95
    auto& toAtEndOfDurationAngleAndEnumeration = toAtEndOfDuration->angleAndEnumeration();
85
    auto& toAngle = static_cast<SVGAngleValue&>(*to->values[0]);
96
    auto& animatedAngleAndEnumeration = animated->angleAndEnumeration();
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]);
97
90
98
    if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second) {
91
    if (fromEnumeration != toEnumeration) {
99
        // Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
92
        // Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
100
        if (percentage < 0.5f) {
93
        if (percentage < 0.5f) {
101
            animatedAngleAndEnumeration.second = fromAngleAndEnumeration.second;
94
            animatedEnumeration = fromEnumeration;
102
            if (fromAngleAndEnumeration.second == SVGMarkerOrientAngle)
95
            if (fromEnumeration == SVGMarkerOrientAngle)
103
                animatedAngleAndEnumeration.first = fromAngleAndEnumeration.first;
96
                animatedAngle = fromAngle;
104
            else
97
            else
105
                animatedAngleAndEnumeration.first.setValue(0);
98
                animatedAngle.setValue(0);
106
            return;
99
            return;
107
        }
100
        }
108
        animatedAngleAndEnumeration.second = toAngleAndEnumeration.second;
101
        animatedEnumeration = toEnumeration;
109
        if (toAngleAndEnumeration.second == SVGMarkerOrientAngle)
102
        if (toEnumeration == SVGMarkerOrientAngle)
110
            animatedAngleAndEnumeration.first = toAngleAndEnumeration.first;
103
            animatedAngle = toAngle;
111
        else
104
        else
112
            animatedAngleAndEnumeration.first.setValue(0);
105
            animatedAngle.setValue(0);
113
        return;
106
        return;
114
    }
107
    }
115
108
116
    if (fromAngleAndEnumeration.second == SVGMarkerOrientAngle) {
109
    if (fromEnumeration == SVGMarkerOrientAngle) {
117
        // Regular from angle to angle animation, with support for smooth interpolation, and additive and accumulated animation.
110
        // Regular from angle to angle animation, with support for smooth interpolation, and additive and accumulated animation.
118
        animatedAngleAndEnumeration.second = SVGMarkerOrientAngle;
111
        animatedEnumeration = SVGMarkerOrientAngle;
119
112
120
        auto& animatedSVGAngle = animatedAngleAndEnumeration.first;
113
        float animatedAngleValue = animatedAngle.value();
121
        const auto& toAtEndOfDurationSVGAngle = toAtEndOfDurationAngleAndEnumeration.first;
114
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngle.value(), toAngle.value(), toAtEndOfDurationAngle.value(), animatedAngleValue);
122
        float animatedAngle = animatedSVGAngle.value();
115
        animatedAngle.setValue(animatedAngleValue);
123
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngleAndEnumeration.first.value(), toAngleAndEnumeration.first.value(), toAtEndOfDurationSVGAngle.value(), animatedAngle);
124
        animatedSVGAngle.setValue(animatedAngle);
125
        return;
116
        return;
126
    }
117
    }
127
118
128
    // auto, auto-start-reverse, or unknown.
119
    // auto, auto-start-reverse, or unknown.
129
    animatedAngleAndEnumeration.first.setValue(0);
120
    animatedAngle.setValue(0);
130
121
131
    if (fromAngleAndEnumeration.second == SVGMarkerOrientAuto || fromAngleAndEnumeration.second == SVGMarkerOrientAutoStartReverse)
122
    if (fromEnumeration == SVGMarkerOrientAuto || fromEnumeration == SVGMarkerOrientAutoStartReverse)
132
        animatedAngleAndEnumeration.second = fromAngleAndEnumeration.second;
123
        animatedEnumeration = fromEnumeration;
133
    else
124
    else
134
        animatedAngleAndEnumeration.second = SVGMarkerOrientUnknown;
125
        animatedEnumeration = SVGMarkerOrientUnknown;
135
}
126
}
136
127
137
float SVGAnimatedAngleAnimator::calculateDistance(const String& fromString, const String& toString)
128
float SVGAnimatedAngleAnimator::calculateDistance(const String& fromString, const String& toString)
- Source/WebCore/svg/SVGAnimatedBoolean.cpp -8 / +6 lines
Lines 31-44 SVGAnimatedBooleanAnimator::SVGAnimatedB Source/WebCore/svg/SVGAnimatedBoolean.cpp_sec1
31
31
32
std::unique_ptr<SVGAnimatedType> SVGAnimatedBooleanAnimator::constructFromString(const String& string)
32
std::unique_ptr<SVGAnimatedType> SVGAnimatedBooleanAnimator::constructFromString(const String& string)
33
{
33
{
34
    auto animatedType = SVGAnimatedType::createBoolean(std::make_unique<bool>());
34
    return SVGAnimatedType::create(SVGPropertyTraits<bool>::fromString(string));
35
    animatedType->boolean() = (string == "true"); // wat?
36
    return animatedType;
37
}
35
}
38
36
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedBooleanAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
37
std::unique_ptr<SVGAnimatedType> SVGAnimatedBooleanAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
40
{
38
{
41
    return SVGAnimatedType::createBoolean(constructFromBaseValue<SVGAnimatedBoolean>(animatedTypes));
39
    return constructFromBaseValue<SVGAnimatedBoolean>(animatedTypes);
42
}
40
}
43
41
44
void SVGAnimatedBooleanAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
42
void SVGAnimatedBooleanAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 48-54 void SVGAnimatedBooleanAnimator::stopAni Source/WebCore/svg/SVGAnimatedBoolean.cpp_sec2
48
46
49
void SVGAnimatedBooleanAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
47
void SVGAnimatedBooleanAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
50
{
48
{
51
    resetFromBaseValue<SVGAnimatedBoolean>(animatedTypes, type, &SVGAnimatedType::boolean);
49
    resetFromBaseValue<SVGAnimatedBoolean>(animatedTypes, type);
52
}
50
}
53
51
54
void SVGAnimatedBooleanAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
52
void SVGAnimatedBooleanAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 71-79 void SVGAnimatedBooleanAnimator::calcula Source/WebCore/svg/SVGAnimatedBoolean.cpp_sec3
71
    ASSERT(m_animationElement);
69
    ASSERT(m_animationElement);
72
    ASSERT(m_contextElement);
70
    ASSERT(m_contextElement);
73
71
74
    bool fromBoolean = m_animationElement->animationMode() == ToAnimation ? animated->boolean() : from->boolean();
72
    bool fromBoolean = m_animationElement->animationMode() == ToAnimation ? static_cast<bool&>(*animated->values[0]) : static_cast<bool&>(*from->values[0]);
75
    bool toBoolean = to->boolean();
73
    bool toBoolean = static_cast<bool&>(*to->values[0]);
76
    bool& animatedBoolean = animated->boolean();
74
    bool& animatedBoolean = static_cast<bool&>(*animated->values[0]);
77
75
78
    m_animationElement->animateDiscreteType<bool>(percentage, fromBoolean, toBoolean, animatedBoolean);
76
    m_animationElement->animateDiscreteType<bool>(percentage, fromBoolean, toBoolean, animatedBoolean);
79
}
77
}
- Source/WebCore/svg/SVGAnimatedColor.cpp -7 / +7 lines
Lines 33-39 SVGAnimatedColorAnimator::SVGAnimatedCol Source/WebCore/svg/SVGAnimatedColor.cpp_sec1
33
33
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedColorAnimator::constructFromString(const String& string)
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedColorAnimator::constructFromString(const String& string)
35
{
35
{
36
    return SVGAnimatedType::createColor(std::make_unique<Color>(CSSParser::parseColor(string.stripWhiteSpace())));
36
    return SVGAnimatedType::create(SVGPropertyTraits<Color>::fromString(string));
37
}
37
}
38
38
39
void SVGAnimatedColorAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
39
void SVGAnimatedColorAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
Lines 44-51 void SVGAnimatedColorAnimator::addAnimat Source/WebCore/svg/SVGAnimatedColor.cpp_sec2
44
    ASSERT(to->type() == AnimatedColor);
44
    ASSERT(to->type() == AnimatedColor);
45
45
46
    // Ignores any alpha and sets alpha on result to 100% opaque.
46
    // Ignores any alpha and sets alpha on result to 100% opaque.
47
    auto& fromColor = from->color();
47
    auto& fromColor = static_cast<Color&>(*from->values[0]);
48
    auto& toColor = to->color();
48
    auto& toColor = static_cast<Color&>(*to->values[0]);
49
    toColor = { roundAndClampColorChannel(toColor.red() + fromColor.red()),
49
    toColor = { roundAndClampColorChannel(toColor.red() + fromColor.red()),
50
        roundAndClampColorChannel(toColor.green() + fromColor.green()),
50
        roundAndClampColorChannel(toColor.green() + fromColor.green()),
51
        roundAndClampColorChannel(toColor.blue() + fromColor.blue()) };
51
        roundAndClampColorChannel(toColor.blue() + fromColor.blue()) };
Lines 69-76 void SVGAnimatedColorAnimator::calculate Source/WebCore/svg/SVGAnimatedColor.cpp_sec3
69
    ASSERT(m_animationElement);
69
    ASSERT(m_animationElement);
70
    ASSERT(m_contextElement);
70
    ASSERT(m_contextElement);
71
71
72
    Color fromColor = m_animationElement->animationMode() == ToAnimation ? animated->color() : from->color();
72
    Color fromColor = m_animationElement->animationMode() == ToAnimation ? static_cast<Color&>(*animated->values[0]) : static_cast<Color&>(*from->values[0]);
73
    Color toColor = to->color();
73
    Color toColor = static_cast<Color&>(*to->values[0]);
74
74
75
    // Apply CSS inheritance rules.
75
    // Apply CSS inheritance rules.
76
    m_animationElement->adjustForInheritance<Color>(parseColorFromString, m_animationElement->fromPropertyValueType(), fromColor, m_contextElement);
76
    m_animationElement->adjustForInheritance<Color>(parseColorFromString, m_animationElement->fromPropertyValueType(), fromColor, m_contextElement);
Lines 82-89 void SVGAnimatedColorAnimator::calculate Source/WebCore/svg/SVGAnimatedColor.cpp_sec4
82
    if (m_animationElement->toPropertyValueType() == CurrentColorValue)
82
    if (m_animationElement->toPropertyValueType() == CurrentColorValue)
83
        toColor = currentColor(*m_contextElement);
83
        toColor = currentColor(*m_contextElement);
84
84
85
    auto& toAtEndOfDurationColor = toAtEndOfDuration->color();
85
    auto& toAtEndOfDurationColor = static_cast<Color&>(*toAtEndOfDuration->values[0]);
86
    auto& animatedColor = animated->color();
86
    auto& animatedColor = static_cast<Color&>(*animated->values[0]);
87
87
88
    // FIXME: ExtendedColor - this will need to handle blending between colors in different color spaces,
88
    // FIXME: ExtendedColor - this will need to handle blending between colors in different color spaces,
89
    // as well as work with non [0-255] Colors.
89
    // as well as work with non [0-255] Colors.
- Source/WebCore/svg/SVGAnimatedEnumeration.cpp -8 / +6 lines
Lines 109-122 SVGAnimatedEnumerationAnimator::SVGAnima Source/WebCore/svg/SVGAnimatedEnumeration.cpp_sec1
109
std::unique_ptr<SVGAnimatedType> SVGAnimatedEnumerationAnimator::constructFromString(const String& string)
109
std::unique_ptr<SVGAnimatedType> SVGAnimatedEnumerationAnimator::constructFromString(const String& string)
110
{
110
{
111
    ASSERT(m_animationElement);
111
    ASSERT(m_animationElement);
112
    auto animatedType = SVGAnimatedType::createEnumeration(std::make_unique<unsigned>());
112
    return SVGAnimatedType::create(enumerationValueForTargetAttribute(m_animationElement->targetElement(), m_animationElement->attributeName(), string));
113
    animatedType->enumeration() = enumerationValueForTargetAttribute(m_animationElement->targetElement(), m_animationElement->attributeName(), string);
114
    return animatedType;
115
}
113
}
116
114
117
std::unique_ptr<SVGAnimatedType> SVGAnimatedEnumerationAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
115
std::unique_ptr<SVGAnimatedType> SVGAnimatedEnumerationAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
118
{
116
{
119
    return SVGAnimatedType::createEnumeration(constructFromBaseValue<SVGAnimatedEnumeration>(animatedTypes));
117
    return constructFromBaseValue<SVGAnimatedEnumeration>(animatedTypes);
120
}
118
}
121
119
122
void SVGAnimatedEnumerationAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
120
void SVGAnimatedEnumerationAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 126-132 void SVGAnimatedEnumerationAnimator::sto Source/WebCore/svg/SVGAnimatedEnumeration.cpp_sec2
126
124
127
void SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
125
void SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
128
{
126
{
129
    resetFromBaseValue<SVGAnimatedEnumeration>(animatedTypes, type, &SVGAnimatedType::enumeration);
127
    resetFromBaseValue<SVGAnimatedEnumeration>(animatedTypes, type);
130
}
128
}
131
129
132
void SVGAnimatedEnumerationAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
130
void SVGAnimatedEnumerationAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 149-157 void SVGAnimatedEnumerationAnimator::cal Source/WebCore/svg/SVGAnimatedEnumeration.cpp_sec3
149
    ASSERT(m_animationElement);
147
    ASSERT(m_animationElement);
150
    ASSERT(m_contextElement);
148
    ASSERT(m_contextElement);
151
149
152
    unsigned fromEnumeration = m_animationElement->animationMode() == ToAnimation ? animated->enumeration() : from->enumeration();
150
    unsigned fromEnumeration = m_animationElement->animationMode() == ToAnimation ? static_cast<unsigned&>(*animated->values[0]) : static_cast<unsigned&>(*from->values[0]);
153
    unsigned toEnumeration = to->enumeration();
151
    unsigned toEnumeration = static_cast<unsigned&>(*to->values[0]);
154
    unsigned& animatedEnumeration = animated->enumeration();
152
    unsigned& animatedEnumeration = static_cast<unsigned&>(*animated->values[0]);
155
153
156
    m_animationElement->animateDiscreteType<unsigned>(percentage, fromEnumeration, toEnumeration, animatedEnumeration);
154
    m_animationElement->animateDiscreteType<unsigned>(percentage, fromEnumeration, toEnumeration, animatedEnumeration);
157
}
155
}
- Source/WebCore/svg/SVGAnimatedInteger.cpp -10 / +8 lines
Lines 33-46 SVGAnimatedIntegerAnimator::SVGAnimatedI Source/WebCore/svg/SVGAnimatedInteger.cpp_sec1
33
33
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerAnimator::constructFromString(const String& string)
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerAnimator::constructFromString(const String& string)
35
{
35
{
36
    auto animatedType = SVGAnimatedType::createInteger(std::make_unique<int>());
36
    return SVGAnimatedType::create(SVGPropertyTraits<int>::fromString(string));
37
    animatedType->integer() = string.toIntStrict();
38
    return animatedType;
39
}
37
}
40
38
41
std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
42
{
40
{
43
    return SVGAnimatedType::createInteger(constructFromBaseValue<SVGAnimatedInteger>(animatedTypes));
41
    return constructFromBaseValue<SVGAnimatedInteger>(animatedTypes);
44
}
42
}
45
43
46
void SVGAnimatedIntegerAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
44
void SVGAnimatedIntegerAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 50-56 void SVGAnimatedIntegerAnimator::stopAni Source/WebCore/svg/SVGAnimatedInteger.cpp_sec2
50
48
51
void SVGAnimatedIntegerAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
49
void SVGAnimatedIntegerAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
52
{
50
{
53
    resetFromBaseValue<SVGAnimatedInteger>(animatedTypes, type, &SVGAnimatedType::integer);
51
    resetFromBaseValue<SVGAnimatedInteger>(animatedTypes, type);
54
}
52
}
55
53
56
void SVGAnimatedIntegerAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
54
void SVGAnimatedIntegerAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 68-74 void SVGAnimatedIntegerAnimator::addAnim Source/WebCore/svg/SVGAnimatedInteger.cpp_sec3
68
    ASSERT(from->type() == AnimatedInteger);
66
    ASSERT(from->type() == AnimatedInteger);
69
    ASSERT(from->type() == to->type());
67
    ASSERT(from->type() == to->type());
70
68
71
    to->integer() += from->integer();
69
    static_cast<int&>(*to->values[0]) += static_cast<int&>(*from->values[0]);
72
}
70
}
73
71
74
void SVGAnimatedIntegerAnimator::calculateAnimatedInteger(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, int fromInteger, int toInteger, int toAtEndOfDurationInteger, int& animatedInteger)
72
void SVGAnimatedIntegerAnimator::calculateAnimatedInteger(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, int fromInteger, int toInteger, int toAtEndOfDurationInteger, int& animatedInteger)
Lines 83-92 void SVGAnimatedIntegerAnimator::calcula Source/WebCore/svg/SVGAnimatedInteger.cpp_sec4
83
    ASSERT(m_animationElement);
81
    ASSERT(m_animationElement);
84
    ASSERT(m_contextElement);
82
    ASSERT(m_contextElement);
85
83
86
    int fromInteger = m_animationElement->animationMode() == ToAnimation ? animated->integer() : from->integer();
84
    int fromInteger = m_animationElement->animationMode() == ToAnimation ? static_cast<int&>(*animated->values[0]) : static_cast<int&>(*from->values[0]);
87
    int toInteger = to->integer();
85
    int toInteger = static_cast<int&>(*to->values[0]);
88
    int toAtEndOfDurationInteger = toAtEndOfDuration->integer();
86
    int toAtEndOfDurationInteger = static_cast<int&>(*toAtEndOfDuration->values[0]);
89
    int& animatedInteger = animated->integer();
87
    int& animatedInteger = static_cast<int&>(*animated->values[0]);
90
88
91
    calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromInteger, toInteger, toAtEndOfDurationInteger, animatedInteger);
89
    calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromInteger, toInteger, toAtEndOfDurationInteger, animatedInteger);
92
}
90
}
- Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp -25 / +15 lines
Lines 33-55 SVGAnimatedIntegerOptionalIntegerAnimato Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp_sec1
33
33
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString(const String& string)
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString(const String& string)
35
{
35
{
36
    auto animatedType = SVGAnimatedType::createIntegerOptionalInteger(std::make_unique<std::pair<int, int>>());
36
    return SVGAnimatedType::create(SVGPropertyTraits<std::pair<int, int>>::fromString(string));
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;
48
}
37
}
49
38
50
std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
51
{
40
{
52
    return SVGAnimatedType::createIntegerOptionalInteger(constructFromBaseValues<SVGAnimatedInteger, SVGAnimatedInteger>(animatedTypes));
41
    return constructFromBaseValues<SVGAnimatedInteger, SVGAnimatedInteger>(animatedTypes);
53
}
42
}
54
43
55
void SVGAnimatedIntegerOptionalIntegerAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
44
void SVGAnimatedIntegerOptionalIntegerAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 59-65 void SVGAnimatedIntegerOptionalIntegerAn Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp_sec2
59
48
60
void SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
49
void SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
61
{
50
{
62
    resetFromBaseValues<SVGAnimatedInteger, SVGAnimatedInteger>(animatedTypes, type, &SVGAnimatedType::integerOptionalInteger);
51
    resetFromBaseValues<SVGAnimatedInteger, SVGAnimatedInteger>(animatedTypes, type);
63
}
52
}
64
53
65
void SVGAnimatedIntegerOptionalIntegerAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
54
void SVGAnimatedIntegerOptionalIntegerAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 77-87 void SVGAnimatedIntegerOptionalIntegerAn Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp_sec3
77
    ASSERT(from->type() == AnimatedIntegerOptionalInteger);
66
    ASSERT(from->type() == AnimatedIntegerOptionalInteger);
78
    ASSERT(from->type() == to->type());
67
    ASSERT(from->type() == to->type());
79
68
80
    const std::pair<int, int>& fromIntegerPair = from->integerOptionalInteger();
69
    static_cast<int&>(*to->values[0]) += static_cast<int&>(*from->values[0]);
81
    std::pair<int, int>& toIntegerPair = to->integerOptionalInteger();
70
    static_cast<int&>(*to->values[1]) += static_cast<int&>(*from->values[1]);
82
83
    toIntegerPair.first += fromIntegerPair.first;
84
    toIntegerPair.second += fromIntegerPair.second;
85
}
71
}
86
72
87
void SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
73
void SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
Lines 89-101 void SVGAnimatedIntegerOptionalIntegerAn Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp_sec4
89
    ASSERT(m_animationElement);
75
    ASSERT(m_animationElement);
90
    ASSERT(m_contextElement);
76
    ASSERT(m_contextElement);
91
77
92
    const std::pair<int, int>& fromIntegerPair = m_animationElement->animationMode() == ToAnimation ? animated->integerOptionalInteger() : from->integerOptionalInteger();
78
    const int& formFirst = m_animationElement->animationMode() == ToAnimation ? static_cast<int&>(*animated->values[0]) : static_cast<int&>(*from->values[0]);
93
    const std::pair<int, int>& toIntegerPair = to->integerOptionalInteger();
79
    const int& formSecond = m_animationElement->animationMode() == ToAnimation ? static_cast<int&>(*animated->values[1]) : static_cast<int&>(*from->values[1]);
94
    const std::pair<int, int>& toAtEndOfDurationIntegerPair = toAtEndOfDuration->integerOptionalInteger();
80
    const int& toFirst = static_cast<int&>(*to->values[0]);
95
    std::pair<int, int>& animatedIntegerPair = animated->integerOptionalInteger();
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]);
96
86
97
    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.first, toIntegerPair.first, toAtEndOfDurationIntegerPair.first, animatedIntegerPair.first);
87
    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, formFirst, toFirst, toAtEndOfDurationFirst, animatedFirst);
98
    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.second, toIntegerPair.second, toAtEndOfDurationIntegerPair.second, animatedIntegerPair.second);
88
    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, formSecond, toSecond, toAtEndOfDurationSecond, animatedSecond);
99
}
89
}
100
90
101
float SVGAnimatedIntegerOptionalIntegerAnimator::calculateDistance(const String&, const String&)
91
float SVGAnimatedIntegerOptionalIntegerAnimator::calculateDistance(const String&, const String&)
- Source/WebCore/svg/SVGAnimatedLength.cpp -9 / +9 lines
Lines 33-44 SVGAnimatedLengthAnimator::SVGAnimatedLe Source/WebCore/svg/SVGAnimatedLength.cpp_sec1
33
33
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string)
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string)
35
{
35
{
36
    return SVGAnimatedType::createLength(std::make_unique<SVGLengthValue>(m_lengthMode, string));
36
    return SVGAnimatedType::create(SVGLengthValue(m_lengthMode, string));
37
}
37
}
38
38
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
40
{
40
{
41
    return SVGAnimatedType::createLength(constructFromBaseValue<SVGAnimatedLength>(animatedTypes));
41
    return constructFromBaseValue<SVGAnimatedLength>(animatedTypes);
42
}
42
}
43
43
44
void SVGAnimatedLengthAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
44
void SVGAnimatedLengthAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 48-54 void SVGAnimatedLengthAnimator::stopAnim Source/WebCore/svg/SVGAnimatedLength.cpp_sec2
48
48
49
void SVGAnimatedLengthAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
49
void SVGAnimatedLengthAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
50
{
50
{
51
    resetFromBaseValue<SVGAnimatedLength>(animatedTypes, type, &SVGAnimatedType::length);
51
    resetFromBaseValue<SVGAnimatedLength>(animatedTypes, type);
52
}
52
}
53
53
54
void SVGAnimatedLengthAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
54
void SVGAnimatedLengthAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 67-74 void SVGAnimatedLengthAnimator::addAnima Source/WebCore/svg/SVGAnimatedLength.cpp_sec3
67
    ASSERT(from->type() == to->type());
67
    ASSERT(from->type() == to->type());
68
68
69
    SVGLengthContext lengthContext(m_contextElement);
69
    SVGLengthContext lengthContext(m_contextElement);
70
    const auto& fromLength = from->length();
70
    const auto& fromLength = static_cast<SVGLengthValue&>(*from->values[0]);
71
    auto& toLength = to->length();
71
    auto& toLength = static_cast<SVGLengthValue&>(*to->values[0]);
72
72
73
    toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext);
73
    toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext);
74
}
74
}
Lines 85-94 void SVGAnimatedLengthAnimator::calculat Source/WebCore/svg/SVGAnimatedLength.cpp_sec4
85
    ASSERT(m_animationElement);
85
    ASSERT(m_animationElement);
86
    ASSERT(m_contextElement);
86
    ASSERT(m_contextElement);
87
87
88
    auto fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->length() : from->length();
88
    auto fromSVGLength = m_animationElement->animationMode() == ToAnimation ? static_cast<SVGLengthValue&>(*animated->values[0]) : static_cast<SVGLengthValue&>(*from->values[0]);
89
    auto toSVGLength = to->length();
89
    auto toSVGLength = static_cast<SVGLengthValue&>(*to->values[0]);
90
    const auto& toAtEndOfDurationSVGLength = toAtEndOfDuration->length();
90
    const auto& toAtEndOfDurationSVGLength = static_cast<SVGLengthValue&>(*toAtEndOfDuration->values[0]);
91
    auto& animatedSVGLength = animated->length();
91
    auto& animatedSVGLength = static_cast<SVGLengthValue&>(*animated->values[0]);
92
92
93
    // Apply CSS inheritance rules.
93
    // Apply CSS inheritance rules.
94
    m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
94
    m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
- Source/WebCore/svg/SVGAnimatedLengthList.cpp -19 / +17 lines
Lines 33-46 SVGAnimatedLengthListAnimator::SVGAnimat Source/WebCore/svg/SVGAnimatedLengthList.cpp_sec1
33
33
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::constructFromString(const String& string)
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::constructFromString(const String& string)
35
{
35
{
36
    auto animatedType = SVGAnimatedType::createLengthList(std::make_unique<SVGLengthListValues>());
36
    return SVGAnimatedType::create(SVGPropertyTraits<SVGLengthListValues>::fromString(string, m_lengthMode));
37
    animatedType->lengthList().parse(string, m_lengthMode);
38
    return animatedType;
39
}
37
}
40
38
41
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
42
{
40
{
43
    return SVGAnimatedType::createLengthList(constructFromBaseValue<SVGAnimatedLengthList>(animatedTypes));
41
    return constructFromBaseValue<SVGAnimatedLengthList>(animatedTypes);
44
}
42
}
45
43
46
void SVGAnimatedLengthListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
44
void SVGAnimatedLengthListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 50-56 void SVGAnimatedLengthListAnimator::stop Source/WebCore/svg/SVGAnimatedLengthList.cpp_sec2
50
48
51
void SVGAnimatedLengthListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
49
void SVGAnimatedLengthListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
52
{
50
{
53
    resetFromBaseValue<SVGAnimatedLengthList>(animatedTypes, type, &SVGAnimatedType::lengthList);
51
    resetFromBaseValue<SVGAnimatedLengthList>(animatedTypes, type);
54
}
52
}
55
53
56
void SVGAnimatedLengthListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
54
void SVGAnimatedLengthListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 68-75 void SVGAnimatedLengthListAnimator::addA Source/WebCore/svg/SVGAnimatedLengthList.cpp_sec3
68
    ASSERT(from->type() == AnimatedLengthList);
66
    ASSERT(from->type() == AnimatedLengthList);
69
    ASSERT(from->type() == to->type());
67
    ASSERT(from->type() == to->type());
70
68
71
    const auto& fromLengthList = from->lengthList();
69
    const auto& fromLengthList = static_cast<SVGLengthListValues&>(*from->values[0]);
72
    auto& toLengthList = to->lengthList();
70
    auto& toLengthList = static_cast<SVGLengthListValues&>(*to->values[0]);
73
71
74
    unsigned fromLengthListSize = fromLengthList.size();
72
    unsigned fromLengthListSize = fromLengthList.size();
75
    if (!fromLengthListSize || fromLengthListSize != toLengthList.size())
73
    if (!fromLengthListSize || fromLengthListSize != toLengthList.size())
Lines 77-83 void SVGAnimatedLengthListAnimator::addA Source/WebCore/svg/SVGAnimatedLengthList.cpp_sec4
77
75
78
    SVGLengthContext lengthContext(m_contextElement);
76
    SVGLengthContext lengthContext(m_contextElement);
79
    for (unsigned i = 0; i < fromLengthListSize; ++i)
77
    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);
81
}
79
}
82
80
83
static SVGLengthListValues parseLengthListFromString(SVGAnimationElement* animationElement, const String& string)
81
static SVGLengthListValues parseLengthListFromString(SVGAnimationElement* animationElement, const String& string)
Lines 92-101 void SVGAnimatedLengthListAnimator::calc Source/WebCore/svg/SVGAnimatedLengthList.cpp_sec5
92
    ASSERT(m_animationElement);
90
    ASSERT(m_animationElement);
93
    ASSERT(m_contextElement);
91
    ASSERT(m_contextElement);
94
92
95
    auto fromLengthList = m_animationElement->animationMode() == ToAnimation ? animated->lengthList() : from->lengthList();
93
    auto fromLengthList = m_animationElement->animationMode() == ToAnimation ? static_cast<SVGLengthListValues&>(*animated->values[0]) : static_cast<SVGLengthListValues&>(*from->values[0]);
96
    auto toLengthList = to->lengthList();
94
    auto toLengthList = static_cast<SVGLengthListValues&>(*to->values[0]);
97
    const auto& toAtEndOfDurationLengthList = toAtEndOfDuration->lengthList();
95
    const auto& toAtEndOfDurationLengthList = static_cast<SVGLengthListValues&>(*toAtEndOfDuration->values[0]);
98
    auto& animatedLengthList = animated->lengthList();
96
    auto& animatedLengthList = static_cast<SVGLengthListValues&>(*animated->values[0]);
99
97
100
    // Apply CSS inheritance rules.
98
    // Apply CSS inheritance rules.
101
    m_animationElement->adjustForInheritance<SVGLengthListValues>(parseLengthListFromString, m_animationElement->fromPropertyValueType(), fromLengthList, m_contextElement);
99
    m_animationElement->adjustForInheritance<SVGLengthListValues>(parseLengthListFromString, m_animationElement->fromPropertyValueType(), fromLengthList, m_contextElement);
Lines 110-127 void SVGAnimatedLengthListAnimator::calc Source/WebCore/svg/SVGAnimatedLengthList.cpp_sec6
110
108
111
    SVGLengthContext lengthContext(m_contextElement);
109
    SVGLengthContext lengthContext(m_contextElement);
112
    for (unsigned i = 0; i < toLengthListSize; ++i) {
110
    for (unsigned i = 0; i < toLengthListSize; ++i) {
113
        float animatedNumber = animatedLengthList[i].value(lengthContext);
111
        float animatedNumber = animatedLengthList.propertyAt(i).value(lengthContext);
114
        SVGLengthType unitType = toLengthList[i].unitType();
112
        SVGLengthType unitType = toLengthList.propertyAt(i).unitType();
115
        float effectiveFrom = 0;
113
        float effectiveFrom = 0;
116
        if (fromLengthListSize) {
114
        if (fromLengthListSize) {
117
            if (percentage < 0.5)
115
            if (percentage < 0.5)
118
                unitType = fromLengthList[i].unitType();
116
                unitType = fromLengthList.propertyAt(i).unitType();
119
            effectiveFrom = fromLengthList[i].value(lengthContext);
117
            effectiveFrom = fromLengthList.propertyAt(i).value(lengthContext);
120
        }
118
        }
121
        float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurationLengthList[i].value(lengthContext) : 0;
119
        float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurationLengthList.propertyAt(i).value(lengthContext) : 0;
122
120
123
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toLengthList[i].value(lengthContext), effectiveToAtEnd, animatedNumber);
121
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toLengthList.propertyAt(i).value(lengthContext), effectiveToAtEnd, animatedNumber);
124
        animatedLengthList[i].setValue(lengthContext, animatedNumber, m_lengthMode, unitType);
122
        animatedLengthList.propertyAt(i).setValue(lengthContext, animatedNumber, m_lengthMode, unitType);
125
    }
123
    }
126
}
124
}
127
125
- Source/WebCore/svg/SVGAnimatedNumber.cpp -15 / +9 lines
Lines 32-47 SVGAnimatedNumberAnimator::SVGAnimatedNu Source/WebCore/svg/SVGAnimatedNumber.cpp_sec1
32
32
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberAnimator::constructFromString(const String& string)
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberAnimator::constructFromString(const String& string)
34
{
34
{
35
    auto animatedType = SVGAnimatedType::createNumber(std::make_unique<float>());
35
    return SVGAnimatedType::create(SVGPropertyTraits<float>::fromString(string));
36
    float& animatedNumber = animatedType->number();
37
    if (!parseNumberFromString(string, animatedNumber))
38
        animatedNumber = 0;
39
    return animatedType;
40
}
36
}
41
37
42
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
38
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
43
{
39
{
44
    return SVGAnimatedType::createNumber(constructFromBaseValue<SVGAnimatedNumber>(animatedTypes));
40
    return constructFromBaseValue<SVGAnimatedNumber>(animatedTypes);
45
}
41
}
46
42
47
void SVGAnimatedNumberAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
43
void SVGAnimatedNumberAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 51-57 void SVGAnimatedNumberAnimator::stopAnim Source/WebCore/svg/SVGAnimatedNumber.cpp_sec2
51
47
52
void SVGAnimatedNumberAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
48
void SVGAnimatedNumberAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
53
{
49
{
54
    resetFromBaseValue<SVGAnimatedNumber>(animatedTypes, type, &SVGAnimatedType::number);
50
    resetFromBaseValue<SVGAnimatedNumber>(animatedTypes, type);
55
}
51
}
56
52
57
void SVGAnimatedNumberAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
53
void SVGAnimatedNumberAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 69-82 void SVGAnimatedNumberAnimator::addAnima Source/WebCore/svg/SVGAnimatedNumber.cpp_sec3
69
    ASSERT(from->type() == AnimatedNumber);
65
    ASSERT(from->type() == AnimatedNumber);
70
    ASSERT(from->type() == to->type());
66
    ASSERT(from->type() == to->type());
71
67
72
    to->number() += from->number();
68
    static_cast<float&>(*to->values[0]) += static_cast<float&>(*from->values[0]);
73
}
69
}
74
70
75
static float parseNumberFromString(SVGAnimationElement*, const String& string)
71
static float parseNumberFromString(SVGAnimationElement*, const String& string)
76
{
72
{
77
    float number = 0;
73
    return SVGPropertyTraits<float>::fromString(string);
78
    parseNumberFromString(string, number);
79
    return number;
80
}
74
}
81
75
82
void SVGAnimatedNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
76
void SVGAnimatedNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
Lines 84-93 void SVGAnimatedNumberAnimator::calculat Source/WebCore/svg/SVGAnimatedNumber.cpp_sec4
84
    ASSERT(m_animationElement);
78
    ASSERT(m_animationElement);
85
    ASSERT(m_contextElement);
79
    ASSERT(m_contextElement);
86
80
87
    float fromNumber = m_animationElement->animationMode() == ToAnimation ? animated->number() : from->number();
81
    float fromNumber = m_animationElement->animationMode() == ToAnimation ? static_cast<float&>(*animated->values[0]) : static_cast<float&>(*from->values[0]);
88
    float toNumber = to->number();
82
    float toNumber = static_cast<float&>(*to->values[0]);
89
    float toAtEndOfDurationNumber = toAtEndOfDuration->number();
83
    float toAtEndOfDurationNumber = static_cast<float&>(*toAtEndOfDuration->values[0]);
90
    float& animatedNumber = animated->number();
84
    float& animatedNumber = static_cast<float&>(*animated->values[0]);
91
85
92
    // Apply CSS inheritance rules.
86
    // Apply CSS inheritance rules.
93
    m_animationElement->adjustForInheritance<float>(parseNumberFromString, m_animationElement->fromPropertyValueType(), fromNumber, m_contextElement);
87
    m_animationElement->adjustForInheritance<float>(parseNumberFromString, m_animationElement->fromPropertyValueType(), fromNumber, m_contextElement);
- Source/WebCore/svg/SVGAnimatedNumberList.cpp -15 / +13 lines
Lines 32-45 SVGAnimatedNumberListAnimator::SVGAnimat Source/WebCore/svg/SVGAnimatedNumberList.cpp_sec1
32
32
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::constructFromString(const String& string)
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::constructFromString(const String& string)
34
{
34
{
35
    auto animatedType = SVGAnimatedType::createNumberList(std::make_unique<SVGNumberListValues>());
35
    return SVGAnimatedType::create(SVGPropertyTraits<SVGNumberListValues>::fromString(string));
36
    animatedType->numberList().parse(string);
37
    return animatedType;
38
}
36
}
39
37
40
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
38
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
41
{
39
{
42
    return SVGAnimatedType::createNumberList(constructFromBaseValue<SVGAnimatedNumberList>(animatedTypes));
40
    return constructFromBaseValue<SVGAnimatedNumberList>(animatedTypes);
43
}
41
}
44
42
45
void SVGAnimatedNumberListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
43
void SVGAnimatedNumberListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 49-55 void SVGAnimatedNumberListAnimator::stop Source/WebCore/svg/SVGAnimatedNumberList.cpp_sec2
49
47
50
void SVGAnimatedNumberListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
48
void SVGAnimatedNumberListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
51
{
49
{
52
    resetFromBaseValue<SVGAnimatedNumberList>(animatedTypes, type, &SVGAnimatedType::numberList);
50
    resetFromBaseValue<SVGAnimatedNumberList>(animatedTypes, type);
53
}
51
}
54
52
55
void SVGAnimatedNumberListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
53
void SVGAnimatedNumberListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 67-91 void SVGAnimatedNumberListAnimator::addA Source/WebCore/svg/SVGAnimatedNumberList.cpp_sec3
67
    ASSERT(from->type() == AnimatedNumberList);
65
    ASSERT(from->type() == AnimatedNumberList);
68
    ASSERT(from->type() == to->type());
66
    ASSERT(from->type() == to->type());
69
67
70
    const auto& fromNumberList = from->numberList();
68
    const auto& fromNumberList = static_cast<SVGNumberListValues&>(*from->values[0]);
71
    auto& toNumberList = to->numberList();
69
    auto& toNumberList = static_cast<SVGNumberListValues&>(*to->values[0]);
72
70
73
    unsigned fromNumberListSize = fromNumberList.size();
71
    unsigned fromNumberListSize = fromNumberList.size();
74
    if (!fromNumberListSize || fromNumberListSize != toNumberList.size())
72
    if (!fromNumberListSize || fromNumberListSize != toNumberList.size())
75
        return;
73
        return;
76
74
77
    for (unsigned i = 0; i < fromNumberListSize; ++i)
75
    for (unsigned i = 0; i < fromNumberListSize; ++i)
78
        toNumberList[i] += fromNumberList[i];
76
        static_cast<float&>(*toNumberList[i]) += static_cast<float&>(*fromNumberList[i]);
79
}
77
}
80
78
81
void SVGAnimatedNumberListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
79
void SVGAnimatedNumberListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
82
{
80
{
83
    ASSERT(m_animationElement);
81
    ASSERT(m_animationElement);
84
82
85
    const auto& fromNumberList = m_animationElement->animationMode() == ToAnimation ? animated->numberList() : from->numberList();
83
    const auto& fromNumberList = m_animationElement->animationMode() == ToAnimation ? static_cast<SVGNumberListValues&>(*animated->values[0]) : static_cast<SVGNumberListValues&>(*from->values[0]);
86
    const auto& toNumberList = to->numberList();
84
    const auto& toNumberList = static_cast<SVGNumberListValues&>(*to->values[0]);
87
    const auto& toAtEndOfDurationNumberList = toAtEndOfDuration->numberList();
85
    const auto& toAtEndOfDurationNumberList = static_cast<SVGNumberListValues&>(*toAtEndOfDuration->values[0]);
88
    auto& animatedNumberList = animated->numberList();
86
    auto& animatedNumberList = static_cast<SVGNumberListValues&>(*animated->values[0]);
89
    if (!m_animationElement->adjustFromToListValues<SVGNumberListValues>(fromNumberList, toNumberList, animatedNumberList, percentage))
87
    if (!m_animationElement->adjustFromToListValues<SVGNumberListValues>(fromNumberList, toNumberList, animatedNumberList, percentage))
90
        return;
88
        return;
91
89
Lines 94-102 void SVGAnimatedNumberListAnimator::calc Source/WebCore/svg/SVGAnimatedNumberList.cpp_sec4
94
    unsigned toAtEndOfDurationSize = toAtEndOfDurationNumberList.size();
92
    unsigned toAtEndOfDurationSize = toAtEndOfDurationNumberList.size();
95
93
96
    for (unsigned i = 0; i < toNumberListSize; ++i) {
94
    for (unsigned i = 0; i < toNumberListSize; ++i) {
97
        float effectiveFrom = fromNumberListSize ? fromNumberList[i] : 0;
95
        float effectiveFrom = fromNumberListSize ? fromNumberList.propertyAt(i) : 0;
98
        float effectiveToAtEnd = i < toAtEndOfDurationSize ? toAtEndOfDurationNumberList[i] : 0;
96
        float effectiveToAtEnd = i < toAtEndOfDurationSize ? toAtEndOfDurationNumberList.propertyAt(i) : 0;
99
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toNumberList[i], effectiveToAtEnd, animatedNumberList[i]);
97
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toNumberList.propertyAt(i), effectiveToAtEnd, animatedNumberList.propertyAt(i));
100
    }
98
    }
101
}
99
}
102
100
- Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp -20 / +15 lines
Lines 33-50 SVGAnimatedNumberOptionalNumberAnimator: Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp_sec1
33
33
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberOptionalNumberAnimator::constructFromString(const String& string)
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberOptionalNumberAnimator::constructFromString(const String& string)
35
{
35
{
36
    auto animatedType = SVGAnimatedType::createNumberOptionalNumber(std::make_unique<std::pair<float, float>>());
36
    return SVGAnimatedType::create(SVGPropertyTraits<std::pair<float, float>>::fromString(string));
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;
43
}
37
}
44
38
45
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
46
{
40
{
47
    return SVGAnimatedType::createNumberOptionalNumber(constructFromBaseValues<SVGAnimatedNumber, SVGAnimatedNumber>(animatedTypes));
41
    return constructFromBaseValues<SVGAnimatedNumber, SVGAnimatedNumber>(animatedTypes);
48
}
42
}
49
43
50
void SVGAnimatedNumberOptionalNumberAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
44
void SVGAnimatedNumberOptionalNumberAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 54-60 void SVGAnimatedNumberOptionalNumberAnim Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp_sec2
54
48
55
void SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
49
void SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
56
{
50
{
57
    resetFromBaseValues<SVGAnimatedNumber, SVGAnimatedNumber>(animatedTypes, type, &SVGAnimatedType::numberOptionalNumber);
51
    resetFromBaseValues<SVGAnimatedNumber, SVGAnimatedNumber>(animatedTypes, type);
58
}
52
}
59
53
60
void SVGAnimatedNumberOptionalNumberAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
54
void SVGAnimatedNumberOptionalNumberAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 72-82 void SVGAnimatedNumberOptionalNumberAnim Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp_sec3
72
    ASSERT(from->type() == AnimatedNumberOptionalNumber);
66
    ASSERT(from->type() == AnimatedNumberOptionalNumber);
73
    ASSERT(from->type() == to->type());
67
    ASSERT(from->type() == to->type());
74
68
75
    const std::pair<float, float>& fromNumberPair = from->numberOptionalNumber();
69
    static_cast<float&>(*to->values[0]) += static_cast<float&>(*from->values[0]);
76
    std::pair<float, float>& toNumberPair = to->numberOptionalNumber();
70
    static_cast<float&>(*to->values[1]) += static_cast<float&>(*from->values[1]);
77
78
    toNumberPair.first += fromNumberPair.first;
79
    toNumberPair.second += fromNumberPair.second;
80
}
71
}
81
72
82
void SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
73
void SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
Lines 84-96 void SVGAnimatedNumberOptionalNumberAnim Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp_sec4
84
    ASSERT(m_animationElement);
75
    ASSERT(m_animationElement);
85
    ASSERT(m_contextElement);
76
    ASSERT(m_contextElement);
86
77
87
    const std::pair<float, float>& fromNumberPair = m_animationElement->animationMode() == ToAnimation ? animated->numberOptionalNumber() :  from->numberOptionalNumber();
78
    const auto& formFirst = m_animationElement->animationMode() == ToAnimation ? static_cast<float&>(*animated->values[0]) : static_cast<float&>(*from->values[0]);
88
    const std::pair<float, float>& toNumberPair = to->numberOptionalNumber();
79
    const auto& formSecond = m_animationElement->animationMode() == ToAnimation ? static_cast<float&>(*animated->values[1]) : static_cast<float&>(*from->values[1]);
89
    const std::pair<float, float>& toAtEndOfDurationNumberPair = toAtEndOfDuration->numberOptionalNumber();
80
    const auto& toFirst = static_cast<float&>(*to->values[0]);
90
    std::pair<float, float>& animatedNumberPair = animated->numberOptionalNumber();
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]);
91
86
92
    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.first, toNumberPair.first, toAtEndOfDurationNumberPair.first, animatedNumberPair.first);
87
    m_animationElement->animateAdditiveNumber(percentage, repeatCount, formFirst, toFirst, toAtEndOfDurationFirst, animatedFirst);
93
    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.second, toNumberPair.second, toAtEndOfDurationNumberPair.second, animatedNumberPair.second);
88
    m_animationElement->animateAdditiveNumber(percentage, repeatCount, formSecond, toSecond, toAtEndOfDurationSecond, animatedSecond);
94
}
89
}
95
90
96
float SVGAnimatedNumberOptionalNumberAnimator::calculateDistance(const String&, const String&)
91
float SVGAnimatedNumberOptionalNumberAnimator::calculateDistance(const String&, const String&)
- Source/WebCore/svg/SVGAnimatedPath.cpp -32 / +26 lines
Lines 22-28 Source/WebCore/svg/SVGAnimatedPath.cpp_sec1
22
22
23
#include "SVGAnimateElementBase.h"
23
#include "SVGAnimateElementBase.h"
24
#include "SVGAnimatedPathSegListPropertyTearOff.h"
24
#include "SVGAnimatedPathSegListPropertyTearOff.h"
25
#include "SVGPathUtilities.h"
26
25
27
namespace WebCore {
26
namespace WebCore {
28
27
Lines 33-41 SVGAnimatedPathAnimator::SVGAnimatedPath Source/WebCore/svg/SVGAnimatedPath.cpp_sec2
33
32
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedPathAnimator::constructFromString(const String& string)
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedPathAnimator::constructFromString(const String& string)
35
{
34
{
36
    auto byteStream = std::make_unique<SVGPathByteStream>();
35
    return SVGAnimatedType::create(SVGPropertyTraits<SVGPathByteStream>::fromString(string));
37
    buildSVGPathByteStreamFromString(string, *byteStream, UnalteredParsing);
38
    return SVGAnimatedType::createPath(WTFMove(byteStream));
39
}
36
}
40
37
41
std::unique_ptr<SVGAnimatedType> SVGAnimatedPathAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
38
std::unique_ptr<SVGAnimatedType> SVGAnimatedPathAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 43-51 std::unique_ptr<SVGAnimatedType> SVGAnim Source/WebCore/svg/SVGAnimatedPath.cpp_sec3
43
    ASSERT(animatedTypes.size() >= 1);
40
    ASSERT(animatedTypes.size() >= 1);
44
41
45
    // Build initial path byte stream.
42
    // Build initial path byte stream.
46
    auto byteStream = std::make_unique<SVGPathByteStream>();
43
    auto animatedType = SVGAnimatedType::create<SVGPathByteStream>();
47
    resetAnimValToBaseVal(animatedTypes, byteStream.get());
44
    resetAnimValToBaseVal(animatedTypes, *animatedType);
48
    return SVGAnimatedType::createPath(WTFMove(byteStream));
45
    return animatedType;
49
}
46
}
50
47
51
void SVGAnimatedPathAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
48
void SVGAnimatedPathAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 58-64 void SVGAnimatedPathAnimator::resetAnimV Source/WebCore/svg/SVGAnimatedPath.cpp_sec4
58
    RefPtr<SVGAnimatedPathSegListPropertyTearOff> property = castAnimatedPropertyToActualType<SVGAnimatedPathSegListPropertyTearOff>(animatedTypes[0].properties[0].get());
55
    RefPtr<SVGAnimatedPathSegListPropertyTearOff> property = castAnimatedPropertyToActualType<SVGAnimatedPathSegListPropertyTearOff>(animatedTypes[0].properties[0].get());
59
    const auto& baseValue = property->currentBaseValue();
56
    const auto& baseValue = property->currentBaseValue();
60
57
61
    buildSVGPathByteStreamFromSVGPathSegListValues(baseValue, *byteStream, UnalteredParsing);
58
    buildSVGPathByteStreamFromSVGPathSegListValues(static_cast<SVGPathSegListValues&>(*baseValue), *byteStream, UnalteredParsing);
62
59
63
    Vector<RefPtr<SVGAnimatedPathSegListPropertyTearOff>> result;
60
    Vector<RefPtr<SVGAnimatedPathSegListPropertyTearOff>> result;
64
61
Lines 72-78 void SVGAnimatedPathAnimator::resetAnimV Source/WebCore/svg/SVGAnimatedPath.cpp_sec5
72
    if (!result.isEmpty()) {
69
    if (!result.isEmpty()) {
73
        SVGElement::InstanceUpdateBlocker blocker(*property->contextElement());
70
        SVGElement::InstanceUpdateBlocker blocker(*property->contextElement());
74
        for (auto& segment : result)
71
        for (auto& segment : result)
75
            segment->animationStarted(byteStream, &baseValue);
72
            segment->animationStarted(byteStream, &static_cast<SVGPathSegListValues&>(*baseValue));
76
    }
73
    }
77
}
74
}
78
75
Lines 80-86 void SVGAnimatedPathAnimator::resetAnimV Source/WebCore/svg/SVGAnimatedPath.cpp_sec6
80
{
77
{
81
    ASSERT(animatedTypes.size() >= 1);
78
    ASSERT(animatedTypes.size() >= 1);
82
    ASSERT(type.type() == m_type);
79
    ASSERT(type.type() == m_type);
83
    resetAnimValToBaseVal(animatedTypes, type.path());
80
    resetAnimValToBaseVal(animatedTypes, &static_cast<SVGPathByteStream&>(*type.values[0]));
84
}
81
}
85
82
86
void SVGAnimatedPathAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
83
void SVGAnimatedPathAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 98-109 void SVGAnimatedPathAnimator::addAnimate Source/WebCore/svg/SVGAnimatedPath.cpp_sec7
98
    ASSERT(from->type() == AnimatedPath);
95
    ASSERT(from->type() == AnimatedPath);
99
    ASSERT(from->type() == to->type());
96
    ASSERT(from->type() == to->type());
100
97
101
    SVGPathByteStream* fromPath = from->path();
98
    const auto& fromPath = static_cast<SVGPathByteStream&>(*from->values[0]);
102
    SVGPathByteStream* toPath = to->path();
99
    auto& toPath = static_cast<SVGPathByteStream&>(*to->values[0]);
103
    unsigned fromPathSize = fromPath->size();
100
    unsigned fromPathSize = fromPath.size();
104
    if (!fromPathSize || fromPathSize != toPath->size())
101
    if (!fromPathSize || fromPathSize != toPath.size())
105
        return;
102
        return;
106
    addToSVGPathByteStream(*toPath, *fromPath);
103
    addToSVGPathByteStream(toPath, fromPath);
107
}
104
}
108
105
109
void SVGAnimatedPathAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
106
void SVGAnimatedPathAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
Lines 111-146 void SVGAnimatedPathAnimator::calculateA Source/WebCore/svg/SVGAnimatedPath.cpp_sec8
111
    ASSERT(m_animationElement);
108
    ASSERT(m_animationElement);
112
    ASSERT(m_contextElement);
109
    ASSERT(m_contextElement);
113
110
114
    SVGPathByteStream* fromPath = from->path();
111
    auto& fromPath = static_cast<SVGPathByteStream&>(*from->values[0]);
115
    SVGPathByteStream* toPath = to->path();
112
    auto& toPath = static_cast<SVGPathByteStream&>(*to->values[0]);
116
    SVGPathByteStream* toAtEndOfDurationPath = toAtEndOfDuration->path();
113
    auto& toAtEndOfDurationPath = static_cast<SVGPathByteStream&>(*toAtEndOfDuration->values[0]);
117
    SVGPathByteStream* animatedPath = animated->path();
114
    auto& animatedPath = static_cast<SVGPathByteStream&>(*animated->values[0]);
118
115
119
    std::unique_ptr<SVGPathByteStream> underlyingPath;
120
    bool isToAnimation = m_animationElement->animationMode() == ToAnimation;
116
    bool isToAnimation = m_animationElement->animationMode() == ToAnimation;
121
    if (isToAnimation) {
117
    if (isToAnimation)
122
        underlyingPath = animatedPath->copy();
118
        fromPath = animatedPath;
123
        fromPath = underlyingPath.get();
124
    }
125
119
126
    // Cache the current animated value before the buildAnimatedSVGPathByteStream() clears animatedPath.
120
    // Cache the current animated value before the buildAnimatedSVGPathByteStream() clears animatedPath.
127
    std::unique_ptr<SVGPathByteStream> lastAnimatedPath;
121
    SVGPathByteStream lastAnimatedPath;
128
    if (!fromPath->size() || (m_animationElement->isAdditive() && !isToAnimation))
122
    if (!fromPath.size() || (m_animationElement->isAdditive() && !isToAnimation))
129
        lastAnimatedPath = animatedPath->copy();
123
        lastAnimatedPath = animatedPath;
130
124
131
    // Pass false to 'resizeAnimatedListIfNeeded' here, as the path animation is not a regular Vector<SVGXXX> type, but a SVGPathByteStream, that works differently.
125
    // 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))
133
        return;
127
        return;
134
128
135
    buildAnimatedSVGPathByteStream(*fromPath, *toPath, *animatedPath, percentage);
129
    buildAnimatedSVGPathByteStream(fromPath, toPath, animatedPath, percentage);
136
130
137
    // Handle additive='sum'.
131
    // Handle additive='sum'.
138
    if (lastAnimatedPath)
132
    if (!lastAnimatedPath.isEmpty())
139
        addToSVGPathByteStream(*animatedPath, *lastAnimatedPath);
133
        addToSVGPathByteStream(animatedPath, lastAnimatedPath);
140
134
141
    // Handle accumulate='sum'.
135
    // Handle accumulate='sum'.
142
    if (m_animationElement->isAccumulated() && repeatCount)
136
    if (m_animationElement->isAccumulated() && repeatCount)
143
        addToSVGPathByteStream(*animatedPath, *toAtEndOfDurationPath, repeatCount);
137
        addToSVGPathByteStream(animatedPath, toAtEndOfDurationPath, repeatCount);
144
}
138
}
145
139
146
float SVGAnimatedPathAnimator::calculateDistance(const String&, const String&)
140
float SVGAnimatedPathAnimator::calculateDistance(const String&, const String&)
- Source/WebCore/svg/SVGAnimatedPointList.cpp -19 / +17 lines
Lines 34-47 SVGAnimatedPointListAnimator::SVGAnimate Source/WebCore/svg/SVGAnimatedPointList.cpp_sec1
34
34
35
std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::constructFromString(const String& string)
35
std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::constructFromString(const String& string)
36
{
36
{
37
    auto animatedType = SVGAnimatedType::createPointList(std::make_unique<SVGPointListValues>());
37
    return SVGAnimatedType::create(SVGPropertyTraits<SVGPointListValues>::fromString(string));
38
    pointsListFromSVGData(animatedType->pointList(), string);
39
    return animatedType;
40
}
38
}
41
39
42
std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
40
std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
43
{
41
{
44
    return SVGAnimatedType::createPointList(constructFromBaseValue<SVGAnimatedPointList>(animatedTypes));
42
    return constructFromBaseValue<SVGAnimatedPointList>(animatedTypes);
45
}
43
}
46
44
47
void SVGAnimatedPointListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
45
void SVGAnimatedPointListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 51-57 void SVGAnimatedPointListAnimator::stopA Source/WebCore/svg/SVGAnimatedPointList.cpp_sec2
51
49
52
void SVGAnimatedPointListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
50
void SVGAnimatedPointListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
53
{
51
{
54
    resetFromBaseValue<SVGAnimatedPointList>(animatedTypes, type, &SVGAnimatedType::pointList);
52
    resetFromBaseValue<SVGAnimatedPointList>(animatedTypes, type);
55
}
53
}
56
54
57
void SVGAnimatedPointListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
55
void SVGAnimatedPointListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 69-93 void SVGAnimatedPointListAnimator::addAn Source/WebCore/svg/SVGAnimatedPointList.cpp_sec3
69
    ASSERT(from->type() == AnimatedPoints);
67
    ASSERT(from->type() == AnimatedPoints);
70
    ASSERT(from->type() == to->type());
68
    ASSERT(from->type() == to->type());
71
69
72
    const auto& fromPointList = from->pointList();
70
    const auto& fromPointList = static_cast<SVGPointListValues&>(*from->values[0]);
73
    auto& toPointList = to->pointList();
71
    auto& toPointList =  static_cast<SVGPointListValues&>(*to->values[0]);
74
72
75
    unsigned fromPointListSize = fromPointList.size();
73
    unsigned fromPointListSize = fromPointList.size();
76
    if (!fromPointListSize || fromPointListSize != toPointList.size())
74
    if (!fromPointListSize || fromPointListSize != toPointList.size())
77
        return;
75
        return;
78
76
79
    for (unsigned i = 0; i < fromPointListSize; ++i)
77
    for (unsigned i = 0; i < fromPointListSize; ++i)
80
        toPointList[i] += fromPointList[i];
78
        toPointList.propertyAt(i) += fromPointList.propertyAt(i);
81
}
79
}
82
80
83
void SVGAnimatedPointListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
81
void SVGAnimatedPointListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
84
{
82
{
85
    ASSERT(m_animationElement);
83
    ASSERT(m_animationElement);
86
84
87
    const auto& fromPointList = m_animationElement->animationMode() == ToAnimation ? animated->pointList() : from->pointList();
85
    const auto& fromPointList = m_animationElement->animationMode() == ToAnimation ? static_cast<SVGPointListValues&>(*animated->values[0]) : static_cast<SVGPointListValues&>(*from->values[0]);
88
    const auto& toPointList = to->pointList();
86
    const auto& toPointList = static_cast<SVGPointListValues&>(*to->values[0]);
89
    const auto& toAtEndOfDurationPointList = toAtEndOfDuration->pointList();
87
    const auto& toAtEndOfDurationPointList = static_cast<SVGPointListValues&>(*toAtEndOfDuration->values[0]);
90
    auto& animatedPointList = animated->pointList();
88
    auto& animatedPointList = static_cast<SVGPointListValues&>(*animated->values[0]);
91
    if (!m_animationElement->adjustFromToListValues<SVGPointListValues>(fromPointList, toPointList, animatedPointList, percentage))
89
    if (!m_animationElement->adjustFromToListValues<SVGPointListValues>(fromPointList, toPointList, animatedPointList, percentage))
92
        return;
90
        return;
93
91
Lines 98-111 void SVGAnimatedPointListAnimator::calcu Source/WebCore/svg/SVGAnimatedPointList.cpp_sec4
98
    for (unsigned i = 0; i < toPointListSize; ++i) {
96
    for (unsigned i = 0; i < toPointListSize; ++i) {
99
        FloatPoint effectiveFrom;
97
        FloatPoint effectiveFrom;
100
        if (fromPointListSize)
98
        if (fromPointListSize)
101
            effectiveFrom = fromPointList[i];
99
            effectiveFrom = fromPointList.propertyAt(i);
102
        FloatPoint effectiveToAtEnd = i < toAtEndOfDurationSize ? toAtEndOfDurationPointList[i] : FloatPoint();
100
        FloatPoint effectiveToAtEnd = i < toAtEndOfDurationSize ? toAtEndOfDurationPointList.propertyAt(i) : FloatPoint();
103
101
104
        float animatedX = animatedPointList[i].x();
102
        float animatedX = animatedPointList.propertyAt(i).x();
105
        float animatedY = animatedPointList[i].y();
103
        float animatedY = animatedPointList.propertyAt(i).y();
106
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.x(), toPointList[i].x(), effectiveToAtEnd.x(), animatedX);
104
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.x(), toPointList.propertyAt(i).x(), effectiveToAtEnd.x(), animatedX);
107
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.y(), toPointList[i].y(), effectiveToAtEnd.y(), animatedY);
105
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom.y(), toPointList.propertyAt(i).y(), effectiveToAtEnd.y(), animatedY);
108
        animatedPointList[i] = FloatPoint(animatedX, animatedY);
106
        animatedPointList.propertyAt(i) = FloatPoint(animatedX, animatedY);
109
    }
107
    }
110
}
108
}
111
109
- Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp -8 / +6 lines
Lines 31-44 SVGAnimatedPreserveAspectRatioAnimator:: Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp_sec1
31
31
32
std::unique_ptr<SVGAnimatedType> SVGAnimatedPreserveAspectRatioAnimator::constructFromString(const String& string)
32
std::unique_ptr<SVGAnimatedType> SVGAnimatedPreserveAspectRatioAnimator::constructFromString(const String& string)
33
{
33
{
34
    auto animatedType = SVGAnimatedType::createPreserveAspectRatio(std::make_unique<SVGPreserveAspectRatioValue>());
34
    return SVGAnimatedType::create(SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString(string));
35
    animatedType->preserveAspectRatio().parse(string);
36
    return animatedType;
37
}
35
}
38
36
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
37
std::unique_ptr<SVGAnimatedType> SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
40
{
38
{
41
    return SVGAnimatedType::createPreserveAspectRatio(constructFromBaseValue<SVGAnimatedPreserveAspectRatio>(animatedTypes));
39
    return constructFromBaseValue<SVGAnimatedPreserveAspectRatio>(animatedTypes);
42
}
40
}
43
41
44
void SVGAnimatedPreserveAspectRatioAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
42
void SVGAnimatedPreserveAspectRatioAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 48-54 void SVGAnimatedPreserveAspectRatioAnima Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp_sec2
48
46
49
void SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
47
void SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
50
{
48
{
51
    resetFromBaseValue<SVGAnimatedPreserveAspectRatio>(animatedTypes, type, &SVGAnimatedType::preserveAspectRatio);
49
    resetFromBaseValue<SVGAnimatedPreserveAspectRatio>(animatedTypes, type);
52
}
50
}
53
51
54
void SVGAnimatedPreserveAspectRatioAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
52
void SVGAnimatedPreserveAspectRatioAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 71-79 void SVGAnimatedPreserveAspectRatioAnima Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp_sec3
71
    ASSERT(m_animationElement);
69
    ASSERT(m_animationElement);
72
    ASSERT(m_contextElement);
70
    ASSERT(m_contextElement);
73
71
74
    const auto& fromPreserveAspectRatio = m_animationElement->animationMode() == ToAnimation ? animated->preserveAspectRatio() : from->preserveAspectRatio();
72
    const auto& fromPreserveAspectRatio = m_animationElement->animationMode() == ToAnimation ? static_cast<SVGPreserveAspectRatioValue&>(*animated->values[0]) : static_cast<SVGPreserveAspectRatioValue&>(*from->values[0]);
75
    const auto& toPreserveAspectRatio = to->preserveAspectRatio();
73
    const auto& toPreserveAspectRatio = static_cast<SVGPreserveAspectRatioValue&>(*to->values[0]);
76
    auto& animatedPreserveAspectRatio = animated->preserveAspectRatio();
74
    auto& animatedPreserveAspectRatio = static_cast<SVGPreserveAspectRatioValue&>(*animated->values[0]);
77
75
78
    m_animationElement->animateDiscreteType<SVGPreserveAspectRatioValue>(percentage, fromPreserveAspectRatio, toPreserveAspectRatio, animatedPreserveAspectRatio);
76
    m_animationElement->animateDiscreteType<SVGPreserveAspectRatioValue>(percentage, fromPreserveAspectRatio, toPreserveAspectRatio, animatedPreserveAspectRatio);
79
}
77
}
- Source/WebCore/svg/SVGAnimatedRect.cpp -10 / +8 lines
Lines 32-45 SVGAnimatedRectAnimator::SVGAnimatedRect Source/WebCore/svg/SVGAnimatedRect.cpp_sec1
32
32
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::constructFromString(const String& string)
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::constructFromString(const String& string)
34
{
34
{
35
    auto animatedType = SVGAnimatedType::createRect(std::make_unique<FloatRect>());
35
    return SVGAnimatedType::create(SVGPropertyTraits<FloatRect>::fromString(string));
36
    parseRect(string, animatedType->rect());
37
    return animatedType;
38
}
36
}
39
37
40
std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
38
std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
41
{
39
{
42
    return SVGAnimatedType::createRect(constructFromBaseValue<SVGAnimatedRect>(animatedTypes));
40
    return constructFromBaseValue<SVGAnimatedRect>(animatedTypes);
43
}
41
}
44
42
45
void SVGAnimatedRectAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
43
void SVGAnimatedRectAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 49-55 void SVGAnimatedRectAnimator::stopAnimVa Source/WebCore/svg/SVGAnimatedRect.cpp_sec2
49
47
50
void SVGAnimatedRectAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
48
void SVGAnimatedRectAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
51
{
49
{
52
    resetFromBaseValue<SVGAnimatedRect>(animatedTypes, type, &SVGAnimatedType::rect);
50
    resetFromBaseValue<SVGAnimatedRect>(animatedTypes, type);
53
}
51
}
54
52
55
void SVGAnimatedRectAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
53
void SVGAnimatedRectAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 67-73 void SVGAnimatedRectAnimator::addAnimate Source/WebCore/svg/SVGAnimatedRect.cpp_sec3
67
    ASSERT(from->type() == AnimatedRect);
65
    ASSERT(from->type() == AnimatedRect);
68
    ASSERT(from->type() == to->type());
66
    ASSERT(from->type() == to->type());
69
67
70
    to->rect() += from->rect();
68
    static_cast<FloatRect&>(*to->values[0]) += static_cast<FloatRect&>(*from->values[0]);
71
}
69
}
72
70
73
void SVGAnimatedRectAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
71
void SVGAnimatedRectAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
Lines 75-84 void SVGAnimatedRectAnimator::calculateA Source/WebCore/svg/SVGAnimatedRect.cpp_sec4
75
    ASSERT(m_animationElement);
73
    ASSERT(m_animationElement);
76
    ASSERT(m_contextElement);
74
    ASSERT(m_contextElement);
77
75
78
    const FloatRect& fromRect = m_animationElement->animationMode() == ToAnimation ? animated->rect() : from->rect();
76
    const auto& fromRect = m_animationElement->animationMode() == ToAnimation ? static_cast<FloatRect&>(*animated->values[0]) : static_cast<FloatRect&>(*from->values[0]);
79
    const FloatRect& toRect = to->rect();
77
    const auto& toRect = static_cast<FloatRect&>(*to->values[0]);
80
    const FloatRect& toAtEndOfDurationRect = toAtEndOfDuration->rect();
78
    const auto& toAtEndOfDurationRect = static_cast<FloatRect&>(*toAtEndOfDuration->values[0]);
81
    FloatRect& animatedRect = animated->rect();
79
    auto& animatedRect = static_cast<FloatRect&>(*animated->values[0]);
82
80
83
    float animatedX = animatedRect.x();
81
    float animatedX = animatedRect.x();
84
    float animatedY = animatedRect.y();
82
    float animatedY = animatedRect.y();
- Source/WebCore/svg/SVGAnimatedString.cpp -8 / +7 lines
Lines 1-5 Source/WebCore/svg/SVGAnimatedString.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
2
 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3
 * Copyright (C) 2018 Apple Inc.  All rights reserved.
3
 *
4
 *
4
 * This library is free software; you can redistribute it and/or
5
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * modify it under the terms of the GNU Library General Public
Lines 31-44 SVGAnimatedStringAnimator::SVGAnimatedSt Source/WebCore/svg/SVGAnimatedString.cpp_sec2
31
32
32
std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const String& string)
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const String& string)
33
{
34
{
34
    auto animatedType = SVGAnimatedType::createString(std::make_unique<String>());
35
    return SVGAnimatedType::create(SVGPropertyTraits<String>::fromString(string));
35
    animatedType->string() = string;
36
    return animatedType;
37
}
36
}
38
37
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
38
std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
40
{
39
{
41
    return SVGAnimatedType::createString(constructFromBaseValue<SVGAnimatedString>(animatedTypes));
40
    return constructFromBaseValue<SVGAnimatedString>(animatedTypes);
42
}
41
}
43
42
44
void SVGAnimatedStringAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
43
void SVGAnimatedStringAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 48-54 void SVGAnimatedStringAnimator::stopAnim Source/WebCore/svg/SVGAnimatedString.cpp_sec3
48
47
49
void SVGAnimatedStringAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
48
void SVGAnimatedStringAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
50
{
49
{
51
    resetFromBaseValue<SVGAnimatedString>(animatedTypes, type, &SVGAnimatedType::string);
50
    resetFromBaseValue<SVGAnimatedString>(animatedTypes, type);
52
}
51
}
53
52
54
void SVGAnimatedStringAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
53
void SVGAnimatedStringAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 76-84 void SVGAnimatedStringAnimator::calculat Source/WebCore/svg/SVGAnimatedString.cpp_sec4
76
    ASSERT(m_animationElement);
75
    ASSERT(m_animationElement);
77
    ASSERT(m_contextElement);
76
    ASSERT(m_contextElement);
78
77
79
    String fromString = from->string();
78
    String fromString = static_cast<String&>(*from->values[0]);
80
    String toString = to->string();
79
    String toString = static_cast<String&>(*to->values[0]);
81
    String& animatedString = animated->string();
80
    String& animatedString = static_cast<String&>(*animated->values[0]);
82
81
83
    // Apply CSS inheritance rules.
82
    // Apply CSS inheritance rules.
84
    m_animationElement->adjustForInheritance<String>(parseStringFromString, m_animationElement->fromPropertyValueType(), fromString, m_contextElement);
83
    m_animationElement->adjustForInheritance<String>(parseStringFromString, m_animationElement->fromPropertyValueType(), fromString, m_contextElement);
- Source/WebCore/svg/SVGAnimatedTransformList.cpp -23 / +20 lines
Lines 41-55 SVGAnimatedTransformListAnimator::SVGAni Source/WebCore/svg/SVGAnimatedTransformList.cpp_sec1
41
41
42
std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::constructFromString(const String& string)
42
std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::constructFromString(const String& string)
43
{
43
{
44
    auto animatedType = SVGAnimatedType::createTransformList(std::make_unique<SVGTransformListValues>());
44
    return SVGAnimatedType::create(SVGPropertyTraits<SVGTransformListValues>::fromString(m_transformTypeString + string + ')'));
45
    animatedType->transformList().parse(m_transformTypeString + string + ')');
46
    ASSERT(animatedType->transformList().size() <= 1);
47
    return animatedType;
48
}
45
}
49
46
50
std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
47
std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
51
{
48
{
52
    return SVGAnimatedType::createTransformList(constructFromBaseValue<SVGAnimatedTransformList>(animatedTypes));
49
    return constructFromBaseValue<SVGAnimatedTransformList>(animatedTypes);
53
}
50
}
54
51
55
void SVGAnimatedTransformListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
52
void SVGAnimatedTransformListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 59-65 void SVGAnimatedTransformListAnimator::s Source/WebCore/svg/SVGAnimatedTransformList.cpp_sec2
59
56
60
void SVGAnimatedTransformListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
57
void SVGAnimatedTransformListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
61
{
58
{
62
    resetFromBaseValue<SVGAnimatedTransformList>(animatedTypes, type, &SVGAnimatedType::transformList);
59
    resetFromBaseValue<SVGAnimatedTransformList>(animatedTypes, type);
63
}
60
}
64
61
65
void SVGAnimatedTransformListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
62
void SVGAnimatedTransformListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 77-91 void SVGAnimatedTransformListAnimator::a Source/WebCore/svg/SVGAnimatedTransformList.cpp_sec3
77
    ASSERT(from->type() == AnimatedTransformList);
74
    ASSERT(from->type() == AnimatedTransformList);
78
    ASSERT(from->type() == to->type());
75
    ASSERT(from->type() == to->type());
79
76
80
    const auto& fromTransformList = from->transformList();
77
    const auto& fromTransformList = static_cast<SVGTransformListValues&>(*from->values[0]);
81
    auto& toTransformList = to->transformList();
78
    auto& toTransformList = static_cast<SVGTransformListValues&>(*to->values[0]);
82
    auto fromTransformListSize = fromTransformList.size();
79
    auto fromTransformListSize = fromTransformList.size();
83
    if (!fromTransformListSize || fromTransformListSize != toTransformList.size())
80
    if (!fromTransformListSize || fromTransformListSize != toTransformList.size())
84
        return;
81
        return;
85
82
86
    ASSERT(fromTransformListSize == 1);
83
    ASSERT(fromTransformListSize == 1);
87
    const auto& fromTransform = fromTransformList[0];
84
    const auto& fromTransform = fromTransformList.propertyAt(0);
88
    auto& toTransform = toTransformList[0];
85
    auto& toTransform = toTransformList.propertyAt(0);
89
86
90
    ASSERT(fromTransform.type() == toTransform.type());
87
    ASSERT(fromTransform.type() == toTransform.type());
91
    toTransform = SVGTransformDistance::addSVGTransforms(fromTransform, toTransform);
88
    toTransform = SVGTransformDistance::addSVGTransforms(fromTransform, toTransform);
Lines 98-107 void SVGAnimatedTransformListAnimator::c Source/WebCore/svg/SVGAnimatedTransformList.cpp_sec4
98
    // Spec: To animations provide specific functionality to get a smooth change from the underlying value to the
95
    // Spec: To animations provide specific functionality to get a smooth change from the underlying value to the
99
    // ‘to’ attribute value, which conflicts mathematically with the requirement for additive transform animations
96
    // ‘to’ attribute value, which conflicts mathematically with the requirement for additive transform animations
100
    // to be post-multiplied. As a consequence, in SVG 1.1 the behavior of to animations for ‘animateTransform’ is undefined.
97
    // 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();
98
    const auto& fromTransformList = static_cast<SVGTransformListValues&>(*from->values[0]);
102
    const auto& toTransformList = to->transformList();
99
    const auto& toTransformList = static_cast<SVGTransformListValues&>(*to->values[0]);
103
    const auto& toAtEndOfDurationTransformList = toAtEndOfDuration->transformList();
100
    const auto& toAtEndOfDurationTransformList = static_cast<SVGTransformListValues&>(*toAtEndOfDuration->values[0]);
104
    auto& animatedTransformList = animated->transformList();
101
    auto& animatedTransformList = static_cast<SVGTransformListValues&>(*animated->values[0]);
105
102
106
    // Pass false to 'resizeAnimatedListIfNeeded' here, as the special post-multiplication behavior of <animateTransform> needs to be respected below.
103
    // Pass false to 'resizeAnimatedListIfNeeded' here, as the special post-multiplication behavior of <animateTransform> needs to be respected below.
107
    if (!m_animationElement->adjustFromToListValues<SVGTransformListValues>(fromTransformList, toTransformList, animatedTransformList, percentage, false))
104
    if (!m_animationElement->adjustFromToListValues<SVGTransformListValues>(fromTransformList, toTransformList, animatedTransformList, percentage, false))
Lines 112-125 void SVGAnimatedTransformListAnimator::c Source/WebCore/svg/SVGAnimatedTransformList.cpp_sec5
112
        animatedTransformList.clear();
109
        animatedTransformList.clear();
113
110
114
    auto fromTransformListSize = fromTransformList.size();
111
    auto fromTransformListSize = fromTransformList.size();
115
    const auto& toTransform = toTransformList[0];
112
    const auto& toTransform = toTransformList.propertyAt(0);
116
    const auto effectiveFrom = fromTransformListSize ? fromTransformList[0] : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
113
    const auto effectiveFrom = fromTransformListSize ? fromTransformList.propertyAt(0) : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
117
    auto currentTransform = SVGTransformDistance(effectiveFrom, toTransform).scaledDistance(percentage).addToSVGTransform(effectiveFrom);
114
    auto currentTransform = SVGTransformDistance(effectiveFrom, toTransform).scaledDistance(percentage).addToSVGTransform(effectiveFrom);
118
    if (m_animationElement->isAccumulated() && repeatCount) {
115
    if (m_animationElement->isAccumulated() && repeatCount) {
119
        const auto effectiveToAtEnd = toAtEndOfDurationTransformList.size() ? toAtEndOfDurationTransformList[0] : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
116
        const auto effectiveToAtEnd = toAtEndOfDurationTransformList.size() ? toAtEndOfDurationTransformList.propertyAt(0) : SVGTransformValue(toTransform.type(), SVGTransformValue::ConstructZeroTransform);
120
        animatedTransformList.append(SVGTransformDistance::addSVGTransforms(currentTransform, effectiveToAtEnd, repeatCount));
117
        animatedTransformList.append(SVGValue::create<SVGTransformValue>(SVGTransformDistance::addSVGTransforms(currentTransform, effectiveToAtEnd, repeatCount)));
121
    } else
118
    } else
122
        animatedTransformList.append(currentTransform);
119
        animatedTransformList.append(SVGValue::create<SVGTransformValue>(currentTransform));
123
}
120
}
124
121
125
float SVGAnimatedTransformListAnimator::calculateDistance(const String& fromString, const String& toString)
122
float SVGAnimatedTransformListAnimator::calculateDistance(const String& fromString, const String& toString)
Lines 131-150 float SVGAnimatedTransformListAnimator:: Source/WebCore/svg/SVGAnimatedTransformList.cpp_sec6
131
    auto from = constructFromString(fromString);
128
    auto from = constructFromString(fromString);
132
    auto to = constructFromString(toString);
129
    auto to = constructFromString(toString);
133
130
134
    auto& fromTransformList = from->transformList();
131
    auto& fromTransformList = static_cast<SVGTransformListValues&>(*from->values[0]);
135
    auto& toTransformList = to->transformList();
132
    auto& toTransformList = static_cast<SVGTransformListValues&>(*to->values[0]);
136
    unsigned itemsCount = fromTransformList.size();
133
    unsigned itemsCount = fromTransformList.size();
137
    if (!itemsCount || itemsCount != toTransformList.size())
134
    if (!itemsCount || itemsCount != toTransformList.size())
138
        return -1;
135
        return -1;
139
136
140
    ASSERT(itemsCount == 1);
137
    ASSERT(itemsCount == 1);
141
    if (fromTransformList[0].type() != toTransformList[0].type())
138
    if (fromTransformList.propertyAt(0).type() != toTransformList.propertyAt(0).type())
142
        return -1;
139
        return -1;
143
140
144
    // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances
141
    // Spec: http://www.w3.org/TR/SVG/animate.html#complexDistances
145
    // Paced animations assume a notion of distance between the various animation values defined by the ‘to’, ‘from’, ‘by’ and ‘values’ attributes.
142
    // Paced animations assume a notion of distance between the various animation values defined by the ‘to’, ‘from’, ‘by’ and ‘values’ attributes.
146
    // Distance is defined only for scalar types (such as <length>), colors and the subset of transformation types that are supported by ‘animateTransform’.
143
    // 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();
148
}
145
}
149
146
150
}
147
}
- Source/WebCore/svg/SVGAnimatedType.cpp -328 lines
Lines 1-327 Source/WebCore/svg/SVGAnimatedType.cpp_sec1
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
328
native
- Source/WebCore/svg/SVGAnimatedType.h -226 / +72 lines
Lines 1-5 Source/WebCore/svg/SVGAnimatedType.h_sec1
1
/*
1
/*
2
 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
2
 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3
 * Copyright (C) 2018 Apple Inc.  All rights reserved.
3
 *
4
 *
4
 * This library is free software; you can redistribute it and/or
5
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * modify it under the terms of the GNU Library General Public
Lines 19-302 Source/WebCore/svg/SVGAnimatedType.h_sec2
19
20
20
#pragma once
21
#pragma once
21
22
22
#include "Color.h"
23
#include "SVGValue.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"
32
24
33
namespace WebCore {
25
namespace WebCore {
34
26
35
class SVGPathByteStream;
27
struct SVGAnimatedType {
36
28
    template<typename PropertyType>
37
class SVGAnimatedType {
29
    SVGAnimatedType(PropertyType&& property)
38
    WTF_MAKE_FAST_ALLOCATED;
30
        : values { SVGValue::create(WTFMove(property)) }
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
120
    {
31
    {
121
        ASSERT(m_type == AnimatedNumberList);
122
        return *m_data.numberList;
123
    }
32
    }
124
33
125
    const std::pair<float, float>& numberOptionalNumber() const
34
    SVGAnimatedType(RefPtr<SVGValue>&& value)
35
        : values { WTFMove(value) }
126
    {
36
    {
127
        ASSERT(m_type == AnimatedNumberOptionalNumber);
128
        return *m_data.numberOptionalNumber;
129
    }
37
    }
130
38
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) }
132
    {
42
    {
133
        ASSERT(m_type == AnimatedPath);
134
        return m_data.path;
135
    }
43
    }
136
44
137
    const SVGPointListValues& pointList() const
45
    SVGAnimatedType(RefPtr<SVGValue>&& value1, RefPtr<SVGValue>&& value2)
46
        : values { WTFMove(value1), WTFMove(value2) }
138
    {
47
    {
139
        ASSERT(m_type == AnimatedPoints);
140
        return *m_data.pointList;
141
    }
48
    }
142
49
143
    const SVGPreserveAspectRatioValue& preserveAspectRatio() const
50
    template<typename PropertyType>
51
    static std::unique_ptr<SVGAnimatedType> create()
144
    {
52
    {
145
        ASSERT(m_type == AnimatedPreserveAspectRatio);
53
        return std::make_unique<SVGAnimatedType>(SVGPropertyTraits<PropertyType>::initialValue());
146
        return *m_data.preserveAspectRatio;
147
    }
54
    }
148
55
149
    const FloatRect& rect() const
56
    template<typename PropertyType>
57
    static std::unique_ptr<SVGAnimatedType> create(PropertyType&& property)
150
    {
58
    {
151
        ASSERT(m_type == AnimatedRect);
59
        return std::make_unique<SVGAnimatedType>(WTFMove(property));
152
        return *m_data.rect;
153
    }
60
    }
154
61
155
    const String& string() const
62
    static std::unique_ptr<SVGAnimatedType> create(RefPtr<SVGValue>&& value)
156
    {
63
    {
157
        ASSERT(m_type == AnimatedString);
64
        return std::make_unique<SVGAnimatedType>(WTFMove(value));
158
        return *m_data.string;
159
    }
65
    }
160
66
161
    const SVGTransformListValues& transformList() const
67
    template<typename PropertyType1, typename PropertyType2>
68
    static std::unique_ptr<SVGAnimatedType> create()
162
    {
69
    {
163
        ASSERT(m_type == AnimatedTransformList);
70
        return std::make_unique<SVGAnimatedType>(SVGPropertyTraits<std::pair<PropertyType1, PropertyType2>>::initialValue());
164
        return *m_data.transformList;
165
    }
71
    }
166
72
167
    // Mutable accessors.
73
    template<typename PropertyType1, typename PropertyType2>
168
    std::pair<SVGAngleValue, unsigned>& angleAndEnumeration()
74
    static std::unique_ptr<SVGAnimatedType> create(std::pair<PropertyType1, PropertyType2>&& properties)
169
    {
75
    {
170
        ASSERT(m_type == AnimatedAngle);
76
        return std::make_unique<SVGAnimatedType>(WTFMove(properties));
171
        return *m_data.angleAndEnumeration;
172
    }
77
    }
173
78
174
    bool& boolean()
79
    static std::unique_ptr<SVGAnimatedType> create(RefPtr<SVGValue>&& value1, RefPtr<SVGValue>&& value2)
175
    {
80
    {
176
        ASSERT(m_type == AnimatedBoolean);
81
        return std::make_unique<SVGAnimatedType>(WTFMove(value1), WTFMove(value2));
177
        return *m_data.boolean;
178
    }
82
    }
179
83
180
    Color& color()
84
    AnimatedPropertyType type() const
181
    {
85
    {
182
        ASSERT(m_type == AnimatedColor);
86
        ASSERT(values[0]);
183
        return *m_data.color;
87
        AnimatedPropertyType animatedType1 = valueAnimatedType(*values[0]);
184
    }
88
        AnimatedPropertyType animatedType2 = values[1] ? valueAnimatedType(*values[1]) : AnimatedUnknown;
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
    }
215
89
216
    float& number()
90
        if (animatedType1 == AnimatedAngle) {
217
    {
91
            ASSERT(animatedType2 == AnimatedEnumeration);
218
        ASSERT(m_type == AnimatedNumber);
92
            return AnimatedAngle;
219
        return *m_data.number;
93
        }
220
    }
221
94
222
    SVGNumberListValues& numberList()
95
        if (animatedType1 == AnimatedInteger && animatedType2 == AnimatedInteger)
223
    {
96
            return AnimatedIntegerOptionalInteger;
224
        ASSERT(m_type == AnimatedNumberList);
225
        return *m_data.numberList;
226
    }
227
97
228
    std::pair<float, float>& numberOptionalNumber()
98
        if (animatedType1 == AnimatedNumber && animatedType2 == AnimatedNumber)
229
    {
99
            return AnimatedNumberOptionalNumber;
230
        ASSERT(m_type == AnimatedNumberOptionalNumber);
231
        return *m_data.numberOptionalNumber;
232
    }
233
100
234
    SVGPathByteStream* path()
101
        ASSERT(animatedType2 == AnimatedUnknown);
235
    {
102
        return animatedType1;
236
        ASSERT(m_type == AnimatedPath);
237
        return m_data.path;
238
    }
103
    }
239
104
240
    SVGPointListValues& pointList()
105
    String valueAsString() const
241
    {
106
    {
242
        ASSERT(m_type == AnimatedPoints);
107
        ASSERT(values[0] && !values[1]);
243
        return *m_data.pointList;
108
        return values[0]->toString();
244
    }
109
    }
245
110
246
    SVGPreserveAspectRatioValue& preserveAspectRatio()
111
    bool setValueAsString(const QualifiedName& attrName, const String& string)
247
    {
112
    {
248
        ASSERT(m_type == AnimatedPreserveAspectRatio);
113
        ASSERT(values[0] && !values[1]);
249
        return *m_data.preserveAspectRatio;
114
        return values[0]->parse(attrName, string);
250
    }
115
    }
251
116
252
    FloatRect& rect()
117
    static bool supportsAnimVal(AnimatedPropertyType type)
253
    {
118
    {
254
        ASSERT(m_type == AnimatedRect);
119
        // AnimatedColor is only used for CSS property animations.
255
        return *m_data.rect;
120
        return type != AnimatedUnknown && type != AnimatedColor;
256
    }
121
    }
257
122
258
    String& string()
123
    static AnimatedPropertyType valueAnimatedType(const SVGValue& value)
259
    {
124
    {
260
        ASSERT(m_type == AnimatedString);
125
        return WTF::visit(WTF::makeVisitor(
261
        return *m_data.string;
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));
262
    }
143
    }
263
144
264
    SVGTransformListValues& transformList()
145
    RefPtr<SVGValue> values[2];
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;
300
};
146
};
301
147
302
} // namespace WebCore
148
} // namespace WebCore
- Source/WebCore/svg/SVGAnimatedTypeAnimator.h -43 / +48 lines
Lines 1-6 Source/WebCore/svg/SVGAnimatedTypeAnimator.h_sec1
1
/*
1
/*
2
 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
2
 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
3
 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
3
 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4
 * Copyright (C) 2018 Apple Inc.  All rights reserved.
4
 *
5
 *
5
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * modify it under the terms of the GNU Library General Public
Lines 63-90 protected: Source/WebCore/svg/SVGAnimatedTypeAnimator.h_sec2
63
64
64
    // Helpers for animators that operate on single types, eg. just one SVGAnimatedInteger.
65
    // Helpers for animators that operate on single types, eg. just one SVGAnimatedInteger.
65
    template<typename AnimValType>
66
    template<typename AnimValType>
66
    std::unique_ptr<typename AnimValType::ContentType> constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
67
    std::unique_ptr<SVGAnimatedType> constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
67
    {
68
    {
68
        ASSERT(animatedTypes[0].properties.size() == 1);
69
        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());
70
71
71
        auto copy = std::make_unique<typename AnimValType::ContentType>(animatedType);
72
        RefPtr<SVGValue> animatedValue = SVGValue::create(*animatedType->currentBaseValue());
72
        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, copy.get());
73
        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, animatedValue);
73
        return copy;
74
        return SVGAnimatedType::create(WTFMove(animatedValue));
74
    }
75
    }
75
76
76
    template<typename AnimValType>
77
    template<typename AnimValType>
77
    void resetFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type, typename AnimValType::ContentType& (SVGAnimatedType::*getter)())
78
    void resetFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
78
    {
79
    {
79
        ASSERT(animatedTypes[0].properties.size() == 1);
80
        ASSERT(animatedTypes[0].properties.size() == 1);
80
        ASSERT(type.type() == m_type);
81
        ASSERT(type.type() == m_type);
81
        auto* property = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get());
82
        AnimValType* animatedType = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get());
82
        property->synchronizeWrappersIfNeeded();
83
        animatedType->synchronizeWrappersIfNeeded();
83
84
84
        typename AnimValType::ContentType& animatedTypeValue = (type.*getter)();
85
        RefPtr<SVGValue> baseValue = animatedType->currentBaseValue();
85
        animatedTypeValue = property->currentBaseValue();
86
        RefPtr<SVGValue> animatedValue = type.values[0];
86
87
        static_cast<typename AnimValType::ContentType&>(*animatedValue) = static_cast<typename AnimValType::ContentType&>(*baseValue);
87
        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, &animatedTypeValue);
88
        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, animatedValue);
88
    }
89
    }
89
90
90
    template<typename AnimValType>
91
    template<typename AnimValType>
Lines 110-143 protected: Source/WebCore/svg/SVGAnimatedTypeAnimator.h_sec3
110
111
111
    // Helpers for animators that operate on pair types, eg. a pair of SVGAnimatedIntegers.
112
    // Helpers for animators that operate on pair types, eg. a pair of SVGAnimatedIntegers.
112
    template<typename AnimValType1, typename AnimValType2>
113
    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)
114
    {
115
    {
115
        ASSERT(animatedTypes[0].properties.size() == 2);
116
        ASSERT(animatedTypes[0].properties.size() == 2);
116
        const typename AnimValType1::ContentType& firstType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get())->currentBaseValue();
117
        const AnimValType1* firstAnimatedType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get());
117
        const typename AnimValType2::ContentType& secondType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get())->currentBaseValue();
118
        const AnimValType2* secondAnimatedType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get());
118
119
119
        auto copy = std::make_unique<std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>>(firstType, secondType);
120
        RefPtr<SVGValue> firstAnimatedValue = SVGValue::create(*firstAnimatedType->currentBaseValue());
120
        executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &copy->first);
121
        RefPtr<SVGValue> secondAnimatedValue = SVGValue::create(*secondAnimatedType->currentBaseValue());
121
        executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &copy->second);
122
        executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, firstAnimatedValue);
122
        return copy;
123
        executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, secondAnimatedValue);
124
        return SVGAnimatedType::create(WTFMove(firstAnimatedValue), WTFMove(secondAnimatedValue));
123
    }
125
    }
124
126
125
    template<typename AnimValType1, typename AnimValType2>
127
    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)
127
    {
129
    {
128
        ASSERT(animatedTypes[0].properties.size() == 2);
130
        ASSERT(animatedTypes[0].properties.size() == 2);
129
        ASSERT(type.type() == m_type);
131
        ASSERT(type.type() == m_type);
130
        auto* firstProperty = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get());
132
        AnimValType1* firstAnimatedType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get());
131
        auto* secondProperty =  castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get());
133
        AnimValType2* secondAnimatedType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get());
132
        firstProperty->synchronizeWrappersIfNeeded();
134
        firstAnimatedType->synchronizeWrappersIfNeeded();
133
        secondProperty->synchronizeWrappersIfNeeded();
135
        secondAnimatedType->synchronizeWrappersIfNeeded();
134
136
135
        std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>& animatedTypeValue = (type.*getter)();
137
        RefPtr<SVGValue> firstBaseValue = firstAnimatedType->currentBaseValue();
136
        animatedTypeValue.first = firstProperty->currentBaseValue();
138
        RefPtr<SVGValue> firstAnimatedValue = type.values[0];
137
        animatedTypeValue.second = secondProperty->currentBaseValue();
139
        static_cast<typename AnimValType1::ContentType&>(*firstAnimatedValue) = static_cast<typename AnimValType1::ContentType&>(*firstBaseValue);
138
140
        executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, firstAnimatedValue);
139
        executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &animatedTypeValue.first);
141
140
        executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &animatedTypeValue.second);
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);
141
    }
146
    }
142
147
143
    template<typename AnimValType1, typename AnimValType2>
148
    template<typename AnimValType1, typename AnimValType2>
Lines 190-222 private: Source/WebCore/svg/SVGAnimatedTypeAnimator.h_sec4
190
    };
195
    };
191
196
192
    template<typename AnimValType>
197
    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)
194
    {
199
    {
195
        // FIXME: Can't use SVGElement::InstanceUpdateBlocker because of circular header dependency. Would be nice to untangle this.
200
        // FIXME: Can't use SVGElement::InstanceUpdateBlocker because of circular header dependency. Would be nice to untangle this.
196
        setInstanceUpdatesBlocked(*animatedTypes[0].element, true);
201
        setInstanceUpdatesBlocked(*animatedTypes[0].element, true);
197
202
198
        for (auto& animatedType : animatedTypes) {
203
        for (auto& animatedType : animatedTypes) {
199
            ASSERT_WITH_SECURITY_IMPLICATION(whichProperty < animatedType.properties.size());
204
            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());
201
206
202
            switch (action) {
207
            switch (action) {
203
            case StartAnimationAction:
208
            case StartAnimationAction:
204
                ASSERT(type);
209
                ASSERT(animatedValue);
205
                if (!property->isAnimating())
210
                if (!animatedProperty->isAnimating())
206
                    property->animationStarted(type);
211
                    animatedProperty->animationStarted(animatedValue);
207
                break;
212
                break;
208
            case StopAnimationAction:
213
            case StopAnimationAction:
209
                ASSERT(!type);
214
                ASSERT(!animatedValue);
210
                if (property->isAnimating())
215
                if (animatedProperty->isAnimating())
211
                    property->animationEnded();
216
                    animatedProperty->animationEnded();
212
                break;
217
                break;
213
            case AnimValWillChangeAction:
218
            case AnimValWillChangeAction:
214
                ASSERT(!type);
219
                ASSERT(!animatedValue);
215
                property->animValWillChange();
220
                animatedProperty->animValWillChange();
216
                break;
221
                break;
217
            case AnimValDidChangeAction:
222
            case AnimValDidChangeAction:
218
                ASSERT(!type);
223
                ASSERT(!animatedValue);
219
                property->animValDidChange();
224
                animatedProperty->animValDidChange();
220
                break;
225
                break;
221
            }
226
            }
222
        }
227
        }
- Source/WebCore/svg/SVGAnimationElement.h -1 / +1 lines
Lines 33-39 Source/WebCore/svg/SVGAnimationElement.h_sec1
33
namespace WebCore {
33
namespace WebCore {
34
34
35
class ConditionEventListener;
35
class ConditionEventListener;
36
class SVGAnimatedType;
36
struct SVGAnimatedType;
37
class TimeContainer;
37
class TimeContainer;
38
38
39
enum AnimationMode {
39
enum AnimationMode {
- Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp -1 / +1 lines
Lines 137-143 ComponentTransferFunction SVGComponentTr Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp_sec1
137
    func.amplitude = amplitude();
137
    func.amplitude = amplitude();
138
    func.exponent = exponent();
138
    func.exponent = exponent();
139
    func.offset = offset();
139
    func.offset = offset();
140
    func.tableValues = tableValues();
140
    func.tableValues = tableValues().properties();
141
    return func;
141
    return func;
142
}
142
}
143
143
- Source/WebCore/svg/SVGCursorElement.cpp -2 / +2 lines
Lines 46-53 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGCursorElement.cpp_sec1
46
46
47
inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document& document)
47
inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document& document)
48
    : SVGElement(tagName, document)
48
    : SVGElement(tagName, document)
49
    , m_x(LengthModeWidth)
49
    , m_x(SVGLengthValue(LengthModeWidth))
50
    , m_y(LengthModeHeight)
50
    , m_y(SVGLengthValue(LengthModeHeight))
51
{
51
{
52
    ASSERT(hasTagName(SVGNames::cursorTag));
52
    ASSERT(hasTagName(SVGNames::cursorTag));
53
    registerAnimatedPropertiesForSVGCursorElement();
53
    registerAnimatedPropertiesForSVGCursorElement();
- Source/WebCore/svg/SVGEllipseElement.cpp -4 / +4 lines
Lines 48-57 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGEllipseElement.cpp_sec1
48
48
49
inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document& document)
49
inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document& document)
50
    : SVGGraphicsElement(tagName, document)
50
    : SVGGraphicsElement(tagName, document)
51
    , m_cx(LengthModeWidth)
51
    , m_cx(SVGLengthValue(LengthModeWidth))
52
    , m_cy(LengthModeHeight)
52
    , m_cy(SVGLengthValue(LengthModeHeight))
53
    , m_rx(LengthModeWidth)
53
    , m_rx(SVGLengthValue(LengthModeWidth))
54
    , m_ry(LengthModeHeight)
54
    , m_ry(SVGLengthValue(LengthModeHeight))
55
{
55
{
56
    ASSERT(hasTagName(SVGNames::ellipseTag));
56
    ASSERT(hasTagName(SVGNames::ellipseTag));
57
    registerAnimatedPropertiesForSVGEllipseElement();
57
    registerAnimatedPropertiesForSVGEllipseElement();
- Source/WebCore/svg/SVGFEColorMatrixElement.cpp -2 / +2 lines
Lines 83-89 bool SVGFEColorMatrixElement::setFilterE Source/WebCore/svg/SVGFEColorMatrixElement.cpp_sec1
83
    if (attrName == SVGNames::typeAttr)
83
    if (attrName == SVGNames::typeAttr)
84
        return colorMatrix->setType(type());
84
        return colorMatrix->setType(type());
85
    if (attrName == SVGNames::valuesAttr)
85
    if (attrName == SVGNames::valuesAttr)
86
        return colorMatrix->setValues(values());
86
        return colorMatrix->setValues(values().properties());
87
87
88
    ASSERT_NOT_REACHED();
88
    ASSERT_NOT_REACHED();
89
    return false;
89
    return false;
Lines 133-139 RefPtr<FilterEffect> SVGFEColorMatrixEle Source/WebCore/svg/SVGFEColorMatrixElement.cpp_sec2
133
            break;
133
            break;
134
        }
134
        }
135
    } else {
135
    } else {
136
        filterValues = values();
136
        filterValues = values().properties();
137
        unsigned size = filterValues.size();
137
        unsigned size = filterValues.size();
138
138
139
        if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20)
139
        if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20)
- Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp -2 / +2 lines
Lines 282-293 RefPtr<FilterEffect> SVGFEConvolveMatrix Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp_sec1
282
        return nullptr;
282
        return nullptr;
283
    if (!hasAttribute(SVGNames::divisorAttr)) {
283
    if (!hasAttribute(SVGNames::divisorAttr)) {
284
        for (int i = 0; i < kernelMatrixSize; ++i)
284
        for (int i = 0; i < kernelMatrixSize; ++i)
285
            divisorValue += kernelMatrix.at(i);
285
            divisorValue += kernelMatrix.propertyAt(i);
286
        if (!divisorValue)
286
        if (!divisorValue)
287
            divisorValue = 1;
287
            divisorValue = 1;
288
    }
288
    }
289
289
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());
291
    effect->inputEffects().append(input1);
291
    effect->inputEffects().append(input1);
292
    return WTFMove(effect);
292
    return WTFMove(effect);
293
}
293
}
- Source/WebCore/svg/SVGFilterElement.cpp -4 / +4 lines
Lines 64-73 inline SVGFilterElement::SVGFilterElemen Source/WebCore/svg/SVGFilterElement.cpp_sec1
64
    : SVGElement(tagName, document)
64
    : SVGElement(tagName, document)
65
    , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
65
    , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
66
    , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
66
    , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
67
    , m_x(LengthModeWidth, "-10%")
67
    , m_x(SVGLengthValue(LengthModeWidth, "-10%"))
68
    , m_y(LengthModeHeight, "-10%")
68
    , m_y(SVGLengthValue(LengthModeHeight, "-10%"))
69
    , m_width(LengthModeWidth, "120%")
69
    , m_width(SVGLengthValue(LengthModeWidth, "120%"))
70
    , m_height(LengthModeHeight, "120%")
70
    , m_height(SVGLengthValue(LengthModeHeight, "120%"))
71
{
71
{
72
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
72
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
73
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
73
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
- Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp -4 / +4 lines
Lines 51-60 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp_sec1
51
51
52
SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document)
52
SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document)
53
    : SVGElement(tagName, document)
53
    : SVGElement(tagName, document)
54
    , m_x(LengthModeWidth, "0%")
54
    , m_x(SVGLengthValue(LengthModeWidth, "0%"))
55
    , m_y(LengthModeHeight, "0%")
55
    , m_y(SVGLengthValue(LengthModeHeight, "0%"))
56
    , m_width(LengthModeWidth, "100%")
56
    , m_width(SVGLengthValue(LengthModeWidth, "100%"))
57
    , m_height(LengthModeHeight, "100%")
57
    , m_height(SVGLengthValue(LengthModeHeight, "100%"))
58
{
58
{
59
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified.
59
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified.
60
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified.
60
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified.
- Source/WebCore/svg/SVGForeignObjectElement.cpp -4 / +4 lines
Lines 53-62 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGForeignObjectElement.cpp_sec1
53
53
54
inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document& document)
54
inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document& document)
55
    : SVGGraphicsElement(tagName, document)
55
    : SVGGraphicsElement(tagName, document)
56
    , m_x(LengthModeWidth)
56
    , m_x(SVGLengthValue(LengthModeWidth))
57
    , m_y(LengthModeHeight)
57
    , m_y(SVGLengthValue(LengthModeHeight))
58
    , m_width(LengthModeWidth)
58
    , m_width(SVGLengthValue(LengthModeWidth))
59
    , m_height(LengthModeHeight)
59
    , m_height(SVGLengthValue(LengthModeHeight))
60
{
60
{
61
    ASSERT(hasTagName(SVGNames::foreignObjectTag));
61
    ASSERT(hasTagName(SVGNames::foreignObjectTag));
62
    registerAnimatedPropertiesForSVGForeignObjectElement();
62
    registerAnimatedPropertiesForSVGForeignObjectElement();
- Source/WebCore/svg/SVGImageElement.cpp -4 / +4 lines
Lines 55-64 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGImageElement.cpp_sec1
55
55
56
inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& document)
56
inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& document)
57
    : SVGGraphicsElement(tagName, document)
57
    : SVGGraphicsElement(tagName, document)
58
    , m_x(LengthModeWidth)
58
    , m_x(SVGLengthValue(LengthModeWidth))
59
    , m_y(LengthModeHeight)
59
    , m_y(SVGLengthValue(LengthModeHeight))
60
    , m_width(LengthModeWidth)
60
    , m_width(SVGLengthValue(LengthModeWidth))
61
    , m_height(LengthModeHeight)
61
    , m_height(SVGLengthValue(LengthModeHeight))
62
    , m_imageLoader(*this)
62
    , m_imageLoader(*this)
63
{
63
{
64
    registerAnimatedPropertiesForSVGImageElement();
64
    registerAnimatedPropertiesForSVGImageElement();
- Source/WebCore/svg/SVGLength.h -12 / +2 lines
Lines 47-53 public: Source/WebCore/svg/SVGLength.h_sec1
47
        SVG_LENGTHTYPE_PC = LengthTypePC
47
        SVG_LENGTHTYPE_PC = LengthTypePC
48
    };
48
    };
49
49
50
    static Ref<SVGLength> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGLengthValue& value)
50
    static Ref<SVGLength> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
51
    {
51
    {
52
        return adoptRef(*new SVGLength(animatedProperty, role, value));
52
        return adoptRef(*new SVGLength(animatedProperty, role, value));
53
    }
53
    }
Lines 57-67 public: Source/WebCore/svg/SVGLength.h_sec2
57
        return adoptRef(*new SVGLength(initialValue));
57
        return adoptRef(*new SVGLength(initialValue));
58
    }
58
    }
59
59
60
    static Ref<SVGLength> create(const SVGLengthValue* initialValue)
61
    {
62
        return adoptRef(*new SVGLength(initialValue));
63
    }
64
65
    template<typename T> static ExceptionOr<Ref<SVGLength>> create(ExceptionOr<T>&& initialValue)
60
    template<typename T> static ExceptionOr<Ref<SVGLength>> create(ExceptionOr<T>&& initialValue)
66
    {
61
    {
67
        if (initialValue.hasException())
62
        if (initialValue.hasException())
Lines 153-159 public: Source/WebCore/svg/SVGLength.h_sec3
153
    }
148
    }
154
149
155
private:
150
private:
156
    SVGLength(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGLengthValue& value)
151
    SVGLength(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
157
        : SVGPropertyTearOff<SVGLengthValue>(&animatedProperty, role, value)
152
        : SVGPropertyTearOff<SVGLengthValue>(&animatedProperty, role, value)
158
    {
153
    {
159
    }
154
    }
Lines 162-172 private: Source/WebCore/svg/SVGLength.h_sec4
162
        : SVGPropertyTearOff<SVGLengthValue>(initialValue)
157
        : SVGPropertyTearOff<SVGLengthValue>(initialValue)
163
    {
158
    {
164
    }
159
    }
165
166
    explicit SVGLength(const SVGLengthValue* initialValue)
167
        : SVGPropertyTearOff<SVGLengthValue>(initialValue)
168
    {
169
    }
170
};
160
};
171
161
172
} // namespace WebCore
162
} // namespace WebCore
- Source/WebCore/svg/SVGLengthList.h -2 / +2 lines
Lines 36-48 public: Source/WebCore/svg/SVGLengthList.h_sec1
36
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGLengthListValues>;
36
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGLengthListValues>;
37
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
37
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
38
38
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)
40
    {
40
    {
41
        return adoptRef(*new SVGLengthList(animatedProperty, role, values, wrappers));
41
        return adoptRef(*new SVGLengthList(animatedProperty, role, values, wrappers));
42
    }
42
    }
43
43
44
private:
44
private:
45
    SVGLengthList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGLengthListValues& values, ListWrapperCache& wrappers)
45
    SVGLengthList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
46
        : SVGListPropertyTearOff<SVGLengthListValues>(animatedProperty, role, values, wrappers)
46
        : SVGListPropertyTearOff<SVGLengthListValues>(animatedProperty, role, values, wrappers)
47
    {
47
    {
48
    }
48
    }
- Source/WebCore/svg/SVGLengthListValues.cpp -2 / +3 lines
Lines 22-27 Source/WebCore/svg/SVGLengthListValues.cpp_sec1
22
#include "SVGLengthListValues.h"
22
#include "SVGLengthListValues.h"
23
23
24
#include "SVGParserUtilities.h"
24
#include "SVGParserUtilities.h"
25
#include "SVGValue.h"
25
#include <wtf/text/StringBuilder.h>
26
#include <wtf/text/StringBuilder.h>
26
27
27
namespace WebCore {
28
namespace WebCore {
Lines 46-52 void SVGLengthListValues::parse(const St Source/WebCore/svg/SVGLengthListValues.cpp_sec2
46
            return;
47
            return;
47
        if (length.setValueAsString(valueString).hasException())
48
        if (length.setValueAsString(valueString).hasException())
48
            return;
49
            return;
49
        append(length);
50
        append(SVGValue::create<SVGLengthValue>(length));
50
        skipOptionalSVGSpacesOrDelimiter(ptr, end);
51
        skipOptionalSVGSpacesOrDelimiter(ptr, end);
51
    }
52
    }
52
}
53
}
Lines 60-66 String SVGLengthListValues::valueAsStrin Source/WebCore/svg/SVGLengthListValues.cpp_sec3
60
        if (i > 0)
61
        if (i > 0)
61
            builder.append(' ');
62
            builder.append(' ');
62
63
63
        builder.append(at(i).valueAsString());
64
        builder.append(propertyAt(i).valueAsString());
64
    }
65
    }
65
66
66
    return builder.toString();
67
    return builder.toString();
- Source/WebCore/svg/SVGLengthListValues.h -6 / +20 lines
Lines 1-6 Source/WebCore/svg/SVGLengthListValues.h_sec1
1
/*
1
/*
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2018 Apple Inc.  All rights reserved.
4
 *
5
 *
5
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * modify it under the terms of the GNU Library General Public
Lines 21-46 Source/WebCore/svg/SVGLengthListValues.h_sec2
21
#pragma once
22
#pragma once
22
23
23
#include "SVGLengthValue.h"
24
#include "SVGLengthValue.h"
24
#include <wtf/Vector.h>
25
#include "SVGListValues.h"
25
26
26
namespace WebCore {
27
namespace WebCore {
27
28
28
class SVGLength;
29
class SVGLength;
29
class SVGLengthList;
30
class SVGLengthList;
30
31
31
class SVGLengthListValues final : public Vector<SVGLengthValue> {
32
class SVGLengthListValues final : public SVGListValues<SVGLengthValue> {
32
public:
33
public:
33
    void parse(const String& value, SVGLengthMode);
34
    void parse(const String& value, SVGLengthMode);
34
    String valueAsString() const;
35
    String valueAsString() const;
35
};
36
};
36
37
37
template<> struct SVGPropertyTraits<SVGLengthListValues> {
38
template<>
39
struct 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
    
38
    using ListItemType = SVGLengthValue;
55
    using ListItemType = SVGLengthValue;
39
    using ListItemTearOff = SVGLength;
56
    using ListItemTearOff = SVGLength;
40
    using ListPropertyTearOff = SVGLengthList;
57
    using ListPropertyTearOff = SVGLengthList;
41
42
    static SVGLengthListValues initialValue() { return  { }; }
43
    static String toString(const SVGLengthListValues& type) { return type.valueAsString(); }
44
};
58
};
45
59
46
} // namespace WebCore
60
} // namespace WebCore
- Source/WebCore/svg/SVGLengthValue.h -1 / +7 lines
Lines 147-153 private: Source/WebCore/svg/SVGLengthValue.h_sec1
147
147
148
template<> struct SVGPropertyTraits<SVGLengthValue> {
148
template<> struct SVGPropertyTraits<SVGLengthValue> {
149
    static SVGLengthValue initialValue() { return { }; }
149
    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(); }
151
};
157
};
152
158
153
WTF::TextStream& operator<<(WTF::TextStream&, const SVGLengthValue&);
159
WTF::TextStream& operator<<(WTF::TextStream&, const SVGLengthValue&);
- Source/WebCore/svg/SVGLinearGradientElement.cpp -4 / +4 lines
Lines 51-60 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGLinearGradientElement.cpp_sec1
51
51
52
inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document& document)
52
inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document& document)
53
    : SVGGradientElement(tagName, document)
53
    : SVGGradientElement(tagName, document)
54
    , m_x1(LengthModeWidth)
54
    , m_x1(SVGLengthValue(LengthModeWidth))
55
    , m_y1(LengthModeHeight)
55
    , m_y1(SVGLengthValue(LengthModeHeight))
56
    , m_x2(LengthModeWidth, "100%")
56
    , m_x2(SVGLengthValue(LengthModeWidth, "100%"))
57
    , m_y2(LengthModeHeight)
57
    , m_y2(SVGLengthValue(LengthModeHeight))
58
{
58
{
59
    // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified.
59
    // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified.
60
    ASSERT(hasTagName(SVGNames::linearGradientTag));
60
    ASSERT(hasTagName(SVGNames::linearGradientTag));
- Source/WebCore/svg/SVGListValues.cpp +64 lines
Line 0 Source/WebCore/svg/SVGListValues.cpp_sec1
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
31
namespace WebCore {
32
33
template <typename PropertyType>
34
void 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
42
template <typename PropertyType>
43
Vector<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.
52
template void SVGListValues<float>::resize(size_t);
53
template void SVGListValues<FloatPoint>::resize(size_t);
54
template void SVGListValues<SVGLengthValue>::resize(size_t);
55
template void SVGListValues<SVGTransformValue>::resize(size_t);
56
57
template Vector<RefPtr<SVGValue>> SVGListValues<float>::deepCopy() const;
58
template Vector<RefPtr<SVGValue>> SVGListValues<String>::deepCopy() const;
59
template Vector<RefPtr<SVGValue>> SVGListValues<FloatPoint>::deepCopy() const;
60
template Vector<RefPtr<SVGValue>> SVGListValues<SVGLengthValue>::deepCopy() const;
61
template Vector<RefPtr<SVGValue>> SVGListValues<RefPtr<SVGPathSeg>>::deepCopy() const;
62
template Vector<RefPtr<SVGValue>> SVGListValues<SVGTransformValue>::deepCopy() const;
63
64
}
- Source/WebCore/svg/SVGListValues.h +65 lines
Line 0 Source/WebCore/svg/SVGListValues.h_sec1
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
30
namespace WebCore {
31
    
32
class SVGValue;
33
    
34
template<typename PropertyType>
35
class SVGListValues : public Vector<RefPtr<SVGValue>> {
36
public:
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
}
- Source/WebCore/svg/SVGMarkerElement.cpp -9 / +9 lines
Lines 71-80 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGMarkerElement.cpp_sec1
71
71
72
inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document& document)
72
inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document& document)
73
    : SVGElement(tagName, document)
73
    : SVGElement(tagName, document)
74
    , m_refX(LengthModeWidth)
74
    , m_refX(SVGLengthValue(LengthModeWidth))
75
    , m_refY(LengthModeHeight)
75
    , m_refY(SVGLengthValue(LengthModeHeight))
76
    , m_markerWidth(LengthModeWidth, "3")
76
    , m_markerWidth(SVGLengthValue(LengthModeWidth, "3"))
77
    , m_markerHeight(LengthModeHeight, "3") 
77
    , m_markerHeight(SVGLengthValue(LengthModeHeight, "3"))
78
    , m_markerUnits(SVGMarkerUnitsStrokeWidth)
78
    , m_markerUnits(SVGMarkerUnitsStrokeWidth)
79
    , m_orientType(SVGMarkerOrientAngle)
79
    , m_orientType(SVGMarkerOrientAngle)
80
{
80
{
Lines 238-249 void SVGMarkerElement::synchronizeOrient Source/WebCore/svg/SVGMarkerElement.cpp_sec2
238
    static NeverDestroyed<AtomicString> autoStartReverseString("auto-start-reverse", AtomicString::ConstructFromLiteral);
238
    static NeverDestroyed<AtomicString> autoStartReverseString("auto-start-reverse", AtomicString::ConstructFromLiteral);
239
239
240
    // If orient is not auto or auto-start-reverse, the previous call to synchronizeOrientAngle already set the orientAttr to the right angle.
240
    // 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) {
242
        ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoString);
242
        ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoString);
243
        return;
243
        return;
244
    }
244
    }
245
245
246
    if (ownerType.m_orientType.value == SVGMarkerOrientAutoStartReverse)
246
    if (static_cast<SVGMarkerOrientType&>(*ownerType.m_orientType.value) == SVGMarkerOrientAutoStartReverse)
247
        ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoStartReverseString);
247
        ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoStartReverseString);
248
}
248
}
249
249
Lines 259-269 SVGMarkerOrientType& SVGMarkerElement::o Source/WebCore/svg/SVGMarkerElement.cpp_sec3
259
{
259
{
260
    if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, SVGAnimatedEnumeration>(this, orientTypePropertyInfo())) {
260
    if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, SVGAnimatedEnumeration>(this, orientTypePropertyInfo())) {
261
        if (wrapper->isAnimating()) {
261
        if (wrapper->isAnimating()) {
262
            ASSERT(wrapper->currentAnimatedValue() < SVGMarkerOrientMax);
262
            ASSERT(static_cast<SVGMarkerOrientType&>(*wrapper->currentAnimatedValue()) < SVGMarkerOrientMax);
263
            return reinterpret_cast<SVGMarkerOrientType&>(wrapper->currentAnimatedValue());
263
            return static_cast<SVGMarkerOrientType&>(*wrapper->currentAnimatedValue());
264
        }
264
        }
265
    }
265
    }
266
    return m_orientType.value;
266
    return static_cast<SVGMarkerOrientType&>(*m_orientType.value);
267
}
267
}
268
268
269
Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated()
269
Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated()
- Source/WebCore/svg/SVGMarkerElement.h -68 / +3 lines
Lines 29-103 Source/WebCore/svg/SVGMarkerElement.h_sec1
29
#include "SVGElement.h"
29
#include "SVGElement.h"
30
#include "SVGExternalResourcesRequired.h"
30
#include "SVGExternalResourcesRequired.h"
31
#include "SVGFitToViewBox.h"
31
#include "SVGFitToViewBox.h"
32
#include "SVGMarkerTypes.h"
32
33
33
namespace WebCore {
34
namespace WebCore {
34
35
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
101
class SVGMarkerElement final : public SVGElement,
36
class SVGMarkerElement final : public SVGElement,
102
                               public SVGExternalResourcesRequired,
37
                               public SVGExternalResourcesRequired,
103
                               public SVGFitToViewBox {
38
                               public SVGFitToViewBox {
Lines 164-171 public: Source/WebCore/svg/SVGMarkerElement.h_sec2
164
    static void synchronizeOrientType(SVGElement* contextElement);
99
    static void synchronizeOrientType(SVGElement* contextElement);
165
    static Ref<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
100
    static Ref<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
166
    SVGMarkerOrientType& orientType() const;
101
    SVGMarkerOrientType& orientType() const;
167
    SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }
102
    SVGMarkerOrientType& orientTypeBaseValue() const { return static_cast<SVGMarkerOrientType&>(*m_orientType.value); }
168
    void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }
103
    void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { orientTypeBaseValue() = type; }
169
    Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();
104
    Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();
170
105
171
private:
106
private:
- Source/WebCore/svg/SVGMarkerTypes.h +106 lines
Line 0 Source/WebCore/svg/SVGMarkerTypes.h_sec1
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
30
namespace WebCore {
31
32
enum SVGMarkerUnitsType {
33
    SVGMarkerUnitsUnknown = 0,
34
    SVGMarkerUnitsUserSpaceOnUse,
35
    SVGMarkerUnitsStrokeWidth
36
};
37
38
enum SVGMarkerOrientType {
39
    SVGMarkerOrientUnknown = 0,
40
    SVGMarkerOrientAuto,
41
    SVGMarkerOrientAngle,
42
    SVGMarkerOrientAutoStartReverse,
43
    
44
    // Add new elements before here.
45
    SVGMarkerOrientMax
46
};
47
    
48
template<>
49
struct 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
75
template<>
76
struct 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
91
template<>
92
struct 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
103
template<>
104
inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
105
106
} // namespace WebCore
- Source/WebCore/svg/SVGMaskElement.cpp -4 / +4 lines
Lines 60-69 inline SVGMaskElement::SVGMaskElement(co Source/WebCore/svg/SVGMaskElement.cpp_sec1
60
    : SVGElement(tagName, document)
60
    : SVGElement(tagName, document)
61
    , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
61
    , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
62
    , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
62
    , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
63
    , m_x(LengthModeWidth, "-10%")
63
    , m_x(SVGLengthValue(LengthModeWidth, "-10%"))
64
    , m_y(LengthModeHeight, "-10%")
64
    , m_y(SVGLengthValue(LengthModeHeight, "-10%"))
65
    , m_width(LengthModeWidth, "120%")
65
    , m_width(SVGLengthValue(LengthModeWidth, "120%"))
66
    , m_height(LengthModeHeight, "120%")
66
    , m_height(SVGLengthValue(LengthModeHeight, "120%"))
67
{
67
{
68
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
68
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
69
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
69
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
- Source/WebCore/svg/SVGMatrix.h -11 / +11 lines
Lines 33-39 namespace WebCore { Source/WebCore/svg/SVGMatrix.h_sec1
33
// FIXME: Remove this class once SVGMatrix becomes an alias to DOMMatrix.
33
// FIXME: Remove this class once SVGMatrix becomes an alias to DOMMatrix.
34
class SVGMatrix : public SVGPropertyTearOff<SVGMatrixValue> {
34
class SVGMatrix : public SVGPropertyTearOff<SVGMatrixValue> {
35
public:
35
public:
36
    static Ref<SVGMatrix> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGMatrixValue& value)
36
    static Ref<SVGMatrix> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
37
    {
37
    {
38
        return adoptRef(*new SVGMatrix(animatedProperty, role, value));
38
        return adoptRef(*new SVGMatrix(animatedProperty, role, value));
39
    }
39
    }
Lines 180-186 public: Source/WebCore/svg/SVGMatrix.h_sec2
180
        if (isReadOnly())
180
        if (isReadOnly())
181
            return Exception { NoModificationAllowedError };
181
            return Exception { NoModificationAllowedError };
182
182
183
        auto result = propertyReference().translate(x, y);        
183
        auto result = propertyReference().translate(x, y);
184
        commitChange();
184
        commitChange();
185
185
186
        return SVGMatrix::create(result);
186
        return SVGMatrix::create(result);
Lines 191-197 public: Source/WebCore/svg/SVGMatrix.h_sec3
191
        if (isReadOnly())
191
        if (isReadOnly())
192
            return Exception { NoModificationAllowedError };
192
            return Exception { NoModificationAllowedError };
193
193
194
        auto result = propertyReference().scale(scaleFactor);        
194
        auto result = propertyReference().scale(scaleFactor);
195
        commitChange();
195
        commitChange();
196
196
197
        return SVGMatrix::create(result);
197
        return SVGMatrix::create(result);
Lines 202-208 public: Source/WebCore/svg/SVGMatrix.h_sec4
202
        if (isReadOnly())
202
        if (isReadOnly())
203
            return Exception { NoModificationAllowedError };
203
            return Exception { NoModificationAllowedError };
204
204
205
        auto result = propertyReference().scaleNonUniform(scaleFactorX, scaleFactorY);        
205
        auto result = propertyReference().scaleNonUniform(scaleFactorX, scaleFactorY);
206
        commitChange();
206
        commitChange();
207
207
208
        return SVGMatrix::create(result);
208
        return SVGMatrix::create(result);
Lines 213-219 public: Source/WebCore/svg/SVGMatrix.h_sec5
213
        if (isReadOnly())
213
        if (isReadOnly())
214
            return Exception { NoModificationAllowedError };
214
            return Exception { NoModificationAllowedError };
215
215
216
        auto result = propertyReference().rotate(angle);        
216
        auto result = propertyReference().rotate(angle);
217
        commitChange();
217
        commitChange();
218
218
219
        return SVGMatrix::create(result);
219
        return SVGMatrix::create(result);
Lines 224-230 public: Source/WebCore/svg/SVGMatrix.h_sec6
224
        if (isReadOnly())
224
        if (isReadOnly())
225
            return Exception { NoModificationAllowedError };
225
            return Exception { NoModificationAllowedError };
226
226
227
        auto result = propertyReference().rotateFromVector(x, y);        
227
        auto result = propertyReference().rotateFromVector(x, y);
228
        if (result.hasException())
228
        if (result.hasException())
229
            return result.releaseException();
229
            return result.releaseException();
230
        
230
        
Lines 237-243 public: Source/WebCore/svg/SVGMatrix.h_sec7
237
        if (isReadOnly())
237
        if (isReadOnly())
238
            return Exception { NoModificationAllowedError };
238
            return Exception { NoModificationAllowedError };
239
239
240
        auto result = propertyReference().flipX();        
240
        auto result = propertyReference().flipX();
241
        commitChange();
241
        commitChange();
242
242
243
        return SVGMatrix::create(result);
243
        return SVGMatrix::create(result);
Lines 248-254 public: Source/WebCore/svg/SVGMatrix.h_sec8
248
        if (isReadOnly())
248
        if (isReadOnly())
249
            return Exception { NoModificationAllowedError };
249
            return Exception { NoModificationAllowedError };
250
250
251
        auto result = propertyReference().flipY();        
251
        auto result = propertyReference().flipY();
252
        commitChange();
252
        commitChange();
253
253
254
        return SVGMatrix::create(result);
254
        return SVGMatrix::create(result);
Lines 259-265 public: Source/WebCore/svg/SVGMatrix.h_sec9
259
        if (isReadOnly())
259
        if (isReadOnly())
260
            return Exception { NoModificationAllowedError };
260
            return Exception { NoModificationAllowedError };
261
261
262
        auto result = propertyReference().skewX(angle);        
262
        auto result = propertyReference().skewX(angle);
263
        commitChange();
263
        commitChange();
264
264
265
        return SVGMatrix::create(result);
265
        return SVGMatrix::create(result);
Lines 270-283 public: Source/WebCore/svg/SVGMatrix.h_sec10
270
        if (isReadOnly())
270
        if (isReadOnly())
271
            return Exception { NoModificationAllowedError };
271
            return Exception { NoModificationAllowedError };
272
272
273
        auto result = propertyReference().skewY(angle);        
273
        auto result = propertyReference().skewY(angle);
274
        commitChange();
274
        commitChange();
275
275
276
        return SVGMatrix::create(result);
276
        return SVGMatrix::create(result);
277
    }
277
    }
278
278
279
protected:
279
protected:
280
    SVGMatrix(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGMatrixValue& value)
280
    SVGMatrix(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
281
        : SVGPropertyTearOff<SVGMatrixValue>(&animatedProperty, role, value)
281
        : SVGPropertyTearOff<SVGMatrixValue>(&animatedProperty, role, value)
282
    {
282
    {
283
    }
283
    }
- Source/WebCore/svg/SVGNumber.h -12 / +2 lines
Lines 31-37 namespace WebCore { Source/WebCore/svg/SVGNumber.h_sec1
31
31
32
class SVGNumber : public SVGPropertyTearOff<float> {
32
class SVGNumber : public SVGPropertyTearOff<float> {
33
public:
33
public:
34
    static Ref<SVGNumber> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, float& value)
34
    static Ref<SVGNumber> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
35
    {
35
    {
36
        return adoptRef(*new SVGNumber(animatedProperty, role, value));
36
        return adoptRef(*new SVGNumber(animatedProperty, role, value));
37
    }
37
    }
Lines 41-51 public: Source/WebCore/svg/SVGNumber.h_sec2
41
        return adoptRef(*new SVGNumber(initialValue));
41
        return adoptRef(*new SVGNumber(initialValue));
42
    }
42
    }
43
43
44
    static Ref<SVGNumber> create(const float* initialValue)
45
    {
46
        return adoptRef(*new SVGNumber(initialValue));
47
    }
48
49
    template<typename T> static ExceptionOr<Ref<SVGNumber>> create(ExceptionOr<T>&& initialValue)
44
    template<typename T> static ExceptionOr<Ref<SVGNumber>> create(ExceptionOr<T>&& initialValue)
50
    {
45
    {
51
        if (initialValue.hasException())
46
        if (initialValue.hasException())
Lines 70-76 public: Source/WebCore/svg/SVGNumber.h_sec3
70
    }
65
    }
71
66
72
private:
67
private:
73
    SVGNumber(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, float& value)
68
    SVGNumber(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
74
        : SVGPropertyTearOff<float>(&animatedProperty, role, value)
69
        : SVGPropertyTearOff<float>(&animatedProperty, role, value)
75
    {
70
    {
76
    }
71
    }
Lines 79-89 private: Source/WebCore/svg/SVGNumber.h_sec4
79
        : SVGPropertyTearOff<float>(initialValue)
74
        : SVGPropertyTearOff<float>(initialValue)
80
    {
75
    {
81
    }
76
    }
82
83
    explicit SVGNumber(const float* initialValue)
84
        : SVGPropertyTearOff<float>(initialValue)
85
    {
86
    }
87
};
77
};
88
78
89
} // namespace WebCore
79
} // namespace WebCore
- Source/WebCore/svg/SVGNumberList.h -2 / +2 lines
Lines 36-48 public: Source/WebCore/svg/SVGNumberList.h_sec1
36
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGNumberListValues>;
36
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGNumberListValues>;
37
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
37
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
38
38
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)
40
    {
40
    {
41
        return adoptRef(*new SVGNumberList(animatedProperty, role, values, wrappers));
41
        return adoptRef(*new SVGNumberList(animatedProperty, role, values, wrappers));
42
    }
42
    }
43
43
44
private:
44
private:
45
    SVGNumberList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGNumberListValues& values, ListWrapperCache& wrappers)
45
    SVGNumberList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
46
        : SVGListPropertyTearOff<SVGNumberListValues>(animatedProperty, role, values, wrappers)
46
        : SVGListPropertyTearOff<SVGNumberListValues>(animatedProperty, role, values, wrappers)
47
    {
47
    {
48
    }
48
    }
- Source/WebCore/svg/SVGNumberListValues.cpp -2 / +2 lines
Lines 39-45 void SVGNumberListValues::parse(const St Source/WebCore/svg/SVGNumberListValues.cpp_sec1
39
    while (ptr < end) {
39
    while (ptr < end) {
40
        if (!parseNumber(ptr, end, number))
40
        if (!parseNumber(ptr, end, number))
41
            return;
41
            return;
42
        append(number);
42
        append(SVGValue::create<float>(number));
43
    }
43
    }
44
}
44
}
45
45
Lines 52-58 String SVGNumberListValues::valueAsStrin Source/WebCore/svg/SVGNumberListValues.cpp_sec2
52
        if (i > 0)
52
        if (i > 0)
53
            builder.append(' ');
53
            builder.append(' ');
54
54
55
        builder.appendNumber(at(i));
55
        builder.appendNumber(propertyAt(i));
56
    }
56
    }
57
57
58
    return builder.toString();
58
    return builder.toString();
- Source/WebCore/svg/SVGNumberListValues.h -5 / +11 lines
Lines 20-43 Source/WebCore/svg/SVGNumberListValues.h_sec1
20
20
21
#pragma once
21
#pragma once
22
22
23
#include "SVGListValues.h"
23
#include "SVGPropertyTraits.h"
24
#include "SVGPropertyTraits.h"
24
#include <wtf/Vector.h>
25
25
26
namespace WebCore {
26
namespace WebCore {
27
27
28
class SVGNumber;
28
class SVGNumber;
29
class SVGNumberList;
29
class SVGNumberList;
30
30
31
class SVGNumberListValues final : public Vector<float> {
31
class SVGNumberListValues final : public SVGListValues<float> {
32
public:
32
public:
33
    void parse(const String&);
33
    void parse(const String&);
34
    String valueAsString() const;
34
    String valueAsString() const;   
35
};
35
};
36
36
37
template<> struct SVGPropertyTraits<SVGNumberListValues> {
37
template<>
38
struct SVGPropertyTraits<SVGNumberListValues> {
38
    static SVGNumberListValues initialValue() { return { }; }
39
    static SVGNumberListValues initialValue() { return { }; }
40
    static SVGNumberListValues fromString(const String& string)
41
    {
42
        SVGNumberListValues list;
43
        list.parse(string);
44
        return list;
45
    }
39
    static String toString(const SVGNumberListValues& list) { return list.valueAsString(); }
46
    static String toString(const SVGNumberListValues& list) { return list.valueAsString(); }
40
41
    using ListItemType = float;
47
    using ListItemType = float;
42
    using ListItemTearOff = SVGNumber;
48
    using ListItemTearOff = SVGNumber;
43
    using ListPropertyTearOff = SVGNumberList;
49
    using ListPropertyTearOff = SVGNumberList;
- Source/WebCore/svg/SVGParserUtilities.cpp -1 / +26 lines
Lines 219-224 bool parseNumberOptionalNumber(const Str Source/WebCore/svg/SVGParserUtilities.cpp_sec1
219
    return cur == end;
219
    return cur == end;
220
}
220
}
221
221
222
bool 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
222
bool parseRect(const String& string, FloatRect& rect)
247
bool parseRect(const String& string, FloatRect& rect)
223
{
248
{
224
    auto upconvertedCharacters = StringView(string).upconvertedCharacters();
249
    auto upconvertedCharacters = StringView(string).upconvertedCharacters();
Lines 264-270 bool pointsListFromSVGData(SVGPointListV Source/WebCore/svg/SVGParserUtilities.cpp_sec2
264
        }
289
        }
265
        skipOptionalSVGSpaces(cur, end);
290
        skipOptionalSVGSpaces(cur, end);
266
291
267
        pointsList.append(FloatPoint(xPos, yPos));
292
        pointsList.append(SVGValue::create<FloatPoint>(FloatPoint(xPos, yPos)));
268
    }
293
    }
269
    return cur == end && !delimParsed;
294
    return cur == end && !delimParsed;
270
}
295
}
- Source/WebCore/svg/SVGParserUtilities.h +1 lines
Lines 43-48 bool parseNumberOptionalNumber(const Str Source/WebCore/svg/SVGParserUtilities.h_sec1
43
bool parseArcFlag(const LChar*& ptr, const LChar* end, bool& flag);
43
bool parseArcFlag(const LChar*& ptr, const LChar* end, bool& flag);
44
bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag);
44
bool parseArcFlag(const UChar*& ptr, const UChar* end, bool& flag);
45
bool parseRect(const String&, FloatRect&);
45
bool parseRect(const String&, FloatRect&);
46
bool parsePoint(const String&, FloatPoint&);
46
47
47
template <typename CharacterType>
48
template <typename CharacterType>
48
bool parseFloatPoint(const CharacterType*& current, const CharacterType* end, FloatPoint&);
49
bool parseFloatPoint(const CharacterType*& current, const CharacterType* end, FloatPoint&);
- Source/WebCore/svg/SVGPathByteStream.h -12 / +33 lines
Lines 19-24 Source/WebCore/svg/SVGPathByteStream.h_sec1
19
19
20
#pragma once
20
#pragma once
21
21
22
#include "SVGPathUtilities.h"
23
#include "SVGPropertyTraits.h"
22
#include <wtf/Vector.h>
24
#include <wtf/Vector.h>
23
25
24
namespace WebCore {
26
namespace WebCore {
Lines 46-79 public: Source/WebCore/svg/SVGPathByteStream.h_sec2
46
    typedef Data::const_iterator DataIterator;
48
    typedef Data::const_iterator DataIterator;
47
49
48
    SVGPathByteStream() { }
50
    SVGPathByteStream() { }
49
    SVGPathByteStream(const Data& data) : m_data(data) { }
51
    SVGPathByteStream(SVGPathByteStream&& other)
52
        : m_data(WTFMove(other.m_data))
53
    {
54
    }
50
    
55
    
51
    bool operator==(const SVGPathByteStream& other) const
56
    SVGPathByteStream(const SVGPathByteStream& other)
57
        : m_data(other.m_data)
52
    {
58
    {
53
        return m_data == other.m_data;
54
    }
59
    }
55
60
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)
57
    {
67
    {
58
        return !(*this == other);
68
        m_data = other.m_data;
69
        return *this;
59
    }
70
    }
60
71
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
61
    std::unique_ptr<SVGPathByteStream> copy() const
75
    std::unique_ptr<SVGPathByteStream> copy() const
62
    {
76
    {
63
        return std::make_unique<SVGPathByteStream>(m_data);
77
        return std::make_unique<SVGPathByteStream>(*this);
64
    }
78
    }
65
79
66
    DataIterator begin() const { return m_data.begin(); }
80
    DataIterator begin() const { return m_data.begin(); }
67
    DataIterator end() const { return m_data.end(); }
81
    DataIterator end() const { return m_data.end(); }
68
82
69
    void append(unsigned char byte) { m_data.append(byte); }
83
    void append(unsigned char byte) { m_data.append(byte); }
70
    void append(const SVGPathByteStream& other)
84
    void append(const SVGPathByteStream& other) { m_data.appendVector(other.m_data); }
71
    {
72
        for (auto stream : other)
73
            append(stream);
74
    }
75
    void clear() { m_data.clear(); }
85
    void clear() { m_data.clear(); }
76
    bool isEmpty() const { return !m_data.size(); }
86
    bool isEmpty() const { return m_data.isEmpty(); }
77
    unsigned size() const { return m_data.size(); }
87
    unsigned size() const { return m_data.size(); }
78
88
79
    // Only defined to let SVGAnimatedPathAnimator use the standard list code paths - this method is never called.
89
    // Only defined to let SVGAnimatedPathAnimator use the standard list code paths - this method is never called.
Lines 82-86 public: Source/WebCore/svg/SVGPathByteStream.h_sec3
82
private:
92
private:
83
    Data m_data;
93
    Data m_data;
84
};
94
};
95
    
96
template<>
97
struct 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
};
85
106
86
} // namespace WebCore
107
} // namespace WebCore
- Source/WebCore/svg/SVGPathElement.cpp -8 / +8 lines
Lines 80-86 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGPathElement.cpp_sec1
80
80
81
inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& document)
81
inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& document)
82
    : SVGGraphicsElement(tagName, document)
82
    : SVGGraphicsElement(tagName, document)
83
    , m_pathSegList(PathSegUnalteredRole)
83
    , m_pathSegList(SVGPathSegListValues(PathSegUnalteredRole))
84
    , m_isAnimValObserved(false)
84
    , m_isAnimValObserved(false)
85
{
85
{
86
    ASSERT(hasTagName(SVGNames::pathTag));
86
    ASSERT(hasTagName(SVGNames::pathTag));
Lines 255-261 void SVGPathElement::svgAttributeChanged Source/WebCore/svg/SVGPathElement.cpp_sec2
255
        if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo())->isAnimating()) {
255
        if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo())->isAnimating()) {
256
            SVGPathSegListValues newList(PathSegUnalteredRole);
256
            SVGPathSegListValues newList(PathSegUnalteredRole);
257
            buildSVGPathSegListValuesFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing);
257
            buildSVGPathSegListValuesFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing);
258
            m_pathSegList.value = newList;
258
            static_cast<SVGPathSegListValues&>(*m_pathSegList.value) = WTFMove(newList);
259
        }
259
        }
260
260
261
        if (renderer)
261
        if (renderer)
Lines 327-334 Ref<SVGAnimatedProperty> SVGPathElement: Source/WebCore/svg/SVGPathElement.cpp_sec3
327
    if (auto property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(&ownerType, dPropertyInfo()))
327
    if (auto property = SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(&ownerType, dPropertyInfo()))
328
        return *property;
328
        return *property;
329
329
330
    if (ownerType.m_pathSegList.value.isEmpty())
330
    if (static_cast<SVGPathSegListValues&>(*ownerType.m_pathSegList.value).isEmpty())
331
        buildSVGPathSegListValuesFromByteStream(ownerType.m_pathByteStream, ownerType, ownerType.m_pathSegList.value, UnalteredParsing);
331
        buildSVGPathSegListValuesFromByteStream(ownerType.m_pathByteStream, ownerType, static_cast<SVGPathSegListValues&>(*ownerType.m_pathSegList.value), UnalteredParsing);
332
332
333
    return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegListValues>(&ownerType, dPropertyInfo(), ownerType.m_pathSegList.value);
333
    return SVGAnimatedProperty::lookupOrCreateWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegListValues>(&ownerType, dPropertyInfo(), ownerType.m_pathSegList.value);
334
}
334
}
Lines 339-345 void SVGPathElement::synchronizeD(SVGEle Source/WebCore/svg/SVGPathElement.cpp_sec4
339
    SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement);
339
    SVGPathElement& ownerType = downcast<SVGPathElement>(*contextElement);
340
    if (!ownerType.m_pathSegList.shouldSynchronize)
340
    if (!ownerType.m_pathSegList.shouldSynchronize)
341
        return;
341
        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());
343
}
343
}
344
344
345
void SVGPathElement::animatedPropertyWillBeDeleted()
345
void SVGPathElement::animatedPropertyWillBeDeleted()
Lines 392-401 void SVGPathElement::pathSegListChanged( Source/WebCore/svg/SVGPathElement.cpp_sec5
392
        break;
392
        break;
393
    case PathSegUnalteredRole:
393
    case PathSegUnalteredRole:
394
        if (listModification == ListModificationAppend) {
394
        if (listModification == ListModificationAppend) {
395
            ASSERT(!m_pathSegList.value.isEmpty());
395
            ASSERT(!static_cast<SVGPathSegListValues&>(*m_pathSegList.value).isEmpty());
396
            appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last().copyRef(), m_pathByteStream, UnalteredParsing);
396
            appendSVGPathByteStreamFromSVGPathSeg(static_cast<SVGPathSegListValues&>(*m_pathSegList.value).lastProperty().copyRef(), m_pathByteStream, UnalteredParsing);
397
        } else
397
        } else
398
            buildSVGPathByteStreamFromSVGPathSegListValues(m_pathSegList.value, m_pathByteStream, UnalteredParsing);
398
            buildSVGPathByteStreamFromSVGPathSegListValues(static_cast<SVGPathSegListValues&>(*m_pathSegList.value), m_pathByteStream, UnalteredParsing);
399
        m_cachedPath = std::nullopt;
399
        m_cachedPath = std::nullopt;
400
        break;
400
        break;
401
    case PathSegUndefinedRole:
401
    case PathSegUndefinedRole:
- Source/WebCore/svg/SVGPathSegList.cpp -6 / +4 lines
Lines 28-42 namespace WebCore { Source/WebCore/svg/SVGPathSegList.cpp_sec1
28
28
29
void SVGPathSegList::clearContextAndRoles()
29
void SVGPathSegList::clearContextAndRoles()
30
{
30
{
31
    ASSERT(m_values);
31
    for (auto& item : valuesProperty().properties())
32
    for (auto& item : *m_values)
33
        static_cast<SVGPathSegWithContext*>(item.get())->setContextAndRole(nullptr, PathSegUndefinedRole);
32
        static_cast<SVGPathSegWithContext*>(item.get())->setContextAndRole(nullptr, PathSegUndefinedRole);
34
}
33
}
35
34
36
ExceptionOr<void> SVGPathSegList::clear()
35
ExceptionOr<void> SVGPathSegList::clear()
37
{
36
{
38
    ASSERT(m_values);
37
    if (valuesProperty().isEmpty())
39
    if (m_values->isEmpty())
40
        return { };
38
        return { };
41
39
42
    clearContextAndRoles();
40
    clearContextAndRoles();
Lines 50-57 ExceptionOr<RefPtr<SVGPathSeg>> SVGPathS Source/WebCore/svg/SVGPathSegList.cpp_sec2
50
48
51
ExceptionOr<RefPtr<SVGPathSeg>> SVGPathSegList::replaceItem(Ref<SVGPathSeg>&& newItem, unsigned index)
49
ExceptionOr<RefPtr<SVGPathSeg>> SVGPathSegList::replaceItem(Ref<SVGPathSeg>&& newItem, unsigned index)
52
{
50
{
53
    if (index < m_values->size()) {
51
    if (index < valuesProperty().size()) {
54
        ListItemType replacedItem = m_values->at(index);
52
        ListItemType replacedItem = valuesProperty().propertyAt(index);
55
        ASSERT(replacedItem);
53
        ASSERT(replacedItem);
56
        static_cast<SVGPathSegWithContext*>(replacedItem.get())->setContextAndRole(nullptr, PathSegUndefinedRole);
54
        static_cast<SVGPathSegWithContext*>(replacedItem.get())->setContextAndRole(nullptr, PathSegUndefinedRole);
57
    }
55
    }
- Source/WebCore/svg/SVGPathSegList.h -14 / +9 lines
Lines 32-43 public: Source/WebCore/svg/SVGPathSegList.h_sec1
32
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGPathSegListValues>;
32
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGPathSegListValues>;
33
    using ListItemType = SVGPropertyTraits<SVGPathSegListValues>::ListItemType;
33
    using ListItemType = SVGPropertyTraits<SVGPathSegListValues>::ListItemType;
34
34
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)
36
    {
36
    {
37
        return adoptRef(*new SVGPathSegList(animatedProperty, role, pathSegRole, values, wrappers));
37
        return adoptRef(*new SVGPathSegList(animatedProperty, role, pathSegRole, values, wrappers));
38
    }
38
    }
39
39
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)
41
    {
41
    {
42
        ASSERT_NOT_REACHED();
42
        ASSERT_NOT_REACHED();
43
        return adoptRef(*new SVGPathSegList(animatedProperty, role, PathSegUndefinedRole, values, wrappers));
43
        return adoptRef(*new SVGPathSegList(animatedProperty, role, PathSegUndefinedRole, values, wrappers));
Lines 45-55 public: Source/WebCore/svg/SVGPathSegList.h_sec2
45
45
46
    int findItem(const ListItemType& item) const
46
    int findItem(const ListItemType& item) const
47
    {
47
    {
48
        ASSERT(m_values);
48
        unsigned size = valuesProperty().size();
49
50
        unsigned size = m_values->size();
51
        for (size_t i = 0; i < size; ++i) {
49
        for (size_t i = 0; i < size; ++i) {
52
            if (item == m_values->at(i))
50
            if (item == valuesProperty().propertyAt(i))
53
                return i;
51
                return i;
54
        }
52
        }
55
53
Lines 58-67 public: Source/WebCore/svg/SVGPathSegList.h_sec3
58
56
59
    void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
57
    void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
60
    {
58
    {
61
        ASSERT(m_values);
59
        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < valuesProperty().size());
62
        ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < m_values->size());
63
60
64
        m_values->remove(itemIndex);
61
        valuesProperty().remove(itemIndex);
65
62
66
        if (shouldSynchronizeWrappers)
63
        if (shouldSynchronizeWrappers)
67
            commitChange();
64
            commitChange();
Lines 93-99 public: Source/WebCore/svg/SVGPathSegList.h_sec4
93
    }
90
    }
94
91
95
private:
92
private:
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)
97
        : SVGListProperty<SVGPathSegListValues>(role, values, &wrappers)
94
        : SVGListProperty<SVGPathSegListValues>(role, values, &wrappers)
98
        , m_animatedProperty(&animatedProperty)
95
        , m_animatedProperty(&animatedProperty)
99
        , m_pathSegRole(pathSegRole)
96
        , m_pathSegRole(pathSegRole)
Lines 117-130 private: Source/WebCore/svg/SVGPathSegList.h_sec5
117
114
118
    void commitChange() final
115
    void commitChange() final
119
    {
116
    {
120
        ASSERT(m_values);
117
        valuesProperty().commitChange(*m_animatedProperty->contextElement(), ListModificationUnknown);
121
        m_values->commitChange(*m_animatedProperty->contextElement(), ListModificationUnknown);
122
    }
118
    }
123
119
124
    void commitChange(ListModification listModification) final
120
    void commitChange(ListModification listModification) final
125
    {
121
    {
126
        ASSERT(m_values);
122
        valuesProperty().commitChange(*m_animatedProperty->contextElement(), listModification);
127
        m_values->commitChange(*m_animatedProperty->contextElement(), listModification);
128
    }
123
    }
129
124
130
    bool processIncomingListItemValue(const ListItemType& newItem, unsigned* indexToModify) final;
125
    bool processIncomingListItemValue(const ListItemType& newItem, unsigned* indexToModify) final;
- Source/WebCore/svg/SVGPathSegListBuilder.cpp -19 / +19 lines
Lines 58-135 SVGPathSegListBuilder::SVGPathSegListBui Source/WebCore/svg/SVGPathSegListBuilder.cpp_sec1
58
void SVGPathSegListBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode mode)
58
void SVGPathSegListBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode mode)
59
{
59
{
60
    if (mode == AbsoluteCoordinates)
60
    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)));
62
    else
62
    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)));
64
}
64
}
65
65
66
void SVGPathSegListBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
66
void SVGPathSegListBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
67
{
67
{
68
    if (mode == AbsoluteCoordinates)
68
    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)));
70
    else
70
    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)));
72
}
72
}
73
73
74
void SVGPathSegListBuilder::lineToHorizontal(float x, PathCoordinateMode mode)
74
void SVGPathSegListBuilder::lineToHorizontal(float x, PathCoordinateMode mode)
75
{
75
{
76
    if (mode == AbsoluteCoordinates)
76
    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)));
78
    else
78
    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)));
80
}
80
}
81
81
82
void SVGPathSegListBuilder::lineToVertical(float y, PathCoordinateMode mode)
82
void SVGPathSegListBuilder::lineToVertical(float y, PathCoordinateMode mode)
83
{
83
{
84
    if (mode == AbsoluteCoordinates)
84
    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)));
86
    else
86
    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)));
88
}
88
}
89
89
90
void SVGPathSegListBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
90
void SVGPathSegListBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
91
{
91
{
92
    if (mode == AbsoluteCoordinates)
92
    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)));
94
    else
94
    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)));
96
}
96
}
97
97
98
void SVGPathSegListBuilder::curveToCubicSmooth(const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
98
void SVGPathSegListBuilder::curveToCubicSmooth(const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
99
{
99
{
100
    if (mode == AbsoluteCoordinates)
100
    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)));
102
    else
102
    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)));
104
}
104
}
105
105
106
void SVGPathSegListBuilder::curveToQuadratic(const FloatPoint& point1, const FloatPoint& targetPoint, PathCoordinateMode mode)
106
void SVGPathSegListBuilder::curveToQuadratic(const FloatPoint& point1, const FloatPoint& targetPoint, PathCoordinateMode mode)
107
{
107
{
108
    if (mode == AbsoluteCoordinates)
108
    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)));
110
    else
110
    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)));
112
}
112
}
113
113
114
void SVGPathSegListBuilder::curveToQuadraticSmooth(const FloatPoint& targetPoint, PathCoordinateMode mode)
114
void SVGPathSegListBuilder::curveToQuadraticSmooth(const FloatPoint& targetPoint, PathCoordinateMode mode)
115
{
115
{
116
    if (mode == AbsoluteCoordinates)
116
    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)));
118
    else
118
    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)));
120
}
120
}
121
121
122
void SVGPathSegListBuilder::arcTo(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, const FloatPoint& targetPoint, PathCoordinateMode mode)
122
void SVGPathSegListBuilder::arcTo(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, const FloatPoint& targetPoint, PathCoordinateMode mode)
123
{
123
{
124
    if (mode == AbsoluteCoordinates)
124
    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)));
126
    else
126
    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)));
128
}
128
}
129
129
130
void SVGPathSegListBuilder::closePath()
130
void SVGPathSegListBuilder::closePath()
131
{
131
{
132
    m_pathSegList.append(m_pathElement.createSVGPathSegClosePath(m_pathSegRole));
132
    m_pathSegList.append(SVGValue::create<RefPtr<SVGPathSeg>>(m_pathElement.createSVGPathSegClosePath(m_pathSegRole)));
133
}
133
}
134
134
135
}
135
}
- Source/WebCore/svg/SVGPathSegListSource.cpp -2 / +2 lines
Lines 43-49 bool SVGPathSegListSource::hasMoreData() Source/WebCore/svg/SVGPathSegListSource.cpp_sec1
43
43
44
bool SVGPathSegListSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
44
bool SVGPathSegListSource::parseSVGSegmentType(SVGPathSegType& pathSegType)
45
{
45
{
46
    m_segment = m_pathSegList.at(m_itemCurrent);
46
    m_segment = m_pathSegList.propertyAt(m_itemCurrent);
47
    pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
47
    pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
48
    ++m_itemCurrent;
48
    ++m_itemCurrent;
49
    return true;
49
    return true;
Lines 51-57 bool SVGPathSegListSource::parseSVGSegme Source/WebCore/svg/SVGPathSegListSource.cpp_sec2
51
51
52
SVGPathSegType SVGPathSegListSource::nextCommand(SVGPathSegType)
52
SVGPathSegType SVGPathSegListSource::nextCommand(SVGPathSegType)
53
{
53
{
54
    m_segment = m_pathSegList.at(m_itemCurrent);
54
    m_segment = m_pathSegList.propertyAt(m_itemCurrent);
55
    SVGPathSegType pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
55
    SVGPathSegType pathSegType = static_cast<SVGPathSegType>(m_segment->pathSegType());
56
    ++m_itemCurrent;
56
    ++m_itemCurrent;
57
    return pathSegType;
57
    return pathSegType;
- Source/WebCore/svg/SVGPathSegListValues.h -3 / +2 lines
Lines 19-28 Source/WebCore/svg/SVGPathSegListValues.h_sec1
19
19
20
#pragma once
20
#pragma once
21
21
22
#include "SVGListProperty.h"
22
#include "SVGListValues.h"
23
#include "SVGPathSeg.h"
23
#include "SVGPathSeg.h"
24
#include "SVGPropertyTraits.h"
24
#include "SVGPropertyTraits.h"
25
#include <wtf/Vector.h>
26
#include <wtf/text/WTFString.h>
25
#include <wtf/text/WTFString.h>
27
26
28
namespace WebCore {
27
namespace WebCore {
Lines 33-39 class SVGPathSegList; Source/WebCore/svg/SVGPathSegListValues.h_sec2
33
template<typename T> 
32
template<typename T> 
34
class SVGPropertyTearOff;
33
class SVGPropertyTearOff;
35
34
36
class SVGPathSegListValues : public Vector<RefPtr<SVGPathSeg>> {
35
class SVGPathSegListValues : public SVGListValues<RefPtr<SVGPathSeg>> {
37
public:
36
public:
38
    explicit SVGPathSegListValues(SVGPathSegRole role)
37
    explicit SVGPathSegListValues(SVGPathSegRole role)
39
        : m_role(role)
38
        : m_role(role)
- Source/WebCore/svg/SVGPathUtilities.cpp -6 / +5 lines
Lines 120-126 bool appendSVGPathByteStreamFromSVGPathS Source/WebCore/svg/SVGPathUtilities.cpp_sec1
120
    ASSERT(parsingMode == UnalteredParsing);
120
    ASSERT(parsingMode == UnalteredParsing);
121
121
122
    SVGPathSegListValues appendedItemList(PathSegUnalteredRole);
122
    SVGPathSegListValues appendedItemList(PathSegUnalteredRole);
123
    appendedItemList.append(WTFMove(pathSeg));
123
    appendedItemList.append(SVGValue::create<RefPtr<SVGPathSeg>>(WTFMove(pathSeg)));
124
124
125
    SVGPathByteStream appendedByteStream;
125
    SVGPathByteStream appendedByteStream;
126
    SVGPathSegListSource source(appendedItemList);
126
    SVGPathSegListSource source(appendedItemList);
Lines 206-220 bool buildAnimatedSVGPathByteStream(cons Source/WebCore/svg/SVGPathUtilities.cpp_sec2
206
206
207
bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& byStream, unsigned repeatCount)
207
bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& byStream, unsigned repeatCount)
208
{
208
{
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.
210
    if (streamToAppendTo.isEmpty() || byStream.isEmpty())
210
    if (streamToAppendTo.isEmpty() || byStream.isEmpty())
211
        return true;
211
        return true;
212
212
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.
214
    SVGPathByteStreamBuilder builder(streamToAppendTo);
215
    SVGPathByteStreamBuilder builder(streamToAppendTo);
215
216
    SVGPathByteStream fromStreamCopy = WTFMove(streamToAppendTo);
216
    SVGPathByteStream fromStreamCopy = streamToAppendTo;
217
    streamToAppendTo.clear();
218
217
219
    SVGPathByteStreamSource fromSource(fromStreamCopy);
218
    SVGPathByteStreamSource fromSource(fromStreamCopy);
220
    SVGPathByteStreamSource bySource(byStream);
219
    SVGPathByteStreamSource bySource(byStream);
- Source/WebCore/svg/SVGPoint.h -13 / +3 lines
Lines 33-39 namespace WebCore { Source/WebCore/svg/SVGPoint.h_sec1
33
33
34
class SVGPoint : public SVGPropertyTearOff<FloatPoint> {
34
class SVGPoint : public SVGPropertyTearOff<FloatPoint> {
35
public:
35
public:
36
    static Ref<SVGPoint> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatPoint& value)
36
    static Ref<SVGPoint> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
37
    {
37
    {
38
        return adoptRef(*new SVGPoint(animatedProperty, role, value));
38
        return adoptRef(*new SVGPoint(animatedProperty, role, value));
39
    }
39
    }
Lines 43-53 public: Source/WebCore/svg/SVGPoint.h_sec2
43
        return adoptRef(*new SVGPoint(initialValue));
43
        return adoptRef(*new SVGPoint(initialValue));
44
    }
44
    }
45
45
46
    static Ref<SVGPoint> create(const FloatPoint* initialValue)
47
    {
48
        return adoptRef(*new SVGPoint(initialValue));
49
    }
50
51
    template<typename T> static ExceptionOr<Ref<SVGPoint>> create(ExceptionOr<T>&& initialValue)
46
    template<typename T> static ExceptionOr<Ref<SVGPoint>> create(ExceptionOr<T>&& initialValue)
52
    {
47
    {
53
        if (initialValue.hasException())
48
        if (initialValue.hasException())
Lines 99-110 public: Source/WebCore/svg/SVGPoint.h_sec3
99
    }
94
    }
100
95
101
protected:
96
protected:
102
    SVGPoint(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatPoint& value)
97
    SVGPoint(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
103
        : SVGPropertyTearOff<FloatPoint>(&animatedProperty, role, value)
98
        : SVGPropertyTearOff<FloatPoint>(&animatedProperty, role, value)
104
    {
99
    {
105
    }
100
    }
106
101
107
    SVGPoint(SVGPropertyRole role, FloatPoint& value)
102
    SVGPoint(SVGPropertyRole role, const RefPtr<SVGValue>& value)
108
        : SVGPropertyTearOff<FloatPoint>(nullptr, role, value)
103
        : SVGPropertyTearOff<FloatPoint>(nullptr, role, value)
109
    {
104
    {
110
    }
105
    }
Lines 113-123 protected: Source/WebCore/svg/SVGPoint.h_sec4
113
        : SVGPropertyTearOff<FloatPoint>(initialValue)
108
        : SVGPropertyTearOff<FloatPoint>(initialValue)
114
    {
109
    {
115
    }
110
    }
116
117
    explicit SVGPoint(const FloatPoint* initialValue)
118
        : SVGPropertyTearOff<FloatPoint>(initialValue)
119
    {
120
    }
121
};
111
};
122
112
123
} // namespace WebCore
113
} // namespace WebCore
- Source/WebCore/svg/SVGPointList.h -2 / +2 lines
Lines 37-49 public: Source/WebCore/svg/SVGPointList.h_sec1
37
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGPointListValues>;
37
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGPointListValues>;
38
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
38
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
39
39
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)
41
    {
41
    {
42
        return adoptRef(*new SVGPointList(animatedProperty, role, values, wrappers));
42
        return adoptRef(*new SVGPointList(animatedProperty, role, values, wrappers));
43
    }
43
    }
44
44
45
private:
45
private:
46
    SVGPointList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGPointListValues& values, ListWrapperCache& wrappers)
46
    SVGPointList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
47
        : SVGListPropertyTearOff<SVGPointListValues>(animatedProperty, role, values, wrappers)
47
        : SVGListPropertyTearOff<SVGPointListValues>(animatedProperty, role, values, wrappers)
48
    {
48
    {
49
    }
49
    }
- Source/WebCore/svg/SVGPointListValues.cpp -1 / +1 lines
Lines 35-41 String SVGPointListValues::valueAsString Source/WebCore/svg/SVGPointListValues.cpp_sec1
35
        if (i > 0)
35
        if (i > 0)
36
            builder.append(' '); // FIXME: Shouldn't we use commas to seperate?
36
            builder.append(' '); // FIXME: Shouldn't we use commas to seperate?
37
37
38
        const auto& point = at(i);
38
        const auto& point = propertyAt(i);
39
        builder.appendNumber(point.x());
39
        builder.appendNumber(point.x());
40
        builder.append(' ');
40
        builder.append(' ');
41
        builder.appendNumber(point.y());
41
        builder.appendNumber(point.y());
- Source/WebCore/svg/SVGPointListValues.h -4 / +10 lines
Lines 21-42 Source/WebCore/svg/SVGPointListValues.h_sec1
21
#pragma once
21
#pragma once
22
22
23
#include "FloatPoint.h"
23
#include "FloatPoint.h"
24
#include "SVGListValues.h"
24
#include "SVGPropertyTraits.h"
25
#include "SVGPropertyTraits.h"
25
#include <wtf/Vector.h>
26
26
27
namespace WebCore {
27
namespace WebCore {
28
28
29
class SVGPoint;
29
class SVGPoint;
30
class SVGPointList;
30
class SVGPointList;
31
31
32
class SVGPointListValues final : public Vector<FloatPoint> {
32
class SVGPointListValues final : public SVGListValues<FloatPoint> {
33
public:
33
public:
34
    String valueAsString() const;
34
    String valueAsString() const;
35
};
35
};
36
36
37
template<> struct SVGPropertyTraits<SVGPointListValues> {
37
template<>
38
struct SVGPropertyTraits<SVGPointListValues> {
38
    static SVGPointListValues initialValue() { return { }; }
39
    static SVGPointListValues initialValue() { return { }; }
39
40
    static SVGPointListValues fromString(const String& string)
41
    {
42
        SVGPointListValues list;
43
        pointsListFromSVGData(list, string);
44
        return list;
45
    }
40
    using ListItemType = FloatPoint;
46
    using ListItemType = FloatPoint;
41
    using ListItemTearOff = SVGPoint;
47
    using ListItemTearOff = SVGPoint;
42
    using ListPropertyTearOff = SVGPointList;
48
    using ListPropertyTearOff = SVGPointList;
- Source/WebCore/svg/SVGPolyElement.cpp -2 / +2 lines
Lines 73-79 void SVGPolyElement::parseAttribute(cons Source/WebCore/svg/SVGPolyElement.cpp_sec1
73
        if (auto wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()))
73
        if (auto wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()))
74
            static_pointer_cast<SVGAnimatedPointList>(wrapper)->detachListWrappers(newList.size());
74
            static_pointer_cast<SVGAnimatedPointList>(wrapper)->detachListWrappers(newList.size());
75
75
76
        m_points.value = newList;
76
        static_cast<SVGPointListValues&>(*m_points.value) = WTFMove(newList);
77
        return;
77
        return;
78
    }
78
    }
79
79
Lines 109-115 void SVGPolyElement::synchronizePoints(S Source/WebCore/svg/SVGPolyElement.cpp_sec2
109
    SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement);
109
    SVGPolyElement& ownerType = downcast<SVGPolyElement>(*contextElement);
110
    if (!ownerType.m_points.shouldSynchronize)
110
    if (!ownerType.m_points.shouldSynchronize)
111
        return;
111
        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());
113
}
113
}
114
114
115
Ref<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement)
115
Ref<SVGAnimatedProperty> SVGPolyElement::lookupOrCreatePointsWrapper(SVGElement* contextElement)
- Source/WebCore/svg/SVGPolyElement.h -1 / +1 lines
Lines 33-39 public: Source/WebCore/svg/SVGPolyElement.h_sec1
33
    Ref<SVGPointList> points();
33
    Ref<SVGPointList> points();
34
    Ref<SVGPointList> animatedPoints();
34
    Ref<SVGPointList> animatedPoints();
35
35
36
    SVGPointListValues& pointList() const { return m_points.value; }
36
    SVGPointListValues& pointList() const { return static_cast<SVGPointListValues&>(*m_points.value); }
37
37
38
    static const SVGPropertyInfo* pointsPropertyInfo();
38
    static const SVGPropertyInfo* pointsPropertyInfo();
39
39
- Source/WebCore/svg/SVGPreserveAspectRatio.h -12 / +2 lines
Lines 32-38 namespace WebCore { Source/WebCore/svg/SVGPreserveAspectRatio.h_sec1
32
32
33
class SVGPreserveAspectRatio : public SVGPropertyTearOff<SVGPreserveAspectRatioValue> {
33
class SVGPreserveAspectRatio : public SVGPropertyTearOff<SVGPreserveAspectRatioValue> {
34
public:
34
public:
35
    static Ref<SVGPreserveAspectRatio> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGPreserveAspectRatioValue& value)
35
    static Ref<SVGPreserveAspectRatio> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
36
    {
36
    {
37
        return adoptRef(*new SVGPreserveAspectRatio(animatedProperty, role, value));
37
        return adoptRef(*new SVGPreserveAspectRatio(animatedProperty, role, value));
38
    }
38
    }
Lines 42-52 public: Source/WebCore/svg/SVGPreserveAspectRatio.h_sec2
42
        return adoptRef(*new SVGPreserveAspectRatio(initialValue));
42
        return adoptRef(*new SVGPreserveAspectRatio(initialValue));
43
    }
43
    }
44
44
45
    static Ref<SVGPreserveAspectRatio> create(const SVGPreserveAspectRatioValue* initialValue)
46
    {
47
        return adoptRef(*new SVGPreserveAspectRatio(initialValue));
48
    }
49
50
    template<typename T> static ExceptionOr<Ref<SVGPreserveAspectRatio>> create(ExceptionOr<T>&& initialValue)
45
    template<typename T> static ExceptionOr<Ref<SVGPreserveAspectRatio>> create(ExceptionOr<T>&& initialValue)
51
    {
46
    {
52
        if (initialValue.hasException())
47
        if (initialValue.hasException())
Lines 91-97 public: Source/WebCore/svg/SVGPreserveAspectRatio.h_sec3
91
    }
86
    }
92
87
93
private:
88
private:
94
    SVGPreserveAspectRatio(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGPreserveAspectRatioValue& value)
89
    SVGPreserveAspectRatio(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
95
        : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(&animatedProperty, role, value)
90
        : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(&animatedProperty, role, value)
96
    {
91
    {
97
    }
92
    }
Lines 100-110 private: Source/WebCore/svg/SVGPreserveAspectRatio.h_sec4
100
        : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(initialValue)
95
        : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(initialValue)
101
    {
96
    {
102
    }
97
    }
103
104
    explicit SVGPreserveAspectRatio(const SVGPreserveAspectRatioValue* initialValue)
105
        : SVGPropertyTearOff<SVGPreserveAspectRatioValue>(initialValue)
106
    {
107
    }
108
};
98
};
109
99
110
} // namespace WebCore
100
} // namespace WebCore
- Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp +5 lines
Lines 35-40 SVGPreserveAspectRatioValue::SVGPreserve Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp_sec1
35
{
35
{
36
}
36
}
37
37
38
SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue(const String& string)
39
{
40
    parse(string);
41
}
42
38
ExceptionOr<void> SVGPreserveAspectRatioValue::setAlign(unsigned short align)
43
ExceptionOr<void> SVGPreserveAspectRatioValue::setAlign(unsigned short align)
39
{
44
{
40
    if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX)
45
    if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX)
- Source/WebCore/svg/SVGPreserveAspectRatioValue.h +2 lines
Lines 52-57 public: Source/WebCore/svg/SVGPreserveAspectRatioValue.h_sec1
52
    };
52
    };
53
53
54
    SVGPreserveAspectRatioValue();
54
    SVGPreserveAspectRatioValue();
55
    SVGPreserveAspectRatioValue(const String&);
55
56
56
    ExceptionOr<void> setAlign(unsigned short);
57
    ExceptionOr<void> setAlign(unsigned short);
57
    unsigned short align() const { return m_align; }
58
    unsigned short align() const { return m_align; }
Lines 77-82 private: Source/WebCore/svg/SVGPreserveAspectRatioValue.h_sec2
77
78
78
template<> struct SVGPropertyTraits<SVGPreserveAspectRatioValue> {
79
template<> struct SVGPropertyTraits<SVGPreserveAspectRatioValue> {
79
    static SVGPreserveAspectRatioValue initialValue() { return SVGPreserveAspectRatioValue(); }
80
    static SVGPreserveAspectRatioValue initialValue() { return SVGPreserveAspectRatioValue(); }
81
    static SVGPreserveAspectRatioValue fromString(const String& string) { return SVGPreserveAspectRatioValue(string); }
80
    static String toString(const SVGPreserveAspectRatioValue& type) { return type.valueAsString(); }
82
    static String toString(const SVGPreserveAspectRatioValue& type) { return type.valueAsString(); }
81
};
83
};
82
84
- Source/WebCore/svg/SVGRadialGradientElement.cpp -6 / +6 lines
Lines 55-66 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGRadialGradientElement.cpp_sec1
55
55
56
inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document& document)
56
inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document& document)
57
    : SVGGradientElement(tagName, document)
57
    : SVGGradientElement(tagName, document)
58
    , m_cx(LengthModeWidth, "50%")
58
    , m_cx(SVGLengthValue(LengthModeWidth, "50%"))
59
    , m_cy(LengthModeHeight, "50%")
59
    , m_cy(SVGLengthValue(LengthModeHeight, "50%"))
60
    , m_r(LengthModeOther, "50%")
60
    , m_r(SVGLengthValue(LengthModeOther, "50%"))
61
    , m_fx(LengthModeWidth)
61
    , m_fx(SVGLengthValue(LengthModeWidth))
62
    , m_fy(LengthModeHeight)
62
    , m_fy(SVGLengthValue(LengthModeHeight))
63
    , m_fr(LengthModeOther, "0%")
63
    , m_fr(SVGLengthValue(LengthModeOther, "0%"))
64
{
64
{
65
    // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified.
65
    // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified.
66
    ASSERT(hasTagName(SVGNames::radialGradientTag));
66
    ASSERT(hasTagName(SVGNames::radialGradientTag));
- Source/WebCore/svg/SVGRect.h -13 / +3 lines
Lines 20-32 Source/WebCore/svg/SVGRect.h_sec1
20
#pragma once
20
#pragma once
21
21
22
#include "SVGPropertyTearOff.h"
22
#include "SVGPropertyTearOff.h"
23
#include "SVGRectTraits.h"
23
#include "SVGPropertyTraits.h"
24
24
25
namespace WebCore {
25
namespace WebCore {
26
26
27
class SVGRect : public SVGPropertyTearOff<FloatRect> {
27
class SVGRect : public SVGPropertyTearOff<FloatRect> {
28
public:
28
public:
29
    static Ref<SVGRect> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatRect& value)
29
    static Ref<SVGRect> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
30
    {
30
    {
31
        return adoptRef(*new SVGRect(animatedProperty, role, value));
31
        return adoptRef(*new SVGRect(animatedProperty, role, value));
32
    }
32
    }
Lines 36-46 public: Source/WebCore/svg/SVGRect.h_sec2
36
        return adoptRef(*new SVGRect(initialValue));
36
        return adoptRef(*new SVGRect(initialValue));
37
    }
37
    }
38
38
39
    static Ref<SVGRect> create(const FloatRect* initialValue)
40
    {
41
        return adoptRef(*new SVGRect(initialValue));
42
    }
43
44
    template<typename T> static ExceptionOr<Ref<SVGRect>> create(ExceptionOr<T>&& initialValue)
39
    template<typename T> static ExceptionOr<Ref<SVGRect>> create(ExceptionOr<T>&& initialValue)
45
    {
40
    {
46
        if (initialValue.hasException())
41
        if (initialValue.hasException())
Lines 113-119 public: Source/WebCore/svg/SVGRect.h_sec3
113
    }
108
    }
114
109
115
private:
110
private:
116
    SVGRect(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, FloatRect& value)
111
    SVGRect(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
117
        : SVGPropertyTearOff<FloatRect>(&animatedProperty, role, value)
112
        : SVGPropertyTearOff<FloatRect>(&animatedProperty, role, value)
118
    {
113
    {
119
    }
114
    }
Lines 122-132 private: Source/WebCore/svg/SVGRect.h_sec4
122
        : SVGPropertyTearOff<FloatRect>(initialValue)
117
        : SVGPropertyTearOff<FloatRect>(initialValue)
123
    {
118
    {
124
    }
119
    }
125
126
    explicit SVGRect(const FloatRect* initialValue)
127
        : SVGPropertyTearOff<FloatRect>(initialValue)
128
    {
129
    }
130
};
120
};
131
121
132
122
- Source/WebCore/svg/SVGRectTraits.h -51 lines
Lines 1-51 Source/WebCore/svg/SVGRectTraits.h_sec1
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
- Source/WebCore/svg/SVGSVGElement.cpp -6 / +7 lines
Lines 71-81 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGSVGElement.cpp_sec1
71
71
72
inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& document)
72
inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& document)
73
    : SVGGraphicsElement(tagName, document)
73
    : SVGGraphicsElement(tagName, document)
74
    , m_x(LengthModeWidth)
74
    , m_x(SVGLengthValue(LengthModeWidth))
75
    , m_y(LengthModeHeight)
75
    , m_y(SVGLengthValue(LengthModeHeight))
76
    , m_width(LengthModeWidth, ASCIILiteral("100%"))
76
    , m_width(SVGLengthValue(LengthModeWidth, ASCIILiteral("100%")))
77
    , m_height(LengthModeHeight, ASCIILiteral("100%"))
77
    , m_height(SVGLengthValue(LengthModeHeight, ASCIILiteral("100%")))
78
    , m_timeContainer(SMILTimeContainer::create(*this))
78
    , m_timeContainer(SMILTimeContainer::create(*this))
79
    , m_currentTranslate(SVGValue::create<FloatPoint>())
79
{
80
{
80
    ASSERT(hasTagName(SVGNames::svgTag));
81
    ASSERT(hasTagName(SVGNames::svgTag));
81
    registerAnimatedPropertiesForSVGSVGElement();
82
    registerAnimatedPropertiesForSVGSVGElement();
Lines 197-205 Ref<SVGPoint> SVGSVGElement::currentTran Source/WebCore/svg/SVGSVGElement.cpp_sec2
197
198
198
void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation)
199
void SVGSVGElement::setCurrentTranslate(const FloatPoint& translation)
199
{
200
{
200
    if (m_currentTranslate == translation)
201
    if (static_cast<FloatPoint&>(*m_currentTranslate) == translation)
201
        return;
202
        return;
202
    m_currentTranslate = translation;
203
    static_cast<FloatPoint&>(*m_currentTranslate) = translation;
203
    updateCurrentTranslate();
204
    updateCurrentTranslate();
204
}
205
}
205
206
- Source/WebCore/svg/SVGSVGElement.h -2 / +2 lines
Lines 163-169 private: Source/WebCore/svg/SVGSVGElement.h_sec1
163
    bool m_useCurrentView { false };
163
    bool m_useCurrentView { false };
164
    SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
164
    SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
165
    Ref<SMILTimeContainer> m_timeContainer;
165
    Ref<SMILTimeContainer> m_timeContainer;
166
    FloatPoint m_currentTranslate;
166
    RefPtr<SVGValue> m_currentTranslate;
167
    RefPtr<SVGViewSpec> m_viewSpec;
167
    RefPtr<SVGViewSpec> m_viewSpec;
168
    String m_currentViewFragmentIdentifier;
168
    String m_currentViewFragmentIdentifier;
169
};
169
};
Lines 175-181 inline bool SVGSVGElement::useCurrentVie Source/WebCore/svg/SVGSVGElement.h_sec2
175
175
176
inline FloatPoint SVGSVGElement::currentTranslateValue()
176
inline FloatPoint SVGSVGElement::currentTranslateValue()
177
{
177
{
178
    return m_currentTranslate;
178
    return static_cast<FloatPoint&>(*m_currentTranslate);
179
}
179
}
180
180
181
inline SVGZoomAndPanType SVGSVGElement::zoomAndPan() const
181
inline SVGZoomAndPanType SVGSVGElement::zoomAndPan() const
- Source/WebCore/svg/SVGStringList.h -3 / +3 lines
Lines 36-47 public: Source/WebCore/svg/SVGStringList.h_sec1
36
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGStringListValues>;
36
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGStringListValues>;
37
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
37
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
38
38
39
    static Ref<SVGStringList> create(SVGElement& contextElement, SVGStringListValues& values)
39
    static Ref<SVGStringList> create(SVGElement& contextElement, const RefPtr<SVGValue>& values)
40
    {
40
    {
41
        return adoptRef(*new SVGStringList(&contextElement, values));
41
        return adoptRef(*new SVGStringList(&contextElement, values));
42
    }
42
    }
43
43
44
    static Ref<SVGStringList> create(AnimatedListPropertyTearOff&, SVGPropertyRole, SVGStringListValues& values, ListWrapperCache&)
44
    static Ref<SVGStringList> create(AnimatedListPropertyTearOff&, SVGPropertyRole, const RefPtr<SVGValue>& values, ListWrapperCache&)
45
    {
45
    {
46
        // FIXME: Find a way to remove this. It's only needed to keep Windows compiling.
46
        // FIXME: Find a way to remove this. It's only needed to keep Windows compiling.
47
        ASSERT_NOT_REACHED();
47
        ASSERT_NOT_REACHED();
Lines 49-55 public: Source/WebCore/svg/SVGStringList.h_sec2
49
    }
49
    }
50
50
51
private:
51
private:
52
    SVGStringList(SVGElement* contextElement, SVGStringListValues& values)
52
    SVGStringList(SVGElement* contextElement, const RefPtr<SVGValue>& values)
53
        : SVGStaticListPropertyTearOff<SVGStringListValues>(contextElement, values)
53
        : SVGStaticListPropertyTearOff<SVGStringListValues>(contextElement, values)
54
    {
54
    {
55
    }
55
    }
- Source/WebCore/svg/SVGStringListValues.cpp -3 / +3 lines
Lines 39-45 void SVGStringListValues::reset(const St Source/WebCore/svg/SVGStringListValues.cpp_sec1
39
39
40
    // Add empty string, if list is empty.
40
    // Add empty string, if list is empty.
41
    if (isEmpty())
41
    if (isEmpty())
42
        append(emptyString());
42
        append(SVGValue::create<String>(emptyString()));
43
}
43
}
44
44
45
void SVGStringListValues::parse(const String& data, UChar delimiter)
45
void SVGStringListValues::parse(const String& data, UChar delimiter)
Lines 56-62 void SVGStringListValues::parse(const St Source/WebCore/svg/SVGStringListValues.cpp_sec2
56
            ptr++;
56
            ptr++;
57
        if (ptr == start)
57
        if (ptr == start)
58
            break;
58
            break;
59
        append(String(start, ptr - start));
59
        append(SVGValue::create<String>(String(start, ptr - start)));
60
        skipOptionalSVGSpacesOrDelimiter(ptr, end, delimiter);
60
        skipOptionalSVGSpacesOrDelimiter(ptr, end, delimiter);
61
    }
61
    }
62
}
62
}
Lines 70-76 String SVGStringListValues::valueAsStrin Source/WebCore/svg/SVGStringListValues.cpp_sec3
70
        if (i > 0)
70
        if (i > 0)
71
            builder.append(' ');
71
            builder.append(' ');
72
72
73
        builder.append(at(i));
73
        builder.append(propertyAt(i));
74
    }
74
    }
75
75
76
    return builder.toString();
76
    return builder.toString();
- Source/WebCore/svg/SVGStringListValues.h -2 / +2 lines
Lines 21-28 Source/WebCore/svg/SVGStringListValues.h_sec1
21
#pragma once
21
#pragma once
22
22
23
#include "QualifiedName.h"
23
#include "QualifiedName.h"
24
#include "SVGListValues.h"
24
#include "SVGPropertyTraits.h"
25
#include "SVGPropertyTraits.h"
25
#include <wtf/Vector.h>
26
26
27
namespace WebCore {
27
namespace WebCore {
28
28
Lines 32-38 class SVGStringList; Source/WebCore/svg/SVGStringListValues.h_sec2
32
template<typename T> 
32
template<typename T> 
33
class SVGPropertyTearOff;
33
class SVGPropertyTearOff;
34
34
35
class SVGStringListValues final : public Vector<String> {
35
class SVGStringListValues final : public SVGListValues<String> {
36
public:
36
public:
37
    SVGStringListValues(const QualifiedName& attributeName)
37
    SVGStringListValues(const QualifiedName& attributeName)
38
        : m_attributeName(attributeName)
38
        : m_attributeName(attributeName)
- Source/WebCore/svg/SVGTests.cpp -10 / +15 lines
Lines 107-115 static const HashSet<String, ASCIICaseIn Source/WebCore/svg/SVGTests.cpp_sec1
107
}
107
}
108
108
109
SVGTests::SVGTests()
109
SVGTests::SVGTests()
110
    : m_requiredFeatures(requiredFeaturesAttr)
110
    : m_requiredFeatures(SVGStringListValues(requiredFeaturesAttr))
111
    , m_requiredExtensions(requiredExtensionsAttr)
111
    , m_requiredExtensions(SVGStringListValues(requiredExtensionsAttr))
112
    , m_systemLanguage(systemLanguageAttr)
112
    , m_systemLanguage(SVGStringListValues(systemLanguageAttr))
113
{
113
{
114
}
114
}
115
115
Lines 154-168 bool SVGTests::hasExtension(const String Source/WebCore/svg/SVGTests.cpp_sec2
154
154
155
bool SVGTests::isValid() const
155
bool SVGTests::isValid() const
156
{
156
{
157
    for (auto& feature : m_requiredFeatures.value) {
157
    auto features = static_cast<SVGStringListValues&>(*m_requiredFeatures.value).properties();
158
    for (auto& feature : features) {
158
        if (feature.isEmpty() || !supportedSVGFeatures().contains(feature))
159
        if (feature.isEmpty() || !supportedSVGFeatures().contains(feature))
159
            return false;
160
            return false;
160
    }
161
    }
161
    for (auto& language : m_systemLanguage.value) {
162
163
    auto languages = static_cast<SVGStringListValues&>(*m_systemLanguage.value).properties();
164
    for (auto& language : languages) {
162
        if (language != defaultLanguage().substring(0, 2))
165
        if (language != defaultLanguage().substring(0, 2))
163
            return false;
166
            return false;
164
    }
167
    }
165
    for (auto& extension : m_requiredExtensions.value) {
168
169
    auto extensions = static_cast<SVGStringListValues&>(*m_requiredExtensions.value).properties();
170
    for (auto& extension : extensions) {
166
        if (!hasExtension(extension))
171
        if (!hasExtension(extension))
167
            return false;
172
            return false;
168
    }
173
    }
Lines 172-182 bool SVGTests::isValid() const Source/WebCore/svg/SVGTests.cpp_sec3
172
void SVGTests::parseAttribute(const QualifiedName& attributeName, const AtomicString& value)
177
void SVGTests::parseAttribute(const QualifiedName& attributeName, const AtomicString& value)
173
{
178
{
174
    if (attributeName == requiredFeaturesAttr)
179
    if (attributeName == requiredFeaturesAttr)
175
        m_requiredFeatures.value.reset(value);
180
        static_cast<SVGStringListValues&>(*m_requiredFeatures.value).reset(value);
176
    if (attributeName == requiredExtensionsAttr)
181
    if (attributeName == requiredExtensionsAttr)
177
        m_requiredExtensions.value.reset(value);
182
        static_cast<SVGStringListValues&>(*m_requiredExtensions.value).reset(value);
178
    if (attributeName == systemLanguageAttr)
183
    if (attributeName == systemLanguageAttr)
179
        m_systemLanguage.value.reset(value);
184
        static_cast<SVGStringListValues&>(*m_systemLanguage.value).reset(value);
180
}
185
}
181
186
182
bool SVGTests::isKnownAttribute(const QualifiedName& attributeName)
187
bool SVGTests::isKnownAttribute(const QualifiedName& attributeName)
Lines 208-214 void SVGTests::synchronizeAttribute(SVGE Source/WebCore/svg/SVGTests.cpp_sec4
208
{
213
{
209
    if (!property.shouldSynchronize)
214
    if (!property.shouldSynchronize)
210
        return;
215
        return;
211
    m_requiredFeatures.synchronize(&contextElement, attributeName, property.value.valueAsString());
216
    m_requiredFeatures.synchronize(&contextElement, attributeName, static_cast<SVGStringListValues&>(*property.value).valueAsString());
212
}
217
}
213
218
214
void SVGTests::synchronizeRequiredFeatures(SVGElement& contextElement)
219
void SVGTests::synchronizeRequiredFeatures(SVGElement& contextElement)
- Source/WebCore/svg/SVGTextContentElement.cpp -5 / +5 lines
Lines 66-73 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGTextContentElement.cpp_sec1
66
66
67
SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Document& document)
67
SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Document& document)
68
    : SVGGraphicsElement(tagName, document)
68
    : SVGGraphicsElement(tagName, document)
69
    , m_textLength(LengthModeOther)
69
    , m_textLength(SVGLengthValue(LengthModeOther))
70
    , m_specifiedTextLength(LengthModeOther)
70
    , m_specifiedTextLength(SVGLengthValue(LengthModeOther))
71
    , m_lengthAdjust(SVGLengthAdjustSpacing)
71
    , m_lengthAdjust(SVGLengthAdjustSpacing)
72
{
72
{
73
    registerAnimatedPropertiesForSVGTextContentElement();
73
    registerAnimatedPropertiesForSVGTextContentElement();
Lines 95-101 Ref<SVGAnimatedLength> SVGTextContentEle Source/WebCore/svg/SVGTextContentElement.cpp_sec2
95
{
95
{
96
    static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther);
96
    static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther);
97
    if (m_specifiedTextLength == defaultTextLength)
97
    if (m_specifiedTextLength == defaultTextLength)
98
        m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength());
98
        static_cast<SVGLengthValue&>(*m_textLength.value).newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength());
99
99
100
    m_textLength.shouldSynchronize = true;
100
    m_textLength.shouldSynchronize = true;
101
    return static_reference_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this));
101
    return static_reference_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this));
Lines 229-235 void SVGTextContentElement::parseAttribu Source/WebCore/svg/SVGTextContentElement.cpp_sec3
229
        if (propertyValue > 0)
229
        if (propertyValue > 0)
230
            setLengthAdjustBaseValue(propertyValue);
230
            setLengthAdjustBaseValue(propertyValue);
231
    } else if (name == SVGNames::textLengthAttr)
231
    } 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);
233
233
234
    reportAttributeParsingError(parseError, name, value);
234
    reportAttributeParsingError(parseError, name, value);
235
235
Lines 245-251 void SVGTextContentElement::svgAttribute Source/WebCore/svg/SVGTextContentElement.cpp_sec4
245
    }
245
    }
246
246
247
    if (attrName == SVGNames::textLengthAttr)
247
    if (attrName == SVGNames::textLengthAttr)
248
        m_specifiedTextLength = m_textLength.value;
248
        m_specifiedTextLength = static_cast<SVGLengthValue&>(*m_textLength.value);
249
249
250
    if (auto renderer = this->renderer()) {
250
    if (auto renderer = this->renderer()) {
251
        InstanceInvalidationGuard guard(*this);
251
        InstanceInvalidationGuard guard(*this);
- Source/WebCore/svg/SVGTextPathElement.cpp -1 / +1 lines
Lines 46-52 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGTextPathElement.cpp_sec1
46
46
47
inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document& document)
47
inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document& document)
48
    : SVGTextContentElement(tagName, document)
48
    : SVGTextContentElement(tagName, document)
49
    , m_startOffset(LengthModeOther)
49
    , m_startOffset(SVGLengthValue(LengthModeOther))
50
    , m_method(SVGTextPathMethodAlign)
50
    , m_method(SVGTextPathMethodAlign)
51
    , m_spacing(SVGTextPathSpacingExact)
51
    , m_spacing(SVGTextPathSpacingExact)
52
{
52
{
- Source/WebCore/svg/SVGTransform.h -12 / +2 lines
Lines 33-39 namespace WebCore { Source/WebCore/svg/SVGTransform.h_sec1
33
33
34
class SVGTransform : public SVGPropertyTearOff<SVGTransformValue> {
34
class SVGTransform : public SVGPropertyTearOff<SVGTransformValue> {
35
public:
35
public:
36
    static Ref<SVGTransform> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGTransformValue& value)
36
    static Ref<SVGTransform> create(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
37
    {
37
    {
38
        return adoptRef(*new SVGTransform(animatedProperty, role, value));
38
        return adoptRef(*new SVGTransform(animatedProperty, role, value));
39
    }
39
    }
Lines 43-53 public: Source/WebCore/svg/SVGTransform.h_sec2
43
        return adoptRef(*new SVGTransform(initialValue));
43
        return adoptRef(*new SVGTransform(initialValue));
44
    }
44
    }
45
45
46
    static Ref<SVGTransform> create(const SVGTransformValue* initialValue)
47
    {
48
        return adoptRef(*new SVGTransform(initialValue));
49
    }
50
51
    template<typename T> static ExceptionOr<Ref<SVGTransform>> create(ExceptionOr<T>&& initialValue)
46
    template<typename T> static ExceptionOr<Ref<SVGTransform>> create(ExceptionOr<T>&& initialValue)
52
    {
47
    {
53
        if (initialValue.hasException())
48
        if (initialValue.hasException())
Lines 134-140 public: Source/WebCore/svg/SVGTransform.h_sec3
134
    }
129
    }
135
130
136
private:
131
private:
137
    SVGTransform(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGTransformValue& value)
132
    SVGTransform(SVGAnimatedProperty& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
138
        : SVGPropertyTearOff<SVGTransformValue>(&animatedProperty, role, value)
133
        : SVGPropertyTearOff<SVGTransformValue>(&animatedProperty, role, value)
139
    {
134
    {
140
    }
135
    }
Lines 143-153 private: Source/WebCore/svg/SVGTransform.h_sec4
143
        : SVGPropertyTearOff<SVGTransformValue>(initialValue)
138
        : SVGPropertyTearOff<SVGTransformValue>(initialValue)
144
    {
139
    {
145
    }
140
    }
146
147
    explicit SVGTransform(const SVGTransformValue* initialValue)
148
        : SVGPropertyTearOff<SVGTransformValue>(initialValue)
149
    {
150
    }
151
};
141
};
152
142
153
} // namespace WebCore
143
} // namespace WebCore
- Source/WebCore/svg/SVGTransformList.h -9 / +8 lines
Lines 22-27 Source/WebCore/svg/SVGTransformList.h_sec1
22
22
23
#include "SVGAnimatedListPropertyTearOff.h"
23
#include "SVGAnimatedListPropertyTearOff.h"
24
#include "SVGListPropertyTearOff.h"
24
#include "SVGListPropertyTearOff.h"
25
#include "SVGTransform.h"
25
#include "SVGTransformListValues.h"
26
#include "SVGTransformListValues.h"
26
27
27
namespace WebCore {
28
namespace WebCore {
Lines 31-50 public: Source/WebCore/svg/SVGTransformList.h_sec2
31
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGTransformListValues>;
32
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGTransformListValues>;
32
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
33
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
33
34
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)
35
    {
36
    {
36
        return adoptRef(*new SVGTransformList(animatedProperty, role, values, wrappers));
37
        return adoptRef(*new SVGTransformList(animatedProperty, role, values, wrappers));
37
    }
38
    }
38
39
39
    ExceptionOr<Ref<SVGTransform>> createSVGTransformFromMatrix(SVGMatrix& matrix)
40
    ExceptionOr<Ref<SVGTransform>> createSVGTransformFromMatrix(SVGMatrix& matrix)
40
    {
41
    {
41
        ASSERT(m_values);
42
        return valuesProperty().createSVGTransformFromMatrix(matrix);
42
        return m_values->createSVGTransformFromMatrix(matrix);
43
    }
43
    }
44
44
45
    ExceptionOr<RefPtr<SVGTransform>> consolidate()
45
    ExceptionOr<RefPtr<SVGTransform>> consolidate()
46
    {
46
    {
47
        ASSERT(m_values);
48
        ASSERT(m_wrappers);
47
        ASSERT(m_wrappers);
49
48
50
        auto result = canAlterList();
49
        auto result = canAlterList();
Lines 52-74 public: Source/WebCore/svg/SVGTransformList.h_sec3
52
            return result.releaseException();
51
            return result.releaseException();
53
        ASSERT(result.releaseReturnValue());
52
        ASSERT(result.releaseReturnValue());
54
53
55
        ASSERT(m_values->size() == m_wrappers->size());
54
        ASSERT(valuesProperty().size() == m_wrappers->size());
56
55
57
        // Spec: If the list was empty, then a value of null is returned.
56
        // Spec: If the list was empty, then a value of null is returned.
58
        if (m_values->isEmpty())
57
        if (valuesProperty().isEmpty())
59
            return nullptr;
58
            return nullptr;
60
59
61
        detachListWrappers(0);
60
        detachListWrappers(0);
62
        
61
        
63
        RefPtr<SVGTransform> wrapper = m_values->consolidate();
62
        RefPtr<SVGTransform> wrapper = valuesProperty().consolidate();
64
        m_wrappers->append(wrapper->createWeakPtr());
63
        m_wrappers->append(wrapper->createWeakPtr());
65
64
66
        ASSERT(m_values->size() == m_wrappers->size());
65
        ASSERT(valuesProperty().size() == m_wrappers->size());
67
        return WTFMove(wrapper);
66
        return WTFMove(wrapper);
68
    }
67
    }
69
68
70
private:
69
private:
71
    SVGTransformList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGTransformListValues& values, ListWrapperCache& wrappers)
70
    SVGTransformList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
72
        : SVGListPropertyTearOff<SVGTransformListValues>(animatedProperty, role, values, wrappers)
71
        : SVGListPropertyTearOff<SVGTransformListValues>(animatedProperty, role, values, wrappers)
73
    {
72
    {
74
    }
73
    }
- Source/WebCore/svg/SVGTransformListValues.cpp -3 / +3 lines
Lines 41-47 Ref<SVGTransform> SVGTransformListValues Source/WebCore/svg/SVGTransformListValues.cpp_sec1
41
41
42
    SVGTransformValue transform(matrix);
42
    SVGTransformValue transform(matrix);
43
    clear();
43
    clear();
44
    append(transform);
44
    append(SVGValue::create<SVGTransformValue>(transform));
45
    return SVGTransform::create(transform);
45
    return SVGTransform::create(transform);
46
}
46
}
47
47
Lines 52-58 bool SVGTransformListValues::concatenate Source/WebCore/svg/SVGTransformListValues.cpp_sec2
52
        return false;
52
        return false;
53
53
54
    for (unsigned i = 0; i < size; ++i)
54
    for (unsigned i = 0; i < size; ++i)
55
        result *= at(i).matrix();
55
        result *= propertyAt(i).matrix();
56
56
57
    return true;
57
    return true;
58
}
58
}
Lines 65-71 String SVGTransformListValues::valueAsSt Source/WebCore/svg/SVGTransformListValues.cpp_sec3
65
        if (i > 0)
65
        if (i > 0)
66
            builder.append(' ');
66
            builder.append(' ');
67
67
68
        builder.append(at(i).valueAsString());
68
        builder.append(propertyAt(i).valueAsString());
69
    }
69
    }
70
70
71
    return builder.toString();
71
    return builder.toString();
- Source/WebCore/svg/SVGTransformListValues.h -8 / +15 lines
Lines 1-6 Source/WebCore/svg/SVGTransformListValues.h_sec1
1
/*
1
/*
2
 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2018 Apple Inc.  All rights reserved.
4
 *
5
 *
5
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * modify it under the terms of the GNU Library General Public
Lines 20-37 Source/WebCore/svg/SVGTransformListValues.h_sec2
20
21
21
#pragma once
22
#pragma once
22
23
23
#include "SVGPropertyTraits.h"
24
#include "SVGListValues.h"
24
#include "SVGTransform.h"
25
#include "SVGTransformValue.h"
25
#include <wtf/Vector.h>
26
26
27
namespace WebCore {
27
namespace WebCore {
28
28
29
template<typename T>
29
class SVGMatrix;
30
class SVGListPropertyTearOff;
30
class SVGTransform;
31
32
class SVGTransformList;
31
class SVGTransformList;
33
32
34
class SVGTransformListValues final : public Vector<SVGTransformValue, 1> {
33
class SVGTransformListValues final : public SVGListValues<SVGTransformValue> {
35
public:
34
public:
36
    Ref<SVGTransform> createSVGTransformFromMatrix(SVGMatrix&) const;
35
    Ref<SVGTransform> createSVGTransformFromMatrix(SVGMatrix&) const;
37
    Ref<SVGTransform> consolidate();
36
    Ref<SVGTransform> consolidate();
Lines 42-49 public: Source/WebCore/svg/SVGTransformListValues.h_sec3
42
    void parse(const String&);
41
    void parse(const String&);
43
};
42
};
44
43
45
template<> struct SVGPropertyTraits<SVGTransformListValues> {
44
template<>
45
struct SVGPropertyTraits<SVGTransformListValues> {
46
    static SVGTransformListValues initialValue() { return { }; }
46
    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
    }
47
    static String toString(const SVGTransformListValues& list) { return list.valueAsString(); }
54
    static String toString(const SVGTransformListValues& list) { return list.valueAsString(); }
48
55
49
    using ListItemType = SVGTransformValue;
56
    using ListItemType = SVGTransformValue;
- Source/WebCore/svg/SVGTransformValue.h +5 lines
Lines 91-94 inline bool operator!=(const SVGTransfor Source/WebCore/svg/SVGTransformValue.h_sec1
91
    return !(a == b);
91
    return !(a == b);
92
}
92
}
93
93
94
template<> struct SVGPropertyTraits<SVGTransformValue> {
95
    static SVGTransformValue initialValue() { return { }; }
96
    static String toString(const SVGTransformValue& transform) { return transform.valueAsString(); }
97
};
98
94
} // namespace WebCore
99
} // namespace WebCore
- Source/WebCore/svg/SVGTransformable.cpp -1 / +1 lines
Lines 197-203 bool SVGTransformable::parseTransformAtt Source/WebCore/svg/SVGTransformable.cpp_sec1
197
        if (!parseTransformValue(type, currTransform, end, transform))
197
        if (!parseTransformValue(type, currTransform, end, transform))
198
            return false;
198
            return false;
199
199
200
        list.append(transform);
200
        list.append(SVGValue::create<SVGTransformValue>(transform));
201
        skipOptionalSVGSpaces(currTransform, end);
201
        skipOptionalSVGSpaces(currTransform, end);
202
        if (currTransform < end && *currTransform == ',') {
202
        if (currTransform < end && *currTransform == ',') {
203
            delimParsed = true;
203
            delimParsed = true;
- Source/WebCore/svg/SVGUseElement.cpp -4 / +4 lines
Lines 62-71 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGUseElement.cpp_sec1
62
62
63
inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& document)
63
inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& document)
64
    : SVGGraphicsElement(tagName, document)
64
    : SVGGraphicsElement(tagName, document)
65
    , m_x(LengthModeWidth)
65
    , m_x(SVGLengthValue(LengthModeWidth))
66
    , m_y(LengthModeHeight)
66
    , m_y(SVGLengthValue(LengthModeHeight))
67
    , m_width(LengthModeWidth)
67
    , m_width(SVGLengthValue(LengthModeWidth))
68
    , m_height(LengthModeHeight)
68
    , m_height(SVGLengthValue(LengthModeHeight))
69
    , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired)
69
    , m_svgLoadEventTimer(*this, &SVGElement::svgLoadEventTimerFired)
70
{
70
{
71
    ASSERT(hasCustomStyleResolveCallbacks());
71
    ASSERT(hasCustomStyleResolveCallbacks());
- Source/WebCore/svg/SVGValue.h +225 lines
Line 0 Source/WebCore/svg/SVGValue.h_sec1
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
46
namespace WebCore {
47
48
using SVGValueVariant = Variant<
49
    SVGAngleValue,
50
    bool,
51
    Color,
52
    unsigned,
53
    int,
54
    SVGLengthValue,
55
    SVGLengthListValues,
56
    SVGMatrixValue,
57
    float,
58
    SVGNumberListValues,
59
    SVGPathByteStream,
60
    RefPtr<SVGPathSeg>,
61
    SVGPathSegListValues,
62
    SVGPreserveAspectRatioValue,
63
    FloatPoint,
64
    SVGPointListValues,
65
    FloatRect,
66
    String,
67
    SVGStringListValues,
68
    SVGTransformValue,
69
    SVGTransformListValues
70
>;
71
72
template <typename PropertyType>
73
class 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
80
public:
81
    enum { Value = sizeof(test<PropertyType>(nullptr)) == sizeof(char) };
82
};
83
    
84
struct 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
    
99
template <typename PropertyType>
100
class 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
107
public:
108
    enum { Value = sizeof(test<PropertyType>(nullptr)) == sizeof(char) };
109
};
110
111
struct 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
    
141
class SVGValue : public RefCounted<SVGValue>, public SVGValueVariant {
142
public:
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
210
private:
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
- Source/WebCore/svg/SVGViewElement.cpp -2 / +2 lines
Lines 41-47 END_REGISTER_ANIMATED_PROPERTIES Source/WebCore/svg/SVGViewElement.cpp_sec1
41
inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document& document)
41
inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document& document)
42
    : SVGElement(tagName, document)
42
    : SVGElement(tagName, document)
43
    , m_zoomAndPan(SVGZoomAndPanMagnify)
43
    , m_zoomAndPan(SVGZoomAndPanMagnify)
44
    , m_viewTarget(SVGNames::viewTargetAttr)
44
    , m_viewTarget(SVGValue::create(SVGStringListValues(SVGNames::viewTargetAttr)))
45
{
45
{
46
    ASSERT(hasTagName(SVGNames::viewTag));
46
    ASSERT(hasTagName(SVGNames::viewTag));
47
    registerAnimatedPropertiesForSVGViewElement();
47
    registerAnimatedPropertiesForSVGViewElement();
Lines 60-66 Ref<SVGStringList> SVGViewElement::viewT Source/WebCore/svg/SVGViewElement.cpp_sec2
60
void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
60
void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
61
{
61
{
62
    if (name == SVGNames::viewTargetAttr)
62
    if (name == SVGNames::viewTargetAttr)
63
        m_viewTarget.reset(value);
63
        static_cast<SVGStringListValues&>(*m_viewTarget).reset(value);
64
64
65
    SVGExternalResourcesRequired::parseAttribute(name, value);
65
    SVGExternalResourcesRequired::parseAttribute(name, value);
66
    SVGFitToViewBox::parseAttribute(this, name, value);
66
    SVGFitToViewBox::parseAttribute(this, name, value);
- Source/WebCore/svg/SVGViewElement.h -1 / +1 lines
Lines 59-65 private: Source/WebCore/svg/SVGViewElement.h_sec1
59
    END_DECLARE_ANIMATED_PROPERTIES
59
    END_DECLARE_ANIMATED_PROPERTIES
60
60
61
    SVGZoomAndPanType m_zoomAndPan;
61
    SVGZoomAndPanType m_zoomAndPan;
62
    SVGStringListValues m_viewTarget;
62
    RefPtr<SVGValue> m_viewTarget;
63
};
63
};
64
64
65
} // namespace WebCore
65
} // namespace WebCore
- Source/WebCore/svg/SVGViewSpec.cpp -7 / +10 lines
Lines 79-84 const SVGPropertyInfo* SVGViewSpec::tran Source/WebCore/svg/SVGViewSpec.cpp_sec1
79
79
80
SVGViewSpec::SVGViewSpec(SVGElement& contextElement)
80
SVGViewSpec::SVGViewSpec(SVGElement& contextElement)
81
    : m_contextElement(&contextElement)
81
    : m_contextElement(&contextElement)
82
    , m_transform(SVGValue::create<SVGTransformListValues>())
83
    , m_viewBox(SVGValue::create<FloatRect>())
84
    , m_preserveAspectRatio(SVGValue::create<SVGPreserveAspectRatioValue>())
82
{
85
{
83
}
86
}
84
87
Lines 108-124 ExceptionOr<void> SVGViewSpec::setZoomAn Source/WebCore/svg/SVGViewSpec.cpp_sec2
108
111
109
String SVGViewSpec::transformString() const
112
String SVGViewSpec::transformString() const
110
{
113
{
111
    return SVGPropertyTraits<SVGTransformListValues>::toString(m_transform);
114
    return m_transform->toString();
112
}
115
}
113
116
114
String SVGViewSpec::viewBoxString() const
117
String SVGViewSpec::viewBoxString() const
115
{
118
{
116
    return SVGPropertyTraits<FloatRect>::toString(m_viewBox);
119
    return m_viewBox->toString();
117
}
120
}
118
121
119
String SVGViewSpec::preserveAspectRatioString() const
122
String SVGViewSpec::preserveAspectRatioString() const
120
{
123
{
121
    return SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString(m_preserveAspectRatio);
124
    return m_preserveAspectRatio->toString();
122
}
125
}
123
126
124
SVGElement* SVGViewSpec::viewTarget() const
127
SVGElement* SVGViewSpec::viewTarget() const
Lines 177-185 Ref<SVGAnimatedProperty> SVGViewSpec::lo Source/WebCore/svg/SVGViewSpec.cpp_sec3
177
void SVGViewSpec::reset()
180
void SVGViewSpec::reset()
178
{
181
{
179
    m_zoomAndPan = SVGZoomAndPanMagnify;
182
    m_zoomAndPan = SVGZoomAndPanMagnify;
180
    m_transform.clear();
183
    static_cast<SVGTransformListValues&>(*m_transform).clear();
181
    m_viewBox = { };
184
    static_cast<FloatRect&>(*m_viewBox) = { };
182
    m_preserveAspectRatio = { };
185
    static_cast<SVGPreserveAspectRatioValue&>(*m_preserveAspectRatio) = { };
183
    m_viewTargetString = emptyString();
186
    m_viewTargetString = emptyString();
184
}
187
}
185
188
Lines 261-267 bool SVGViewSpec::parseViewSpec(const St Source/WebCore/svg/SVGViewSpec.cpp_sec4
261
            if (currViewSpec >= end || *currViewSpec != '(')
264
            if (currViewSpec >= end || *currViewSpec != '(')
262
                return false;
265
                return false;
263
            currViewSpec++;
266
            currViewSpec++;
264
            SVGTransformable::parseTransformAttribute(m_transform, currViewSpec, end, SVGTransformable::DoNotClearList);
267
            SVGTransformable::parseTransformAttribute(static_cast<SVGTransformListValues&>(*m_transform), currViewSpec, end, SVGTransformable::DoNotClearList);
265
            if (currViewSpec >= end || *currViewSpec != ')')
268
            if (currViewSpec >= end || *currViewSpec != ')')
266
                return false;
269
                return false;
267
            currViewSpec++;
270
            currViewSpec++;
- Source/WebCore/svg/SVGViewSpec.h -8 / +8 lines
Lines 55-71 public: Source/WebCore/svg/SVGViewSpec.h_sec1
55
55
56
    // Custom non-animated 'transform' property.
56
    // Custom non-animated 'transform' property.
57
    RefPtr<SVGTransformList> transform();
57
    RefPtr<SVGTransformList> transform();
58
    SVGTransformListValues transformBaseValue() const { return m_transform; }
58
    SVGTransformListValues transformBaseValue() const { return static_cast<SVGTransformListValues&>(*m_transform); }
59
59
60
    // Custom animated 'viewBox' property.
60
    // Custom animated 'viewBox' property.
61
    RefPtr<SVGAnimatedRect> viewBoxAnimated();
61
    RefPtr<SVGAnimatedRect> viewBoxAnimated();
62
    FloatRect& viewBox() { return m_viewBox; }
62
    FloatRect& viewBox() { return static_cast<FloatRect&>(*m_viewBox); }
63
    void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; }
63
    void setViewBoxBaseValue(const FloatRect& viewBox) { static_cast<FloatRect&>(*m_viewBox) = viewBox; }
64
64
65
    // Custom animated 'preserveAspectRatio' property.
65
    // Custom animated 'preserveAspectRatio' property.
66
    RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated();
66
    RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated();
67
    SVGPreserveAspectRatioValue& preserveAspectRatio() { return m_preserveAspectRatio; }
67
    SVGPreserveAspectRatioValue& preserveAspectRatio() { return static_cast<SVGPreserveAspectRatioValue&>(*m_preserveAspectRatio); }
68
    void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; }
68
    void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatioValue& preserveAspectRatio) { static_cast<SVGPreserveAspectRatioValue&>(*m_preserveAspectRatio) = preserveAspectRatio; }
69
69
70
private:
70
private:
71
    explicit SVGViewSpec(SVGElement&);
71
    explicit SVGViewSpec(SVGElement&);
Lines 84-92 private: Source/WebCore/svg/SVGViewSpec.h_sec2
84
84
85
    SVGElement* m_contextElement;
85
    SVGElement* m_contextElement;
86
    SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
86
    SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify };
87
    SVGTransformListValues m_transform;
87
    RefPtr<SVGValue> m_transform;
88
    FloatRect m_viewBox;
88
    RefPtr<SVGValue> m_viewBox;
89
    SVGPreserveAspectRatioValue m_preserveAspectRatio;
89
    RefPtr<SVGValue> m_preserveAspectRatio;
90
    String m_viewTargetString;
90
    String m_viewTargetString;
91
};
91
};
92
92
- Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h -11 / +4 lines
Lines 55-76 public: Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h_sec1
55
        return SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property);
55
        return SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property);
56
    }
56
    }
57
57
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)
59
    {
59
    {
60
        ASSERT(contextElement);
60
        ASSERT(contextElement);
61
        return adoptRef(*new SVGAnimatedEnumerationPropertyTearOff<EnumType>(contextElement, attributeName, animatedPropertyType, reinterpret_cast<unsigned&>(property)));
61
        return adoptRef(*new SVGAnimatedEnumerationPropertyTearOff<EnumType>(contextElement, attributeName, animatedPropertyType, baseValue));
62
    }
63
64
    EnumType& currentAnimatedValue()
65
    {
66
        unsigned& animatedValue = SVGAnimatedStaticPropertyTearOff<unsigned>::currentAnimatedValue();
67
        ASSERT(animatedValue <= SVGPropertyTraits<EnumType>::highestEnumValue());
68
        return reinterpret_cast<EnumType&>(animatedValue);
69
    }
62
    }
70
63
71
private:
64
private:
72
    SVGAnimatedEnumerationPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, unsigned& property)
65
    SVGAnimatedEnumerationPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& baseValue)
73
        : SVGAnimatedStaticPropertyTearOff<unsigned>(contextElement, attributeName, animatedPropertyType, property)
66
        : SVGAnimatedStaticPropertyTearOff<unsigned>(contextElement, attributeName, animatedPropertyType, baseValue)
74
    {
67
    {
75
    }
68
    }
76
69
- Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h -21 / +27 lines
Lines 39-45 public: Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h_sec1
39
    using ListPropertyTearOff = typename SVGPropertyTraits<PropertyType>::ListPropertyTearOff;
39
    using ListPropertyTearOff = typename SVGPropertyTraits<PropertyType>::ListPropertyTearOff;
40
    using ContentType = PropertyType;
40
    using ContentType = PropertyType;
41
41
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)
43
    {
43
    {
44
        ASSERT(contextElement);
44
        ASSERT(contextElement);
45
        return adoptRef(*new SVGAnimatedListPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, values));
45
        return adoptRef(*new SVGAnimatedListPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, values));
Lines 85-128 public: Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h_sec2
85
        ListProperty::detachListWrappersAndResize(&m_wrappers, newListSize);
85
        ListProperty::detachListWrappersAndResize(&m_wrappers, newListSize);
86
    }
86
    }
87
87
88
    PropertyType& currentAnimatedValue()
88
    RefPtr<SVGValue> currentAnimatedValue()
89
    {
89
    {
90
        ASSERT(isAnimating());
90
        ASSERT(isAnimating());
91
        return m_animatedProperty->values();
91
        return m_animatedProperty->values();
92
    }
92
    }
93
93
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
95
    {
101
    {
96
        return m_values;
102
        return m_values;
97
    }
103
    }
98
104
99
    void animationStarted(PropertyType* newAnimVal, bool shouldOwnValues = false)
105
    void animationStarted(RefPtr<SVGValue> newAnimVal)
100
    {
106
    {
101
        ASSERT(!isAnimating());
107
        ASSERT(!isAnimating());
102
        ASSERT(newAnimVal);
108
        ASSERT(newAnimVal);
103
        ASSERT(m_values.size() == m_wrappers.size());
109
        ASSERT(static_cast<PropertyType&>(*currentBaseValue()).size() == m_wrappers.size());
104
        ASSERT(m_animatedWrappers.isEmpty());
110
        ASSERT(m_animatedWrappers.isEmpty());
105
111
106
        // Switch to new passed in value type & new wrappers list. The new wrappers list must be created for the new value.
112
        // 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())
113
        if (size_t size = static_cast<PropertyType&>(*newAnimVal).size())
108
            m_animatedWrappers.fill(0, newAnimVal->size());
114
            m_animatedWrappers.fill(0, size);
109
115
110
        m_animatedProperty = animVal();
116
        m_animatedProperty = animVal();
111
        m_animatedProperty->setValuesAndWrappers(newAnimVal, &m_animatedWrappers, shouldOwnValues);
117
        m_animatedProperty->setValuesAndWrappers(newAnimVal, &m_animatedWrappers);
112
        ASSERT(m_animatedProperty->values().size() == m_animatedProperty->wrappers().size());
118
        ASSERT(m_animatedProperty->valuesProperty().size() == m_animatedProperty->wrappers().size());
113
        ASSERT(m_animatedProperty->wrappers().size() == m_animatedWrappers.size());
119
        ASSERT(m_animatedProperty->wrappers().size() == m_animatedWrappers.size());
114
    }
120
    }
115
121
116
    void animationEnded()
122
    void animationEnded()
117
    {
123
    {
118
        ASSERT(isAnimating());
124
        ASSERT(isAnimating());
119
        ASSERT(m_values.size() == m_wrappers.size());
125
        ASSERT(static_cast<PropertyType&>(*currentBaseValue()).size() == m_wrappers.size());
120
126
121
        ASSERT(m_animatedProperty->values().size() == m_animatedProperty->wrappers().size());
127
        ASSERT(m_animatedProperty->valuesProperty().size() == m_animatedProperty->wrappers().size());
122
        ASSERT(m_animatedProperty->wrappers().size() == m_animatedWrappers.size());
128
        ASSERT(m_animatedProperty->wrappers().size() == m_animatedWrappers.size());
123
129
124
        m_animatedProperty->setValuesAndWrappers(&m_values, &m_wrappers, false);
130
        m_animatedProperty->setValuesAndWrappers(m_values, &m_wrappers);
125
        ASSERT(m_animatedProperty->values().size() == m_animatedProperty->wrappers().size());
131
        ASSERT(m_animatedProperty->valuesProperty().size() == m_animatedProperty->wrappers().size());
126
        ASSERT(m_animatedProperty->wrappers().size() == m_wrappers.size());
132
        ASSERT(m_animatedProperty->wrappers().size() == m_wrappers.size());
127
133
128
        m_animatedWrappers.clear();
134
        m_animatedWrappers.clear();
Lines 142-175 public: Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h_sec3
142
        // Also existing wrappers which point directly at elements in the existing SVGLengthListValues have to be detached (so a copy
148
        // Also existing wrappers which point directly at elements in the existing SVGLengthListValues have to be detached (so a copy
143
        // of them is created, so existing animVal variables in JS are kept-alive). If we'd detach them later the underlying
149
        // of them is created, so existing animVal variables in JS are kept-alive). If we'd detach them later the underlying
144
        // SVGLengthListValues was already mutated, and our list item wrapper tear offs would point nowhere. Assertions would fire.
150
        // 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());
146
152
147
        ASSERT(m_animatedProperty->values().size() == m_animatedProperty->wrappers().size());
153
        ASSERT(m_animatedProperty->valuesProperty().size() == m_animatedProperty->wrappers().size());
148
        ASSERT(m_animatedProperty->wrappers().size() == m_animatedWrappers.size());
154
        ASSERT(m_animatedProperty->wrappers().size() == m_animatedWrappers.size());
149
    }
155
    }
150
156
151
    void animValWillChange()
157
    void animValWillChange()
152
    {
158
    {
153
        ASSERT(m_values.size() == m_wrappers.size());
159
        ASSERT(static_cast<PropertyType&>(*currentBaseValue()).size() == m_wrappers.size());
154
        synchronizeWrappersIfNeeded();
160
        synchronizeWrappersIfNeeded();
155
    }
161
    }
156
162
157
    void animValDidChange()
163
    void animValDidChange()
158
    {
164
    {
159
        ASSERT(m_values.size() == m_wrappers.size());
165
        ASSERT(static_cast<PropertyType&>(*currentBaseValue()).size() == m_wrappers.size());
160
        synchronizeWrappersIfNeeded();
166
        synchronizeWrappersIfNeeded();
161
    }
167
    }
162
168
163
protected:
169
protected:
164
    SVGAnimatedListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& values)
170
    SVGAnimatedListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& values)
165
        : SVGAnimatedProperty(contextElement, attributeName, animatedPropertyType)
171
        : SVGAnimatedProperty(contextElement, attributeName, animatedPropertyType)
166
        , m_values(values)
172
        , m_values(values)
167
    {
173
    {
168
        if (!values.isEmpty())
174
        if (size_t size = static_cast<PropertyType&>(*values).size())
169
            m_wrappers.fill(0, values.size());
175
            m_wrappers.fill(0, size);
170
    }
176
    }
171
177
172
    PropertyType& m_values;
178
    RefPtr<SVGValue> m_values;
173
179
174
    ListWrapperCache m_wrappers;
180
    ListWrapperCache m_wrappers;
175
    ListWrapperCache m_animatedWrappers;
181
    ListWrapperCache m_animatedWrappers;
- Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h -6 / +6 lines
Lines 1-5 Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h_sec1
1
/*
1
/*
2
 * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved.
2
 * Copyright (C) Research In Motion Limited 2010, 2012. All rights reserved.
3
 * Copyright (C) 2018 Apple Inc.  All rights reserved.
3
 *
4
 *
4
 * This library is free software; you can redistribute it and/or
5
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * modify it under the terms of the GNU Library General Public
Lines 31-37 class SVGAnimatedPathSegListPropertyTear Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h_sec2
31
public:
32
public:
32
    using Base = SVGAnimatedListPropertyTearOff<SVGPathSegListValues>;
33
    using Base = SVGAnimatedListPropertyTearOff<SVGPathSegListValues>;
33
34
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)
35
    {
36
    {
36
        ASSERT(contextElement);
37
        ASSERT(contextElement);
37
        return adoptRef(*new SVGAnimatedPathSegListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));
38
        return adoptRef(*new SVGAnimatedPathSegListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));
Lines 75-83 public: Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h_sec3
75
        ASSERT(!m_animatedPathByteStream);
76
        ASSERT(!m_animatedPathByteStream);
76
        m_animatedPathByteStream = byteStream;
77
        m_animatedPathByteStream = byteStream;
77
78
78
        // Pass shouldOwnValues=true, as the SVGPathSegListValues lifetime is solely managed by its tear off class.
79
        auto copy = SVGValue::create(*baseValue);
79
        auto* copy = new SVGPathSegListValues(*baseValue);
80
        Base::animationStarted(copy.ptr());
80
        Base::animationStarted(copy, true);
81
    }
81
    }
82
82
83
    void animationEnded()
83
    void animationEnded()
Lines 95-101 public: Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h_sec4
95
        // If the animVal is observed from JS, we have to update it on each animation step.
95
        // If the animVal is observed from JS, we have to update it on each animation step.
96
        // This is an expensive operation and only done, if someone actually observes the animatedPathSegList() while an animation is running.
96
        // This is an expensive operation and only done, if someone actually observes the animatedPathSegList() while an animation is running.
97
        if (pathElement->isAnimValObserved()) {
97
        if (pathElement->isAnimValObserved()) {
98
            auto& animatedList = currentAnimatedValue();
98
            auto& animatedList = static_cast<SVGPathSegListValues&>(*currentAnimatedValue());
99
            animatedList.clear();
99
            animatedList.clear();
100
            buildSVGPathSegListValuesFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing);
100
            buildSVGPathSegListValuesFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing);
101
        }
101
        }
Lines 106-112 public: Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h_sec5
106
    SVGPathByteStream* animatedPathByteStream() const { return m_animatedPathByteStream; }
106
    SVGPathByteStream* animatedPathByteStream() const { return m_animatedPathByteStream; }
107
107
108
private:
108
private:
109
    SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegListValues& values)
109
    SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& values)
110
        : Base(contextElement, attributeName, animatedPropertyType, values)
110
        : Base(contextElement, attributeName, animatedPropertyType, values)
111
        , m_animatedPathByteStream(nullptr)
111
        , m_animatedPathByteStream(nullptr)
112
    {
112
    {
- Source/WebCore/svg/properties/SVGAnimatedProperty.h -2 / +3 lines
Lines 27-32 Source/WebCore/svg/properties/SVGAnimatedProperty.h_sec1
27
27
28
namespace WebCore {
28
namespace WebCore {
29
29
30
class SVGValue;
30
class SVGElement;
31
class SVGElement;
31
class SVGProperty;
32
class SVGProperty;
32
33
Lines 49-55 public: Source/WebCore/svg/properties/SVGAnimatedProperty.h_sec2
49
    virtual ~SVGAnimatedProperty();
50
    virtual ~SVGAnimatedProperty();
50
51
51
    template<typename OwnerType, typename TearOffType, typename PropertyType>
52
    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)
53
    {
54
    {
54
        ASSERT(info);
55
        ASSERT(info);
55
        SVGAnimatedPropertyDescription key(element, info->propertyIdentifier);
56
        SVGAnimatedPropertyDescription key(element, info->propertyIdentifier);
Lines 58-64 public: Source/WebCore/svg/properties/SVGAnimatedProperty.h_sec3
58
        if (!result.isNewEntry)
59
        if (!result.isNewEntry)
59
            return static_cast<TearOffType&>(*result.iterator->value);
60
            return static_cast<TearOffType&>(*result.iterator->value);
60
61
61
        Ref<SVGAnimatedProperty> wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property);
62
        Ref<SVGAnimatedProperty> wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, value);
62
        if (info->animatedPropertyState == PropertyIsReadOnly)
63
        if (info->animatedPropertyState == PropertyIsReadOnly)
63
            wrapper->setIsReadOnly();
64
            wrapper->setIsReadOnly();
64
65
- Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h -25 / +14 lines
Lines 2-7 Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h_sec1
2
 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4
 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
4
 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
5
 * Copyright (C) 2018 Apple Inc.  All rights reserved.
5
 *
6
 *
6
 * This library is free software; you can redistribute it and/or
7
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * modify it under the terms of the GNU Library General Public
Lines 25-30 Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h_sec2
25
#include "SVGAnimatedProperty.h"
26
#include "SVGAnimatedProperty.h"
26
#include "SVGAttributeToPropertyMap.h"
27
#include "SVGAttributeToPropertyMap.h"
27
#include "SVGPropertyTraits.h"
28
#include "SVGPropertyTraits.h"
29
#include "SVGValue.h"
28
#include <wtf/NeverDestroyed.h>
30
#include <wtf/NeverDestroyed.h>
29
#include <wtf/StdLibExtras.h>
31
#include <wtf/StdLibExtras.h>
30
32
Lines 34-58 namespace WebCore { Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h_sec3
34
template<typename PropertyType>
36
template<typename PropertyType>
35
struct SVGSynchronizableAnimatedProperty {
37
struct SVGSynchronizableAnimatedProperty {
36
    SVGSynchronizableAnimatedProperty()
38
    SVGSynchronizableAnimatedProperty()
37
        : value(SVGPropertyTraits<PropertyType>::initialValue())
39
        : value(SVGValue::create<PropertyType>())
38
        , shouldSynchronize(false)
39
        , isValid(false)
40
    {
40
    {
41
    }
41
    }
42
42
43
    template<typename ConstructorParameter1>
43
    SVGSynchronizableAnimatedProperty(const PropertyType& value)
44
    SVGSynchronizableAnimatedProperty(const ConstructorParameter1& value1)
44
        : value(SVGValue::create<PropertyType>(value))
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)
56
    {
45
    {
57
    }
46
    }
58
47
Lines 61-69 struct SVGSynchronizableAnimatedProperty Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h_sec4
61
        ownerElement->setSynchronizedLazyAttribute(attrName, value);
50
        ownerElement->setSynchronizedLazyAttribute(attrName, value);
62
    }
51
    }
63
52
64
    PropertyType value;
53
    RefPtr<SVGValue> value;
65
    bool shouldSynchronize : 1;
54
    bool shouldSynchronize { false };
66
    bool isValid : 1;
55
    bool isValid { false };
67
};
56
};
68
57
69
// Property registration helpers
58
// Property registration helpers
Lines 124-142 public: \ Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h_sec5
124
    { \
113
    { \
125
        if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) { \
114
        if (auto wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) { \
126
            if (wrapper->isAnimating()) \
115
            if (wrapper->isAnimating()) \
127
                return wrapper->currentAnimatedValue(); \
116
                return static_cast<PropertyType&>(*wrapper->currentAnimatedValue()); \
128
        } \
117
        } \
129
        return m_##LowerProperty.value; \
118
        return static_cast<PropertyType&>(*m_##LowerProperty.value); \
130
    } \
119
    } \
131
\
120
\
132
    PropertyType& LowerProperty##BaseValue() const OverrideSpecifier \
121
    PropertyType& LowerProperty##BaseValue() const OverrideSpecifier \
133
    { \
122
    { \
134
        return m_##LowerProperty.value; \
123
        return static_cast<PropertyType&>(*m_##LowerProperty.value); \
135
    } \
124
    } \
136
\
125
\
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 \
138
    { \
127
    { \
139
        m_##LowerProperty.value = type; \
128
        static_cast<PropertyType&>(*m_##LowerProperty.value) = value; \
140
        m_##LowerProperty.isValid = validValue; \
129
        m_##LowerProperty.isValid = validValue; \
141
    } \
130
    } \
142
\
131
\
Lines 156-162 private: \ Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h_sec6
156
    { \
145
    { \
157
        if (!m_##LowerProperty.shouldSynchronize) \
146
        if (!m_##LowerProperty.shouldSynchronize) \
158
            return; \
147
            return; \
159
        AtomicString value(SVGPropertyTraits<PropertyType>::toString(m_##LowerProperty.value)); \
148
        AtomicString value(SVGPropertyTraits<PropertyType>::toString(static_cast<PropertyType&>(*m_##LowerProperty.value))); \
160
        m_##LowerProperty.synchronize(this, LowerProperty##PropertyInfo()->attributeName, value); \
149
        m_##LowerProperty.synchronize(this, LowerProperty##PropertyInfo()->attributeName, value); \
161
    } \
150
    } \
162
\
151
\
- Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h -8 / +14 lines
Lines 32-38 public: Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h_sec1
32
    using PropertyType = typename PropertyTearOff::PropertyType;
32
    using PropertyType = typename PropertyTearOff::PropertyType;
33
    using ContentType = PropertyType;
33
    using ContentType = PropertyType;
34
34
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>& property)
36
    {
36
    {
37
        ASSERT(contextElement);
37
        ASSERT(contextElement);
38
        return adoptRef(*new SVGAnimatedPropertyTearOff<PropertyTearOff>(contextElement, attributeName, animatedPropertyType, property));
38
        return adoptRef(*new SVGAnimatedPropertyTearOff<PropertyTearOff>(contextElement, attributeName, animatedPropertyType, property));
Lines 60-82 public: Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h_sec2
60
60
61
    bool isAnimating() const final { return m_animatedProperty; }
61
    bool isAnimating() const final { return m_animatedProperty; }
62
62
63
    PropertyType& currentAnimatedValue()
63
    RefPtr<SVGValue> currentAnimatedValue()
64
    {
64
    {
65
        ASSERT(isAnimating());
65
        ASSERT(isAnimating());
66
        return m_animatedProperty->propertyReference();
66
        return m_animatedProperty->value();
67
    }
67
    }
68
68
69
    const PropertyType& currentBaseValue() const
69
    const RefPtr<SVGValue> currentAnimatedValue() const
70
    {
71
        ASSERT(isAnimating());
72
        return m_animatedProperty->value();
73
    }
74
75
    const RefPtr<SVGValue> currentBaseValue() const
70
    {
76
    {
71
        return m_property;
77
        return m_property;
72
    }
78
    }
73
79
74
    void animationStarted(PropertyType* newAnimVal)
80
    void animationStarted(const RefPtr<SVGValue>& newAnimVal)
75
    {
81
    {
76
        ASSERT(!isAnimating());
82
        ASSERT(!isAnimating());
77
        ASSERT(newAnimVal);
83
        ASSERT(newAnimVal);
78
        m_animatedProperty = animVal();
84
        m_animatedProperty = animVal();
79
        m_animatedProperty->setValue(*newAnimVal);
85
        m_animatedProperty->setValue(newAnimVal);
80
    }
86
    }
81
87
82
    void animationEnded()
88
    void animationEnded()
Lines 104-116 public: Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h_sec3
104
    }
110
    }
105
111
106
private:
112
private:
107
    SVGAnimatedPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
113
    SVGAnimatedPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& property)
108
        : SVGAnimatedProperty(contextElement, attributeName, animatedPropertyType)
114
        : SVGAnimatedProperty(contextElement, attributeName, animatedPropertyType)
109
        , m_property(property)
115
        , m_property(property)
110
    {
116
    {
111
    }
117
    }
112
118
113
    PropertyType& m_property;
119
    RefPtr<SVGValue> m_property;
114
    WeakPtr<SVGPropertyTearOff<PropertyType>> m_baseVal;
120
    WeakPtr<SVGPropertyTearOff<PropertyType>> m_baseVal;
115
    WeakPtr<SVGPropertyTearOff<PropertyType>> m_animVal;
121
    WeakPtr<SVGPropertyTearOff<PropertyType>> m_animVal;
116
122
- Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h -13 / +20 lines
Lines 22-27 Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h_sec1
22
22
23
#include "ExceptionOr.h"
23
#include "ExceptionOr.h"
24
#include "SVGAnimatedProperty.h"
24
#include "SVGAnimatedProperty.h"
25
#include "SVGValue.h"
25
26
26
namespace WebCore {
27
namespace WebCore {
27
28
Lines 32-74 public: Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h_sec2
32
33
33
    virtual const PropertyType& baseVal()
34
    virtual const PropertyType& baseVal()
34
    {
35
    {
35
        return m_property;
36
        return static_cast<PropertyType&>(*m_property);
36
    }
37
    }
37
38
38
    virtual const PropertyType& animVal()
39
    virtual const PropertyType& animVal()
39
    {
40
    {
40
        if (m_animatedProperty)
41
        if (m_animatedProperty)
41
            return *m_animatedProperty;
42
            return static_cast<PropertyType&>(*m_animatedProperty);
42
        return m_property;
43
        return baseVal();
43
    }
44
    }
44
45
45
    virtual ExceptionOr<void> setBaseVal(const PropertyType& property)
46
    virtual ExceptionOr<void> setBaseVal(const PropertyType& property)
46
    {
47
    {
47
        m_property = property;
48
        static_cast<PropertyType&>(*m_property) = property;
48
        commitChange();
49
        commitChange();
49
        return { };
50
        return { };
50
    }
51
    }
51
52
52
    bool isAnimating() const override { return m_animatedProperty; }
53
    bool isAnimating() const override { return m_animatedProperty; }
53
54
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>& property)
55
    {
56
    {
56
        ASSERT(contextElement);
57
        ASSERT(contextElement);
57
        return adoptRef(*new SVGAnimatedStaticPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, property));
58
        return adoptRef(*new SVGAnimatedStaticPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, property));
58
    }
59
    }
59
60
60
    PropertyType& currentAnimatedValue()
61
    RefPtr<SVGValue> currentAnimatedValue()
62
    {
63
        ASSERT(isAnimating());
64
        return m_animatedProperty;
65
    }
66
67
    const RefPtr<SVGValue> currentAnimatedValue() const
61
    {
68
    {
62
        ASSERT(isAnimating());
69
        ASSERT(isAnimating());
63
        return *m_animatedProperty;
70
        return m_animatedProperty;
64
    }
71
    }
65
72
66
    const PropertyType& currentBaseValue() const
73
    const RefPtr<SVGValue> currentBaseValue() const
67
    {
74
    {
68
        return m_property;
75
        return m_property;
69
    }
76
    }
70
77
71
    void animationStarted(PropertyType* newAnimVal)
78
    void animationStarted(RefPtr<SVGValue> newAnimVal)
72
    {
79
    {
73
        ASSERT(!isAnimating());
80
        ASSERT(!isAnimating());
74
        ASSERT(newAnimVal);
81
        ASSERT(newAnimVal);
Lines 99-114 public: Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h_sec3
99
    }
106
    }
100
107
101
protected:
108
protected:
102
    SVGAnimatedStaticPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
109
    SVGAnimatedStaticPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& property)
103
        : SVGAnimatedProperty(contextElement, attributeName, animatedPropertyType)
110
        : SVGAnimatedProperty(contextElement, attributeName, animatedPropertyType)
104
        , m_property(property)
111
        , m_property(property)
105
        , m_animatedProperty(nullptr)
106
    {
112
    {
113
        ASSERT_IMPLIES(m_property, m_property->is<PropertyType>());
107
    }
114
    }
108
115
109
private:
116
private:
110
    PropertyType& m_property;
117
    RefPtr<SVGValue> m_property;
111
    PropertyType* m_animatedProperty;
118
    RefPtr<SVGValue> m_animatedProperty;
112
};
119
};
113
120
114
}
121
}
- Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h -2 / +2 lines
Lines 26-32 namespace WebCore { Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h_sec1
26
26
27
class SVGAnimatedTransformListPropertyTearOff final : public SVGAnimatedListPropertyTearOff<SVGTransformListValues> {
27
class SVGAnimatedTransformListPropertyTearOff final : public SVGAnimatedListPropertyTearOff<SVGTransformListValues> {
28
public:
28
public:
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)
30
    {
30
    {
31
        ASSERT(contextElement);
31
        ASSERT(contextElement);
32
        return adoptRef(*new SVGAnimatedTransformListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));
32
        return adoptRef(*new SVGAnimatedTransformListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));
Lines 53-59 public: Source/WebCore/svg/properties/SVGAnimatedTransformListPropertyTearOff.h_sec2
53
    }
53
    }
54
54
55
private:
55
private:
56
    SVGAnimatedTransformListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGTransformListValues& values)
56
    SVGAnimatedTransformListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, const RefPtr<SVGValue>& values)
57
        : SVGAnimatedListPropertyTearOff<SVGTransformListValues>(contextElement, attributeName, animatedPropertyType, values)
57
        : SVGAnimatedListPropertyTearOff<SVGTransformListValues>(contextElement, attributeName, animatedPropertyType, values)
58
    {
58
    {
59
    }
59
    }
- Source/WebCore/svg/properties/SVGListProperty.h -59 / +46 lines
Lines 25-38 Source/WebCore/svg/properties/SVGListProperty.h_sec1
25
25
26
namespace WebCore {
26
namespace WebCore {
27
27
28
enum ListModification {
29
    ListModificationUnknown = 0,
30
    ListModificationInsert = 1,
31
    ListModificationReplace = 2,
32
    ListModificationRemove = 3,
33
    ListModificationAppend = 4
34
};
35
36
template<typename PropertyType>
28
template<typename PropertyType>
37
class SVGAnimatedListPropertyTearOff;
29
class SVGAnimatedListPropertyTearOff;
38
30
Lines 75-93 public: Source/WebCore/svg/properties/SVGListProperty.h_sec2
75
        detachListWrappersAndResize(m_wrappers, newListSize);
67
        detachListWrappersAndResize(m_wrappers, newListSize);
76
    }
68
    }
77
69
78
    void setValuesAndWrappers(PropertyType* values, ListWrapperCache* wrappers, bool shouldOwnValues)
70
    void setValuesAndWrappers(const RefPtr<SVGValue>& values, ListWrapperCache* wrappers)
79
    {
71
    {
80
        // This is only used for animVal support, to switch the underlying values & wrappers
72
        // This is only used for animVal support, to switch the underlying values & wrappers
81
        // to the current animated values, once animation for a list starts.
73
        // to the current animated values, once animation for a list starts.
82
        ASSERT(m_values);
74
        ASSERT(m_values);
83
        ASSERT(m_wrappers);
75
        ASSERT(m_wrappers);
84
        ASSERT(m_role == AnimValRole);
76
        ASSERT(m_role == AnimValRole);
85
        if (m_ownsValues)
86
            delete m_values;
87
        m_values = values;
77
        m_values = values;
88
        m_ownsValues = shouldOwnValues;
89
        m_wrappers = wrappers;
78
        m_wrappers = wrappers;
90
        ASSERT(m_values->size() == m_wrappers->size());
79
        ASSERT(valuesProperty().size() == m_wrappers->size());
91
    }
80
    }
92
81
93
    // SVGList::clear()
82
    // SVGList::clear()
Lines 98-104 public: Source/WebCore/svg/properties/SVGListProperty.h_sec3
98
            return result.releaseException();
87
            return result.releaseException();
99
        ASSERT(result.releaseReturnValue());
88
        ASSERT(result.releaseReturnValue());
100
89
101
        m_values->clear();
90
        valuesProperty().clear();
102
        commitChange();
91
        commitChange();
103
        return { };
92
        return { };
104
    }
93
    }
Lines 111-117 public: Source/WebCore/svg/properties/SVGListProperty.h_sec4
111
        ASSERT(result.releaseReturnValue());
100
        ASSERT(result.releaseReturnValue());
112
101
113
        detachListWrappers(0);
102
        detachListWrappers(0);
114
        m_values->clear();
103
        valuesProperty().clear();
115
        commitChange();
104
        commitChange();
116
        return { };
105
        return { };
117
    }
106
    }
Lines 119-125 public: Source/WebCore/svg/properties/SVGListProperty.h_sec5
119
    // SVGList::numberOfItems()
108
    // SVGList::numberOfItems()
120
    unsigned numberOfItems() const
109
    unsigned numberOfItems() const
121
    {
110
    {
122
        return m_values->size();
111
        return valuesProperty().size();
123
    }
112
    }
124
113
125
    // SVGList::initialize()
114
    // SVGList::initialize()
Lines 134-141 public: Source/WebCore/svg/properties/SVGListProperty.h_sec6
134
        processIncomingListItemValue(newItem, 0);
123
        processIncomingListItemValue(newItem, 0);
135
124
136
        // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
125
        // 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();
126
        valuesProperty().clear();
138
        m_values->append(newItem);
127
        valuesProperty().append(SVGValue::create<ListItemType>(newItem));
139
128
140
        commitChange();
129
        commitChange();
141
        return ListItemType { newItem };
130
        return ListItemType { newItem };
Lines 150-156 public: Source/WebCore/svg/properties/SVGListProperty.h_sec7
150
            return result.releaseException();
139
            return result.releaseException();
151
        ASSERT(result.releaseReturnValue());
140
        ASSERT(result.releaseReturnValue());
152
141
153
        ASSERT(m_values->size() == m_wrappers->size());
142
        ASSERT(valuesProperty().size() == m_wrappers->size());
154
143
155
        Ref<ListItemTearOff> newItem(item);
144
        Ref<ListItemTearOff> newItem(item);
156
145
Lines 159-167 public: Source/WebCore/svg/properties/SVGListProperty.h_sec8
159
148
160
        // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
149
        // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
161
        detachListWrappers(0);
150
        detachListWrappers(0);
162
        m_values->clear();
151
        valuesProperty().clear();
163
152
164
        m_values->append(newItem->propertyReference());
153
        valuesProperty().append(newItem->value());
165
        m_wrappers->append(newItem->createWeakPtr());
154
        m_wrappers->append(newItem->createWeakPtr());
166
155
167
        commitChange();
156
        commitChange();
Lines 171-177 public: Source/WebCore/svg/properties/SVGListProperty.h_sec9
171
    // SVGList::getItem()
160
    // SVGList::getItem()
172
    ExceptionOr<bool> canGetItem(unsigned index)
161
    ExceptionOr<bool> canGetItem(unsigned index)
173
    {
162
    {
174
        if (index >= m_values->size())
163
        if (index >= valuesProperty().size())
175
            return Exception { IndexSizeError };
164
            return Exception { IndexSizeError };
176
165
177
        return true;
166
        return true;
Lines 185-191 public: Source/WebCore/svg/properties/SVGListProperty.h_sec10
185
        ASSERT(result.releaseReturnValue());
174
        ASSERT(result.releaseReturnValue());
186
175
187
        // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
176
        // 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)) };
189
    }
178
    }
190
179
191
    ExceptionOr<Ref<ListItemTearOff>> getItemValuesAndWrappers(AnimatedListPropertyTearOff& animatedList, unsigned index)
180
    ExceptionOr<Ref<ListItemTearOff>> getItemValuesAndWrappers(AnimatedListPropertyTearOff& animatedList, unsigned index)
Lines 199-211 public: Source/WebCore/svg/properties/SVGListProperty.h_sec11
199
188
200
        // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
189
        // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
201
        // Any changes made to the item are immediately reflected in the list.
190
        // 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());
203
        RefPtr<ListItemTearOff> wrapper = static_cast<ListItemTearOff*>(m_wrappers->at(index).get());
192
        RefPtr<ListItemTearOff> wrapper = static_cast<ListItemTearOff*>(m_wrappers->at(index).get());
204
        if (!wrapper) {
193
        if (!wrapper) {
205
            // Create new wrapper, which is allowed to directly modify the item in the list, w/o copying and cache the wrapper in our map.
194
            // Create new wrapper, which is allowed to directly modify the item in the list, w/o copying and cache the wrapper in our map.
206
            // It is also associated with our animated property, so it can notify the SVG Element which holds the SVGAnimated*List
195
            // It is also associated with our animated property, so it can notify the SVG Element which holds the SVGAnimated*List
207
            // that it has been modified (and thus can call svgAttributeChanged(associatedAttributeName)).
196
            // 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));
209
            m_wrappers->at(index) = wrapper->createWeakPtr();
198
            m_wrappers->at(index) = wrapper->createWeakPtr();
210
        }
199
        }
211
200
Lines 221-228 public: Source/WebCore/svg/properties/SVGListProperty.h_sec12
221
        ASSERT(result.releaseReturnValue());
210
        ASSERT(result.releaseReturnValue());
222
211
223
        // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
212
        // 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())
213
        if (index > valuesProperty().size())
225
            index = m_values->size();
214
            index = valuesProperty().size();
226
215
227
        // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
216
        // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
228
        if (!processIncomingListItemValue(newItem, &index)) {
217
        if (!processIncomingListItemValue(newItem, &index)) {
Lines 232-238 public: Source/WebCore/svg/properties/SVGListProperty.h_sec13
232
221
233
        // 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
222
        // 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
234
        // 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.
223
        // 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));
236
225
237
        commitChange();
226
        commitChange();
238
        return ListItemType { newItem };
227
        return ListItemType { newItem };
Lines 248-257 public: Source/WebCore/svg/properties/SVGListProperty.h_sec14
248
        ASSERT(result.releaseReturnValue());
237
        ASSERT(result.releaseReturnValue());
249
238
250
        // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
239
        // 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())
240
        if (index > valuesProperty().size())
252
            index = m_values->size();
241
            index = valuesProperty().size();
253
242
254
        ASSERT(m_values->size() == m_wrappers->size());
243
        ASSERT(valuesProperty().size() == m_wrappers->size());
255
244
256
        Ref<ListItemTearOff> newItem(item);
245
        Ref<ListItemTearOff> newItem(item);
257
246
Lines 261-267 public: Source/WebCore/svg/properties/SVGListProperty.h_sec15
261
250
262
        // 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
251
        // 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
263
        // 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.
252
        // 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());
265
254
266
        // Store new wrapper at position 'index', change its underlying value, so mutations of newItem, directly affect the item in the list.
255
        // Store new wrapper at position 'index', change its underlying value, so mutations of newItem, directly affect the item in the list.
267
        m_wrappers->insert(index, newItem->createWeakPtr());
256
        m_wrappers->insert(index, newItem->createWeakPtr());
Lines 278-284 public: Source/WebCore/svg/properties/SVGListProperty.h_sec16
278
            return result.releaseException();
267
            return result.releaseException();
279
        ASSERT(result.releaseReturnValue());
268
        ASSERT(result.releaseReturnValue());
280
269
281
        if (index >= m_values->size())
270
        if (index >= valuesProperty().size())
282
            return Exception { IndexSizeError };
271
            return Exception { IndexSizeError };
283
272
284
        return true;
273
        return true;
Lines 298-310 public: Source/WebCore/svg/properties/SVGListProperty.h_sec17
298
            return ListItemType { newItem };
287
            return ListItemType { newItem };
299
        }
288
        }
300
289
301
        if (m_values->isEmpty()) {
290
        if (valuesProperty().isEmpty()) {
302
            // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
291
            // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
303
            return Exception { IndexSizeError };
292
            return Exception { IndexSizeError };
304
        }
293
        }
305
294
306
        // Update the value at the desired position 'index'. 
295
        // Update the value at the desired position 'index'. 
307
        m_values->at(index) = newItem;
296
        static_cast<ListItemType&>(*valuesProperty().at(index)) = newItem;
308
297
309
        commitChange();
298
        commitChange();
310
        return ListItemType { newItem };
299
        return ListItemType { newItem };
Lines 319-325 public: Source/WebCore/svg/properties/SVGListProperty.h_sec18
319
            return result.releaseException();
308
            return result.releaseException();
320
        ASSERT(result.releaseReturnValue());
309
        ASSERT(result.releaseReturnValue());
321
310
322
        ASSERT(m_values->size() == m_wrappers->size());
311
        ASSERT(valuesProperty().size() == m_wrappers->size());
323
312
324
        Ref<ListItemTearOff> newItem(item);
313
        Ref<ListItemTearOff> newItem(item);
325
314
Lines 328-334 public: Source/WebCore/svg/properties/SVGListProperty.h_sec19
328
        if (!processIncomingListItemWrapper(newItem, &index))
317
        if (!processIncomingListItemWrapper(newItem, &index))
329
            return WTFMove(newItem);
318
            return WTFMove(newItem);
330
319
331
        if (m_values->isEmpty()) {
320
        if (valuesProperty().isEmpty()) {
332
            ASSERT(m_wrappers->isEmpty());
321
            ASSERT(m_wrappers->isEmpty());
333
            // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
322
            // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
334
            return Exception { IndexSizeError };
323
            return Exception { IndexSizeError };
Lines 340-346 public: Source/WebCore/svg/properties/SVGListProperty.h_sec20
340
            oldItem->detachWrapper();
329
            oldItem->detachWrapper();
341
330
342
        // Update the value and the wrapper at the desired position 'index'. 
331
        // Update the value and the wrapper at the desired position 'index'. 
343
        m_values->at(index) = newItem->propertyReference();
332
        valuesProperty().at(index) = newItem->value();
344
        m_wrappers->at(index) = newItem->createWeakPtr();
333
        m_wrappers->at(index) = newItem->createWeakPtr();
345
334
346
        commitChange();
335
        commitChange();
Lines 355-361 public: Source/WebCore/svg/properties/SVGListProperty.h_sec21
355
            return result.releaseException();
344
            return result.releaseException();
356
        ASSERT(result.releaseReturnValue());
345
        ASSERT(result.releaseReturnValue());
357
346
358
        if (index >= m_values->size())
347
        if (index >= valuesProperty().size())
359
            return Exception { IndexSizeError };
348
            return Exception { IndexSizeError };
360
349
361
        return true;
350
        return true;
Lines 368-375 public: Source/WebCore/svg/properties/SVGListProperty.h_sec22
368
            return result.releaseException();
357
            return result.releaseException();
369
        ASSERT(result.releaseReturnValue());
358
        ASSERT(result.releaseReturnValue());
370
359
371
        ListItemType oldItem = m_values->at(index);
360
        ListItemType oldItem = static_cast<ListItemType&>(*valuesProperty().at(index));
372
        m_values->remove(index);
361
        valuesProperty().remove(index);
373
362
374
        commitChange();
363
        commitChange();
375
        return WTFMove(oldItem);
364
        return WTFMove(oldItem);
Lines 384-399 public: Source/WebCore/svg/properties/SVGListProperty.h_sec23
384
            return result.releaseException();
373
            return result.releaseException();
385
        ASSERT(result.releaseReturnValue());
374
        ASSERT(result.releaseReturnValue());
386
375
387
        ASSERT(m_values->size() == m_wrappers->size());
376
        ASSERT(valuesProperty().size() == m_wrappers->size());
388
377
389
        // Detach the existing wrapper.
378
        // Detach the existing wrapper.
390
        RefPtr<ListItemTearOff> oldItem = static_cast<ListItemTearOff*>(m_wrappers->at(index).get());
379
        RefPtr<ListItemTearOff> oldItem = static_cast<ListItemTearOff*>(m_wrappers->at(index).get());
391
        if (!oldItem)
380
        if (!oldItem)
392
            oldItem = ListItemTearOff::create(animatedList, UndefinedRole, m_values->at(index));
381
            oldItem = ListItemTearOff::create(animatedList, UndefinedRole, valuesProperty().at(index));
393
382
394
        oldItem->detachWrapper();
383
        oldItem->detachWrapper();
395
        m_wrappers->remove(index);
384
        m_wrappers->remove(index);
396
        m_values->remove(index);
385
        valuesProperty().remove(index);
397
386
398
        commitChange();
387
        commitChange();
399
        return oldItem.releaseNonNull();
388
        return oldItem.releaseNonNull();
Lines 411-417 public: Source/WebCore/svg/properties/SVGListProperty.h_sec24
411
        processIncomingListItemValue(newItem, 0);
400
        processIncomingListItemValue(newItem, 0);
412
401
413
        // Append the value at the end of the list.
402
        // Append the value at the end of the list.
414
        m_values->append(newItem);
403
        valuesProperty().append(SVGValue::create<ListItemType>(newItem));
415
404
416
        commitChange(ListModificationAppend);
405
        commitChange(ListModificationAppend);
417
        return ListItemType { newItem };
406
        return ListItemType { newItem };
Lines 426-432 public: Source/WebCore/svg/properties/SVGListProperty.h_sec25
426
            return result.releaseException();
415
            return result.releaseException();
427
        ASSERT(result.releaseReturnValue());
416
        ASSERT(result.releaseReturnValue());
428
417
429
        ASSERT(m_values->size() == m_wrappers->size());
418
        ASSERT(valuesProperty().size() == m_wrappers->size());
430
419
431
        Ref<ListItemTearOff> newItem(item);
420
        Ref<ListItemTearOff> newItem(item);
432
421
Lines 434-452 public: Source/WebCore/svg/properties/SVGListProperty.h_sec26
434
        processIncomingListItemWrapper(newItem, 0);
423
        processIncomingListItemWrapper(newItem, 0);
435
424
436
        // Append the value and wrapper at the end of the list.
425
        // Append the value and wrapper at the end of the list.
437
        m_values->append(newItem->propertyReference());
426
        valuesProperty().append(newItem->value());
438
        m_wrappers->append(newItem->createWeakPtr());
427
        m_wrappers->append(newItem->createWeakPtr());
439
428
440
        commitChange(ListModificationAppend);
429
        commitChange(ListModificationAppend);
441
        return WTFMove(newItem);
430
        return WTFMove(newItem);
442
    }
431
    }
443
432
444
    PropertyType& values()
433
    Ref<SVGValue> values() const
445
    {
434
    {
446
        ASSERT(m_values);
435
        ASSERT(m_values);
447
        return *m_values;
436
        return *m_values;
448
    }
437
    }
449
438
439
    PropertyType& valuesProperty() const
440
    {
441
        ASSERT(m_values);
442
        return static_cast<PropertyType&>(*m_values);
443
    }
444
450
    ListWrapperCache& wrappers() const
445
    ListWrapperCache& wrappers() const
451
    {
446
    {
452
        ASSERT(m_wrappers);
447
        ASSERT(m_wrappers);
Lines 459-478 public: Source/WebCore/svg/properties/SVGListProperty.h_sec27
459
    }
454
    }
460
455
461
protected:
456
protected:
462
    SVGListProperty(SVGPropertyRole role, PropertyType& values, ListWrapperCache* wrappers)
457
    SVGListProperty(SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache* wrappers)
463
        : m_role(role)
458
        : m_role(role)
464
        , m_ownsValues(false)
459
        , m_values(values)
465
        , m_values(&values)
466
        , m_wrappers(wrappers)
460
        , m_wrappers(wrappers)
467
    {
461
    {
468
    }
462
    }
469
463
470
    virtual ~SVGListProperty()
471
    {
472
        if (m_ownsValues)
473
            delete m_values;
474
    }
475
476
    void commitChange() override = 0;
464
    void commitChange() override = 0;
477
    virtual void commitChange(ListModification)
465
    virtual void commitChange(ListModification)
478
    {
466
    {
Lines 483-490 protected: Source/WebCore/svg/properties/SVGListProperty.h_sec28
483
    virtual bool processIncomingListItemWrapper(Ref<ListItemTearOff>& newItem, unsigned* indexToModify) = 0;
471
    virtual bool processIncomingListItemWrapper(Ref<ListItemTearOff>& newItem, unsigned* indexToModify) = 0;
484
472
485
    SVGPropertyRole m_role;
473
    SVGPropertyRole m_role;
486
    bool m_ownsValues;
474
    RefPtr<SVGValue> m_values;
487
    PropertyType* m_values;
488
    ListWrapperCache* m_wrappers;
475
    ListWrapperCache* m_wrappers;
489
    WeakPtrFactory<SVGListProperty> m_weakPtrFactory;
476
    WeakPtrFactory<SVGListProperty> m_weakPtrFactory;
490
};
477
};
- Source/WebCore/svg/properties/SVGListPropertyTearOff.h -11 / +8 lines
Lines 35-56 public: Source/WebCore/svg/properties/SVGListPropertyTearOff.h_sec1
35
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<PropertyType>;
35
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<PropertyType>;
36
    using ListWrapperCache = typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache;
36
    using ListWrapperCache = typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache;
37
37
38
    using Base::valuesProperty;
38
    using Base::m_role;
39
    using Base::m_role;
39
    using Base::m_values;
40
    using Base::m_wrappers;
40
    using Base::m_wrappers;
41
41
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)
43
    {
43
    {
44
        return adoptRef(*new Self(animatedProperty, role, values, wrappers));
44
        return adoptRef(*new Self(animatedProperty, role, values, wrappers));
45
    }
45
    }
46
46
47
    int findItem(ListItemTearOff* item) const
47
    int findItem(ListItemTearOff* item) const
48
    {
48
    {
49
        ASSERT(m_values);
50
        ASSERT(m_wrappers);
49
        ASSERT(m_wrappers);
51
50
52
        unsigned size = m_wrappers->size();
51
        unsigned size = m_wrappers->size();
53
        ASSERT(size == m_values->size());
52
        ASSERT(size == valuesProperty().size());
54
        for (size_t i = 0; i < size; ++i) {
53
        for (size_t i = 0; i < size; ++i) {
55
            if (item == m_wrappers->at(i))
54
            if (item == m_wrappers->at(i))
56
                return i;
55
                return i;
Lines 61-75 public: Source/WebCore/svg/properties/SVGListPropertyTearOff.h_sec2
61
60
62
    void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
61
    void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
63
    {
62
    {
64
        ASSERT(m_values);
65
        ASSERT(m_wrappers);
63
        ASSERT(m_wrappers);
66
        ASSERT(m_values->size() == m_wrappers->size());
64
        ASSERT(valuesProperty().size() == m_wrappers->size());
67
        ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < m_wrappers->size());
65
        ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < m_wrappers->size());
68
66
69
        auto item = m_wrappers->at(itemIndex);
67
        auto item = m_wrappers->at(itemIndex);
70
        item->detachWrapper();
68
        item->detachWrapper();
71
        m_wrappers->remove(itemIndex);
69
        m_wrappers->remove(itemIndex);
72
        m_values->remove(itemIndex);
70
        valuesProperty().remove(itemIndex);
73
71
74
        if (shouldSynchronizeWrappers)
72
        if (shouldSynchronizeWrappers)
75
            commitChange();
73
            commitChange();
Lines 112-118 public: Source/WebCore/svg/properties/SVGListPropertyTearOff.h_sec3
112
    }
110
    }
113
111
114
protected:
112
protected:
115
    SVGListPropertyTearOff(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, PropertyType& values, ListWrapperCache& wrappers)
113
    SVGListPropertyTearOff(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& values, ListWrapperCache& wrappers)
116
        : SVGListProperty<PropertyType>(role, values, &wrappers)
114
        : SVGListProperty<PropertyType>(role, values, &wrappers)
117
        , m_animatedProperty(animatedProperty)
115
        , m_animatedProperty(animatedProperty)
118
    {
116
    {
Lines 129-146 protected: Source/WebCore/svg/properties/SVGListPropertyTearOff.h_sec4
129
127
130
    void commitChange() override
128
    void commitChange() override
131
    {
129
    {
132
        ASSERT(m_values);
133
        ASSERT(m_wrappers);
130
        ASSERT(m_wrappers);
134
131
135
        // Update existing wrappers, as the index in the values list has changed.
132
        // Update existing wrappers, as the index in the values list has changed.
136
        unsigned size = m_wrappers->size();
133
        unsigned size = m_wrappers->size();
137
        ASSERT(size == m_values->size());
134
        ASSERT(size == valuesProperty().size());
138
        for (unsigned i = 0; i < size; ++i) {
135
        for (unsigned i = 0; i < size; ++i) {
139
            auto item = m_wrappers->at(i);
136
            auto item = m_wrappers->at(i);
140
            if (!item)
137
            if (!item)
141
                continue;
138
                continue;
142
            item->setAnimatedProperty(m_animatedProperty.ptr());
139
            item->setAnimatedProperty(m_animatedProperty.ptr());
143
            item->setValue(m_values->at(i));
140
            item->setValue(valuesProperty().at(i));
144
        }
141
        }
145
142
146
        m_animatedProperty->commitChange();
143
        m_animatedProperty->commitChange();
- Source/WebCore/svg/properties/SVGMatrixTearOff.h -1 / +1 lines
Lines 36-42 public: Source/WebCore/svg/properties/SVGMatrixTearOff.h_sec1
36
36
37
    SVGMatrixValue& propertyReference() final { return m_parent->propertyReference().svgMatrix(); }
37
    SVGMatrixValue& propertyReference() final { return m_parent->propertyReference().svgMatrix(); }
38
38
39
    void setValue(SVGMatrixValue& value) final { m_parent->propertyReference().setMatrix(value); }
39
    void setValue(const RefPtr<SVGValue>& value) final { m_parent->propertyReference().setMatrix(static_cast<SVGMatrixValue&>(*value)); }
40
40
41
    void commitChange() final
41
    void commitChange() final
42
    {
42
    {
- Source/WebCore/svg/properties/SVGPropertyTearOff.h -15 / +14 lines
Lines 23-28 Source/WebCore/svg/properties/SVGPropertyTearOff.h_sec1
23
#include "ExceptionOr.h"
23
#include "ExceptionOr.h"
24
#include "SVGAnimatedProperty.h"
24
#include "SVGAnimatedProperty.h"
25
#include "SVGProperty.h"
25
#include "SVGProperty.h"
26
#include "SVGValue.h"
26
#include <wtf/WeakPtr.h>
27
#include <wtf/WeakPtr.h>
27
28
28
namespace WebCore {
29
namespace WebCore {
Lines 65-81 public: Source/WebCore/svg/properties/SVGPropertyTearOff.h_sec2
65
        return create(initialValue.releaseReturnValue());
66
        return create(initialValue.releaseReturnValue());
66
    }
67
    }
67
68
68
    virtual PropertyType& propertyReference() { return *m_value; }
69
    RefPtr<SVGValue> value() const { return m_value; }
70
    virtual PropertyType& propertyReference() { return static_cast<PropertyType&>(*m_value); }
69
    SVGAnimatedProperty* animatedProperty() const { return m_animatedProperty.get(); }
71
    SVGAnimatedProperty* animatedProperty() const { return m_animatedProperty.get(); }
70
72
71
    virtual void setValue(PropertyType& value)
73
    virtual void setValue(const RefPtr<SVGValue>& value)
72
    {
74
    {
73
        if (m_valueIsCopy) {
75
        if (m_valueIsCopy)
74
            detachChildren();
76
            detachChildren();
75
            delete m_value;
76
        }
77
        m_valueIsCopy = false;
77
        m_valueIsCopy = false;
78
        m_value = &value;
78
        m_value = value;
79
    }
79
    }
80
80
81
    void setAnimatedProperty(SVGAnimatedProperty* animatedProperty)
81
    void setAnimatedProperty(SVGAnimatedProperty* animatedProperty)
Lines 109-115 public: Source/WebCore/svg/properties/SVGPropertyTearOff.h_sec3
109
        // item.value still has to report '50' and it has to be possible to modify 'item'
109
        // item.value still has to report '50' and it has to be possible to modify 'item'
110
        // w/o changing the "new item" (with x=100) in the text element.
110
        // w/o changing the "new item" (with x=100) in the text element.
111
        // Whenever the XML DOM modifies the "x" attribute, all existing wrappers are detached, using this function.
111
        // 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));
113
        m_valueIsCopy = true;
113
        m_valueIsCopy = true;
114
        m_animatedProperty = nullptr;
114
        m_animatedProperty = nullptr;
115
    }
115
    }
Lines 136-145 public: Source/WebCore/svg/properties/SVGPropertyTearOff.h_sec4
136
    }
136
    }
137
137
138
protected:
138
protected:
139
    SVGPropertyTearOff(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, PropertyType& value)
139
    SVGPropertyTearOff(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, const RefPtr<SVGValue>& value)
140
        : m_animatedProperty(animatedProperty)
140
        : m_animatedProperty(animatedProperty)
141
        , m_role(role)
141
        , m_role(role)
142
        , m_value(&value)
142
        , m_value(value)
143
        , m_valueIsCopy(false)
143
        , m_valueIsCopy(false)
144
    {
144
    {
145
    }
145
    }
Lines 152-168 protected: Source/WebCore/svg/properties/SVGPropertyTearOff.h_sec5
152
    SVGPropertyTearOff(const PropertyType* initialValue)
152
    SVGPropertyTearOff(const PropertyType* initialValue)
153
        : m_animatedProperty(nullptr)
153
        : m_animatedProperty(nullptr)
154
        , m_role(UndefinedRole)
154
        , m_role(UndefinedRole)
155
        , m_value(initialValue ? new PropertyType(*initialValue) : nullptr)
156
        , m_valueIsCopy(true)
155
        , m_valueIsCopy(true)
157
    {
156
    {
157
        if (initialValue)
158
            m_value = SVGValue::create(*initialValue);
158
    }
159
    }
159
160
160
    virtual ~SVGPropertyTearOff()
161
    virtual ~SVGPropertyTearOff()
161
    {
162
    {
162
        if (m_valueIsCopy) {
163
        if (m_valueIsCopy)
163
            detachChildren();
164
            detachChildren();
164
            delete m_value;
165
        }
166
    }
165
    }
167
166
168
    void detachChildren()
167
    void detachChildren()
Lines 176-185 protected: Source/WebCore/svg/properties/SVGPropertyTearOff.h_sec6
176
175
177
    RefPtr<SVGAnimatedProperty> m_animatedProperty;
176
    RefPtr<SVGAnimatedProperty> m_animatedProperty;
178
    SVGPropertyRole m_role;
177
    SVGPropertyRole m_role;
179
    PropertyType* m_value;
178
    RefPtr<SVGValue> m_value;
180
    Vector<WeakPtr<SVGPropertyTearOffBase>> m_childTearOffs;
179
    Vector<WeakPtr<SVGPropertyTearOffBase>> m_childTearOffs;
181
    WeakPtrFactory<SVGPropertyTearOff> m_weakPtrFactory;
180
    WeakPtrFactory<SVGPropertyTearOff> m_weakPtrFactory;
182
    bool m_valueIsCopy;
181
    bool m_valueIsCopy { false };
183
};
182
};
184
183
185
}
184
}
- Source/WebCore/svg/properties/SVGPropertyTraits.h -1 / +119 lines
Lines 20-39 Source/WebCore/svg/properties/SVGPropertyTraits.h_sec1
20
20
21
#pragma once
21
#pragma once
22
22
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>
23
#include <wtf/text/WTFString.h>
30
#include <wtf/text/WTFString.h>
24
31
25
namespace WebCore {
32
namespace WebCore {
26
33
34
enum ListModification {
35
    ListModificationUnknown = 0,
36
    ListModificationInsert = 1,
37
    ListModificationReplace = 2,
38
    ListModificationRemove = 3,
39
    ListModificationAppend = 4
40
};
41
    
27
template<typename PropertyType>
42
template<typename PropertyType>
28
struct SVGPropertyTraits { };
43
struct SVGPropertyTraits { };
29
44
30
template<>
45
template<>
31
struct SVGPropertyTraits<bool> {
46
struct SVGPropertyTraits<bool> {
32
    static bool initialValue() { return false; }
47
    static bool initialValue() { return false; }
48
    static bool fromString(const String& string) { return string == "true"; }
33
    static String toString(bool type) { return type ? "true" : "false"; }
49
    static String toString(bool type) { return type ? "true" : "false"; }
34
};
50
};
35
51
36
template<>
52
template<>
53
struct 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
64
template<>
37
struct SVGPropertyTraits<unsigned> {
65
struct SVGPropertyTraits<unsigned> {
38
    static unsigned initialValue() { return 0; }
66
    static unsigned initialValue() { return 0; }
39
    static String toString(unsigned type) { return String::number(type); }
67
    static String toString(unsigned type) { return String::number(type); }
Lines 42-60 struct SVGPropertyTraits<unsigned> { Source/WebCore/svg/properties/SVGPropertyTraits.h_sec2
42
template<>
70
template<>
43
struct SVGPropertyTraits<int> {
71
struct SVGPropertyTraits<int> {
44
    static int initialValue() { return 0; }
72
    static int initialValue() { return 0; }
73
    static int fromString(const String&string) { return string.toIntStrict(); }
45
    static String toString(int type) { return String::number(type); }
74
    static String toString(int type) { return String::number(type); }
46
};
75
};
76
    
77
template<>
78
struct 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
};
47
89
48
template<>
90
template<>
49
struct SVGPropertyTraits<float> {
91
struct SVGPropertyTraits<float> {
50
    static float initialValue() { return 0; }
92
    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
    }
51
    static String toString(float type) { return String::number(type); }
103
    static String toString(float type) { return String::number(type); }
52
};
104
};
53
105
54
template<>
106
template<>
107
struct 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
119
template<>
120
struct 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
142
template<>
143
struct 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
170
template<>
55
struct SVGPropertyTraits<String> {
171
struct SVGPropertyTraits<String> {
56
    static String initialValue() { return String(); }
172
    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; }
58
};
176
};
59
177
60
template<typename EnumType>
178
template<typename EnumType>
- Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h -4 / +3 lines
Lines 33-39 public: Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h_sec1
33
    using ListItemTearOff = typename SVGPropertyTraits<PropertyType>::ListItemTearOff;
33
    using ListItemTearOff = typename SVGPropertyTraits<PropertyType>::ListItemTearOff;
34
34
35
    using Base::m_role;
35
    using Base::m_role;
36
    using Base::m_values;
36
    using Base::valuesProperty;
37
37
38
    static Ref<Self> create(SVGElement& contextElement, PropertyType& values)
38
    static Ref<Self> create(SVGElement& contextElement, PropertyType& values)
39
    {
39
    {
Lines 76-82 public: Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h_sec2
76
    }
76
    }
77
77
78
protected:
78
protected:
79
    SVGStaticListPropertyTearOff(SVGElement* contextElement, PropertyType& values)
79
    SVGStaticListPropertyTearOff(SVGElement* contextElement, const RefPtr<SVGValue>& values)
80
        : Base(UndefinedRole, values, nullptr)
80
        : Base(UndefinedRole, values, nullptr)
81
        , m_contextElement(*contextElement)
81
        , m_contextElement(*contextElement)
82
    {
82
    {
Lines 89-96 protected: Source/WebCore/svg/properties/SVGStaticListPropertyTearOff.h_sec3
89
89
90
    void commitChange() override
90
    void commitChange() override
91
    {
91
    {
92
        ASSERT(m_values);
92
        valuesProperty().commitChange(m_contextElement);
93
        m_values->commitChange(m_contextElement);
94
    }
93
    }
95
94
96
    bool processIncomingListItemValue(const ListItemType&, unsigned*) override
95
    bool processIncomingListItemValue(const ListItemType&, unsigned*) override
- Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h -2 / +2 lines
Lines 36-42 public: Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h_sec1
36
36
37
    // Used for non-animated POD types that are not associated with a SVGAnimatedProperty object, nor with a XML DOM attribute
37
    // Used for non-animated POD types that are not associated with a SVGAnimatedProperty object, nor with a XML DOM attribute
38
    // (for example: SVGSVGElement::currentTranslate).
38
    // (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)
40
    {
40
    {
41
        return adoptRef(*new Self(contextElement, value, update));
41
        return adoptRef(*new Self(contextElement, value, update));
42
    }
42
    }
Lines 44-50 public: Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h_sec2
44
    void commitChange() final { (m_contextElement.get()->*m_update)(); }
44
    void commitChange() final { (m_contextElement.get()->*m_update)(); }
45
45
46
private:
46
private:
47
    SVGStaticPropertyTearOff(ContextElement& contextElement, PropertyType& value, UpdateMethod update)
47
    SVGStaticPropertyTearOff(ContextElement& contextElement, const RefPtr<SVGValue>& value, UpdateMethod update)
48
        : PropertyTearOff(UndefinedRole, value)
48
        : PropertyTearOff(UndefinedRole, value)
49
        , m_update(update)
49
        , m_update(update)
50
        , m_contextElement(&contextElement)
50
        , m_contextElement(&contextElement)

Return to Bug 168586