| Differences between
and this patch
- Source/WebCore/ChangeLog +332 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2017-02-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
2
3
        Make SVGAnimatedType holds RefCounted objects instead of holding a union of raw pointers
4
        https://bugs.webkit.org/show_bug.cgi?id=168586
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        This is a step towards changing the raw pointers which is held by
9
        SVGAnimatedType and the SVGAnimatedPropertyTearOff object to be RefCounted
10
        pointers.
11
12
        This patch changes SVGAnimatedType which holds a union of raw pointers to
13
        hold RefCounted Variant objects. It makes the SVGAnimatedType holds a pair
14
        SVGAnimatedValue. The SVGAnimatedValue is a RefCounted Variant which holds
15
        a single data type. SVGAnimatedType can hold one or two SVGAnimatedValues.
16
        The data pair have to be stored in separate objects not in the same Variant
17
        because they are held by two different SVGAnimatedPropertyTearOff objects.
18
19
        The plan is to change the property raw pointer in SVGAnimatedPropertyTearOff
20
        to be be a SVGAnimatedValue which is a RefCounted pointer initiated in 
21
        SVGAnimatedType.
22
23
        * WebCore.xcodeproj/project.pbxproj: Add SVGMarkerTypes.h and SVGAnimatedValue.h
24
        and delete SVGRectTraits.h from the project. Make ParserUtilities.h private because
25
        it is included in SVGPropertyTraits.h.
26
        
27
        * svg/SVGAnimateElementBase.cpp:
28
        (WebCore::SVGAnimateElementBase::resetAnimatedType): Replace the call to
29
        SVGAnimatedType::setValueAsString() by SVGAnimatedType::parse().
30
        (WebCore::SVGAnimateElementBase::applyResultsToTarget):  Replace the call
31
        to SVGAnimatedType::valueAsString() by SVGAnimatedType::toString().
32
33
        * svg/SVGAnimatedAngle.cpp:
34
        (WebCore::SVGAnimatedAngleAnimator::constructFromString):Use 
35
        SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>>::fromString() to get
36
        the angle value form a string.
37
        (WebCore::SVGAnimatedAngleAnimator::startAnimValAnimation): Don't construct
38
        an SVGAnimatedType from the return of constructFromBaseValues() since it now
39
        returns an SVGAnimatedType.
40
        (WebCore::SVGAnimatedAngleAnimator::resetAnimValToBaseVal): Don't pass a getter
41
        to resetFromBaseValues since the ContentType of the TearOff object can be used
42
        to get the property from the SVGAnimatedType.
43
        (WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes): Replace the call to 
44
        SVGAnimatedType::angleAndEnumeration() by SVGAnimatedType::properties<>().
45
        (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue): Ditto.
46
47
        * svg/SVGAnimatedBoolean.cpp:
48
        (WebCore::SVGAnimatedBooleanAnimator::constructFromString):
49
        (WebCore::SVGAnimatedBooleanAnimator::startAnimValAnimation):
50
        (WebCore::SVGAnimatedBooleanAnimator::resetAnimValToBaseVal):
51
        (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
52
        Ditto.
53
54
        * svg/SVGAnimatedColor.cpp:
55
        (WebCore::SVGAnimatedColorAnimator::constructFromString):
56
        (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
57
        (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
58
        Ditto.
59
60
        * svg/SVGAnimatedEnumeration.cpp:
61
        (WebCore::SVGAnimatedEnumerationAnimator::constructFromString):
62
        (WebCore::SVGAnimatedEnumerationAnimator::startAnimValAnimation):
63
        (WebCore::SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal):
64
        (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
65
        Ditto.
66
67
        * svg/SVGAnimatedInteger.cpp:
68
        (WebCore::SVGAnimatedIntegerAnimator::constructFromString):
69
        (WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
70
        (WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
71
        (WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes):
72
        (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
73
        Ditto.
74
75
        * svg/SVGAnimatedIntegerOptionalInteger.cpp:
76
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
77
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
78
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
79
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes):
80
        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
81
        Ditto.
82
83
        * svg/SVGAnimatedLength.cpp:
84
        (WebCore::SVGAnimatedLengthAnimator::constructFromString):
85
        (WebCore::SVGAnimatedLengthAnimator::startAnimValAnimation):
86
        (WebCore::SVGAnimatedLengthAnimator::resetAnimValToBaseVal):
87
        (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
88
        (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
89
        Ditto.
90
91
        * svg/SVGAnimatedLengthList.cpp:
92
        (WebCore::SVGAnimatedLengthListAnimator::constructFromString):
93
        (WebCore::SVGAnimatedLengthListAnimator::startAnimValAnimation):
94
        (WebCore::SVGAnimatedLengthListAnimator::resetAnimValToBaseVal):
95
        (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
96
        (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
97
        Ditto.
98
99
        * svg/SVGAnimatedNumber.cpp:
100
        (WebCore::SVGAnimatedNumberAnimator::constructFromString):
101
        (WebCore::SVGAnimatedNumberAnimator::startAnimValAnimation):
102
        (WebCore::SVGAnimatedNumberAnimator::resetAnimValToBaseVal):
103
        (WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes):
104
        (WebCore::parseNumberFromString):
105
        (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
106
        Ditto.
107
108
        * svg/SVGAnimatedNumberList.cpp:
109
        (WebCore::SVGAnimatedNumberListAnimator::constructFromString):
110
        (WebCore::SVGAnimatedNumberListAnimator::startAnimValAnimation):
111
        (WebCore::SVGAnimatedNumberListAnimator::resetAnimValToBaseVal):
112
        (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
113
        (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
114
        Ditto.
115
116
        * svg/SVGAnimatedNumberOptionalNumber.cpp:
117
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString):
118
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation):
119
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal):
120
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes):
121
        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
122
        Ditto.
123
124
        * svg/SVGAnimatedPath.cpp:
125
        (WebCore::SVGAnimatedPathAnimator::constructFromString):
126
        (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation):
127
        (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
128
        (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
129
        (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
130
        Ditto.
131
132
        * svg/SVGAnimatedPointList.cpp:
133
        (WebCore::SVGAnimatedPointListAnimator::constructFromString):
134
        (WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation):
135
        (WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal):
136
        (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
137
        (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
138
        Ditto.
139
140
        * svg/SVGAnimatedPreserveAspectRatio.cpp:
141
        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
142
        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation):
143
        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal):
144
        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
145
        Ditto.
146
147
        * svg/SVGAnimatedRect.cpp:
148
        (WebCore::SVGAnimatedRectAnimator::constructFromString):
149
        (WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
150
        (WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
151
        (WebCore::SVGAnimatedRectAnimator::addAnimatedTypes):
152
        (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
153
        Ditto.
154
155
        * svg/SVGAnimatedString.cpp:
156
        (WebCore::SVGAnimatedStringAnimator::constructFromString):
157
        (WebCore::SVGAnimatedStringAnimator::startAnimValAnimation):
158
        (WebCore::SVGAnimatedStringAnimator::resetAnimValToBaseVal):
159
        (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
160
        Ditto.
161
162
        * svg/SVGAnimatedTransformList.cpp:
163
        (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
164
        (WebCore::SVGAnimatedTransformListAnimator::startAnimValAnimation):
165
        (WebCore::SVGAnimatedTransformListAnimator::resetAnimValToBaseVal):
166
        (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
167
        (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
168
        (WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
169
        Ditto.
170
171
        * svg/SVGAnimatedType.cpp:
172
        (WebCore::SVGAnimatedType::type): The type of the SVGAnimatedType can be
173
        deduced from the type of the SVGAnimatedValues.
174
        (WebCore::SVGAnimatedType::toString): Rename valueAsString() to toString().
175
        (WebCore::SVGAnimatedType::parse): Rename setValueAsString() to parse().
176
        (WebCore::SVGAnimatedType::SVGAnimatedType): Deleted.
177
        (WebCore::SVGAnimatedType::~SVGAnimatedType): Deleted.
178
        (WebCore::SVGAnimatedType::createAngleAndEnumeration): Deleted.
179
        (WebCore::SVGAnimatedType::createBoolean): Deleted.
180
        (WebCore::SVGAnimatedType::createColor): Deleted.
181
        (WebCore::SVGAnimatedType::createEnumeration): Deleted.
182
        (WebCore::SVGAnimatedType::createInteger): Deleted.
183
        (WebCore::SVGAnimatedType::createIntegerOptionalInteger): Deleted.
184
        (WebCore::SVGAnimatedType::createLength): Deleted.
185
        (WebCore::SVGAnimatedType::createLengthList): Deleted.
186
        (WebCore::SVGAnimatedType::createNumber): Deleted.
187
        (WebCore::SVGAnimatedType::createNumberList): Deleted.
188
        (WebCore::SVGAnimatedType::createNumberOptionalNumber): Deleted.
189
        (WebCore::SVGAnimatedType::createPath): Deleted.
190
        (WebCore::SVGAnimatedType::createPointList): Deleted.
191
        (WebCore::SVGAnimatedType::createPreserveAspectRatio): Deleted.
192
        (WebCore::SVGAnimatedType::createRect): Deleted.
193
        (WebCore::SVGAnimatedType::createString): Deleted.
194
        (WebCore::SVGAnimatedType::createTransformList): Deleted.
195
        (WebCore::SVGAnimatedType::valueAsString): Deleted.
196
        (WebCore::SVGAnimatedType::setValueAsString): Deleted.
197
198
        * svg/SVGAnimatedType.h:
199
        (WebCore::SVGAnimatedType::SVGAnimatedType): Template constructors to construct a SVGAnimatedType.
200
        (WebCore::SVGAnimatedType::create): Template functions to create a SVGAnimatedType.
201
        (WebCore::SVGAnimatedType::property): Template functions to return the stored property.
202
        (WebCore::SVGAnimatedType::properties): Template functions to return the stored pair properties.
203
        (WebCore::SVGAnimatedType::type): Deleted.
204
        (WebCore::SVGAnimatedType::angleAndEnumeration): Deleted.
205
        (WebCore::SVGAnimatedType::boolean): Deleted.
206
        (WebCore::SVGAnimatedType::color): Deleted.
207
        (WebCore::SVGAnimatedType::enumeration): Deleted.
208
        (WebCore::SVGAnimatedType::integer): Deleted.
209
        (WebCore::SVGAnimatedType::integerOptionalInteger): Deleted.
210
        (WebCore::SVGAnimatedType::length): Deleted.
211
        (WebCore::SVGAnimatedType::lengthList): Deleted.
212
        (WebCore::SVGAnimatedType::number): Deleted.
213
        (WebCore::SVGAnimatedType::numberList): Deleted.
214
        (WebCore::SVGAnimatedType::numberOptionalNumber): Deleted.
215
        (WebCore::SVGAnimatedType::path): Deleted.
216
        (WebCore::SVGAnimatedType::pointList): Deleted.
217
        (WebCore::SVGAnimatedType::preserveAspectRatio): Deleted.
218
        (WebCore::SVGAnimatedType::rect): Deleted.
219
        (WebCore::SVGAnimatedType::string): Deleted.
220
        (WebCore::SVGAnimatedType::transformList): Deleted.
221
222
        * svg/SVGAnimatedTypeAnimator.h:
223
        (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue): Create a RefPtr<SVGAnimatedValue> from
224
        the currentBaseValue and use this pointer to create an std::unique_ptr<SVGAnimatedType>.
225
        (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue): No need for the SVGAnimatedType getter
226
        because the ContentType of the TearOff object can be used to get the property from the SVGAnimatedType.
227
        (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues): Create two  RefPtr<SVGAnimatedValue> 
228
        from the currentBaseValues and use these pair pointers to create an std::unique_ptr<SVGAnimatedType>.
229
        (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues):  No need for the SVGAnimatedType getter
230
        because the ContentType of the TearOff object can be used to get the properties from the SVGAnimatedType.
231
        (WebCore::SVGAnimatedTypeAnimator::executeAction): Rename the argument name.
232
233
        * svg/SVGAnimatedValue.h: Added.
234
        (WebCore::SVGAnimatedValue::create): Template functions to create an SVGAnimatedValue. 
235
        (WebCore::SVGAnimatedValue::is): A template function to return the data type of an SVGAnimatedValue. 
236
        (WebCore::SVGAnimatedValue::property): Template functions to return the data of an SVGAnimatedValue. 
237
        (WebCore::SVGAnimatedValue::toString): A template function to return value an SVGAnimatedValue as an String.
238
        (WebCore::SVGAnimatedValue::parse): A template function to change value an SVGAnimatedValue.
239
        (WebCore::SVGAnimatedValue::SVGAnimatedValue): Template constructors to construct an SVGAnimatedValue.
240
241
        * svg/SVGLengthListValues.h:
242
        (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString):
243
        (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse):
244
        Add functions to SVGPropertyTraits<SVGLengthListValues>.
245
246
        * svg/SVGLengthValue.h:
247
        (WebCore::SVGPropertyTraits<SVGLengthValue>::parse):
248
        (WebCore::SVGPropertyTraits<SVGLengthValue>::toString):
249
        Add functions to SVGPropertyTraits<SVGLengthValue>.
250
251
        * svg/SVGMarkerElement.h:
252
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
253
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
254
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
255
        (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
256
        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
257
        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
258
        * svg/SVGMarkerTypes.h: Added.
259
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
260
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
261
        (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
262
        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
263
        (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
264
        (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
265
        Move these SVGPropertyTraits to a separate file because we want to add a new
266
        SVGPropertyTraits for the pair <SVGAngleValue, unsigned>.
267
        
268
        * svg/SVGNumberListValues.h:
269
        (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString):
270
        (WebCore::SVGPropertyTraits<SVGNumberListValues>::toString):
271
        Add functions to SVGPropertyTraits<SVGNumberListValues>.
272
273
        * svg/SVGPathByteStream.h:
274
        (WebCore::SVGPathByteStream::SVGPathByteStream):
275
        (WebCore::SVGPathByteStream::operator=):
276
        Add copy and move semantics.
277
        
278
        (WebCore::SVGPathByteStream::operator==):
279
        (WebCore::SVGPathByteStream::operator!=):
280
        (WebCore::SVGPathByteStream::copy):
281
        (WebCore::SVGPathByteStream::append):
282
        (WebCore::SVGPathByteStream::clear):
283
        (WebCore::SVGPathByteStream::isEmpty):
284
        Minor clean-up.
285
286
        (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue):
287
        (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString):
288
        Add functions to SVGPropertyTraits<SVGPathByteStream>.
289
290
        * svg/SVGPathUtilities.cpp:
291
        (WebCore::addToSVGPathByteStream): Use SVGPathByteStream move semantics.
292
293
        * svg/SVGPointListValues.h:
294
        (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString):
295
        Add functions to SVGPropertyTraits<SVGPointListValues>.
296
297
        * svg/SVGPreserveAspectRatioValue.cpp:
298
        (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue):
299
        Add a constructor which takes a string to be used by 
300
        SVGPropertyTraits<SVGPreserveAspectRatioValue>.
301
302
        * svg/SVGPreserveAspectRatioValue.h:
303
        (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString):
304
        Add functions to SVGPropertyTraits<SVGPreserveAspectRatioValue>.
305
306
        * svg/SVGRect.h:
307
        * svg/SVGRectTraits.h: Removed.
308
        Move SVGPropertyTraits<FloatRect> from SVGRectTraits.h to SVGPropertyTraits.h 
309
        since it includes the SVGPropertyTraits for the non SVG types.
310
        
311
        * svg/SVGTransformListValues.h:
312
        (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString):
313
        Add functions to SVGPropertyTraits<SVGTransformListValues>.
314
315
        * svg/properties/SVGPropertyTraits.h:
316
        (WebCore::SVGPropertyTraits<bool>::fromString):
317
        (WebCore::SVGPropertyTraits<Color>::initialValue):
318
        (WebCore::SVGPropertyTraits<Color>::fromString):
319
        (WebCore::SVGPropertyTraits<Color>::parse):
320
        (WebCore::SVGPropertyTraits<Color>::toString):
321
        (WebCore::SVGPropertyTraits<int>::fromString):
322
        (WebCore::SVGPropertyTraits<float>::fromString):
323
        (WebCore::SVGPropertyTraits<float>::parse):
324
        (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
325
        (WebCore::SVGPropertyTraits<FloatRect>::fromString):
326
        (WebCore::SVGPropertyTraits<FloatRect>::parse):
327
        (WebCore::SVGPropertyTraits<FloatRect>::toString):
328
        (WebCore::SVGPropertyTraits<String>::fromString):
329
        (WebCore::SVGPropertyTraits<String>::parse):
330
        (WebCore::SVGPropertyTraits<String>::toString):
331
        Add functions to the SVGPropertyTraits for non SVG types.
332
1
2017-02-21  John Wilander  <wilander@apple.com>
333
2017-02-21  John Wilander  <wilander@apple.com>
2
334
3
        Resource Load Statistics: Add alternate classification method
335
        Resource Load Statistics: Add alternate classification method
- Source/WebCore/WebCore.xcodeproj/project.pbxproj -6 / +10 lines
Lines 2320-2331 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
2320
		550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
2320
		550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
2321
		555B87EC1CAAF0AB00349425 /* ImageDecoderCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */; };
2321
		555B87EC1CAAF0AB00349425 /* ImageDecoderCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */; };
2322
		555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */; };
2322
		555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */; };
2323
		5575056D1E53B30C008DE30A /* SVGMarkerTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5575056C1E53B30C008DE30A /* SVGMarkerTypes.h */; };
2323
		5576A5641D88A70800CCC04C /* ImageFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5576A5621D88A70800CCC04C /* ImageFrame.cpp */; };
2324
		5576A5641D88A70800CCC04C /* ImageFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5576A5621D88A70800CCC04C /* ImageFrame.cpp */; };
2324
		5576A5651D88A70800CCC04C /* ImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 5576A5631D88A70800CCC04C /* ImageFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
2325
		5576A5651D88A70800CCC04C /* ImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 5576A5631D88A70800CCC04C /* ImageFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
2325
		5597F8261D91C3130066BC21 /* ImageFrameCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5597F8241D91C3130066BC21 /* ImageFrameCache.cpp */; };
2326
		5597F8261D91C3130066BC21 /* ImageFrameCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5597F8241D91C3130066BC21 /* ImageFrameCache.cpp */; };
2326
		5597F8271D91C3130066BC21 /* ImageFrameCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5597F8251D91C3130066BC21 /* ImageFrameCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
2327
		5597F8271D91C3130066BC21 /* ImageFrameCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5597F8251D91C3130066BC21 /* ImageFrameCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
2327
		55A336F71D8209F40022C4C7 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; };
2328
		55A336F71D8209F40022C4C7 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; };
2328
		55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
2329
		55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
2330
		55E44AE11E4BFBC50092457B /* SVGAnimatedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 55E44AE01E4BFBC50092457B /* SVGAnimatedValue.h */; };
2329
		5706A6961DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */; };
2331
		5706A6961DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */; };
2330
		5706A6981DDE5E4600A03B14 /* JSRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6971DDE5E4600A03B14 /* JSRsaOaepParams.h */; };
2332
		5706A6981DDE5E4600A03B14 /* JSRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6971DDE5E4600A03B14 /* JSRsaOaepParams.h */; };
2331
		5706A69A1DDE5E8500A03B14 /* JSRsaOaepParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5706A6991DDE5E8500A03B14 /* JSRsaOaepParams.cpp */; };
2333
		5706A69A1DDE5E8500A03B14 /* JSRsaOaepParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5706A6991DDE5E8500A03B14 /* JSRsaOaepParams.cpp */; };
Lines 2966-2972 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
2966
		7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */; };
2968
		7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */; };
2967
		7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; };
2969
		7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; };
2968
		7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
2970
		7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
2969
		7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */; };
2970
		7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
2971
		7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
2971
		7CE58D541DD7D6E200128552 /* SVGLengthValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */; };
2972
		7CE58D541DD7D6E200128552 /* SVGLengthValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */; };
2972
		7CE58D571DD7D96D00128552 /* SVGTransformValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE58D551DD7D96D00128552 /* SVGTransformValue.cpp */; };
2973
		7CE58D571DD7D96D00128552 /* SVGTransformValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE58D551DD7D96D00128552 /* SVGTransformValue.cpp */; };
Lines 4761-4767 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
4761
		B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B80D00BF200071B782 /* SVGMPathElement.h */; };
4762
		B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278B80D00BF200071B782 /* SVGMPathElement.h */; };
4762
		B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278BB0D00BF200071B782 /* SVGNumberList.h */; settings = {ATTRIBUTES = (Private, ); }; };
4763
		B2227A510D00BF220071B782 /* SVGNumberList.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278BB0D00BF200071B782 /* SVGNumberList.h */; settings = {ATTRIBUTES = (Private, ); }; };
4763
		B2227A560D00BF220071B782 /* SVGParserUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278C00D00BF200071B782 /* SVGParserUtilities.cpp */; };
4764
		B2227A560D00BF220071B782 /* SVGParserUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278C00D00BF200071B782 /* SVGParserUtilities.cpp */; };
4764
		B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C10D00BF200071B782 /* SVGParserUtilities.h */; };
4765
		B2227A570D00BF220071B782 /* SVGParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C10D00BF200071B782 /* SVGParserUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
4765
		B2227A580D00BF220071B782 /* SVGPathElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278C20D00BF200071B782 /* SVGPathElement.cpp */; };
4766
		B2227A580D00BF220071B782 /* SVGPathElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278C20D00BF200071B782 /* SVGPathElement.cpp */; };
4766
		B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C30D00BF200071B782 /* SVGPathElement.h */; };
4767
		B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C30D00BF200071B782 /* SVGPathElement.h */; };
4767
		B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C50D00BF200071B782 /* SVGPathSeg.h */; };
4768
		B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278C50D00BF200071B782 /* SVGPathSeg.h */; };
Lines 5430-5436 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
5430
		BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D6E2509AF943500F59759 /* ScrollView.h */; settings = {ATTRIBUTES = (Private, ); }; };
5431
		BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D6E2509AF943500F59759 /* ScrollView.h */; settings = {ATTRIBUTES = (Private, ); }; };
5431
		BC74DA371013F3F7007987AD /* RGBColor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC74DA351013F3F7007987AD /* RGBColor.h */; settings = {ATTRIBUTES = (Private, ); }; };
5432
		BC74DA371013F3F7007987AD /* RGBColor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC74DA351013F3F7007987AD /* RGBColor.h */; settings = {ATTRIBUTES = (Private, ); }; };
5432
		BC74DA381013F3F7007987AD /* RGBColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC74DA361013F3F7007987AD /* RGBColor.cpp */; };
5433
		BC74DA381013F3F7007987AD /* RGBColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC74DA361013F3F7007987AD /* RGBColor.cpp */; };
5433
		BC76AC130DD7AD5C00415F34 /* ParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = BC76AC110DD7AD5C00415F34 /* ParserUtilities.h */; };
5434
		BC76AC130DD7AD5C00415F34 /* ParserUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = BC76AC110DD7AD5C00415F34 /* ParserUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
5434
		BC772B3C0C4EA91E0083285F /* CSSHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = BC772B360C4EA91E0083285F /* CSSHelper.h */; settings = {ATTRIBUTES = (Private, ); }; };
5435
		BC772B3C0C4EA91E0083285F /* CSSHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = BC772B360C4EA91E0083285F /* CSSHelper.h */; settings = {ATTRIBUTES = (Private, ); }; };
5435
		BC772C460C4EB2C60083285F /* XMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC772C440C4EB2C60083285F /* XMLHttpRequest.cpp */; };
5436
		BC772C460C4EB2C60083285F /* XMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC772C440C4EB2C60083285F /* XMLHttpRequest.cpp */; };
5436
		BC772C470C4EB2C60083285F /* XMLHttpRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BC772C450C4EB2C60083285F /* XMLHttpRequest.h */; };
5437
		BC772C470C4EB2C60083285F /* XMLHttpRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = BC772C450C4EB2C60083285F /* XMLHttpRequest.h */; };
Lines 9677-9682 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
9677
		550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
9678
		550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
9678
		555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDecoderCG.cpp; sourceTree = "<group>"; };
9679
		555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDecoderCG.cpp; sourceTree = "<group>"; };
9679
		555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDecoderCG.h; sourceTree = "<group>"; };
9680
		555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDecoderCG.h; sourceTree = "<group>"; };
9681
		5575056C1E53B30C008DE30A /* SVGMarkerTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerTypes.h; sourceTree = "<group>"; };
9680
		5576A5621D88A70800CCC04C /* ImageFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrame.cpp; sourceTree = "<group>"; };
9682
		5576A5621D88A70800CCC04C /* ImageFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrame.cpp; sourceTree = "<group>"; };
9681
		5576A5631D88A70800CCC04C /* ImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFrame.h; sourceTree = "<group>"; };
9683
		5576A5631D88A70800CCC04C /* ImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFrame.h; sourceTree = "<group>"; };
9682
		5597F8241D91C3130066BC21 /* ImageFrameCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrameCache.cpp; sourceTree = "<group>"; };
9684
		5597F8241D91C3130066BC21 /* ImageFrameCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrameCache.cpp; sourceTree = "<group>"; };
Lines 9684-9689 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
9684
		55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };
9686
		55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };
9685
		55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBackingStore.h; sourceTree = "<group>"; };
9687
		55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBackingStore.h; sourceTree = "<group>"; };
9686
		55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; };
9688
		55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; };
9689
		55E44AE01E4BFBC50092457B /* SVGAnimatedValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedValue.h; sourceTree = "<group>"; };
9687
		5706A6941DDE5BF800A03B14 /* RsaOaepParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RsaOaepParams.idl; sourceTree = "<group>"; };
9690
		5706A6941DDE5BF800A03B14 /* RsaOaepParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RsaOaepParams.idl; sourceTree = "<group>"; };
9688
		5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRsaOaepParams.h; sourceTree = "<group>"; };
9691
		5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRsaOaepParams.h; sourceTree = "<group>"; };
9689
		5706A6971DDE5E4600A03B14 /* JSRsaOaepParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRsaOaepParams.h; sourceTree = "<group>"; };
9692
		5706A6971DDE5E4600A03B14 /* JSRsaOaepParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRsaOaepParams.h; sourceTree = "<group>"; };
Lines 10611-10617 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
10611
		7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderAttachment.cpp; sourceTree = "<group>"; };
10614
		7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderAttachment.cpp; sourceTree = "<group>"; };
10612
		7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderAttachment.h; sourceTree = "<group>"; };
10615
		7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderAttachment.h; sourceTree = "<group>"; };
10613
		7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = "<group>"; };
10616
		7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = "<group>"; };
10614
		7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectTraits.h; sourceTree = "<group>"; };
10615
		7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = "<group>"; };
10617
		7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = "<group>"; };
10616
		7CE58D511DD7B09300128552 /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = "<group>"; };
10618
		7CE58D511DD7B09300128552 /* SVGLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLength.h; sourceTree = "<group>"; };
10617
		7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthValue.cpp; sourceTree = "<group>"; };
10619
		7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthValue.cpp; sourceTree = "<group>"; };
Lines 21479-21484 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
21479
				439D334013A6911C00C20F4F /* SVGAnimatedType.h */,
21481
				439D334013A6911C00C20F4F /* SVGAnimatedType.h */,
21480
				836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */,
21482
				836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */,
21481
				439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */,
21483
				439D334113A6911C00C20F4F /* SVGAnimatedTypeAnimator.h */,
21484
				55E44AE01E4BFBC50092457B /* SVGAnimatedValue.h */,
21482
				B22277F90D00BF1F0071B782 /* SVGAnimateElement.cpp */,
21485
				B22277F90D00BF1F0071B782 /* SVGAnimateElement.cpp */,
21483
				B22277FA0D00BF1F0071B782 /* SVGAnimateElement.h */,
21486
				B22277FA0D00BF1F0071B782 /* SVGAnimateElement.h */,
21484
				B22277FB0D00BF1F0071B782 /* SVGAnimateElement.idl */,
21487
				B22277FB0D00BF1F0071B782 /* SVGAnimateElement.idl */,
Lines 21817-21823 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec9
21817
				B22279070D00BF210071B782 /* SVGRectElement.cpp */,
21820
				B22279070D00BF210071B782 /* SVGRectElement.cpp */,
21818
				B22279080D00BF210071B782 /* SVGRectElement.h */,
21821
				B22279080D00BF210071B782 /* SVGRectElement.h */,
21819
				B22279090D00BF210071B782 /* SVGRectElement.idl */,
21822
				B22279090D00BF210071B782 /* SVGRectElement.idl */,
21820
				7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */,
21821
				B222790A0D00BF210071B782 /* SVGRenderingIntent.h */,
21823
				B222790A0D00BF210071B782 /* SVGRenderingIntent.h */,
21822
				B222790B0D00BF210071B782 /* SVGRenderingIntent.idl */,
21824
				B222790B0D00BF210071B782 /* SVGRenderingIntent.idl */,
21823
				B222790C0D00BF210071B782 /* SVGScriptElement.cpp */,
21825
				B222790C0D00BF210071B782 /* SVGScriptElement.cpp */,
Lines 21909-21914 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec10
21909
				B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */,
21911
				B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */,
21910
				B2E4EC960D00C22B00432643 /* SVGZoomEvent.idl */,
21912
				B2E4EC960D00C22B00432643 /* SVGZoomEvent.idl */,
21911
				B28C6A260D00C44800334AA4 /* xlinkattrs.in */,
21913
				B28C6A260D00C44800334AA4 /* xlinkattrs.in */,
21914
				5575056C1E53B30C008DE30A /* SVGMarkerTypes.h */,
21912
			);
21915
			);
21913
			path = svg;
21916
			path = svg;
21914
			sourceTree = "<group>";
21917
			sourceTree = "<group>";
Lines 25541-25546 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec11
25541
				A584FE2618637DAB00843B10 /* CommandLineAPIModuleSource.h in Headers */,
25544
				A584FE2618637DAB00843B10 /* CommandLineAPIModuleSource.h in Headers */,
25542
				6550B6A2099DF0270090D781 /* Comment.h in Headers */,
25545
				6550B6A2099DF0270090D781 /* Comment.h in Headers */,
25543
				E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */,
25546
				E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */,
25547
				5575056D1E53B30C008DE30A /* SVGMarkerTypes.h in Headers */,
25544
				0F60F32B1DFBB10700416D6C /* CommonVM.h in Headers */,
25548
				0F60F32B1DFBB10700416D6C /* CommonVM.h in Headers */,
25545
				7C93F34A1AA6BA5E00A98BAB /* CompiledContentExtension.h in Headers */,
25549
				7C93F34A1AA6BA5E00A98BAB /* CompiledContentExtension.h in Headers */,
25546
				C2F4E78C1E45C3EF006D7105 /* ComplexTextController.h in Headers */,
25550
				C2F4E78C1E45C3EF006D7105 /* ComplexTextController.h in Headers */,
Lines 28400-28406 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec12
28400
				B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */,
28404
				B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */,
28401
				08EDE19F12A50B8E00B95797 /* SVGRect.h in Headers */,
28405
				08EDE19F12A50B8E00B95797 /* SVGRect.h in Headers */,
28402
				B2227A9E0D00BF220071B782 /* SVGRectElement.h in Headers */,
28406
				B2227A9E0D00BF220071B782 /* SVGRectElement.h in Headers */,
28403
				7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */,
28404
				197B180C1506353200E4ADA8 /* SVGRenderingContext.h in Headers */,
28407
				197B180C1506353200E4ADA8 /* SVGRenderingContext.h in Headers */,
28405
				B2227AA00D00BF220071B782 /* SVGRenderingIntent.h in Headers */,
28408
				B2227AA00D00BF220071B782 /* SVGRenderingIntent.h in Headers */,
28406
				BC2274790E8366E200E7F975 /* SVGRenderStyle.h in Headers */,
28409
				BC2274790E8366E200E7F975 /* SVGRenderStyle.h in Headers */,
Lines 28615-28620 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec13
28615
				BCA2B061105047600043BD1C /* UserScript.h in Headers */,
28618
				BCA2B061105047600043BD1C /* UserScript.h in Headers */,
28616
				BCA2B08B10505BCD0043BD1C /* UserScriptTypes.h in Headers */,
28619
				BCA2B08B10505BCD0043BD1C /* UserScriptTypes.h in Headers */,
28617
				BC8BF151105813BF00A40A07 /* UserStyleSheet.h in Headers */,
28620
				BC8BF151105813BF00A40A07 /* UserStyleSheet.h in Headers */,
28621
				55E44AE11E4BFBC50092457B /* SVGAnimatedValue.h in Headers */,
28618
				BC8BF15A1058141800A40A07 /* UserStyleSheetTypes.h in Headers */,
28622
				BC8BF15A1058141800A40A07 /* UserStyleSheetTypes.h in Headers */,
28619
				BCDF317C11F8D683003C5BF8 /* UserTypingGestureIndicator.h in Headers */,
28623
				BCDF317C11F8D683003C5BF8 /* UserTypingGestureIndicator.h in Headers */,
28620
				1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */,
28624
				1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */,
- Source/WebCore/svg/SVGAnimateElementBase.cpp -3 / +3 lines
Lines 229-235 void SVGAnimateElementBase::resetAnimate Source/WebCore/svg/SVGAnimateElementBase.cpp_sec1
229
    if (!m_animatedType)
229
    if (!m_animatedType)
230
        m_animatedType = animator->constructFromString(baseValue);
230
        m_animatedType = animator->constructFromString(baseValue);
231
    else
231
    else
232
        m_animatedType->setValueAsString(attributeName, baseValue);
232
        m_animatedType->parse(attributeName, baseValue);
233
}
233
}
234
234
235
static inline void applyCSSPropertyToTarget(SVGElement& targetElement, CSSPropertyID id, const String& value)
235
static inline void applyCSSPropertyToTarget(SVGElement& targetElement, CSSPropertyID id, const String& value)
Lines 349-362 void SVGAnimateElementBase::applyResults Source/WebCore/svg/SVGAnimateElementBase.cpp_sec2
349
    if (m_animatedProperties.isEmpty()) {
349
    if (m_animatedProperties.isEmpty()) {
350
        // CSS properties animation code-path.
350
        // CSS properties animation code-path.
351
        // Convert the result of the animation to a String and apply it as CSS property on the target & all instances.
351
        // Convert the result of the animation to a String and apply it as CSS property on the target & all instances.
352
        applyCSSPropertyToTargetAndInstances(*targetElement, attributeName, m_animatedType->valueAsString());
352
        applyCSSPropertyToTargetAndInstances(*targetElement, attributeName, m_animatedType->toString());
353
        return;
353
        return;
354
    }
354
    }
355
355
356
    // We do update the style and the animation property independent of each other.
356
    // We do update the style and the animation property independent of each other.
357
    ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attributeName);
357
    ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attributeName);
358
    if (shouldApply == ApplyXMLandCSSAnimation)
358
    if (shouldApply == ApplyXMLandCSSAnimation)
359
        applyCSSPropertyToTargetAndInstances(*targetElement, attributeName, m_animatedType->valueAsString());
359
        applyCSSPropertyToTargetAndInstances(*targetElement, attributeName, m_animatedType->toString());
360
360
361
    // SVG DOM animVal animation code-path.
361
    // SVG DOM animVal animation code-path.
362
    // At this point the SVG DOM values are already changed, unlike for CSS.
362
    // At this point the SVG DOM values are already changed, unlike for CSS.
- Source/WebCore/svg/SVGAnimatedAngle.cpp -19 / +9 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-82 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 fromAngleAndEnumeration = from->properties<SVGAngleValue, unsigned>();
79
    auto& toAngleAndEnumeration = to->angleAndEnumeration();
69
    auto toAngleAndEnumeration = to->properties<SVGAngleValue, unsigned>();
80
    // Only respect by animations, if from and by are both specified in angles (and not eg. 'auto').
70
    // 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)
71
    if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second || fromAngleAndEnumeration.second != SVGMarkerOrientAngle)
82
        return;
72
        return;
Lines 90-99 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 fromAngleAndEnumeration = m_animationElement->animationMode() == ToAnimation ? animated->properties<SVGAngleValue, unsigned>() : from->properties<SVGAngleValue, unsigned>();
94
    auto& toAngleAndEnumeration = to->angleAndEnumeration();
84
    auto toAngleAndEnumeration = to->properties<SVGAngleValue, unsigned>();
95
    auto& toAtEndOfDurationAngleAndEnumeration = toAtEndOfDuration->angleAndEnumeration();
85
    auto toAtEndOfDurationAngleAndEnumeration = toAtEndOfDuration->properties<SVGAngleValue, unsigned>();
96
    auto& animatedAngleAndEnumeration = animated->angleAndEnumeration();
86
    auto animatedAngleAndEnumeration = animated->properties<SVGAngleValue, unsigned>();
97
87
98
    if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second) {
88
    if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second) {
99
        // Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
89
        // Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
- 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 ? animated->property<bool>() : from->property<bool>();
75
    bool toBoolean = to->boolean();
73
    bool toBoolean = to->property<bool>();
76
    bool& animatedBoolean = animated->boolean();
74
    bool& animatedBoolean = animated->property<bool>();
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 = from->property<Color>();
48
    auto& toColor = to->color();
48
    auto& toColor = to->property<Color>();
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 ? animated->property<Color>() : from->property<Color>();
73
    Color toColor = to->color();
73
    Color toColor = to->property<Color>();
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 = toAtEndOfDuration->property<Color>();
86
    auto& animatedColor = animated->color();
86
    auto& animatedColor = animated->property<Color>();
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 ? animated->property<unsigned>() : from->property<unsigned>();
153
    unsigned toEnumeration = to->enumeration();
151
    unsigned toEnumeration = to->property<unsigned>();
154
    unsigned& animatedEnumeration = animated->enumeration();
152
    unsigned& animatedEnumeration = animated->property<unsigned>();
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
    to->property<int>() += from->property<int>();
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 ? animated->property<int>() : from->property<int>();
87
    int toInteger = to->integer();
85
    int toInteger = to->property<int>();
88
    int toAtEndOfDurationInteger = toAtEndOfDuration->integer();
86
    int toAtEndOfDurationInteger = toAtEndOfDuration->property<int>();
89
    int& animatedInteger = animated->integer();
87
    int& animatedInteger = animated->property<int>();
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 -20 / +9 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-84 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
    const std::pair<int&, int&> fromIntegerPair = from->properties<int, int>();
81
    std::pair<int, int>& toIntegerPair = to->integerOptionalInteger();
70
    std::pair<int&, int&> toIntegerPair = to->properties<int, int>();
82
71
83
    toIntegerPair.first += fromIntegerPair.first;
72
    toIntegerPair.first += fromIntegerPair.first;
84
    toIntegerPair.second += fromIntegerPair.second;
73
    toIntegerPair.second += fromIntegerPair.second;
Lines 89-98 void SVGAnimatedIntegerOptionalIntegerAn Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp_sec4
89
    ASSERT(m_animationElement);
78
    ASSERT(m_animationElement);
90
    ASSERT(m_contextElement);
79
    ASSERT(m_contextElement);
91
80
92
    const std::pair<int, int>& fromIntegerPair = m_animationElement->animationMode() == ToAnimation ? animated->integerOptionalInteger() : from->integerOptionalInteger();
81
    const std::pair<int&, int&> fromIntegerPair = m_animationElement->animationMode() == ToAnimation ? animated->properties<int, int>() : from->properties<int, int>();
93
    const std::pair<int, int>& toIntegerPair = to->integerOptionalInteger();
82
    const std::pair<int&, int&> toIntegerPair = to->properties<int, int>();
94
    const std::pair<int, int>& toAtEndOfDurationIntegerPair = toAtEndOfDuration->integerOptionalInteger();
83
    const std::pair<int&, int&> toAtEndOfDurationIntegerPair = toAtEndOfDuration->properties<int, int>();
95
    std::pair<int, int>& animatedIntegerPair = animated->integerOptionalInteger();
84
    std::pair<int&, int&> animatedIntegerPair = animated->properties<int, int>();
96
85
97
    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.first, toIntegerPair.first, toAtEndOfDurationIntegerPair.first, animatedIntegerPair.first);
86
    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.first, toIntegerPair.first, toAtEndOfDurationIntegerPair.first, animatedIntegerPair.first);
98
    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.second, toIntegerPair.second, toAtEndOfDurationIntegerPair.second, animatedIntegerPair.second);
87
    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(m_animationElement, percentage, repeatCount, fromIntegerPair.second, toIntegerPair.second, toAtEndOfDurationIntegerPair.second, animatedIntegerPair.second);
- Source/WebCore/svg/SVGAnimatedLength.cpp -9 / +9 lines
Lines 34-45 SVGAnimatedLengthAnimator::SVGAnimatedLe Source/WebCore/svg/SVGAnimatedLength.cpp_sec1
34
34
35
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string)
35
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string)
36
{
36
{
37
    return SVGAnimatedType::createLength(std::make_unique<SVGLengthValue>(m_lengthMode, string));
37
    return SVGAnimatedType::create(SVGLengthValue(m_lengthMode, string));
38
}
38
}
39
39
40
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
40
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
41
{
41
{
42
    return SVGAnimatedType::createLength(constructFromBaseValue<SVGAnimatedLength>(animatedTypes));
42
    return constructFromBaseValue<SVGAnimatedLength>(animatedTypes);
43
}
43
}
44
44
45
void SVGAnimatedLengthAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
45
void SVGAnimatedLengthAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 49-55 void SVGAnimatedLengthAnimator::stopAnim Source/WebCore/svg/SVGAnimatedLength.cpp_sec2
49
49
50
void SVGAnimatedLengthAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
50
void SVGAnimatedLengthAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
51
{
51
{
52
    resetFromBaseValue<SVGAnimatedLength>(animatedTypes, type, &SVGAnimatedType::length);
52
    resetFromBaseValue<SVGAnimatedLength>(animatedTypes, type);
53
}
53
}
54
54
55
void SVGAnimatedLengthAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
55
void SVGAnimatedLengthAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 68-75 void SVGAnimatedLengthAnimator::addAnima Source/WebCore/svg/SVGAnimatedLength.cpp_sec3
68
    ASSERT(from->type() == to->type());
68
    ASSERT(from->type() == to->type());
69
69
70
    SVGLengthContext lengthContext(m_contextElement);
70
    SVGLengthContext lengthContext(m_contextElement);
71
    const auto& fromLength = from->length();
71
    const auto& fromLength = from->property<SVGLengthValue>();
72
    auto& toLength = to->length();
72
    auto& toLength = to->property<SVGLengthValue>();
73
73
74
    toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext);
74
    toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext);
75
}
75
}
Lines 86-95 void SVGAnimatedLengthAnimator::calculat Source/WebCore/svg/SVGAnimatedLength.cpp_sec4
86
    ASSERT(m_animationElement);
86
    ASSERT(m_animationElement);
87
    ASSERT(m_contextElement);
87
    ASSERT(m_contextElement);
88
88
89
    auto fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->length() : from->length();
89
    auto fromSVGLength = m_animationElement->animationMode() == ToAnimation ? animated->property<SVGLengthValue>() : from->property<SVGLengthValue>();
90
    auto toSVGLength = to->length();
90
    auto toSVGLength = to->property<SVGLengthValue>();
91
    const auto& toAtEndOfDurationSVGLength = toAtEndOfDuration->length();
91
    const auto& toAtEndOfDurationSVGLength = toAtEndOfDuration->property<SVGLengthValue>();
92
    auto& animatedSVGLength = animated->length();
92
    auto& animatedSVGLength = animated->property<SVGLengthValue>();
93
93
94
    // Apply CSS inheritance rules.
94
    // Apply CSS inheritance rules.
95
    m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
95
    m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
- Source/WebCore/svg/SVGAnimatedLengthList.cpp -11 / +9 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 = from->property<SVGLengthListValues>();
72
    auto& toLengthList = to->lengthList();
70
    auto& toLengthList = to->property<SVGLengthListValues>();
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 92-101 void SVGAnimatedLengthListAnimator::calc Source/WebCore/svg/SVGAnimatedLengthList.cpp_sec4
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 ? animated->property<SVGLengthListValues>() : from->property<SVGLengthListValues>();
96
    auto toLengthList = to->lengthList();
94
    auto toLengthList = to->property<SVGLengthListValues>();
97
    const auto& toAtEndOfDurationLengthList = toAtEndOfDuration->lengthList();
95
    const auto& toAtEndOfDurationLengthList = toAtEndOfDuration->property<SVGLengthListValues>();
98
    auto& animatedLengthList = animated->lengthList();
96
    auto& animatedLengthList = animated->property<SVGLengthListValues>();
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);
- 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
    to->property<float>() += from->property<float>();
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 ? animated->property<float>() : from->property<float>();
88
    float toNumber = to->number();
82
    float toNumber = to->property<float>();
89
    float toAtEndOfDurationNumber = toAtEndOfDuration->number();
83
    float toAtEndOfDurationNumber = toAtEndOfDuration->property<float>();
90
    float& animatedNumber = animated->number();
84
    float& animatedNumber = animated->property<float>();
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 -11 / +9 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-74 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 = from->property<SVGNumberListValues>();
71
    auto& toNumberList = to->numberList();
69
    auto& toNumberList = to->property<SVGNumberListValues>();
72
70
73
    unsigned fromNumberListSize = fromNumberList.size();
71
    unsigned fromNumberListSize = fromNumberList.size();
74
    if (!fromNumberListSize || fromNumberListSize != toNumberList.size())
72
    if (!fromNumberListSize || fromNumberListSize != toNumberList.size())
Lines 82-91 void SVGAnimatedNumberListAnimator::calc Source/WebCore/svg/SVGAnimatedNumberList.cpp_sec4
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 ? animated->property<SVGNumberListValues>() : from->property<SVGNumberListValues>();
86
    const auto& toNumberList = to->numberList();
84
    const auto& toNumberList = to->property<SVGNumberListValues>();
87
    const auto& toAtEndOfDurationNumberList = toAtEndOfDuration->numberList();
85
    const auto& toAtEndOfDurationNumberList = toAtEndOfDuration->property<SVGNumberListValues>();
88
    auto& animatedNumberList = animated->numberList();
86
    auto& animatedNumberList = animated->property<SVGNumberListValues>();
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
- Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp -15 / +9 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-79 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
    const std::pair<float&, float&> fromNumberPair = from->properties<float, float>();
76
    std::pair<float, float>& toNumberPair = to->numberOptionalNumber();
70
    std::pair<float&, float&> toNumberPair = to->properties<float, float>();
77
71
78
    toNumberPair.first += fromNumberPair.first;
72
    toNumberPair.first += fromNumberPair.first;
79
    toNumberPair.second += fromNumberPair.second;
73
    toNumberPair.second += fromNumberPair.second;
Lines 84-93 void SVGAnimatedNumberOptionalNumberAnim Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp_sec4
84
    ASSERT(m_animationElement);
78
    ASSERT(m_animationElement);
85
    ASSERT(m_contextElement);
79
    ASSERT(m_contextElement);
86
80
87
    const std::pair<float, float>& fromNumberPair = m_animationElement->animationMode() == ToAnimation ? animated->numberOptionalNumber() :  from->numberOptionalNumber();
81
    const std::pair<float&, float&> fromNumberPair = m_animationElement->animationMode() == ToAnimation ? animated->properties<float, float>() :  from->properties<float, float>();
88
    const std::pair<float, float>& toNumberPair = to->numberOptionalNumber();
82
    const std::pair<float&, float&> toNumberPair = to->properties<float, float>();
89
    const std::pair<float, float>& toAtEndOfDurationNumberPair = toAtEndOfDuration->numberOptionalNumber();
83
    const std::pair<float&, float&> toAtEndOfDurationNumberPair = toAtEndOfDuration->properties<float, float>();
90
    std::pair<float, float>& animatedNumberPair = animated->numberOptionalNumber();
84
    std::pair<float&, float&> animatedNumberPair = animated->properties<float, float>();
91
85
92
    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.first, toNumberPair.first, toAtEndOfDurationNumberPair.first, animatedNumberPair.first);
86
    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.first, toNumberPair.first, toAtEndOfDurationNumberPair.first, animatedNumberPair.first);
93
    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.second, toNumberPair.second, toAtEndOfDurationNumberPair.second, animatedNumberPair.second);
87
    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumberPair.second, toNumberPair.second, toAtEndOfDurationNumberPair.second, animatedNumberPair.second);
- Source/WebCore/svg/SVGAnimatedPath.cpp -30 / +24 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 80-86 void SVGAnimatedPathAnimator::resetAnimV Source/WebCore/svg/SVGAnimatedPath.cpp_sec4
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, &type.property<SVGPathByteStream>());
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_sec5
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 = from->property<SVGPathByteStream>();
102
    SVGPathByteStream* toPath = to->path();
99
    auto& toPath = to->property<SVGPathByteStream>();
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_sec6
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 = from->property<SVGPathByteStream>();
115
    SVGPathByteStream* toPath = to->path();
112
    auto& toPath = to->property<SVGPathByteStream>();
116
    SVGPathByteStream* toAtEndOfDurationPath = toAtEndOfDuration->path();
113
    auto& toAtEndOfDurationPath = toAtEndOfDuration->property<SVGPathByteStream>();
117
    SVGPathByteStream* animatedPath = animated->path();
114
    auto& animatedPath = animated->property<SVGPathByteStream>();
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 -11 / +9 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-76 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 = from->property<SVGPointListValues>();
73
    auto& toPointList = to->pointList();
71
    auto& toPointList = to->property<SVGPointListValues>();
74
72
75
    unsigned fromPointListSize = fromPointList.size();
73
    unsigned fromPointListSize = fromPointList.size();
76
    if (!fromPointListSize || fromPointListSize != toPointList.size())
74
    if (!fromPointListSize || fromPointListSize != toPointList.size())
Lines 84-93 void SVGAnimatedPointListAnimator::calcu Source/WebCore/svg/SVGAnimatedPointList.cpp_sec4
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 ? animated->property<SVGPointListValues>() : from->property<SVGPointListValues>();
88
    const auto& toPointList = to->pointList();
86
    const auto& toPointList = to->property<SVGPointListValues>();
89
    const auto& toAtEndOfDurationPointList = toAtEndOfDuration->pointList();
87
    const auto& toAtEndOfDurationPointList = toAtEndOfDuration->property<SVGPointListValues>();
90
    auto& animatedPointList = animated->pointList();
88
    auto& animatedPointList = animated->property<SVGPointListValues>();
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
- 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 ? animated->property<SVGPreserveAspectRatioValue>() : from->property<SVGPreserveAspectRatioValue>();
75
    const auto& toPreserveAspectRatio = to->preserveAspectRatio();
73
    const auto& toPreserveAspectRatio = to->property<SVGPreserveAspectRatioValue>();
76
    auto& animatedPreserveAspectRatio = animated->preserveAspectRatio();
74
    auto& animatedPreserveAspectRatio = animated->property<SVGPreserveAspectRatioValue>();
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
    to->property<FloatRect>() += from->property<FloatRect>();
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 FloatRect& fromRect = m_animationElement->animationMode() == ToAnimation ? animated->property<FloatRect>() : from->property<FloatRect>();
79
    const FloatRect& toRect = to->rect();
77
    const FloatRect& toRect = to->property<FloatRect>();
80
    const FloatRect& toAtEndOfDurationRect = toAtEndOfDuration->rect();
78
    const FloatRect& toAtEndOfDurationRect = toAtEndOfDuration->property<FloatRect>();
81
    FloatRect& animatedRect = animated->rect();
79
    FloatRect& animatedRect = animated->property<FloatRect>();
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 / +6 lines
Lines 31-44 SVGAnimatedStringAnimator::SVGAnimatedSt Source/WebCore/svg/SVGAnimatedString.cpp_sec1
31
31
32
std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const String& string)
32
std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const String& string)
33
{
33
{
34
    auto animatedType = SVGAnimatedType::createString(std::make_unique<String>());
34
    return SVGAnimatedType::create(SVGPropertyTraits<String>::fromString(string));
35
    animatedType->string() = string;
36
    return animatedType;
37
}
35
}
38
36
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
37
std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
40
{
38
{
41
    return SVGAnimatedType::createString(constructFromBaseValue<SVGAnimatedString>(animatedTypes));
39
    return constructFromBaseValue<SVGAnimatedString>(animatedTypes);
42
}
40
}
43
41
44
void SVGAnimatedStringAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
42
void SVGAnimatedStringAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 48-54 void SVGAnimatedStringAnimator::stopAnim Source/WebCore/svg/SVGAnimatedString.cpp_sec2
48
46
49
void SVGAnimatedStringAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
47
void SVGAnimatedStringAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
50
{
48
{
51
    resetFromBaseValue<SVGAnimatedString>(animatedTypes, type, &SVGAnimatedType::string);
49
    resetFromBaseValue<SVGAnimatedString>(animatedTypes, type);
52
}
50
}
53
51
54
void SVGAnimatedStringAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
52
void SVGAnimatedStringAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
Lines 76-84 void SVGAnimatedStringAnimator::calculat Source/WebCore/svg/SVGAnimatedString.cpp_sec3
76
    ASSERT(m_animationElement);
74
    ASSERT(m_animationElement);
77
    ASSERT(m_contextElement);
75
    ASSERT(m_contextElement);
78
76
79
    String fromString = from->string();
77
    String fromString = from->property<String>();
80
    String toString = to->string();
78
    String toString = to->property<String>();
81
    String& animatedString = animated->string();
79
    String& animatedString = animated->property<String>();
82
80
83
    // Apply CSS inheritance rules.
81
    // Apply CSS inheritance rules.
84
    m_animationElement->adjustForInheritance<String>(parseStringFromString, m_animationElement->fromPropertyValueType(), fromString, m_contextElement);
82
    m_animationElement->adjustForInheritance<String>(parseStringFromString, m_animationElement->fromPropertyValueType(), fromString, m_contextElement);
- Source/WebCore/svg/SVGAnimatedTransformList.cpp -14 / +11 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-84 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 = from->property<SVGTransformListValues>();
81
    auto& toTransformList = to->transformList();
78
    auto& toTransformList = to->property<SVGTransformListValues>();
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;
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 = from->property<SVGTransformListValues>();
102
    const auto& toTransformList = to->transformList();
99
    const auto& toTransformList = to->property<SVGTransformListValues>();
103
    const auto& toAtEndOfDurationTransformList = toAtEndOfDuration->transformList();
100
    const auto& toAtEndOfDurationTransformList = toAtEndOfDuration->property<SVGTransformListValues>();
104
    auto& animatedTransformList = animated->transformList();
101
    auto& animatedTransformList = animated->property<SVGTransformListValues>();
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 131-138 float SVGAnimatedTransformListAnimator:: Source/WebCore/svg/SVGAnimatedTransformList.cpp_sec5
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 = from->property<SVGTransformListValues>();
135
    auto& toTransformList = to->transformList();
132
    auto& toTransformList = to->property<SVGTransformListValues>();
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;
- Source/WebCore/svg/SVGAnimatedType.cpp -220 / +54 lines
Lines 1-5 Source/WebCore/svg/SVGAnimatedType.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) 2017 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 26-254 Source/WebCore/svg/SVGAnimatedType.cpp_sec2
26
27
27
namespace WebCore {
28
namespace WebCore {
28
29
29
SVGAnimatedType::SVGAnimatedType(AnimatedPropertyType type)
30
AnimatedPropertyType SVGAnimatedType::type() const
30
    : m_type(type)
31
{
31
{
32
}
32
    if (m_value1->is<SVGAngleValue>()) {
33
33
        ASSERT(m_value2 && m_value2->is<unsigned>());
34
SVGAnimatedType::~SVGAnimatedType()
34
        return AnimatedAngle;
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
    }
35
    }
92
}
36
    
93
37
    if (m_value1->is<bool>())
94
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngleValue, unsigned>> angleAndEnumeration)
38
        return AnimatedBoolean;
95
{
39
    
96
    ASSERT(angleAndEnumeration);
40
    if (m_value1->is<Color>())
97
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedAngle);
41
        return AnimatedColor;
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
42
118
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createEnumeration(std::unique_ptr<unsigned> enumeration)
43
    if (m_value1->is<unsigned>())
119
{
44
        return AnimatedEnumeration;
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
45
150
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createLengthList(std::unique_ptr<SVGLengthListValues> lengthList)
46
    if (m_value1->is<int>())
151
{
47
        return m_value2 && m_value2->is<int>() ? AnimatedIntegerOptionalInteger : AnimatedInteger;
152
    ASSERT(lengthList);
48
    
153
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedLengthList);
49
    if (m_value1->is<SVGLengthValue>())
154
    animatedType->m_data.lengthList = lengthList.release();
50
        return AnimatedLength;
155
    return animatedType;
51
    
156
}
52
    if (m_value1->is<SVGLengthListValues>())
53
        return AnimatedLengthList;
157
54
158
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumber(std::unique_ptr<float> number)
55
    if (m_value1->is<float>())
159
{
56
        return m_value2 && m_value2->is<float>() ? AnimatedNumberOptionalNumber : AnimatedNumber;
160
    ASSERT(number);
161
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedNumber);
162
    animatedType->m_data.number = number.release();
163
    return animatedType;
164
}
165
57
166
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumberList(std::unique_ptr<SVGNumberListValues> numberList)
58
    if (m_value1->is<SVGNumberListValues>())
167
{
59
        return AnimatedNumberList;
168
    ASSERT(numberList);
169
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedNumberList);
170
    animatedType->m_data.numberList = numberList.release();
171
    return animatedType;
172
}
173
60
174
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumberOptionalNumber(std::unique_ptr<std::pair<float, float>> numberOptionalNumber)
61
    if (m_value1->is<SVGPathByteStream>())
175
{
62
        return AnimatedPath;
176
    ASSERT(numberOptionalNumber);
177
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedNumberOptionalNumber);
178
    animatedType->m_data.numberOptionalNumber = numberOptionalNumber.release();
179
    return animatedType;
180
}
181
63
182
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPath(std::unique_ptr<SVGPathByteStream> path)
64
    if (m_value1->is<SVGPointListValues>())
183
{
65
        return AnimatedPoints;
184
    ASSERT(path);
185
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedPath);
186
    animatedType->m_data.path = path.release();
187
    return animatedType;
188
}
189
66
190
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPointList(std::unique_ptr<SVGPointListValues> pointList)
67
    if (m_value1->is<SVGPreserveAspectRatioValue>())
191
{
68
        return AnimatedPreserveAspectRatio;
192
    ASSERT(pointList);
193
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedPoints);
194
    animatedType->m_data.pointList = pointList.release();
195
    return animatedType;
196
}
197
69
198
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPreserveAspectRatio(std::unique_ptr<SVGPreserveAspectRatioValue> preserveAspectRatio)
70
    if (m_value1->is<FloatRect>())
199
{
71
        return AnimatedRect;
200
    ASSERT(preserveAspectRatio);
201
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedPreserveAspectRatio);
202
    animatedType->m_data.preserveAspectRatio = preserveAspectRatio.release();
203
    return animatedType;
204
}
205
72
206
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createRect(std::unique_ptr<FloatRect> rect)
73
    if (m_value1->is<String>())
207
{
74
        return AnimatedString;
208
    ASSERT(rect);
209
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedRect);
210
    animatedType->m_data.rect = rect.release();
211
    return animatedType;
212
}
213
75
214
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createString(std::unique_ptr<String> string)
76
    if (m_value1->is<SVGTransformListValues>())
215
{
77
        return AnimatedTransformList;
216
    ASSERT(string);
217
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedString);
218
    animatedType->m_data.string = string.release();
219
    return animatedType;
220
}
221
78
222
std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createTransformList(std::unique_ptr<SVGTransformListValues> transformList)
79
    return AnimatedUnknown;
223
{
224
    ASSERT(transformList);
225
    auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedTransformList);
226
    animatedType->m_data.transformList = transformList.release();
227
    return animatedType;
228
}
80
}
229
81
230
String SVGAnimatedType::valueAsString()
82
String SVGAnimatedType::toString()
231
{
83
{
232
    switch (m_type) {
84
    switch (type()) {
233
    case AnimatedColor:
85
    case AnimatedColor:
234
        ASSERT(m_data.color);
86
        return m_value1->toString<Color>();
235
        return m_data.color->serialized();
236
    case AnimatedLength:
87
    case AnimatedLength:
237
        ASSERT(m_data.length);
88
        return m_value1->toString<SVGLengthValue>();
238
        return m_data.length->valueAsString();
239
    case AnimatedLengthList:
89
    case AnimatedLengthList:
240
        ASSERT(m_data.lengthList);
90
        return m_value1->toString<SVGLengthListValues>();
241
        return m_data.lengthList->valueAsString();
242
    case AnimatedNumber:
91
    case AnimatedNumber:
243
        ASSERT(m_data.number);
92
        return m_value1->toString<float>();
244
        return String::number(*m_data.number);
245
    case AnimatedRect:
93
    case AnimatedRect:
246
        ASSERT(m_data.rect);
94
        return m_value1->toString<FloatRect>();
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:
95
    case AnimatedString:
250
        ASSERT(m_data.string);
96
        return m_value1->toString<String>();
251
        return *m_data.string;
252
97
253
    // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need valueAsString() support.
98
    // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need valueAsString() support.
254
    case AnimatedAngle:
99
    case AnimatedAngle:
Lines 271-302 String SVGAnimatedType::valueAsString() Source/WebCore/svg/SVGAnimatedType.cpp_sec3
271
    return String();
116
    return String();
272
}
117
}
273
118
274
bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const String& value)
119
bool SVGAnimatedType::parse(const QualifiedName& attrName, const String& string)
275
{
120
{
276
    switch (m_type) {
121
    switch (type()) {
277
    case AnimatedColor:
122
    case AnimatedColor:
278
        ASSERT(m_data.color);
123
        return m_value1->parse<Color>(attrName, string);
279
        *m_data.color = CSSParser::parseColor(value.stripWhiteSpace());
280
        return true;
281
    case AnimatedLength:
124
    case AnimatedLength:
282
        ASSERT(m_data.length);
125
        return m_value1->parse<SVGLengthValue>(attrName, string);
283
        return !m_data.length->setValueAsString(value, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName)).hasException();
284
    case AnimatedLengthList:
126
    case AnimatedLengthList:
285
        ASSERT(m_data.lengthList);
127
        return m_value1->parse<SVGLengthListValues>(attrName, string);
286
        m_data.lengthList->parse(value, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName));
287
        return true;
288
    case AnimatedNumber:
128
    case AnimatedNumber:
289
        ASSERT(m_data.number);
129
        return m_value1->parse<float>(attrName, string);
290
        parseNumberFromString(value, *m_data.number);
291
        return true;
292
    case AnimatedRect:
130
    case AnimatedRect:
293
        ASSERT(m_data.rect);
131
        return m_value1->parse<FloatRect>(attrName, string);
294
        parseRect(value, *m_data.rect);
295
        return true;
296
    case AnimatedString:
132
    case AnimatedString:
297
        ASSERT(m_data.string);
133
        return m_value1->parse<String>(attrName, string);
298
        *m_data.string = value;
299
        return true;
300
134
301
    // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need setValueAsString() support. 
135
    // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need setValueAsString() support. 
302
    case AnimatedAngle:
136
    case AnimatedAngle:
- Source/WebCore/svg/SVGAnimatedType.h -229 / +45 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) 2017 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 "SVGAnimatedValue.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;
36
37
class SVGAnimatedType {
27
class SVGAnimatedType {
38
    WTF_MAKE_FAST_ALLOCATED;
28
    WTF_MAKE_FAST_ALLOCATED;
39
public:
29
public:
40
    SVGAnimatedType(AnimatedPropertyType);
30
    template<typename PropertyType>
41
    virtual ~SVGAnimatedType();
31
    SVGAnimatedType(PropertyType&& property)
42
32
        : m_value1(SVGAnimatedValue::create(WTFMove(property)))
43
    static std::unique_ptr<SVGAnimatedType> createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngleValue, unsigned>>);
44
    static std::unique_ptr<SVGAnimatedType> createBoolean(std::unique_ptr<bool>);
45
    static std::unique_ptr<SVGAnimatedType> createColor(std::unique_ptr<Color>);
46
    static std::unique_ptr<SVGAnimatedType> createEnumeration(std::unique_ptr<unsigned>);
47
    static std::unique_ptr<SVGAnimatedType> createInteger(std::unique_ptr<int>);
48
    static std::unique_ptr<SVGAnimatedType> createIntegerOptionalInteger(std::unique_ptr<std::pair<int, int>>);
49
    static std::unique_ptr<SVGAnimatedType> createLength(std::unique_ptr<SVGLengthValue>);
50
    static std::unique_ptr<SVGAnimatedType> createLengthList(std::unique_ptr<SVGLengthListValues>);
51
    static std::unique_ptr<SVGAnimatedType> createNumber(std::unique_ptr<float>);
52
    static std::unique_ptr<SVGAnimatedType> createNumberList(std::unique_ptr<SVGNumberListValues>);
53
    static std::unique_ptr<SVGAnimatedType> createNumberOptionalNumber(std::unique_ptr<std::pair<float, float>>);
54
    static std::unique_ptr<SVGAnimatedType> createPath(std::unique_ptr<SVGPathByteStream>);
55
    static std::unique_ptr<SVGAnimatedType> createPointList(std::unique_ptr<SVGPointListValues>);
56
    static std::unique_ptr<SVGAnimatedType> createPreserveAspectRatio(std::unique_ptr<SVGPreserveAspectRatioValue>);
57
    static std::unique_ptr<SVGAnimatedType> createRect(std::unique_ptr<FloatRect>);
58
    static std::unique_ptr<SVGAnimatedType> createString(std::unique_ptr<String>);
59
    static std::unique_ptr<SVGAnimatedType> createTransformList(std::unique_ptr<SVGTransformListValues>);
60
    static bool supportsAnimVal(AnimatedPropertyType);
61
62
    AnimatedPropertyType type() const { return m_type; }
63
64
    // Non-mutable accessors.
65
    const std::pair<SVGAngleValue, unsigned>& angleAndEnumeration() const
66
    {
67
        ASSERT(m_type == AnimatedAngle);
68
        return *m_data.angleAndEnumeration;
69
    }
70
71
    const bool& boolean() const
72
    {
73
        ASSERT(m_type == AnimatedBoolean);
74
        return *m_data.boolean;
75
    }
76
77
    const Color& color() const
78
    {
79
        ASSERT(m_type == AnimatedColor);
80
        return *m_data.color;
81
    }
82
83
    const unsigned& enumeration() const
84
    {
85
        ASSERT(m_type == AnimatedEnumeration);
86
        return *m_data.enumeration;
87
    }
88
89
    const int& integer() const
90
    {
91
        ASSERT(m_type == AnimatedInteger);
92
        return *m_data.integer;
93
    }
94
95
    const std::pair<int, int>& integerOptionalInteger() const
96
    {
97
        ASSERT(m_type == AnimatedIntegerOptionalInteger);
98
        return *m_data.integerOptionalInteger;
99
    }
100
101
    const SVGLengthValue& length() const
102
    {
103
        ASSERT(m_type == AnimatedLength);
104
        return *m_data.length;
105
    }
106
107
    const SVGLengthListValues& lengthList() const
108
    {
109
        ASSERT(m_type == AnimatedLengthList);
110
        return *m_data.lengthList;
111
    }
112
113
    const float& number() const
114
    {
115
        ASSERT(m_type == AnimatedNumber);
116
        return *m_data.number;
117
    }
118
119
    const SVGNumberListValues& numberList() const
120
    {
121
        ASSERT(m_type == AnimatedNumberList);
122
        return *m_data.numberList;
123
    }
124
125
    const std::pair<float, float>& numberOptionalNumber() const
126
    {
127
        ASSERT(m_type == AnimatedNumberOptionalNumber);
128
        return *m_data.numberOptionalNumber;
129
    }
130
131
    const SVGPathByteStream* path() const
132
    {
133
        ASSERT(m_type == AnimatedPath);
134
        return m_data.path;
135
    }
136
137
    const SVGPointListValues& pointList() const
138
    {
139
        ASSERT(m_type == AnimatedPoints);
140
        return *m_data.pointList;
141
    }
142
143
    const SVGPreserveAspectRatioValue& preserveAspectRatio() const
144
    {
145
        ASSERT(m_type == AnimatedPreserveAspectRatio);
146
        return *m_data.preserveAspectRatio;
147
    }
148
149
    const FloatRect& rect() const
150
    {
151
        ASSERT(m_type == AnimatedRect);
152
        return *m_data.rect;
153
    }
154
155
    const String& string() const
156
    {
157
        ASSERT(m_type == AnimatedString);
158
        return *m_data.string;
159
    }
160
161
    const SVGTransformListValues& transformList() const
162
    {
163
        ASSERT(m_type == AnimatedTransformList);
164
        return *m_data.transformList;
165
    }
166
167
    // Mutable accessors.
168
    std::pair<SVGAngleValue, unsigned>& angleAndEnumeration()
169
    {
33
    {
170
        ASSERT(m_type == AnimatedAngle);
171
        return *m_data.angleAndEnumeration;
172
    }
34
    }
173
35
174
    bool& boolean()
36
    SVGAnimatedType(RefPtr<SVGAnimatedValue>&& value)
37
        : m_value1(WTFMove(value))
175
    {
38
    {
176
        ASSERT(m_type == AnimatedBoolean);
177
        return *m_data.boolean;
178
    }
39
    }
179
40
180
    Color& color()
41
    template<typename PropertyType1, typename PropertyType2>
42
    SVGAnimatedType(std::pair<PropertyType1, PropertyType2>&& properties)
43
        : m_value1(SVGAnimatedValue::create(properties.first))
44
        , m_value2(SVGAnimatedValue::create(properties.second))
181
    {
45
    {
182
        ASSERT(m_type == AnimatedColor);
183
        return *m_data.color;
184
    }
46
    }
185
47
186
    unsigned& enumeration()
48
    SVGAnimatedType(RefPtr<SVGAnimatedValue>&& value1, RefPtr<SVGAnimatedValue>&& value2)
49
        : m_value1(WTFMove(value1))
50
        , m_value2(WTFMove(value2))
187
    {
51
    {
188
        ASSERT(m_type == AnimatedEnumeration);
189
        return *m_data.enumeration;
190
    }
52
    }
191
53
192
    int& integer()
54
    template<typename PropertyType>
55
    static std::unique_ptr<SVGAnimatedType> create()
193
    {
56
    {
194
        ASSERT(m_type == AnimatedInteger);
57
        return std::make_unique<SVGAnimatedType>(SVGPropertyTraits<PropertyType>::initialValue());
195
        return *m_data.integer;
196
    }
58
    }
197
59
198
    std::pair<int, int>& integerOptionalInteger()
60
    template<typename PropertyType>
61
    static std::unique_ptr<SVGAnimatedType> create(PropertyType&& property)
199
    {
62
    {
200
        ASSERT(m_type == AnimatedIntegerOptionalInteger);
63
        return std::make_unique<SVGAnimatedType>(WTFMove(property));
201
        return *m_data.integerOptionalInteger;
202
    }
64
    }
203
65
204
    SVGLengthValue& length()
66
    static std::unique_ptr<SVGAnimatedType> create(RefPtr<SVGAnimatedValue>&& value)
205
    {
67
    {
206
        ASSERT(m_type == AnimatedLength);
68
        return std::make_unique<SVGAnimatedType>(WTFMove(value));
207
        return *m_data.length;
208
    }
69
    }
209
70
210
    SVGLengthListValues& lengthList()
71
    template<typename PropertyType1, typename PropertyType2>
72
    static std::unique_ptr<SVGAnimatedType> create()
211
    {
73
    {
212
        ASSERT(m_type == AnimatedLengthList);
74
        return std::make_unique<SVGAnimatedType>(SVGPropertyTraits<std::pair<PropertyType1, PropertyType2>>::initialValue());
213
        return *m_data.lengthList;
214
    }
75
    }
215
76
216
    float& number()
77
    template<typename PropertyType1, typename PropertyType2>
78
    static std::unique_ptr<SVGAnimatedType> create(std::pair<PropertyType1, PropertyType2>&& properties)
217
    {
79
    {
218
        ASSERT(m_type == AnimatedNumber);
80
        return std::make_unique<SVGAnimatedType>(WTFMove(properties));
219
        return *m_data.number;
220
    }
81
    }
221
82
222
    SVGNumberListValues& numberList()
83
    static std::unique_ptr<SVGAnimatedType> create(RefPtr<SVGAnimatedValue>&& value1, RefPtr<SVGAnimatedValue>&& value2)
223
    {
84
    {
224
        ASSERT(m_type == AnimatedNumberList);
85
        return std::make_unique<SVGAnimatedType>(WTFMove(value1), WTFMove(value2));
225
        return *m_data.numberList;
226
    }
86
    }
227
87
228
    std::pair<float, float>& numberOptionalNumber()
88
    template<typename PropertyType>
89
    const PropertyType& property() const
229
    {
90
    {
230
        ASSERT(m_type == AnimatedNumberOptionalNumber);
91
        return m_value1->property<PropertyType>();
231
        return *m_data.numberOptionalNumber;
232
    }
92
    }
233
93
234
    SVGPathByteStream* path()
94
    template<typename PropertyType>
95
    PropertyType& property()
235
    {
96
    {
236
        ASSERT(m_type == AnimatedPath);
97
        return m_value1->property<PropertyType>();
237
        return m_data.path;
238
    }
98
    }
239
99
240
    SVGPointListValues& pointList()
100
    template<typename PropertyType1, typename PropertyType2>
101
    std::pair<PropertyType1&, PropertyType2&> properties()
241
    {
102
    {
242
        ASSERT(m_type == AnimatedPoints);
103
        ASSERT(m_value2);
243
        return *m_data.pointList;
104
        return std::pair<PropertyType1&, PropertyType2&>(m_value1->property<PropertyType1>(), m_value2->property<PropertyType2>());
244
    }
105
    }
245
106
246
    SVGPreserveAspectRatioValue& preserveAspectRatio()
107
    static bool supportsAnimVal(AnimatedPropertyType);
247
    {
248
        ASSERT(m_type == AnimatedPreserveAspectRatio);
249
        return *m_data.preserveAspectRatio;
250
    }
251
252
    FloatRect& rect()
253
    {
254
        ASSERT(m_type == AnimatedRect);
255
        return *m_data.rect;
256
    }
257
258
    String& string()
259
    {
260
        ASSERT(m_type == AnimatedString);
261
        return *m_data.string;
262
    }
263
108
264
    SVGTransformListValues& transformList()
109
    AnimatedPropertyType type() const;
265
    {
266
        ASSERT(m_type == AnimatedTransformList);
267
        return *m_data.transformList;
268
    }
269
110
270
    String valueAsString();
111
    String toString();
271
    bool setValueAsString(const QualifiedName&, const String&);
112
    bool parse(const QualifiedName&, const String&);
272
113
273
private:
114
private:
274
    AnimatedPropertyType m_type;
115
    RefPtr<SVGAnimatedValue> m_value1, m_value2;
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
};
116
};
301
117
302
} // namespace WebCore
118
} // namespace WebCore
- Source/WebCore/svg/SVGAnimatedTypeAnimator.h -34 / +36 lines
Lines 63-87 protected: Source/WebCore/svg/SVGAnimatedTypeAnimator.h_sec1
63
63
64
    // Helpers for animators that operate on single types, eg. just one SVGAnimatedInteger.
64
    // Helpers for animators that operate on single types, eg. just one SVGAnimatedInteger.
65
    template<typename AnimValType>
65
    template<typename AnimValType>
66
    std::unique_ptr<typename AnimValType::ContentType> constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
66
    std::unique_ptr<SVGAnimatedType> constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
67
    {
67
    {
68
        ASSERT(animatedTypes[0].properties.size() == 1);
68
        ASSERT(animatedTypes[0].properties.size() == 1);
69
        const typename AnimValType::ContentType& animatedType = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get())->currentBaseValue();
69
        const typename AnimValType::ContentType& animatedType = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get())->currentBaseValue();
70
70
71
        auto copy = std::make_unique<typename AnimValType::ContentType>(animatedType);
71
        RefPtr<SVGAnimatedValue> value = SVGAnimatedValue::create(animatedType);
72
        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, copy.get());
72
        typename AnimValType::ContentType& property = value->property<typename AnimValType::ContentType>();
73
        return copy;
73
        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, &property);
74
        return SVGAnimatedType::create(WTFMove(value));
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
        typename AnimValType::ContentType& property = type.property<typename AnimValType::ContentType>();
81
        typename AnimValType::ContentType& animatedTypeValue = (type.*getter)();
82
        property = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get())->currentBaseValue();
82
        animatedTypeValue = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get())->currentBaseValue();
83
        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, &property);
83
84
        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, &animatedTypeValue);
85
    }
84
    }
86
85
87
    template<typename AnimValType>
86
    template<typename AnimValType>
Lines 107-136 protected: Source/WebCore/svg/SVGAnimatedTypeAnimator.h_sec2
107
106
108
    // Helpers for animators that operate on pair types, eg. a pair of SVGAnimatedIntegers.
107
    // Helpers for animators that operate on pair types, eg. a pair of SVGAnimatedIntegers.
109
    template<typename AnimValType1, typename AnimValType2>
108
    template<typename AnimValType1, typename AnimValType2>
110
    std::unique_ptr<std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>> constructFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes)
109
    std::unique_ptr<SVGAnimatedType> constructFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes)
111
    {
110
    {
112
        ASSERT(animatedTypes[0].properties.size() == 2);
111
        ASSERT(animatedTypes[0].properties.size() == 2);
113
        const typename AnimValType1::ContentType& firstType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get())->currentBaseValue();
112
        const typename AnimValType1::ContentType& firstType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get())->currentBaseValue();
114
        const typename AnimValType2::ContentType& secondType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get())->currentBaseValue();
113
        const typename AnimValType2::ContentType& secondType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get())->currentBaseValue();
115
114
116
        auto copy = std::make_unique<std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>>(firstType, secondType);
115
        RefPtr<SVGAnimatedValue> firstValue = SVGAnimatedValue::create(firstType);
117
        executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &copy->first);
116
        RefPtr<SVGAnimatedValue> secondValue = SVGAnimatedValue::create(secondType);
118
        executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &copy->second);
117
        
119
        return copy;
118
        typename AnimValType1::ContentType& firstProperty = firstValue->property<typename AnimValType1::ContentType>();
119
        typename AnimValType2::ContentType& secondProperty = secondValue->property<typename AnimValType2::ContentType>();
120
121
        executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &firstProperty);
122
        executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &secondProperty);
123
        return SVGAnimatedType::create(WTFMove(firstValue), WTFMove(secondValue));
120
    }
124
    }
121
125
122
    template<typename AnimValType1, typename AnimValType2>
126
    template<typename AnimValType1, typename AnimValType2>
123
    void resetFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type, std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>& (SVGAnimatedType::*getter)())
127
    void resetFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
124
    {
128
    {
125
        ASSERT(animatedTypes[0].properties.size() == 2);
129
        ASSERT(animatedTypes[0].properties.size() == 2);
126
        ASSERT(type.type() == m_type);
130
        ASSERT(type.type() == m_type);
131
        
132
        auto properties = type.properties<typename AnimValType1::ContentType, typename AnimValType2::ContentType>();
127
133
128
        std::pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>& animatedTypeValue = (type.*getter)();
134
        executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &properties.first);
129
        animatedTypeValue.first = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get())->currentBaseValue();
135
        executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &properties.second);
130
        animatedTypeValue.second = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get())->currentBaseValue();
131
132
        executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &animatedTypeValue.first);
133
        executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &animatedTypeValue.second);
134
    }
136
    }
135
137
136
    template<typename AnimValType1, typename AnimValType2>
138
    template<typename AnimValType1, typename AnimValType2>
Lines 183-215 private: Source/WebCore/svg/SVGAnimatedTypeAnimator.h_sec3
183
    };
185
    };
184
186
185
    template<typename AnimValType>
187
    template<typename AnimValType>
186
    void executeAction(AnimationAction action, const SVGElementAnimatedPropertyList& animatedTypes, unsigned whichProperty, typename AnimValType::ContentType* type = 0)
188
    void executeAction(AnimationAction action, const SVGElementAnimatedPropertyList& animatedTypes, unsigned whichProperty, typename AnimValType::ContentType* property = nullptr)
187
    {
189
    {
188
        // FIXME: Can't use SVGElement::InstanceUpdateBlocker because of circular header dependency. Would be nice to untangle this.
190
        // FIXME: Can't use SVGElement::InstanceUpdateBlocker because of circular header dependency. Would be nice to untangle this.
189
        setInstanceUpdatesBlocked(*animatedTypes[0].element, true);
191
        setInstanceUpdatesBlocked(*animatedTypes[0].element, true);
190
192
191
        for (auto& animatedType : animatedTypes) {
193
        for (auto& animatedType : animatedTypes) {
192
            ASSERT_WITH_SECURITY_IMPLICATION(whichProperty < animatedType.properties.size());
194
            ASSERT_WITH_SECURITY_IMPLICATION(whichProperty < animatedType.properties.size());
193
            AnimValType* property = castAnimatedPropertyToActualType<AnimValType>(animatedType.properties[whichProperty].get());
195
            AnimValType* animatedProperty = castAnimatedPropertyToActualType<AnimValType>(animatedType.properties[whichProperty].get());
194
196
195
            switch (action) {
197
            switch (action) {
196
            case StartAnimationAction:
198
            case StartAnimationAction:
197
                ASSERT(type);
199
                ASSERT(property);
198
                if (!property->isAnimating())
200
                if (!animatedProperty->isAnimating())
199
                    property->animationStarted(type);
201
                    animatedProperty->animationStarted(property);
200
                break;
202
                break;
201
            case StopAnimationAction:
203
            case StopAnimationAction:
202
                ASSERT(!type);
204
                ASSERT(!property);
203
                if (property->isAnimating())
205
                if (animatedProperty->isAnimating())
204
                    property->animationEnded();
206
                    animatedProperty->animationEnded();
205
                break;
207
                break;
206
            case AnimValWillChangeAction:
208
            case AnimValWillChangeAction:
207
                ASSERT(!type);
209
                ASSERT(!property);
208
                property->animValWillChange();
210
                animatedProperty->animValWillChange();
209
                break;
211
                break;
210
            case AnimValDidChangeAction:
212
            case AnimValDidChangeAction:
211
                ASSERT(!type);
213
                ASSERT(!property);
212
                property->animValDidChange();
214
                animatedProperty->animValDidChange();
213
                break;
215
                break;
214
            }
216
            }
215
        }
217
        }
- Source/WebCore/svg/SVGAnimatedValue.h +134 lines
Line 0 Source/WebCore/svg/SVGAnimatedValue.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 "Color.h"
29
#include "FloatRect.h"
30
#include "SVGAngleValue.h"
31
#include "SVGLengthListValues.h"
32
#include "SVGLengthValue.h"
33
#include "SVGNumberListValues.h"
34
#include "SVGPathByteStream.h"
35
#include "SVGPointListValues.h"
36
#include "SVGPreserveAspectRatioValue.h"
37
#include "SVGPropertyInfo.h"
38
#include "SVGPropertyTraits.h"
39
#include "SVGTransformListValues.h"
40
#include <wtf/Variant.h>
41
42
namespace WebCore {
43
44
using SVGAnimatedVariant = Variant<
45
    SVGAngleValue,
46
    bool,
47
    Color,
48
    unsigned,
49
    int,
50
    SVGLengthValue,
51
    SVGLengthListValues,
52
    float,
53
    SVGNumberListValues,
54
    SVGPathByteStream,
55
    SVGPointListValues,
56
    SVGPreserveAspectRatioValue,
57
    FloatRect,
58
    String,
59
    SVGTransformListValues
60
>;
61
62
class SVGAnimatedValue : public RefCounted<SVGAnimatedValue>, public SVGAnimatedVariant {
63
public:
64
    template<typename PropertyType>
65
    static Ref<SVGAnimatedValue> create(const PropertyType& property)
66
    {
67
        return adoptRef(*new SVGAnimatedValue(property));
68
    }
69
70
    template<typename PropertyType>
71
    static Ref<SVGAnimatedValue> create(PropertyType&& property)
72
    {
73
        return adoptRef(*new SVGAnimatedValue(WTFMove(property)));
74
    }
75
76
    template<typename PropertyType>
77
    static Ref<SVGAnimatedValue> create(const SVGAnimatedValue& value)
78
    {
79
        return adoptRef(*new SVGAnimatedValue(value.property<PropertyType>()));
80
    }
81
82
    template<typename PropertyType>
83
    bool is() const
84
    {
85
        return WTF::holds_alternative<PropertyType>(*this);
86
    }
87
88
    template<typename PropertyType>
89
    const PropertyType& property() const
90
    {
91
        ASSERT(is<PropertyType>());
92
        return WTF::get<PropertyType>(*this);
93
    }
94
95
    template<typename PropertyType>
96
    PropertyType& property()
97
    {
98
        ASSERT(is<PropertyType>());
99
        return WTF::get<PropertyType>(*this);
100
    }
101
102
    template<typename PropertyType>
103
    String toString() const
104
    {
105
        return SVGPropertyTraits<PropertyType>::toString(property<PropertyType>());
106
    }
107
108
    template<typename PropertyType>
109
    bool parse(const QualifiedName& attrName, const String& string)
110
    {
111
        auto result = SVGPropertyTraits<PropertyType>::parse(attrName, string);
112
        if (!result)
113
            return false;
114
        property<PropertyType>() = WTFMove(result.value());
115
        return true;
116
    }
117
118
private:
119
    template<typename PropertyType>
120
    SVGAnimatedValue(const PropertyType& value)
121
        : SVGAnimatedVariant(value)
122
    {
123
        ASSERT(is<PropertyType>());
124
    }
125
    
126
    template<typename PropertyType>
127
    SVGAnimatedValue(PropertyType&& value)
128
        : SVGAnimatedVariant(WTFMove(value))
129
    {
130
        ASSERT(is<PropertyType>());
131
    }
132
};
133
    
134
} // namespace WebCore
- Source/WebCore/svg/SVGLengthListValues.h -1 / +14 lines
Lines 34-45 public: Source/WebCore/svg/SVGLengthListValues.h_sec1
34
    String valueAsString() const;
34
    String valueAsString() const;
35
};
35
};
36
36
37
template<> struct SVGPropertyTraits<SVGLengthListValues> {
37
template<>
38
struct SVGPropertyTraits<SVGLengthListValues> {
38
    using ListItemType = SVGLengthValue;
39
    using ListItemType = SVGLengthValue;
39
    using ListItemTearOff = SVGLength;
40
    using ListItemTearOff = SVGLength;
40
    using ListPropertyTearOff = SVGLengthList;
41
    using ListPropertyTearOff = SVGLengthList;
41
42
42
    static SVGLengthListValues initialValue() { return  { }; }
43
    static SVGLengthListValues initialValue() { return  { }; }
44
    static SVGLengthListValues fromString(const String& string, SVGLengthMode lengthMode)
45
    {
46
        SVGLengthListValues list;
47
        list.parse(string, lengthMode);
48
        return list;
49
    }
50
    static std::optional<SVGLengthListValues> parse(const QualifiedName& attrName, const String& string)
51
    {
52
        SVGLengthListValues list;
53
        list.parse(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName));
54
        return list;
55
    }
43
    static String toString(const SVGLengthListValues& type) { return type.valueAsString(); }
56
    static String toString(const SVGLengthListValues& type) { return type.valueAsString(); }
44
};
57
};
45
58
- 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
TextStream& operator<<(TextStream&, const SVGLengthValue&);
159
TextStream& operator<<(TextStream&, const SVGLengthValue&);
- Source/WebCore/svg/SVGMarkerElement.h -66 / +1 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 {
- Source/WebCore/svg/SVGMarkerTypes.h +107 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 "SVGAnimatedAngle.h"
29
#include "SVGPropertyTraits.h"
30
31
namespace WebCore {
32
33
enum SVGMarkerUnitsType {
34
    SVGMarkerUnitsUnknown = 0,
35
    SVGMarkerUnitsUserSpaceOnUse,
36
    SVGMarkerUnitsStrokeWidth
37
};
38
39
enum SVGMarkerOrientType {
40
    SVGMarkerOrientUnknown = 0,
41
    SVGMarkerOrientAuto,
42
    SVGMarkerOrientAngle,
43
    SVGMarkerOrientAutoStartReverse,
44
    
45
    // Add new elements before here.
46
    SVGMarkerOrientMax
47
};
48
    
49
template<>
50
struct SVGPropertyTraits<SVGMarkerUnitsType> {
51
    static unsigned highestEnumValue() { return SVGMarkerUnitsStrokeWidth; }
52
    static String toString(SVGMarkerUnitsType type)
53
    {
54
        switch (type) {
55
        case SVGMarkerUnitsUnknown:
56
            return emptyString();
57
        case SVGMarkerUnitsUserSpaceOnUse:
58
            return ASCIILiteral("userSpaceOnUse");
59
        case SVGMarkerUnitsStrokeWidth:
60
            return ASCIILiteral("strokeWidth");
61
        }
62
        
63
        ASSERT_NOT_REACHED();
64
        return emptyString();
65
    }
66
    static SVGMarkerUnitsType fromString(const String& value)
67
    {
68
        if (value == "userSpaceOnUse")
69
            return SVGMarkerUnitsUserSpaceOnUse;
70
        if (value == "strokeWidth")
71
            return SVGMarkerUnitsStrokeWidth;
72
        return SVGMarkerUnitsUnknown;
73
    }
74
};
75
76
template<>
77
struct SVGPropertyTraits<SVGMarkerOrientType> {
78
    static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; }
79
    static SVGMarkerOrientType fromString(const String& value, SVGAngleValue& angle)
80
    {
81
        if (value == "auto")
82
            return SVGMarkerOrientAuto;
83
        if (value == "auto-start-reverse")
84
            return SVGMarkerOrientAutoStartReverse;
85
        auto setValueResult = angle.setValueAsString(value);
86
        if (setValueResult.hasException())
87
            return SVGMarkerOrientUnknown;
88
        return SVGMarkerOrientAngle;
89
    }
90
};
91
92
template<>
93
struct SVGPropertyTraits<std::pair<SVGAngleValue, unsigned>> {
94
    static std::pair<SVGAngleValue, unsigned> fromString(const String& string)
95
    {
96
        SVGAngleValue angle;
97
        SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(string, angle);
98
        if (orientType != SVGMarkerOrientAngle)
99
            angle = { };
100
        return std::pair<SVGAngleValue, unsigned>(angle, orientType);
101
    }
102
};
103
104
template<>
105
inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
106
107
} // namespace WebCore
- Source/WebCore/svg/SVGNumberListValues.h -2 / +8 lines
Lines 34-43 public: Source/WebCore/svg/SVGNumberListValues.h_sec1
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/SVGPathByteStream.h -14 / +33 lines
Lines 19-24 Source/WebCore/svg/SVGPathByteStream.h_sec1
19
19
20
#pragma once
20
#pragma once
21
21
22
#include "SVGPathConsumer.h"
23
#include "SVGPathUtilities.h"
24
#include "SVGPropertyTraits.h"
22
#include <wtf/Noncopyable.h>
25
#include <wtf/Noncopyable.h>
23
#include <wtf/Vector.h>
26
#include <wtf/Vector.h>
24
27
Lines 47-80 public: Source/WebCore/svg/SVGPathByteStream.h_sec2
47
    typedef Data::const_iterator DataIterator;
50
    typedef Data::const_iterator DataIterator;
48
51
49
    SVGPathByteStream() { }
52
    SVGPathByteStream() { }
50
    SVGPathByteStream(const Data& data) : m_data(data) { }
53
    SVGPathByteStream(SVGPathByteStream&& other)
54
        : m_data(WTFMove(other.m_data))
55
    {
56
    }
51
    
57
    
52
    bool operator==(const SVGPathByteStream& other) const
58
    SVGPathByteStream(const SVGPathByteStream& other)
59
        : m_data(other.m_data)
53
    {
60
    {
54
        return m_data == other.m_data;
55
    }
61
    }
56
62
57
    bool operator!=(const SVGPathByteStream& other) const
63
    SVGPathByteStream& operator=(SVGPathByteStream&& other)
58
    {
64
    {
59
        return !(*this == other);
65
        m_data = WTFMove(other.m_data);
66
        return *this;
60
    }
67
    }
61
68
    SVGPathByteStream& operator=(const SVGPathByteStream& other)
62
    std::unique_ptr<SVGPathByteStream> copy() const
63
    {
69
    {
64
        return std::make_unique<SVGPathByteStream>(m_data);
70
        m_data = other.m_data;
71
        return *this;
65
    }
72
    }
66
73
74
    bool operator==(const SVGPathByteStream& other) const { return m_data == other.m_data; }
75
    bool operator!=(const SVGPathByteStream& other) const { return m_data != other.m_data; }
76
77
    std::unique_ptr<SVGPathByteStream> copy() const { return std::make_unique<SVGPathByteStream>(*this); }
78
67
    DataIterator begin() const { return m_data.begin(); }
79
    DataIterator begin() const { return m_data.begin(); }
68
    DataIterator end() const { return m_data.end(); }
80
    DataIterator end() const { return m_data.end(); }
69
81
70
    void append(unsigned char byte) { m_data.append(byte); }
82
    void append(unsigned char byte) { m_data.append(byte); }
71
    void append(const SVGPathByteStream& other)
83
    void append(const SVGPathByteStream& other) { m_data.appendVector(other.m_data); }
72
    {
73
        for (auto stream : other)
74
            append(stream);
75
    }
76
    void clear() { m_data.clear(); }
84
    void clear() { m_data.clear(); }
77
    bool isEmpty() const { return !m_data.size(); }
85
    bool isEmpty() const { return m_data.isEmpty(); }
78
    unsigned size() const { return m_data.size(); }
86
    unsigned size() const { return m_data.size(); }
79
87
80
    // Only defined to let SVGAnimatedPathAnimator use the standard list code paths - this method is never called.
88
    // Only defined to let SVGAnimatedPathAnimator use the standard list code paths - this method is never called.
Lines 83-87 public: Source/WebCore/svg/SVGPathByteStream.h_sec3
83
private:
91
private:
84
    Data m_data;
92
    Data m_data;
85
};
93
};
94
    
95
template<>
96
struct SVGPropertyTraits<SVGPathByteStream> {
97
    static SVGPathByteStream initialValue() { return SVGPathByteStream(); }
98
    static SVGPathByteStream fromString(const String& string)
99
    {
100
        SVGPathByteStream byteStream;
101
        buildSVGPathByteStreamFromString(string, byteStream, UnalteredParsing);
102
        return byteStream;
103
    }
104
};
86
105
87
} // namespace WebCore
106
} // namespace WebCore
- Source/WebCore/svg/SVGPathUtilities.cpp -5 / +4 lines
Lines 149-163 bool buildAnimatedSVGPathByteStream(cons Source/WebCore/svg/SVGPathUtilities.cpp_sec1
149
149
150
bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& byStream, unsigned repeatCount)
150
bool addToSVGPathByteStream(SVGPathByteStream& streamToAppendTo, const SVGPathByteStream& byStream, unsigned repeatCount)
151
{
151
{
152
    // Why return when streamToAppendTo is empty? Don't we still need to append?
152
    // The byStream will be blended with streamToAppendTo. So streamToAppendTo has to have elements.
153
    if (streamToAppendTo.isEmpty() || byStream.isEmpty())
153
    if (streamToAppendTo.isEmpty() || byStream.isEmpty())
154
        return true;
154
        return true;
155
155
156
    // Is it OK to make the SVGPathByteStreamBuilder from a stream, and then clear that stream?
156
    // builder is the destination of blending fromSource and bySource. The stream of builder
157
    // (i.e. streamToAppendTo) has to be cleared before calling addAnimatedPath.
157
    SVGPathByteStreamBuilder builder(streamToAppendTo);
158
    SVGPathByteStreamBuilder builder(streamToAppendTo);
158
159
    SVGPathByteStream fromStreamCopy = WTFMove(streamToAppendTo);
159
    SVGPathByteStream fromStreamCopy = streamToAppendTo;
160
    streamToAppendTo.clear();
161
160
162
    SVGPathByteStreamSource fromSource(fromStreamCopy);
161
    SVGPathByteStreamSource fromSource(fromStreamCopy);
163
    SVGPathByteStreamSource bySource(byStream);
162
    SVGPathByteStreamSource bySource(byStream);
- Source/WebCore/svg/SVGPointListValues.h -2 / +8 lines
Lines 34-42 public: Source/WebCore/svg/SVGPointListValues.h_sec1
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/SVGPreserveAspectRatioValue.cpp +5 lines
Lines 36-41 SVGPreserveAspectRatioValue::SVGPreserve Source/WebCore/svg/SVGPreserveAspectRatioValue.cpp_sec1
36
{
36
{
37
}
37
}
38
38
39
SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue(const String& string)
40
{
41
    parse(string);
42
}
43
39
ExceptionOr<void> SVGPreserveAspectRatioValue::setAlign(unsigned short align)
44
ExceptionOr<void> SVGPreserveAspectRatioValue::setAlign(unsigned short align)
40
{
45
{
41
    if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX)
46
    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/SVGRect.h -1 / +1 lines
Lines 20-26 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
- 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/SVGTransformListValues.h -1 / +9 lines
Lines 42-49 public: Source/WebCore/svg/SVGTransformListValues.h_sec1
42
    void parse(const String&);
42
    void parse(const String&);
43
};
43
};
44
44
45
template<> struct SVGPropertyTraits<SVGTransformListValues> {
45
template<>
46
struct SVGPropertyTraits<SVGTransformListValues> {
46
    static SVGTransformListValues initialValue() { return { }; }
47
    static SVGTransformListValues initialValue() { return { }; }
48
    static SVGTransformListValues fromString(const String& string)
49
    {
50
        SVGTransformListValues list;
51
        list.parse(string);
52
        ASSERT(list.size() <= 1);
53
        return list;
54
    }
47
    static String toString(const SVGTransformListValues& list) { return list.valueAsString(); }
55
    static String toString(const SVGTransformListValues& list) { return list.valueAsString(); }
48
56
49
    using ListItemType = SVGTransformValue;
57
    using ListItemType = SVGTransformValue;
- Source/WebCore/svg/properties/SVGPropertyTraits.h -1 / +87 lines
Lines 20-25 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 "FloatRect.h"
26
#include "QualifiedName.h"
27
#include "SVGParserUtilities.h"
28
#include <wtf/text/StringBuilder.h>
23
#include <wtf/text/WTFString.h>
29
#include <wtf/text/WTFString.h>
24
30
25
namespace WebCore {
31
namespace WebCore {
Lines 30-39 struct SVGPropertyTraits { }; Source/WebCore/svg/properties/SVGPropertyTraits.h_sec2
30
template<>
36
template<>
31
struct SVGPropertyTraits<bool> {
37
struct SVGPropertyTraits<bool> {
32
    static bool initialValue() { return false; }
38
    static bool initialValue() { return false; }
39
    static bool fromString(const String& string) { return string == "true"; }
33
    static String toString(bool type) { return type ? "true" : "false"; }
40
    static String toString(bool type) { return type ? "true" : "false"; }
34
};
41
};
35
42
36
template<>
43
template<>
44
struct SVGPropertyTraits<Color> {
45
    static Color initialValue() { return Color(); }
46
    static Color fromString(const String& string) { return CSSParser::parseColor(string.stripWhiteSpace()); }
47
    static std::optional<Color> parse(const QualifiedName&, const String& string)
48
    {
49
        Color color = CSSParser::parseColor(string.stripWhiteSpace());
50
        return color.isValid() ? color : std::optional<Color>();
51
    }
52
    static String toString(const Color& type) { return type.serialized(); }
53
};
54
55
template<>
37
struct SVGPropertyTraits<unsigned> {
56
struct SVGPropertyTraits<unsigned> {
38
    static unsigned initialValue() { return 0; }
57
    static unsigned initialValue() { return 0; }
39
    static String toString(unsigned type) { return String::number(type); }
58
    static String toString(unsigned type) { return String::number(type); }
Lines 42-60 struct SVGPropertyTraits<unsigned> { Source/WebCore/svg/properties/SVGPropertyTraits.h_sec3
42
template<>
61
template<>
43
struct SVGPropertyTraits<int> {
62
struct SVGPropertyTraits<int> {
44
    static int initialValue() { return 0; }
63
    static int initialValue() { return 0; }
64
    static int fromString(const String&string) { return string.toIntStrict(); }
45
    static String toString(int type) { return String::number(type); }
65
    static String toString(int type) { return String::number(type); }
46
};
66
};
67
    
68
template<>
69
struct SVGPropertyTraits<std::pair<int, int>> {
70
    static std::pair<int, int> initialValue() { return { }; }
71
    static std::pair<int, int> fromString(const String& string)
72
    {
73
        float firstNumber = 0, secondNumber = 0;
74
        if (!parseNumberOptionalNumber(string, firstNumber, secondNumber))
75
            return { };
76
        
77
        return std::make_pair(static_cast<int>(roundf(firstNumber)), static_cast<int>(roundf(secondNumber)));
78
    }
79
};
47
80
48
template<>
81
template<>
49
struct SVGPropertyTraits<float> {
82
struct SVGPropertyTraits<float> {
50
    static float initialValue() { return 0; }
83
    static float initialValue() { return 0; }
84
    static float fromString(const String& string)
85
    {
86
        float type = 0;
87
        return parseNumberFromString(string, type) ? type : 0;
88
    }
89
    static std::optional<float> parse(const QualifiedName&, const String& string)
90
    {
91
        float number;
92
        return parseNumberFromString(string, number) ? number : std::optional<float>();
93
    }
51
    static String toString(float type) { return String::number(type); }
94
    static String toString(float type) { return String::number(type); }
52
};
95
};
53
96
54
template<>
97
template<>
98
struct SVGPropertyTraits<std::pair<float, float>> {
99
    static std::pair<float, float> initialValue() { return { }; }
100
    static std::pair<float, float> fromString(const String& string)
101
    {
102
        float firstNumber = 0, secondNumber = 0;
103
        if (!parseNumberOptionalNumber(string, firstNumber, secondNumber))
104
            return { };
105
106
        return std::make_pair(firstNumber, secondNumber);
107
    }
108
};
109
110
template<>
111
struct SVGPropertyTraits<FloatRect> {
112
    static FloatRect initialValue() { return FloatRect(); }
113
    static FloatRect fromString(const String& string)
114
    {
115
        FloatRect rect;
116
        return parseRect(string, rect) ? rect : FloatRect();
117
        
118
    }
119
    static std::optional<FloatRect> parse(const QualifiedName&, const String& string)
120
    {
121
        FloatRect rect;
122
        return parseRect(string, rect) ? rect : std::optional<FloatRect>();
123
    }
124
    static String toString(const FloatRect& type)
125
    {
126
        StringBuilder builder;
127
        builder.appendNumber(type.x());
128
        builder.append(' ');
129
        builder.appendNumber(type.y());
130
        builder.append(' ');
131
        builder.appendNumber(type.width());
132
        builder.append(' ');
133
        builder.appendNumber(type.height());
134
        return builder.toString();
135
    }
136
};
137
138
template<>
55
struct SVGPropertyTraits<String> {
139
struct SVGPropertyTraits<String> {
56
    static String initialValue() { return String(); }
140
    static String initialValue() { return String(); }
57
    static String toString(const String& type) { return type; }
141
    static String fromString(const String& string) { return string; }
142
    static std::optional<String> parse(const QualifiedName&, const String& string) { return string; }
143
    static String toString(const String& string) { return string; }
58
};
144
};
59
145
60
template<typename EnumType>
146
template<typename EnumType>

Return to Bug 168586